Browse Source

股份分红奖励记录增加总额统计,并完善列表展示内容

sunxbiao 1 year ago
parent
commit
c3a0a9f21f
1 changed files with 14 additions and 3 deletions
  1. 14 3
      app/controller/admin/user/User.php

+ 14 - 3
app/controller/admin/user/User.php

@@ -1522,7 +1522,7 @@ class User extends BaseController
1522 1522
             $where[] = ['o.create_time', 'between', [strtotime($dateRange[0]), strtotime($dateRange[1])]];
1523 1523
         }
1524 1524
         if($nickname) $where[] = ['u.nickname','like','%'.$nickname.'%'];
1525
-        if($account) $where[] = ['u.account','=',$account];
1525
+        if($account) $where[] = ['u.account','like','%'.$account.'%'];
1526 1526
         if ($user_lianc_id) $where[] = ['o.user_lianc_id', '=', $user_lianc_id];
1527 1527
 
1528 1528
         $query = Db::name('old_user_originator')->alias('o')
@@ -1562,14 +1562,23 @@ class User extends BaseController
1562 1562
         [$page, $limit] = $this->getPage();
1563 1563
         $nickname = request()->param('nickname','');
1564 1564
         $account = request()->param('account','');
1565
+        $dateRange = request()->param('dateRange', []);
1565 1566
         $where = [];
1567
+
1568
+        if (!empty($dateRange)) {
1569
+            $where[] = ['o.create_time', 'between', [strtotime($dateRange[0]), strtotime($dateRange[1])]];
1570
+        }
1566 1571
         if($nickname) $where[] = ['u.nickname','like','%'.$nickname.'%'];
1567
-        if($account) $where[] = ['u.account','=',$account];
1572
+        if($account) $where[] = ['u.account','like','%'.$account.'%'];
1568 1573
         $query = Db::name('old_user_stock')->alias('o')
1569 1574
             ->leftJoin('user u','o.user_id=u.uid')
1570
-            ->field('o.*,u.uid,u.real_name,u.nickname')
1575
+            ->field('o.*,u.uid,u.real_name,u.nickname,u.account')
1571 1576
             ->where($where);
1572 1577
 
1578
+        $query1 = clone($query);
1579
+        $stock_getcomm = $query1->sum('getcomm');
1580
+        $stock_allgetcomm = $query1->sum('allgetcomm');
1581
+
1573 1582
         $data = $query->page($page)
1574 1583
             ->limit($limit)
1575 1584
             ->order('o.id desc')
@@ -1584,6 +1593,8 @@ class User extends BaseController
1584 1593
         }
1585 1594
         $return_data['list'] = $data;
1586 1595
         $return_data['count'] = $count;
1596
+        $return_data['stock_getcomm'] = $stock_getcomm;
1597
+        $return_data['stock_allgetcomm'] = $stock_allgetcomm;
1587 1598
         return app('json')->success($return_data);
1588 1599
     }
1589 1600