255], ]; } /** * {@inheritdoc} */ public function attributeLabels() { return [ 'id' => 'ID', 'mall_id' => 'Mall ID', 'user_id' => 'User ID', 'operate_id' => 'Operate ID', 'log_type' => 'Log Type', 'remark' => 'Remark', 'status' => 'Status', 'created_at' => 'Created At', 'updated_at' => 'Updated At', ]; } /** * 保存数据 * * @author hpei * @return bool|Exception */ public static function setData($params) { try { if (empty($params['id'])) { $model = new self(); $model->loadDefaultValues(); } else { $model = self::findOne(['id' => $params['id'], 'status' => [StatusEnum::ENABLED, StatusEnum::DISABLED]]); if (empty($model)) throw new \Exception('数据不存在或者已删除'); } if (!$model->load($params, '') || !$model->save()) throw new \Exception($model->getErrorMessage()); return $model->id; } catch (\Exception $e) { self::$static_error = $e->getMessage(); return false; } } }