join('yz_subscription_user_buy','yz_member_children.child_id','=','yz_subscription_user_buy.uid') ->where('yz_member_children.member_id',698207) ->sum('yz_subscription_user_buy.quantity'); dd($total); } public function test() { $model = Order::find(230997); $set = \Setting::get('plugin.team_dividend'); (new NewUpgrateJob(698207, $set, $model->uniacid, TeamDividendLevelUpgrade::ORDER_PAY, $model))->handle(); dd('ok'); } public function error() { (new WrongDataRepair())->handle(); $a = ErrorTeamDividend::get(); return $this->successJson('修复成功', $a); } public function fixNotIncome() { $count = 0; $team_dividend = TeamDividendModel::uniacid()->where('created_at', '>',1554782400)->where('status',1)->get(); foreach ($team_dividend as $team) { $income = Income::uniacid() ->where('member_id', $team->member_id) ->where('incometable_id',$team->id) ->where('incometable_type','like','%TeamDividendModel') ->first(); if (!$income) { $team->update(['status' => 0, 'statement_at' => null]); $count++; } } echo '修复了'.$count.'条'; } }