autoGen ID

This commit is contained in:
dongpd 2020-12-18 11:59:56 +07:00
parent 4d6f1cbed8
commit 27e58bf5e1
5 changed files with 31 additions and 3 deletions

View File

@ -43,12 +43,23 @@ class CaptureLogsController extends Controller {
$dataProvider->query->andWhere(["BETWEEN", "capture_logs.time", $f, $t]);
$dataProvider->query->orderBy(["time" => SORT_DESC]);
$tempConfig = json_decode(file_get_contents("http://localhost:4004/ReadEngineConfig", false, stream_context_create([
'http' => [
'header' => "Content-Type: application/json",
'method' => "POST"
]
])), true);
$data = json_decode($tempConfig['data'], true);
$last = \app\models\ListManagement::find()->orderBy(['id' => SORT_DESC])->limit(1)->one();
$idAuto = $data['data']['box_id'] . "_" . ($last->id + 1);
return $this->render('index', [
'searchModel' => $searchModel,
'dataProvider' => $dataProvider,
'statusArray' => CaptureLogs::$statusArray,
'f' => $f,
't' => $t
't' => $t,
'idAuto' => $idAuto
]);
}

View File

@ -49,13 +49,24 @@ class ListManagementController extends Controller {
if ($gender !== "all")
$dataProvider->query->andWhere(["gender" => $gender]);
$dataProvider->query->orderBy(["time" => SORT_DESC]);
$tempConfig = json_decode(file_get_contents("http://localhost:4004/ReadEngineConfig", false, stream_context_create([
'http' => [
'header' => "Content-Type: application/json",
'method' => "POST"
]
])), true);
$data = json_decode($tempConfig['data'], true);
$last = \app\models\ListManagement::find()->orderBy(['id' => SORT_DESC])->limit(1)->one();
$idAuto = $data['data']['box_id'] . "_" . ($last->id + 1);
return $this->render('index', [
'searchModel' => $searchModel,
'dataProvider' => $dataProvider,
'f' => $f,
't' => $t,
'typeArray' => ListManagement::$typeArray,
'genderArray' => ListManagement::$genderArray
'genderArray' => ListManagement::$genderArray,
'idAuto' => $idAuto
]);
}

View File

@ -99,7 +99,7 @@
<div class="row">
<div class="col-md-4 text-right">ID</div>
<div class="col-md-8">
<input type="text" name="Code">
<input type="text" name="Code" value="{$idAuto}">
</div>
</div>
<div class="row">

View File

@ -26,6 +26,7 @@
color: #fff;
}
</style>
<input type="hidden" value="{$idAuto}" name="isAuto">
<input type="hidden" value="{Url::to(["/list-management/add"])}" name="create_url">
<input type="hidden" value="{Url::to(["/list-management/update"])}" name="update_url">
<input type="hidden" value="{Url::to(["/list-management/sync-feature"])}" name="sync_feature_url">

View File

@ -204,6 +204,11 @@ function _form() {
$("#FaceImage").attr("src", "/images/user2-160x160.jpg");
$("#save-btn").attr("onclick", "_create(this);");
$("#save-btn").attr("data-href", $("input[name='create_url']").val());
$("input[name='Code']").val($("input[name='isAuto']").val());
$("input[name='Name']").val("");
$("input[name='Birthday']").val("");
$("input[name='Telephone']").val("");
$("input[name='Address']").val("");
}
function btnImage() {