81 lines
1.6 KiB
PHP
81 lines
1.6 KiB
PHP
<?php
|
|
|
|
/**
|
|
* @author Any
|
|
* @description KISS
|
|
* @date 2020-11-5
|
|
* @version 1.0.0
|
|
*
|
|
* _____LOG_____
|
|
*
|
|
*/
|
|
|
|
namespace app\modules\admin\models\store;
|
|
|
|
use app\components\EncryptHelper;
|
|
use app\models\Admin;
|
|
use app\models\auth\RoleUser;
|
|
use app\models\common\CommonUserEditForm;
|
|
use app\models\Store;
|
|
use app\models\StoreUser;
|
|
use app\models\SysAdmin;
|
|
use app\models\User;
|
|
use app\modules\admin\models\AdminModel;
|
|
use yii\data\Pagination;
|
|
|
|
class StoreBjEditForm extends AdminModel
|
|
{
|
|
|
|
public $model;
|
|
|
|
public $status;
|
|
|
|
public $name;
|
|
|
|
public $created_at;
|
|
public $updated_at;
|
|
public $is_delete;
|
|
public $deleted_at;
|
|
|
|
|
|
public function rules()
|
|
{
|
|
return [
|
|
[['status', 'created_at', 'updated_at', 'is_delete', 'deleted_at'], 'integer'],
|
|
[['model'], 'safe'],
|
|
[['name'], 'string'],
|
|
[['name'], 'required'],
|
|
];
|
|
}
|
|
|
|
public function attributeLabels()
|
|
{
|
|
return [
|
|
'name' => '分类名称',
|
|
];
|
|
}
|
|
|
|
public function edit()
|
|
{
|
|
if (!$this->validate()) {
|
|
return $this->getModelError();
|
|
}
|
|
|
|
|
|
if ($this->model->isNewRecord) {
|
|
$this->model->is_delete = 0;
|
|
$this->model->deleted_at = 0;
|
|
$this->model->created_at = time();
|
|
}
|
|
|
|
$this->model->updated_at = time();
|
|
$this->model->name = $this->name;
|
|
$this->model->status = $this->status;
|
|
|
|
if (!$this->model->save()) {
|
|
return $this->getModelError($this->model);
|
|
}
|
|
return $this->apiReturnSuccess('保存成功');
|
|
}
|
|
|
|
} |