'ID', 'order_id' => '订单ID', 'activity_id' => '活动ID', 'share_user_id' => '分享者用户ID', 'mall_id' => '商城ID', 'order_status' => '处理进度 【0未处理 1已处理 2无效】', 'source' => '来源【1自购 2直推 3分享】', 'status' => '状态[-1:删除;0:禁用;1启用]', 'created_at' => '创建时间', 'updated_at' => '更新时间', ]; } /** * 保存数据 * @Author: ltm * @DateTime: 2022/6/8 0015 9:26 * @Copyright: copyright (c) 2021 * @param $mall_id * @param array $params * @return Rebate|bool */ public static function setData(array $params){ try{ $mall_id = $params['mall_id']; if(!empty($params['id'])){ $model = self::findOne(['and',['id' => $params['id'],'mall_id' => $mall_id],['<>','status', StatusEnum::ENABLED]]); if(empty($model)) throw new \Exception('活动不存在或已删除'); }else{ $model = new self(); $model->loadDefaultValues(); $model->mall_id = $mall_id; } if(!$model->load($params,'') || !$model->save()) throw new Exception($model->getErrorMessage()); return $model; }catch(\Exception $e){ self::setStaticError($e->getMessage()); return false; } } }