'ID', 'mall_id' => '商城ID', 'content' => '交换内容', 'change_status' => '交换状态[-1=交换失败,0=交换中,1=交换成功]', 'reason' => '失败原因', 'status' => '状态[-1:删除;0:禁用;1启用]', 'created_at' => '创建时间', 'updated_at' => '更新时间', ]; } /** * 检测是否还有为完成的提交 * @Author: lun * @DateTime: 2023/6/3 0003 11:47 * @Copyright: copyright (c) 2021 广东七件事集团 * @param $mall_id * @return bool */ public static function check($mall_id) { $data = self::find()->where(['mall_id' => $mall_id, 'change_status' => StatusEnum::DISABLED, 'status' => StatusEnum::ENABLED])->asArray()->one(); if ($data) return false; return true; } /** * 保存数据 * @Author: lun * @DateTime: 2023/6/3 0003 11:45 * @Copyright: copyright (c) 2021 广东七件事集团 * @param $mall_id * @param $params * @return bool|int */ public static function setData($mall_id, $params) { try { $model = new self(); $model->loadDefaultValues(); $model->mall_id = $mall_id; $model->content = json_encode($params); if (!$model->save()) throw new Exception($model->getErrorMessage()); return $model->id; } catch (\Exception $e) { self::setStaticError($e->getMessage()); return false; } } }