update save serverKey, staff_id

This commit is contained in:
2021-06-03 09:46:52 +07:00
parent 9ceb3567c9
commit 08266f3a5f
8 changed files with 160 additions and 118 deletions

View File

@@ -8,9 +8,11 @@ use Yii;
* This is the model class for table "list_management".
*
* @property int $id
* @property string $staff_id
* @property string $code
* @property string $type
* @property string $name
* @property string $abbreviated_name
* @property string $image
* @property string $gender
* @property int $birthday
@@ -33,7 +35,7 @@ class ListManagement extends \yii\db\ActiveRecord {
*/
public function rules() {
return [
[['type', 'name', 'gender', 'telephone', 'address', 'image', 'code'], 'string'],
[['type', 'name', 'gender', 'telephone', 'address', 'image', 'code', 'abbreviated_name', 'staff_id'], 'string'],
[['birthday', 'time', 'last_modified'], 'integer'],
];
}
@@ -53,12 +55,15 @@ class ListManagement extends \yii\db\ActiveRecord {
'telephone' => 'Điện thoại',
'address' => 'Đơn vị',
'time' => 'Thời gian đăng kí',
'last_modified' => 'Last Modified'
'last_modified' => 'Last Modified',
'abbreviated_name' => 'Tên hiển thị',
'staff_id' => 'ID'
];
}
public function create($data) {
$r = $this->load([
'staff_id' => $data['staff_id'],
'code' => $data['code'],
'type' => $data['type'],
'name' => $data['name'],
@@ -67,6 +72,7 @@ class ListManagement extends \yii\db\ActiveRecord {
'birthday' => $data['birthday'] === "" ? 0 : date_format(date_create_from_format('d/m/Y', $data['birthday']), 'U'),
'telephone' => $data['telephone'],
'address' => $data['address'],
'abbreviated_name' => $data['abbreviated_name'],
'time' => time(),
'last_modified' => time()
], '');
@@ -102,7 +108,7 @@ class ListManagement extends \yii\db\ActiveRecord {
$res = [];
$ls = self::find()->all();
foreach ($ls as $key => $value) {
$res[] = $value->code;
$res[] = $value->staff_id;
}
return $res;
}