/** * @param $uid * @param $app_id * @param $start_time * @param $end_time * @param $start_page * @param $limit_page * mongodb中的分页查询 */ public static function getUserRevenueInfoList($uid, $source,$app_id, $start_time, $end_time,$skip, $limit){ $match = [‘app_id‘=>$app_id, ‘uid‘=>(int)$uid, ‘msg_id‘=>1009, ‘source‘ => intval($source), "timestamp" => [‘$gte‘ => (int)$start_time, ‘$lt‘ => (int)$end_time], ]; $conditions = array( array(‘$match‘=>$match), ); //分页查询的参数 if($skip > 0) $conditions[] = array(‘$skip‘=>(int)$skip); if($limit > 0) $conditions[] = array(‘$limit‘=>(int)$limit); //指定返回的字段 $project = [ ‘miss‘=>‘$miss‘, ‘win‘=>‘$miss‘, ‘bet‘=>‘$bet‘, ‘user_win‘=>‘$user_win‘, ‘time‘=>‘$timestamp‘, ]; $conditions[] = array(‘$project‘=>$project); $result=self::aggregate($conditions); $final_data = []; foreach($result[‘result‘] as $log){ $temp = []; $temp["miss"] = (int)\Utilities::mongoGetNumber($log[‘miss‘]); $temp["win"] = (int)\Utilities::mongoGetNumber($log[‘win‘]); $temp["bet"] = (int)\Utilities::mongoGetNumber($log[‘bet‘]); $temp["user_win"] = (int)\Utilities::mongoGetNumber($log[‘user_win‘]); $temp["time"] = date("Y-m-d H:i:s",(int)\Utilities::mongoGetNumber($log["time"])); $final_data[]=$temp; } return $final_data; }
时间: 2024-10-12 14:11:58