255], ]; } /** * {@inheritdoc} */ public function attributeLabels() { return [ 'id' => 'ID', 'content' => 'Content', 'created_at' => 'Created At', 'updated_at' => 'Updated At', 'status' => 'Status', ]; } /** * @Author: ltm * @DateTime: 2022/3/16 0016 17:58 * @Copyright: copyright (c) 2021 广东七件事集团 * @param $data * @return string */ public static function setData(array $params){ try{ if (!empty($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){ var_dump($e->getMessage()); self::$static_error = $e->getMessage(); return false; } } }