'ID', 'mall_id' => 'Mall ID', 'user_id' => 'User ID', 'store_id' => 'Store ID', 'remarks' => 'Remarks', 'status' => 'Status', 'created_at' => 'Created At', 'deleted_at' => 'Deleted At', 'updated_at' => 'Updated At', 'upgrade_level_at' => 'Upgrade Level At', 'total_price' => 'Total Price', 'frozen_price' => 'Frozen Price', 'delete_reason' => 'Delete Reason', 'upgrade_status' => 'Upgrade Status', 'level' => 'Level', ]; } /** * @desc:保存数据 * @Author: hua * @Date: 2021/10/23 * @Time: 17:23 * @Copyright: copyright (c) 2021 广东七件事集团 * @param array $params * @return Agent|false|null */ public static function setData(array $params) { try { if(!empty($params['id'])){ $model = self::findOne(['mall_id' => $params['mall_id'], 'id' => $params['id'], 'status' => [StatusEnum::ENABLED, StatusEnum::DISABLED]]); if (empty($model)) throw new \Exception('服务不存在或已删除'); }else{ $model = new self(); $model->loadDefaultValues(); } if (!$model->load($params, '')) throw new \Exception($model->getErrorMessage()); if (!$model->save()) throw new Exception($model->getErrorMessage()); return $model; } catch (\Exception $e) { self::$static_error = $e->getMessage(); return false; } } }