ThinkChat2.0新版上线,更智能更精彩,支持会话、画图、阅读、搜索等,送10W Token,即刻开启你的AI之旅 广告
>[info] 循环每次查询指定数据集(yii2) ~~~ $salesPerformOrderBindId = 0;// 销售订单绑定id while (true) { // 根据时间区域获取企业主体订单 $enterpriseEntityOrder = SalesPerformOrderBindDao::getEnterpriseEntityOrderByTime($startTime, $endTime, $salesId, $salesPerformOrderBindId); if (empty($enterpriseEntityOrder)) { break; } foreach ($enterpriseEntityOrder as $key => $value) { // 如果用户关联企业免押优先取数 if (!empty($value['user_id'])) { $enterpriseEntityOrderCount++; } // 如果用户不在关联企业免押 并且 该订单存在补充企业关联的资料 取数 if (empty($value['user_id']) && !empty($value['extra_info_order_id'])) { $enterpriseEntityOrderCount++; } } $salesPerformOrderBindId = $value['id']; } ~~~ ~~~ public static function getEnterpriseEntityOrderByTime($startTime, $endTime, $salesId, $id, $limit = 300) { $data = (new Query())->select(' b.id, b.sales_id, b.sales_name, o.order_id as v2_order_id, i.order_id as extra_info_order_id, smd.user_id, ')->from('sales_perform_order_bind b') ->leftJoin(V3OrderDao::tableName().' o', 'b.order_id = o.order_id') ->leftJoin('server_minus_deposit smd', 'o.user_id = smd.user_id') ->leftJoin('sales_order_extra_info i', 'b.order_id = i.order_id') ->andWhere(['between', 'b.pay_at', $startTime, $endTime]) ->andWhere(['b.sales_id' => $salesId]) ->andWhere(['>', 'b.id', $id]) ->orderBy('b.id ASC') ->limit($limit) ->all() ?? []; return $data; } ~~~