update sync server

This commit is contained in:
dongpd 2020-12-15 10:55:54 +07:00
parent 8530a33542
commit fc347376d3
11 changed files with 15 additions and 19 deletions

View File

@ -89,7 +89,7 @@ class ApiController extends Controller {
} }
$allFeatures[] = [ $allFeatures[] = [
"id" => $value->id, "id" => $value->id,
"name" => $value->name, "name" => $value->code,
"features" => $f "features" => $f
]; ];
} }

View File

@ -336,19 +336,18 @@ class ListManagementController extends Controller {
]), true); ]), true);
$ft[] = ["url" => $fileName, "features" => $features['results'][0]['feature']]; $ft[] = ["url" => $fileName, "features" => $features['results'][0]['feature']];
} }
$model = ListManagement::findOne(['code' => $data['idStaff']]); $model = ListManagement::findOne(['code' => $data['idStaff']]);
if ($model) { if ($model) {
$model->name = $data['code']; $model->name = $data['name'];
$model->image = json_encode($ft); $model->image = json_encode($ft);
$model->last_modified = time(); $model->last_modified = time();
$model->save(); $model->save();
} else { } else {
$model = new ListManagement(); $model = new ListManagement();
$model->create([ $model->create([
'code' => $data['idStaff'], 'code' => strval($data['idStaff']),
'type' => "wl", 'type' => "wl",
'name' => $data['code'], 'name' => $data['name'],
'image' => json_encode($ft), 'image' => json_encode($ft),
'gender' => "", 'gender' => "",
'birthday' => "", 'birthday' => "",

BIN
db/app.db

Binary file not shown.

View File

@ -8,7 +8,7 @@ use Yii;
* This is the model class for table "list_management". * This is the model class for table "list_management".
* *
* @property int $id * @property int $id
* @property int $code * @property string $code
* @property string $type * @property string $type
* @property string $name * @property string $name
* @property string $image * @property string $image
@ -33,8 +33,8 @@ class ListManagement extends \yii\db\ActiveRecord {
*/ */
public function rules() { public function rules() {
return [ return [
[['type', 'name', 'gender', 'telephone', 'address', 'image'], 'string'], [['type', 'name', 'gender', 'telephone', 'address', 'image', 'code'], 'string'],
[['birthday', 'time', 'code', 'last_modified'], 'integer'], [['birthday', 'time', 'last_modified'], 'integer'],
]; ];
} }
@ -44,7 +44,7 @@ class ListManagement extends \yii\db\ActiveRecord {
public function attributeLabels() { public function attributeLabels() {
return [ return [
'id' => 'ID', 'id' => 'ID',
'code' => 'Code', 'code' => 'ID',
'type' => 'Type', 'type' => 'Type',
'name' => 'Name', 'name' => 'Name',
'image' => 'Registration Image', 'image' => 'Registration Image',

View File

@ -97,9 +97,9 @@
</div> </div>
</div> </div>
<div class="row"> <div class="row">
<div class="col-md-4 text-right">Code</div> <div class="col-md-4 text-right">ID</div>
<div class="col-md-8"> <div class="col-md-8">
<input type="number" name="Code"> <input type="text" name="Code">
</div> </div>
</div> </div>
<div class="row"> <div class="row">

View File

@ -160,7 +160,7 @@
<div class="mt-step-content font-grey-cascade">Server config</div> <div class="mt-step-content font-grey-cascade">Server config</div>
</div> </div>
<div class="col-md-4 bg-grey mt-step-col active"> <div class="col-md-4 bg-grey mt-step-col active">
<div class="mt-step-number bg-white font-grey">2</div> <div class="mt-step-number bg-white font-grey">3</div>
<div class="mt-step-title uppercase font-grey-cascade" style="cursor: pointer;" onclick="window.location = '{Url::to(['/config/cau-hinh-nhan-dien'])}';"> <div class="mt-step-title uppercase font-grey-cascade" style="cursor: pointer;" onclick="window.location = '{Url::to(['/config/cau-hinh-nhan-dien'])}';">
Cấu hình nhận diện Cấu hình nhận diện
</div> </div>

View File

@ -34,7 +34,7 @@
<div class="mt-step-content font-grey-cascade">Server config</div> <div class="mt-step-content font-grey-cascade">Server config</div>
</div> </div>
<div class="col-md-4 bg-grey mt-step-col"> <div class="col-md-4 bg-grey mt-step-col">
<div class="mt-step-number bg-white font-grey">2</div> <div class="mt-step-number bg-white font-grey">3</div>
<div class="mt-step-title uppercase font-grey-cascade" style="cursor: pointer;" onclick="window.location = '{Url::to(['/config/cau-hinh-nhan-dien'])}';"> <div class="mt-step-title uppercase font-grey-cascade" style="cursor: pointer;" onclick="window.location = '{Url::to(['/config/cau-hinh-nhan-dien'])}';">
Cấu hình nhận diện Cấu hình nhận diện
</div> </div>

View File

@ -34,7 +34,7 @@
<div class="mt-step-content font-grey-cascade">Server config</div> <div class="mt-step-content font-grey-cascade">Server config</div>
</div> </div>
<div class="col-md-4 bg-grey mt-step-col"> <div class="col-md-4 bg-grey mt-step-col">
<div class="mt-step-number bg-white font-grey">2</div> <div class="mt-step-number bg-white font-grey">3</div>
<div class="mt-step-title uppercase font-grey-cascade" style="cursor: pointer;" onclick="window.location = '{Url::to(['/config/cau-hinh-nhan-dien'])}';"> <div class="mt-step-title uppercase font-grey-cascade" style="cursor: pointer;" onclick="window.location = '{Url::to(['/config/cau-hinh-nhan-dien'])}';">
Cấu hình nhận diện Cấu hình nhận diện
</div> </div>

View File

@ -203,9 +203,9 @@
</div> </div>
</div> </div>
<div class="row"> <div class="row">
<div class="col-md-4 text-right">Code</div> <div class="col-md-4 text-right">ID</div>
<div class="col-md-8"> <div class="col-md-8">
<input type="number" name="Code"> <input type="text" name="Code">
</div> </div>
</div> </div>
<div class="row"> <div class="row">

View File

@ -4,7 +4,6 @@
<tr> <tr>
<th>ID</th> <th>ID</th>
<th>Name</th> <th>Name</th>
<th>Code</th>
<th>Department</th> <th>Department</th>
<th>Registration Image</th> <th>Registration Image</th>
<th>Code</th> <th>Code</th>
@ -16,7 +15,6 @@
<tr onclick="choooseToSync(this);" style="cursor: pointer;" data-stt="false" data-id="{$arr.idStaff}"> <tr onclick="choooseToSync(this);" style="cursor: pointer;" data-stt="false" data-id="{$arr.idStaff}">
<td>{$arr.idStaff}</td> <td>{$arr.idStaff}</td>
<td>{$arr.name}</td> <td>{$arr.name}</td>
<td>{$arr.code}</td>
<td>{$arr.department}</td> <td>{$arr.department}</td>
<td> <td>
{foreach from=$arr.images item=img} {foreach from=$arr.images item=img}

View File

@ -440,7 +440,6 @@ function syncFeature(id) {
} }
function updateFeature() { function updateFeature() {
console.log("abc");
$.ajax({ $.ajax({
url: $("input[name='update_feature_url']").val(), url: $("input[name='update_feature_url']").val(),
type: 'POST', type: 'POST',