id); if(!$channel_data || !$channel_day_data){ Log::info($channel['id']."日数据未生成".date("y-m-d H:i:s"."\n")); continue; } $userRegisterNum = isset($channel_day_data->register_user_num)?$channel_day_data->register_user_num:0;//昨日注册 $sendOrderDataNum = isset($channel_day_data->send_order_num)?$channel_day_data->send_order_num:0;//昨日派单创建数 try{ $paramsA = [ 'distribution_channel_id' => $channel['id'], 'date' => $yesterStartDay, 'register_user_num' => $userRegisterNum, 'send_order_num' => $sendOrderDataNum, 'is_login_yesterday'=>UserService::judgeUserYesterdayLogin($channel['id'],$yesterStartDay,$yesterEndDay) ]; BusinessChannelDayStatService::createBusinessChannelDayStat($paramsA); }catch (\Exception $exception){ \Log::error($exception->getMessage()); } $yesterday_register_user_num = $userRegisterNum; $total_register_user_num = $channel_data->register_user_num; $total_send_order_num = $channel_data->send_order_num; //当月新增站点充值 $current_month_new_channel_recharge = strtotime($channel->created_at) >= strtotime(date('Y-m-01')) ? $channel_data->current_month_recharge_amount : 0; $current_month_channel_recharge = $channel_data->current_month_recharge_amount;//当月总充值 $channel_total_recharge=$channel_data->total_recharge_amount;//历史总充值 $paramsB = [ 'yesterday_register_user_num' => $yesterday_register_user_num, 'total_register_user_num' => $total_register_user_num, 'total_send_order_num' => $total_send_order_num, 'current_month_new_channels_recharge'=>$current_month_new_channel_recharge, 'current_month_channels_recharge'=>$current_month_channel_recharge, 'service_account_num' =>BusinessChannelStatService::getServiceAccountNum($channel['id']), 'last_week_login_days' =>0,//BusinessChannelStatService::getLoginDays($channel['id'],$beginLastweek,$endLastweek), 'current_week_login_days'=>0,//BusinessChannelStatService::getLoginDays($channel['id'],$current_week_start,$current_week_end), 'yesterday_create_orders'=>$sendOrderDataNum, 'is_login_yesterday'=>$paramsA['is_login_yesterday'], 'channel_total_recharge'=>$channel_total_recharge, ]; if(date('d')=='01'){//月初第一天 $paramsB['last_month_channels_recharge'] = $channel_data->last_month_recharge_amount; $paramsB['last_month_new_channel_recharge'] =$business_stat ? $business_stat->current_month_new_channels_recharge : 0; $paramsB['last_month_register_user_num'] = $business_stat ? $business_stat->current_month_register_user_num : 0; $paramsB['current_month_register_user_num'] = $userRegisterNum; }else{ $paramsB['current_month_register_user_num'] = $business_stat ? $business_stat->current_month_register_user_num + $userRegisterNum : $userRegisterNum; } if(date('w')=='1'){//周一 $paramsB['last_week_actual_send_orders'] = $business_stat ? $business_stat->current_week_actual_send_orders : 0; }else{ $paramsB['current_week_actual_send_orders'] = SendOrderService::getPeriodActualSendOrdersNum($channel['id'], $current_week_start,$current_week_end); } BusinessChannelStatService::crateUpdate($channel['id'], $paramsB); } Log::info("======每日商务渠道数据生成 【任务执行结束】=====".date("y-m-d H:i:s"."\n")); print_r("======每日商务渠道数据生成 【任务执行结束】=====".date("y-m-d H:i:s"."\n")); } }