From 3688b0f858ac7432ea41e219cc2ded72889068d0 Mon Sep 17 00:00:00 2001 From: wuhui_zzw <1760308791@qq.com> Date: Fri, 12 Jan 2024 11:26:28 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=EF=BC=9A=E5=85=91=E6=8D=A2?= =?UTF-8?q?=E9=A2=9D=E5=BA=A6=E7=9B=B8=E5=85=B3=E4=BF=A1=E6=81=AF=E6=9F=A5?= =?UTF-8?q?=E7=9C=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../user/ExchangeQuotaRecordRepository.php | 31 +++++++++ .../user/ExchangeQuotaRepository.php | 46 ++++++++++++++ app/controller/admin/user/ExchangeQuota.php | 63 +++++++++++++++++++ route/admin/marketing.php | 38 +++++------ route/api.php | 33 +++------- 5 files changed, 169 insertions(+), 42 deletions(-) create mode 100644 app/controller/admin/user/ExchangeQuota.php diff --git a/app/common/repositories/user/ExchangeQuotaRecordRepository.php b/app/common/repositories/user/ExchangeQuotaRecordRepository.php index 61e4f6f..b3194fe 100644 --- a/app/common/repositories/user/ExchangeQuotaRecordRepository.php +++ b/app/common/repositories/user/ExchangeQuotaRecordRepository.php @@ -12,6 +12,37 @@ class ExchangeQuotaRecordRepository extends BaseRepository{ public function __construct(ExchangeQuotaRecordDao $dao){ $this->dao = $dao; } + /** + * Common: 获取信息列表 + * Author: wu-hui + * Time: 2024/01/11 10:00 + * @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 getList(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']); + } + ]) + ->order('create_time DESC,id DESC'); + $count = $query->count(); + $list = $query->page($page,$limit)->select(); + + return compact('count','list'); + } + + + diff --git a/app/common/repositories/user/ExchangeQuotaRepository.php b/app/common/repositories/user/ExchangeQuotaRepository.php index ba98f9a..810df4f 100644 --- a/app/common/repositories/user/ExchangeQuotaRepository.php +++ b/app/common/repositories/user/ExchangeQuotaRepository.php @@ -12,6 +12,52 @@ class ExchangeQuotaRepository extends BaseRepository{ public function __construct(ExchangeQuotaDao $dao){ $this->dao = $dao; } + /** + * Common: 获取统计信息 + * Author: wu-hui + * Time: 2024/01/11 9:51 + * @return array + */ + public function getStat():array{ + $model = $this->dao->getSearch([]); + return [ + 'sum_total_quota' => $model->sum('total_quota'),// 平台总额度 + 'sum_use_quota' => $model->sum('use_quota'),// 平台已使用额度 + 'sum_surplus_quota' => $model->sum('surplus_quota'),// 平台剩余额度 + 'sum_freeze_quota' => $model->sum('freeze_quota'),// 平台冻结额度 + 'sum_people_num' => $model->count(),// 参与人数 + ]; + } + /** + * Common: 获取信息列表 + * Author: wu-hui + * Time: 2024/01/11 9:59 + * @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 getList(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']); + } + ]) + ->order('create_time DESC,id DESC'); + $count = $query->count(); + $list = $query->page($page,$limit)->select(); + + return compact('count','list'); + } + + diff --git a/app/controller/admin/user/ExchangeQuota.php b/app/controller/admin/user/ExchangeQuota.php new file mode 100644 index 0000000..e5bea74 --- /dev/null +++ b/app/controller/admin/user/ExchangeQuota.php @@ -0,0 +1,63 @@ +make(ExchangeQuotaRepository::class)->getStat(); + + $data = [ + ['className' => 'el-icon-coin','count' => $statInfo['sum_total_quota'],'field' => '分','name' => '平台总额度'], + ['className' => 'el-icon-coin','count' => $statInfo['sum_use_quota'],'field' => '分','name' => '平台已使用额度'], + ['className' => 'el-icon-coin','count' => $statInfo['sum_surplus_quota'],'field' => '分','name' => '平台剩余额度'], + ['className' => 'el-icon-coin','count' => $statInfo['sum_freeze_quota'],'field' => '分','name' => '平台冻结额度'], + ['className' => 'el-icon-coin','count' => $statInfo['sum_people_num'],'field' => '分','name' => '参与人数'], + ]; + + return app('json')->success($data); + } + /** + * Common: 额度信息 - 额度持有信息 + * Author: wu-hui + * Time: 2024/01/11 9:59 + * @return mixed + */ + public function quotaList(){ + [$page, $limit] = $this->getPage(); + $params = $this->request->params(['uid']); + + $data = app()->make(ExchangeQuotaRepository::class)->getList((array)$params,(int)$page,(int)$limit); + + return app('json')->success($data); + } + /** + * Common: 额度信息 - 变更记录 + * Author: wu-hui + * Time: 2024/01/11 10:02 + * @return mixed + */ + public function quotaRecordList(){ + [$page, $limit] = $this->getPage(); + $params = $this->request->params(['uid']); + + $data = app()->make(ExchangeQuotaRecordRepository::class)->getList((array)$params,(int)$page,(int)$limit); + + return app('json')->success($data); + } + + + +} diff --git a/route/admin/marketing.php b/route/admin/marketing.php index ebab536..69410fd 100644 --- a/route/admin/marketing.php +++ b/route/admin/marketing.php @@ -23,7 +23,6 @@ Route::group(function () { '_path' => '/marketing/integral/config', '_auth' => true, ]); - Route::group('user/integral', function () { Route::get('title', '.UserIntegral/getTitle')->name('systemUserIntegralTitle')->option([ '_alias' => '积分统计', @@ -52,7 +51,6 @@ Route::group(function () { ], ] ]); - Route::group('user/integral', function () { Route::get('hold_list', '.UserIntegral/holdIntegral')->name('systemUserIntegralHoldList')->option([ '_alias' => '持有积分', @@ -68,9 +66,6 @@ Route::group(function () { '_path' => '/marketing/integral/hold', '_auth' => true, ]); - - - //预售商品 Route::group('store/product/presell', function () { Route::get('lst', 'StoreProductPresell/lst')->name('systemStoreProductPresellLst')->option([ @@ -98,8 +93,6 @@ Route::group(function () { '_path' => '/marketing/presell/list', '_auth' => true, ]); - - //助力商品 Route::group('store/product/assist', function () { Route::get('lst', 'StoreProductAssist/lst')->name('systemStoreProductAssistLst')->option([ @@ -127,7 +120,6 @@ Route::group(function () { '_path' => '/marketing/assist/goods_list', '_auth' => true, ]); - //助力活动 Route::group('store/product/assist', function () { @@ -141,8 +133,6 @@ Route::group(function () { '_path' => '/marketing/assist/list', '_auth' => true, ]); - - //拼团商品 Route::group('store/product/group', function () { Route::get('lst', 'StoreProductGroup/lst')->name('systemStoreProductGroupLst')->option([ @@ -185,7 +175,6 @@ Route::group(function () { '_path' => '/marketing/combination/combination_list', '_auth' => true, ]); - Route::group('config/others', function () { Route::get('group_buying', '/getGroupBuying')->name('configOthersGroupBuyingDetail')->option([ '_alias' => '配置信息', @@ -199,7 +188,6 @@ Route::group(function () { '_path' => '/marketing/combination/combination_set', '_auth' => true, ]); - //直播间 Route::group('broadcast/room', function () { Route::get('lst', '/lst')->name('systemBroadcastRoomLst')->option([ @@ -244,7 +232,6 @@ Route::group(function () { '_path' => '/marketing/studio/list', '_auth' => true, ]); - //直播间商品 Route::group('broadcast/goods', function () { Route::get('lst', '/lst')->name('systemBroadcastGoodsLst')->option([ @@ -276,7 +263,6 @@ Route::group(function () { '_path' => '/marketing/broadcast/list', '_auth' => true, ]); - //秒杀配置管理 Route::group('seckill/config', function () { Route::get('lst', '/lst')->name('systemSeckillConfigLst')->option([ @@ -326,7 +312,6 @@ Route::group(function () { ], ] ]); - //秒杀商品管理 Route::group('seckill/product', function () { Route::get('mer_select', '/lists')->option([ @@ -364,8 +349,6 @@ Route::group(function () { ]); //商品列表 Route::get('marketing/spu/lst', 'admin.store.marketing.StoreAtmosphere/markLst'); - - //活动氛围图 - 详情下边框图 Route::group('activity/atmosphere/', function () { Route::post('create', '/create')->name('systemActivityAtmosphereCreate')->option([ @@ -404,7 +387,6 @@ Route::group(function () { ], ] ]); - //活动氛围图-列表边框 Route::group('activity/border/', function () { Route::post('create', '/create')->name('systemActivityBorderCreate')->option([ @@ -443,6 +425,26 @@ Route::group(function () { ], ] ]); + // 兑换额度 + Route::group('user/exchange_quota', function () { + Route::get('quota_title','.ExchangeQuota/quotaTitle')->name('systemUserExchangeQuotaTitle')->option([ + '_alias' => '额度统计', + ]); + Route::get('quota_list', '.ExchangeQuota/quotaList')->name('systemUserExchangeQuotaList')->option([ + '_alias' => '额度持有信息', + ]); + Route::get('quota_record_list', '.ExchangeQuota/quotaRecordList')->name('systemUserExchangeQuotaRecordList')->option([ + '_alias' => '额度变更记录', + ]); + + + + + })->prefix('admin.user')->option([ + '_path' => '/marketing/integral/hold', + '_auth' => true, + ]); + })->middleware(AllowOriginMiddleware::class) diff --git a/route/api.php b/route/api.php index c248891..da2b126 100644 --- a/route/api.php +++ b/route/api.php @@ -22,20 +22,16 @@ Route::group('api/', function () { Route::post('create', '/v2CreateOrder'); })->prefix('api.store.order.StoreOrder'); }); - //退出登录 Route::post('logout', 'api.Auth/logout'); //用户信息 Route::get('user', 'api.Auth/userInfo'); - //绑定推荐人 Route::post('user/spread', 'api.Auth/spread'); - //优惠券 Route::group('coupon', function () { Route::post('receive/:id', 'api.store.product.StoreCoupon/receiveCoupon'); }); - //客服聊天 Route::group('service', function () { Route::get('history/:id', 'api.store.service.Service/chatHistory'); @@ -47,17 +43,11 @@ Route::group('api/', function () { Route::get('user/:merId/:uid', 'api.store.service.Service/user'); Route::post('mark/:merId/:uid', 'api.store.service.Service/mark'); }); - // 客户管理 Route::group('custom', function () { Route::get('list/:merId', 'api.store.user.UserMerchant/getList'); Route::post('integral_change/:merId', 'api.store.user.UserMerchant/integralChange'); }); - - - - - //订单 Route::group('order', function () { Route::post('check', '/checkOrder'); @@ -78,12 +68,10 @@ Route::group('api/', function () { Route::post('receipt/:id', '/createReceipt'); Route::get('delivery/:id', '/getOrderDelivery'); })->prefix('api.store.order.StoreOrder'); - // 预售 Route::group('presell', function () { Route::post('pay/:id', '/pay'); })->prefix('api.store.order.PresellOrder'); - //退款单 Route::group('refund', function () { Route::get('batch_product/:id', '/batchProduct'); @@ -96,13 +84,11 @@ Route::group('api/', function () { Route::post('back_goods/:id', '/back_goods'); Route::post('cancel/:id', '/cancel'); })->prefix('api.store.order.StoreRefundOrder'); - //评价 Route::group('reply', function () { Route::get('product/:id', '/product'); Route::post(':id', '/reply'); })->prefix('api.store.product.StoreReply'); - //注销用户 Route::post('user/cancel', 'api.Auth/cancel'); //用户 @@ -204,7 +190,6 @@ Route::group('api/', function () { Route::get('member/info', 'User/memberInfo'); Route::get('member/log', 'Member/getMemberValue'); })->prefix('api.user.'); - //购物车 Route::group('user/cart', function () { Route::post('/check/:id', 'StoreCart/checkCerate'); @@ -216,7 +201,6 @@ Route::group('api/', function () { Route::get('/count', 'StoreCart/cartCount'); Route::post('/batchCreate', 'StoreCart/batchCreate'); })->prefix('api.store.order.'); - Route::group('store/product', function () { Route::post('/assist/create/:id', 'StoreProductAssistSet/create'); Route::get('/assist/detail/:id', 'StoreProductAssistSet/detail'); @@ -227,13 +211,11 @@ Route::group('api/', function () { Route::post('/assist/set/delete/:id', 'StoreProductAssistSet/delete'); Route::post('/increase_take', 'StoreProduct/setIncreaseTake'); })->prefix('api.store.product.'); - //申请商户 Route::get('intention/lst', 'api.store.merchant.MerchantIntention/lst'); Route::get('intention/detail/:id', 'api.store.merchant.MerchantIntention/detail'); Route::post('intention/update/:id', 'api.store.merchant.MerchantIntention/update'); Route::post('store/product/group/cancel', 'api.store.product.StoreProductGroup/cancel'); - //客服商品管理 Route::group('server/:merId', function () { //商品 @@ -277,7 +259,6 @@ Route::group('api/', function () { Route::get('attr/detail/:id', 'StoreProductAttrTemplate/detail'); Route::get('attr/list', 'StoreProductAttrTemplate/getlist'); })->prefix('api.server.')->middleware(\app\common\middleware\MerchantServerMiddleware::class,1); - //管理员订单 Route::group('admin/:merId', function () { Route::get('/statistics', '/orderStatistics'); @@ -296,7 +277,6 @@ Route::group('api/', function () { Route::get('/delivery_options', '/getDeliveryOptions'); })->prefix('api.server.StoreOrder')->middleware(\app\common\middleware\MerchantServerMiddleware::class,0); - //管理员退款单 Route::group('server/:merId/refund', function () { //退款单 @@ -316,10 +296,8 @@ Route::group('api/', function () { Route::get('order/:id', '/detail'); Route::post(':id', '/verify'); })->prefix('api.store.order.StoreOrderVerify')->middleware(\app\common\middleware\MerchantServerMiddleware::class,0); - //社区 Route::group('community', function () { - Route::post('/create', 'Community/create'); Route::post('/update/:id', 'Community/update'); Route::post('/delete/:id', 'Community/delete'); @@ -341,7 +319,6 @@ Route::group('api/', function () { Route::get('qrcode/:id', 'Community/qrcode'); })->prefix('api.community.'); - //请求频率 Route::group( function () { @@ -357,13 +334,21 @@ Route::group('api/', function () { })->prefix('api.store.order.'); })->middleware(\app\common\middleware\BlockerMiddleware::class); - Route::group('points/order', function () { Route::get('lst', 'PointsOrder/lst'); Route::get('detail/:id', 'PointsOrder/detail'); Route::post('take/:id', 'PointsOrder/take'); Route::post('deleate/:id', 'PointsOrder/del'); })->prefix('api.store.order.'); + // 在线买单 + + + + + + + + })->middleware(UserTokenMiddleware::class, true);