where('id',$taskId)->lockForUpdate()->first(); if(empty($cronTask)){ throw new \Exception('没有查询当任务!'); } $proder = Db::table('wa_payorder')->where('id',$cronTask->order_id)->first(); if(empty($proder)){ Db::table('wa_cron_task')->where('id',$taskId)->update([ 'is_finish' => 2 ]); Db::table('wa_users')->where('id',$cronTask->user_id) ->update(['status'=>0,'updated_at'=>date('Y-m-d H:i:s')]); }else{ /** @var $has 查询今天是否已经发奖*/ $has=Db::table('wa_stream') ->where('user_id',$cronTask->user_id) ->where('type',streamType9) ->where('mold',moldType5) ->whereBetween('add_time',[strtotime(date('Y-m-d').' 00:00:00'),strtotime(date('Y-m-d').' 23:59:59')]) ->where('source_id',$taskId) ->exists(); /** @var $usersData 查询会员信息*/ $usersData=Db::table('wa_users')->where('id',$cronTask->user_id)->first(); if(empty($has) && !empty($usersData)){ StreamBusiness::addStream($usersData->id,$cronTask->bonus,streamType9,moldType5,moldTypefild5,$taskId); Db::table('wa_users')->where('id', $cronTask->user_id)->increment('money_seven',$cronTask->bonus); } Db::table('wa_cron_task')->where('id',$taskId)->update([ 'day_dividend_time' => strtotime("+1 days"), 'is_day' => 2 ]); } Db::commit(); }catch (\Throwable $exception){ Db::rollBack(); Log::channel('task')->error($exception->getMessage(),[$taskId]); } } static public function taskFj(int $taskId) { Db::beginTransaction(); try { StreamBusiness::addStream($taskId,88888,streamType13,moldType4,moldTypefild4,$taskId); Db::table('wa_users')->where('id',$taskId)->update([ 'is_f'=>2, ]); Db::commit(); }catch (\Throwable $exception){ Db::rollBack(); Log::channel('task_jr')->error($exception->getMessage(),$taskId); } } /** 申请通过 * @param $taskId * @return void */ static public function TaskRefund($taskId) { Db::beginTransaction(); try { $has = Db::table('wa_withdraw')->where('type',2)->where('id',$taskId)->first(); if(!$has){ throw new \Exception('没有查询当申请!'); } Db::commit(); }catch (\Throwable $exception){ Db::rollBack(); Log::channel('task_refund')->error($exception->getMessage(),[$taskId]); } } }