'ID', 'mall_id' => 'Mall ID', 'user_id' => 'User ID', 'order_id' => 'Order ID', 'profit' => 'Profit', 'destroy' => 'Destroy', 'platform_account' => 'Platform Account', 'remaining_rewards' => 'Remaining Rewards', 'status' => 'Status', 'created_at' => 'Created At', 'updated_at' => 'Updated At', ]; } /** * 保存数据 * @Author: zmz * @DateTime: 2022/11/19 09:13 * @Copyright: copyright (c) 2022 广东七件事集团 * @param array $params * @return bool|self */ public static function setData(array $params){ try{ if(isset($params['id']) && $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){ self::setStaticError($e->getMessage()); return false; } } /** * 检测奖励是否发放过 * @param $mall_id * @param $source_table * @param $source_id * @return HigoMerchantRewardLog|null */ public static function checkReward($mall_id,$source_table,$source_id) { $log = self::findOne(['mall_id' => $mall_id,'source_table' => $source_table,'source_table_id' => $source_id,'status' => StatusEnum::ENABLED]); return $log; } }