Эх сурвалжийг харах

Merge branch 'dev' of http://git.range8.cn/youyou/dms-api into dev

PC-202304251453\Administrator 5 сар өмнө
parent
commit
e4db0f2fc2

+ 3 - 1
app/v1/controller/customer/SdkOrderController.php

@@ -36,9 +36,11 @@ class SdkOrderController extends BaseController
             ['game_id', ''],
             ['user_name', ''],
             ['role_id', ''],
-            ['pay_date', ''],
+            ['pay_time', ''],
             ['orderBy', ''],
             ['orderType', ''],
+            ['send_status', ''],
+            ['sync_status', ''],
             ['page',''],
             ['limit','']
         ]);

+ 22 - 5
app/v1/logic/customer/SdkOrderLogic.php

@@ -31,11 +31,13 @@ class SdkOrderLogic extends BaseLogic
         $orderBy = $params['orderBy'] ?: 'pay_date';
         $orderType = $params['orderType'] ?: 'DESC';
 
-        if(!$params['pay_date']){
+       
+
+        if(!$params['pay_time']){
             throw new ApiException('请选择时间范围');
         }
         // 获取年月
-        $monthRange = getMonthsBetweenDates($params['pay_date'][0], $params['pay_date'][1]);
+        $monthRange = getMonthsBetweenDates($params['pay_time'][0], $params['pay_time'][1]);
 
         $eqWhere = ["game_id", "user_name", "order_id", "trade_id", "role_id", "role_name"];
         $where = [];
@@ -44,7 +46,17 @@ class SdkOrderLogic extends BaseLogic
                 $where[$field] = $params[$field];
             }
         }
-        $where[] = ['pay_date', 'between', [$params['pay_date'][0]." 00:00:00", $params['pay_date'][1]." 23:59:59"]];
+
+        if($params['send_status']!=''){
+            $where['send_status'] = $params['send_status'];
+        }
+
+        if($params['sync_status']!=''){
+            $where['sync_status'] = $params['sync_status'];
+        }
+
+
+        $where[] = ['pay_time', 'between', [strtotime($params['pay_time'][0]), strtotime($params['pay_time'][1])]];
 
         $db = Db::connect('db_game_log');
         $unionQuery = [];
@@ -54,11 +66,16 @@ class SdkOrderLogic extends BaseLogic
         }
         $fullSql = "(" . implode(' UNION ALL ', $unionQuery) . ") as unTable";
 
-        $list = $db->table($fullSql)->order($orderBy, $orderType)->paginate($params['limit'])->toArray();
+        echo $fullSql;
 
+        $list = $db->table($fullSql)->order($orderBy, $orderType)->paginate($params['limit'])->toArray();
+     
         $list['data'] = $this->trandformListColumn($list['data'], ['game', 'pay_channel']);
 
-        $list['totalRow'] = $db->table($fullSql)->where(["sync_status"=>1])->value("round(sum(money), 2)");
+        $allMoney = $db->table($fullSql)->where(["sync_status"=>1])->value("round(sum(money), 2)");
+        $list['totalRow'] = [
+            'money' => $allMoney,
+        ];
 
         return $list;
     }