45], [['condition'], 'string', 'max' => 5000], ]; } /** * {@inheritdoc} */ public function attributeLabels() { return [ 'id' => 'ID', 'mall_id' => '商城ID', 'label_id' => '对应qimall_user_label.id', 'cond_type' => '条件类型', 'condition' => '条件内容', 'status' => '状态[-1:删除;0:禁用;1启用]', 'select_status' => '是否选择中', 'created_at' => 'Created At', 'updated_at' => 'Updated At', ]; } /** * @Author: ltm * @DateTime: 2022/3/10 0010 9:29 * @Copyright: copyright (c) 2021 广东七件事集团 * @param $data * @return string */ public static function setData(array $params){ try{ $model = self::findOne(['label_id'=>$params['label_id'],'mall_id'=>$params['mall_id'],'cond_type'=>$params['cond_type']]); if(empty($model)){ $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; } } }