From bf1702b3d8558f9bb8aed7f3538edd4280d2af04 Mon Sep 17 00:00:00 2001 From: wuhui_zzw <1760308791@qq.com> Date: Fri, 10 Nov 2023 17:56:10 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=EF=BC=9A=E6=8C=81=E6=9C=89?= =?UTF-8?q?=E7=A7=AF=E5=88=86=E7=9B=B8=E5=85=B3=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../repositories/user/IntegralRepository.php | 40 +++++++++++++++++++ app/controller/admin/user/UserIntegral.php | 17 ++++++++ route/admin/marketing.php | 14 +++++++ 3 files changed, 71 insertions(+) diff --git a/app/common/repositories/user/IntegralRepository.php b/app/common/repositories/user/IntegralRepository.php index 2219887..e02d993 100644 --- a/app/common/repositories/user/IntegralRepository.php +++ b/app/common/repositories/user/IntegralRepository.php @@ -132,6 +132,46 @@ class IntegralRepository extends BaseRepository return compact('count','list'); } + /** + * Common: 获取全部持有积分信息 + * Author: wu-hui + * Time: 2023/11/10 17:02 + * @param int $uid + * @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 getAllIntegralList(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']); + }) + ->when((int)$params['mer_id'] > 0,function($query) use ($params){ + $query->where('mer_id', (int)$params['mer_id']); + }) + ->with([ + 'mer' => function($query){ + $query->field('mer_id,mer_name,mer_avatar')->bind(['mer_name','mer_avatar']); + }, + 'user' => function($query){ + $query->field('uid,nickname,avatar')->bind(['nickname','avatar']); + } + ]) + ->order('create_time DESC'); + $count = $query->count(); + $list = $query->page($page,$limit)->select(); + + return compact('count','list'); + } + + + + + + diff --git a/app/controller/admin/user/UserIntegral.php b/app/controller/admin/user/UserIntegral.php index c2d3de8..a72a014 100644 --- a/app/controller/admin/user/UserIntegral.php +++ b/app/controller/admin/user/UserIntegral.php @@ -17,6 +17,7 @@ use app\common\repositories\store\ExcelRepository; use app\common\repositories\system\CacheRepository; use app\common\repositories\system\config\ConfigClassifyRepository; use app\common\repositories\system\config\ConfigValueRepository; +use app\common\repositories\user\IntegralRepository; use app\common\repositories\user\UserBillRepository; use app\validate\admin\IntegralConfigValidate; use crmeb\basic\BaseController; @@ -88,4 +89,20 @@ class UserIntegral extends BaseController app()->make(ConfigValueRepository::class)->save($cid, $config, 0); return app('json')->success('保存成功'); } + + // 持有积分列表 + public function holdIntegral(){ + [$page, $limit] = $this->getPage(); + $params = $this->request->params(['uid','mer_id']); + + $data = app()->make(IntegralRepository::class)->getAllIntegralList((array)$params,(int)$page,(int)$limit); + + return app('json')->success($data); + } + + + + + + } diff --git a/route/admin/marketing.php b/route/admin/marketing.php index 68fe6cd..0d89af4 100644 --- a/route/admin/marketing.php +++ b/route/admin/marketing.php @@ -61,6 +61,20 @@ Route::group(function () { ] ]); + Route::group('user/integral', function () { + Route::get('hold_list', '.UserIntegral/holdIntegral')->name('systemUserIntegralHoldList')->option([ + '_alias' => '持有积分', + ]); + + + + })->prefix('admin.user')->option([ + '_path' => '/marketing/integral/hold', + '_auth' => true, + ]); + + + //预售商品 Route::group('store/product/presell', function () { Route::get('lst', 'StoreProductPresell/lst')->name('systemStoreProductPresellLst')->option([