make(PartnerSettlementCycleRepository::class) ->getSearch([]) ->field('start_time,end_time') ->where('id',$data['cycle_id']) ->find() ->toArray(); $list = app()->make(PartnerSettlementRepository::class) ->getSearch([]) ->field(['id','uid','cycle_id','money']) ->where('cycle_id',$data['cycle_id']) ->where('is_settlement',0) ->select() ->toArray(); if($list){ $userBillRepository = app()->make(UserBillRepository::class); $userRepository = app()->make(UserRepository::class); $dateCycle = date("Y-m-d H:i:s",$cycleInfo['start_time']) . ' ~ ' . date("Y-m-d H:i:s",$cycleInfo['end_time']); foreach($list as $singleInfo){ $userBillRepository->incBill($singleInfo['uid'], 'brokerage', 'commission_partner', [ 'link_id' => $singleInfo['cycle_id'], 'status' => 1, 'title' => '获得权重值分红', 'number' => $singleInfo['money'], 'mark' => $dateCycle. '时间内获得权重值分红,分红金额:' . floatval($singleInfo['money']), 'balance' => 0 ]); $userRepository->incBrokerage($singleInfo['uid'], $singleInfo['money']); } // 修改结算状态 $ids = array_column($list,'id'); app()->make(PartnerSettlementRepository::class) ->getSearch([]) ->whereIn('id',$ids) ->update([ 'is_settlement' => 1 ]); } } catch(\Exception $e){ $data['error_msg'] = $e->getMessage(); Log::info('合伙人佣金结算 - 失败: '.var_export($data,1)); } $job->delete(); } public function failed($data){ Log::info('合伙人佣金结算 - 失败(failed): '.var_export($data,1)); } }