cxgj/modules/admin/models/store/BoxEditForm.php
2023-12-09 16:31:30 +08:00

100 lines
2.3 KiB
PHP
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<?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 $sort;
public function rules()
{
return [
[['status', 'created_at', 'updated_at', 'is_delete', 'deleted_at', 'goods_id', 'bj_id','sort'], '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;
$this->model->sort = $this->sort;
if (!$this->model->save()) {
return $this->getModelError($this->model);
}
return $this->apiReturnSuccess('保存成功');
}
}