98 lines
2.2 KiB
PHP
98 lines
2.2 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\components\Oss;
|
||
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 BoxEditForm extends AdminModel
|
||
{
|
||
|
||
public $model;
|
||
|
||
public $goods_id;
|
||
public $status;
|
||
|
||
public $bj_id;
|
||
public $cover_pic;
|
||
public $notice;
|
||
|
||
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', 'goods_id', 'bj_id'], 'integer'],
|
||
[['model'], 'safe'],
|
||
[['notice', 'cover_pic'], 'string'],
|
||
[['goods_id', 'bj_id', 'notice', 'cover_pic'], 'required'],
|
||
];
|
||
}
|
||
|
||
public function attributeLabels()
|
||
{
|
||
return [
|
||
'goods_id' => '冠军',
|
||
'notice' => '案例标题',
|
||
'status' => '案例状态',
|
||
'created_at' => '添加时间',
|
||
'updated_at' => '修改时间',
|
||
'is_delete' => '是否删除,0=否,1=是',
|
||
'deleted_at' => '删除时间',
|
||
'bj_id' => '案例分类',
|
||
'cover_pic' => '封面'
|
||
];
|
||
}
|
||
|
||
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->goods_id = $this->goods_id;
|
||
$this->model->bj_id = $this->bj_id;
|
||
|
||
$this->model->cover_pic = $this->cover_pic;
|
||
$this->model->status = $this->status;
|
||
$this->model->notice = $this->notice;
|
||
|
||
if (!$this->model->save()) {
|
||
return $this->getModelError($this->model);
|
||
}
|
||
return $this->apiReturnSuccess('保存成功');
|
||
}
|
||
|
||
|
||
} |