WIN-2308041133\Administrator 1 month ago
parent
commit
1a8eb8a025

+ 18 - 0
app/adminapi/controller/v1/finance/Finance.php

@@ -134,5 +134,23 @@ class Finance extends AuthController
         ]);
         ]);
         return app('json')->success($services->getBrokerageListFull($where));
         return app('json')->success($services->getBrokerageListFull($where));
     }
     }
+    /**
+     * 获取额度完整列表(包含user信息)
+     * @param UserBrokerageServices $services
+     * @return mixed
+     */
+    public function getGiftQuota(UserBrokerageServices $services)
+    {
+        $where = $this->request->getMore([
+            ['start_time', ''],
+            ['end_time', ''],
+            ['nickname', ''],
+            ['uid', ''], //用户id
+            ['pm', ''], //收支
+            ['limit', 20],
+            ['page', 1]
+        ]);
+        return app('json')->success($services->getGiftQuota($where));
+    }
 
 
 }
 }

+ 2 - 0
app/adminapi/route/finance.php

@@ -44,6 +44,8 @@ Route::group('finance', function () {
         Route::get('finance/extract_list/:id', 'v1.finance.Finance/getUserBrokeragelist')->option(['real_name' => '佣金提现记录个人列表']);
         Route::get('finance/extract_list/:id', 'v1.finance.Finance/getUserBrokeragelist')->option(['real_name' => '佣金提现记录个人列表']);
         //佣金记录完整列表(包含user信息)
         //佣金记录完整列表(包含user信息)
         Route::get('finance/brokerage_list_full', 'v1.finance.Finance/getBrokerageListFull')->option(['real_name' => '佣金记录完整列表']);
         Route::get('finance/brokerage_list_full', 'v1.finance.Finance/getBrokerageListFull')->option(['real_name' => '佣金记录完整列表']);
+        //额度记录完整列表
+        Route::get('finance/getGiftQuota', 'v1.finance.Finance/getGiftQuota')->option(['real_name' => '额度记录列表']);
         /** 余额记录 */
         /** 余额记录 */
         Route::get('balance/list', 'v1.finance.UserBalance/balanceList')->option(['real_name' => '余额记录列表']);
         Route::get('balance/list', 'v1.finance.UserBalance/balanceList')->option(['real_name' => '余额记录列表']);
         Route::post('balance/set_mark/:id', 'v1.finance.UserBalance/balanceRecordRemark')->option(['real_name' => '余额记录备注']);
         Route::post('balance/set_mark/:id', 'v1.finance.UserBalance/balanceRecordRemark')->option(['real_name' => '余额记录备注']);

+ 20 - 0
app/dao/user/UserGiftQuotaDao.php

@@ -52,4 +52,24 @@ class UserGiftQuotaDao extends BaseDao
                 $query->page($page, $limit);
                 $query->page($page, $limit);
             })->select()->toArray();
             })->select()->toArray();
     }
     }
+    /**
+     * 按时间获取佣金列表(完整版,包含user信息)
+     * @param array $where
+     * @param string $field
+     * @param int $page
+     * @param int $limit
+     * @return array
+     * @throws \think\db\exception\DataNotFoundException
+     * @throws \think\db\exception\DbException
+     * @throws \think\db\exception\ModelNotFoundException
+     */
+    public function getGiftQuotaListByTime(array $where, string $field = '*', int $page = 0, int $limit = 0)
+    {
+        return $this->search($where)->field($field)->with([
+            'user' => function ($query) {
+                $query->field('uid,nickname,phone,avatar');
+            }])->when($page && $limit, function ($query) use ($page, $limit) {
+            $query->page($page, $limit);
+        })->order('add_time desc')->select()->toArray();
+    }
 }
 }

+ 45 - 0
app/services/user/UserBrokerageServices.php

@@ -13,6 +13,7 @@ namespace app\services\user;
 
 
 use app\dao\system\config\SystemConfigDao;
 use app\dao\system\config\SystemConfigDao;
 use app\dao\user\UserBrokerageDao;
 use app\dao\user\UserBrokerageDao;
+use app\dao\user\UserGiftQuotaDao;
 use app\services\BaseServices;
 use app\services\BaseServices;
 use crmeb\exceptions\ApiException;
 use crmeb\exceptions\ApiException;
 
 
@@ -693,4 +694,48 @@ class UserBrokerageServices extends BaseServices
             return '转账成功';
             return '转账成功';
         });
         });
     }
     }
+    /**
+     * 获取佣金记录列表(完整版,包含user信息)
+     * @param array $where
+     * @param string $field
+     * @return array
+     */
+    public function getGiftQuota(array $where, string $field = '*')
+    {
+        /** @var UserGiftQuotaServices $UserGiftQuotaServices */
+        $UserGiftQuotaServices = app()->make(UserGiftQuotaServices::class);
+        $where_data = [];
+        if (isset($where['uid']) && $where['uid'] != '') {
+            $where_data['uid'] = $where['uid'];
+        }
+        if (isset($where['pm']) && $where['pm'] != '') {
+            $where_data['pm'] = $where['pm'];
+        }
+        if ($where['start_time'] != '' && $where['end_time'] != '') {
+            $where_data['time'] = str_replace('-', '/', $where['start_time']) . ' - ' . str_replace('-', '/', $where['end_time']);
+        }
+        if (isset($where['type']) && $where['type'] != '') {
+            $where_data['type'] = $where['type'];
+        }
+        if (isset($where['nickname']) && $where['nickname'] != '') {
+            $where_data['like'] = $where['nickname'];
+        }
+
+        [$page, $limit] = $UserGiftQuotaServices->getPageValue();
+        /** @var UserGiftQuotaDao $UserGiftQuotaDao */
+        $UserGiftQuotaDao = app()->make(UserGiftQuotaDao::class);
+        // 按时间从大到小排列
+        $data = $UserGiftQuotaDao->getGiftQuotaListByTime($where_data, $field, $page, $limit);
+        $count = $UserGiftQuotaDao->count($where_data);
+
+        foreach ($data as &$item) {
+            $item['nickname'] = $item['user']['nickname'] ?? '';
+            $item['phone'] = $item['user']['phone'] ?? '';
+            $item['avatar'] = $item['user']['avatar'] ?? '';
+            $item['_add_time'] = $item['add_time'] ? date('Y-m-d H:i:s', $item['add_time']) : '';
+            unset($item['user']);
+        }
+
+        return compact('data', 'count');
+    }
 }
 }