field('shop_id,province_id,city_id,region_id')->select(); Db::execute("truncate table yoshop_shop_daily_sales_st"); $m = new ShopsDailySalesSt(); $orderM = new Order(); $datas = []; $baseTo = strtotime(date("Y-m-d"),time()); $now = time(); for ($i=1;$i<72;$i++){ foreach ($shops as $shop) { $from = $baseTo - 86400*$i; $dayMid = $from + 43200; $to = $from + 86399; $temp = []; $tj = $orderM->dailySalesTj($shop['shop_id'],$from,$to); $temp['total_price'] = $tj['total_price']; $temp['total_goods_price'] = $tj['total_goods_price']; $temp['total_pay_price'] = $tj['total_pay_price']; $temp['coupon_money'] = $tj['coupon_money']; $temp['order_count'] = $tj['order_count']; $temp['express_price'] = $tj['express_price']; $temp['boss_comm_money'] = $tj['boss_comm_money']; $temp['mg_comm_money'] = $tj['mg_comm_money']; $temp['seller_comm_money'] = $tj['seller_comm_money']; $temp['shop_id'] = $shop['shop_id']; $temp['st_time'] = $dayMid; $temp['create_time'] = $now; $temp['update_time'] = $now; $datas[] = $temp; } } $m->insertAll($datas); } }