From 58659a686f60830ab159ecfce68d6733794c086f Mon Sep 17 00:00:00 2001 From: wuhui_zzw <1760308791@qq.com> Date: Wed, 27 Dec 2023 11:46:19 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=EF=BC=9A=E6=9D=83=E9=87=8D?= =?UTF-8?q?=E5=80=BC=E7=AE=A1=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../WeightValueLogRepository.php | 29 ++++++++++ .../WeightValueRepository.php | 33 ++++++++++- .../PlatformCommissionWeightValue.php | 56 +++++++++++++++++++ route/admin/marketing.php | 7 +++ 4 files changed, 123 insertions(+), 2 deletions(-) create mode 100644 app/controller/admin/store/marketing/PlatformCommissionWeightValue.php diff --git a/app/common/repositories/store/platformCommission/WeightValueLogRepository.php b/app/common/repositories/store/platformCommission/WeightValueLogRepository.php index 8ece276..22afe0d 100644 --- a/app/common/repositories/store/platformCommission/WeightValueLogRepository.php +++ b/app/common/repositories/store/platformCommission/WeightValueLogRepository.php @@ -15,6 +15,35 @@ class WeightValueLogRepository extends BaseRepository{ public function __construct(WeightValueLogDao $dao){ $this->dao = $dao; } + /** + * Common: 获取变更记录 + * Author: wu-hui + * Time: 2023/12/27 11:24 + * @param array $params + * @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 getRecord(array $params,int $page,int $limit):array{ + $query = $this->dao->getSearch([]) + ->withoutField('product_id,order_id,order_product_id,source') + ->when((int)$params['uid'] > 0,function($query) use ($params){ + $query->where('uid', (int)$params['uid']); + }) + ->with([ + 'user' => function($query){ + $query->field('uid,nickname,avatar')->bind(['nickname','avatar']); + } + ]) + ->order('id DESC'); + $count = $query->count(); + $list = $query->page($page,$limit)->select(); + + return compact('count','list'); + } diff --git a/app/common/repositories/store/platformCommission/WeightValueRepository.php b/app/common/repositories/store/platformCommission/WeightValueRepository.php index 9be412d..3aa7596 100644 --- a/app/common/repositories/store/platformCommission/WeightValueRepository.php +++ b/app/common/repositories/store/platformCommission/WeightValueRepository.php @@ -68,9 +68,38 @@ class WeightValueRepository extends BaseRepository{ return $currentLevelList; } + /** + * Common: 获取用户权重值持有信息 + * Author: wu-hui + * Time: 2023/12/27 11:13 + * @param array $params + * @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 getHoldList(array $params,int $page,int $limit):array{ + $query = $this->dao->getSearch([]) + ->when((int)$params['uid'] > 0,function($query) use ($params){ + $query->where('uid', (int)$params['uid']); + }) + ->with([ + 'user' => function($query){ + $query->field('uid,nickname,avatar')->bind(['nickname','avatar']); + } + ]) + ->group('uid') + ->order('id DESC'); + $count = $query->count(); + $list = $query + ->field('id,uid,brokerage_level,sum(quantity) as sum_quantity') + ->page($page,$limit) + ->select(); - - + return compact('count','list'); + } diff --git a/app/controller/admin/store/marketing/PlatformCommissionWeightValue.php b/app/controller/admin/store/marketing/PlatformCommissionWeightValue.php new file mode 100644 index 0000000..16a8373 --- /dev/null +++ b/app/controller/admin/store/marketing/PlatformCommissionWeightValue.php @@ -0,0 +1,56 @@ +repository = $repository; + } + /** + * Common: 持有列表 + * Author: wu-hui + * Time: 2023/12/27 11:13 + * @return mixed + * @throws \think\db\exception\DataNotFoundException + * @throws \think\db\exception\DbException + * @throws \think\db\exception\ModelNotFoundException + */ + public function holdList(){ + [$page, $limit] = $this->getPage(); + $params = $this->request->params(['uid']); + + $data = $this->repository->getHoldList((array)$params,(int)$page,(int)$limit); + + return app('json')->success($data); + } + /** + * Common: 变更记录 + * Author: wu-hui + * Time: 2023/12/27 11:29 + * @param WeightValueLogRepository $repository + * @return mixed + * @throws \think\db\exception\DataNotFoundException + * @throws \think\db\exception\DbException + * @throws \think\db\exception\ModelNotFoundException + */ + public function changeRecord(WeightValueLogRepository $repository){ + [$page, $limit] = $this->getPage(); + $params = $this->request->params(['uid']); + + $data = $repository->getRecord((array)$params,(int)$page,(int)$limit); + + return app('json')->success($data); + } + + + + +} diff --git a/route/admin/marketing.php b/route/admin/marketing.php index 78d7638..5533c92 100644 --- a/route/admin/marketing.php +++ b/route/admin/marketing.php @@ -440,6 +440,13 @@ Route::group(function () { Route::get('record_list', '.platformCommission/recordList')->name('platformCommissionRecordList')->option([ '_alias' => '抽成记录', ]); + // 权重值 + Route::get('weight_value_hold_list', '.platformCommissionWeightValue/holdList')->name('platformCommissionWeightValueHoldList')->option([ + '_alias' => '持有信息', + ]); + Route::get('weight_value_change_record', '.platformCommissionWeightValue/changeRecord')->name('platformCommissionWeightValueChangeRecord')->option([ + '_alias' => '变更记录', + ]);