selectRaw("bind_app_id, order_source, system_corpid as corpid,count(1) as order_count, count(distinct(external_userid)) as pay_uv, count(external_userid) as pay_pv,sum(pay_money) as pay_money") ->whereIn('bind_app_id', $appIdList) ->where('pay_status', 1) ->where('is_ad_user', 1) ->where('order_type', 1) ->where('order_pay_time', '>=', strtotime($date.' 00:00:00') * 1000) ->where('order_pay_time', '<=', strtotime($date.' 23:59:59') * 1000) ->groupBy(['bind_app_id', 'order_source']) ->get(); return $data; } /** * 统计单个账号指定日期的数据统计 * */ public static function adqStatByDate($accountIdList, $date) { # 统计数据 $data = DjOrder::query()->selectRaw("adq_account_id, order_source, system_corpid as corpid,count(1) as order_count, count(distinct(external_userid)) as pay_uv, count(external_userid) as pay_pv,sum(pay_money) as pay_money") ->whereIn('adq_account_id', $accountIdList) ->where('pay_status', 1) ->where('order_type', 2) ->where('order_pay_time', '>=', strtotime($date.' 00:00:00') * 1000) ->where('order_pay_time', '<=', strtotime($date.' 23:59:59') * 1000) ->groupBy(['adq_account_id', 'order_source']) ->get(); return $data; } /** * 判断是否为往日补充订单数据 * @param $orderPayTime int 订单支付时间戳 * @param $appId string 订单所属账号appid * */ public static function orderCheck($orderId, $orderPayTime, $appId) { $timestamps = strtotime(date('Y-m-d')); $orderPayTime = substr($orderPayTime, 0, 10); if($orderPayTime < $timestamps) { // 回调订单为往日订单数据,入Redis $supplyData = [ 'app_id' => $appId, 'order_id' => $orderId, 'date' => date('Y-m-d', $orderPayTime) ]; Log::logInfo('检出回调订单中出现往日数据', $supplyData, 'SupplyOrderCheck'); RedisModel::lPush(OrderSummary::ORDER_SUPPLY_STAT_RDS, json_encode($supplyData)); } return true; } }