12], [['desc', 'from_type'], 'string', 'max' => 255], [['setting'],'string'] ]; } /** * {@inheritdoc} */ public function attributeLabels() { return [ 'id' => 'ID', 'mall_id' => 'Mall ID', 'change_type' => 'Change Type', 'change_num' => 'Change Num', 'desc' => 'Desc', 'from_type' => 'From Type', 'status' => 'Status', 'created_at' => 'Created At', 'updated_at' => 'Updated At', ]; } /** * 保存数据 * @Author: zmz * @DateTime: 2022/11/16 12:13 * @Copyright: copyright (c) 2022 广东七件事集团 * @param array $params * @return bool */ public static function setData(array $params){ try{ if(isset($params['id']) && $params['id']) { $model = self::findOne(['id' => $params['id']]); if (empty($model)) throw new \Exception('服务不存在或已删除'); }else{ $model = new self(); $model->loadDefaultValues(); } if(!$model->load($params,'') || !$model->save()){ throw new \Exception($model->getErrorMessage()); } return $model; }catch(\Exception $e){ self::setStaticError($e->getMessage()); return false; } } }