WIN-2308041133\Administrator 5 місяців тому
батько
коміт
599e1f3cd3

+ 6 - 5
app/api/controller/user/UserBillController.php

@@ -115,11 +115,12 @@ class UserBillController
      */
     public function spread_commission(Request $request, $type)
     {
-        list($page, $limit) = UtilService::getMore([
+        list($page, $limit,$data) = UtilService::getMore([
             ['page', 0],
             ['limit', 0],
+            ['data','']
         ], $request, true);
-        return app('json')->successful(UserBill::getUserBillList($request->uid(), $page, $limit, $type));
+        return app('json')->successful(UserBill::getUserBillList($request->uid(), $page, $limit, $type,['data'=>$data]));
     }
 
     /**
@@ -355,10 +356,10 @@ class UserBillController
      */
     public function integral_list(Request $request)
     {
-        list($page, $limit, $status) = UtilService::getMore([
-            ['page', 0], ['limit', 0], ['pm', 0]
+        list($page, $limit, $status,$data) = UtilService::getMore([
+            ['page', 0], ['limit', 0], ['pm', 0],['data','']
         ], $request, true);
-        return app('json')->successful(UserBill::userBillList($request->uid(), $page, $limit, 'integral', ['pm' => $status]));
+        return app('json')->successful(UserBill::userBillList($request->uid(), $page, $limit, 'integral', ['pm' => $status,'data'=>$data]));
 
     }
 }

+ 15 - 3
app/models/user/UserBill.php

@@ -61,8 +61,14 @@ class UserBill extends BaseModel
      */
     public static function userBillList($uid, $page, $limit, $category = 'integral', $where = [])
     {
+        $model = new self;
+        if ($where['date'] != '') {
+            list($startTime, $endTime) = explode(' - ', $where['date']);
+            $model = $model->where('a.add_time', '>', strtotime($startTime));
+            $model = $model->where('a.add_time', '<', (int)bcadd(strtotime($endTime), 86400, 0));
+        }
         if ($page) {
-            $list = self::where('uid', $uid)
+            $list = $model->where('uid', $uid)
                 ->where('category', $category)
                 ->field('mark,pm,number,add_time')
                 ->where('status', 1)
@@ -71,7 +77,7 @@ class UserBill extends BaseModel
                 ->page((int)$page, (int)$limit)
                 ->select();
         } else {
-            $list = self::where('uid', $uid)
+            $list = $model->where('uid', $uid)
                 ->where('category', $category)
                 ->field('mark,pm,number,add_time')
                 ->where('status', 1)
@@ -79,6 +85,7 @@ class UserBill extends BaseModel
                 ->order('add_time DESC')
                 ->select();
         }
+
         $list = count($list) ? $list->toArray() : [];
         foreach ($list as &$v) {
             $v['add_time'] = date('Y/m/d H:i', $v['add_time']);
@@ -148,11 +155,16 @@ class UserBill extends BaseModel
      * @param int $type 展示类型
      * @return array
      * */
-    public static function getUserBillList($uid, $page, $limit, $type)
+    public static function getUserBillList($uid, $page, $limit, $type,$where=[])
     {
         if (!$limit) return [];
         $model = self::where('uid', $uid)->order('add_time desc')->where('number', '<>', 0)
             ->field('FROM_UNIXTIME(add_time,"%Y-%m") as time,group_concat(id SEPARATOR ",") ids')->group('time');
+        if ($where['date'] != '') {
+            list($startTime, $endTime) = explode(' - ', $where['date']);
+            $model = $model->where('a.add_time', '>', strtotime($startTime));
+            $model = $model->where('a.add_time', '<', (int)bcadd(strtotime($endTime), 86400, 0));
+        }
         switch ((int)$type) {
             case 1:
                 $model = $model->where('category', 'now_money')->where('pm', 0);