From ef3d60b65f561c11a3744686700c06fad309f20e Mon Sep 17 00:00:00 2001 From: fengxinyhyl Date: Tue, 19 Mar 2024 22:15:41 +0800 Subject: [PATCH] =?UTF-8?q?=E8=8E=B7=E5=8F=96=E5=85=91=E6=8D=A2=E9=85=8D?= =?UTF-8?q?=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../repositories/system/HuitongRepository.php | 10 ++++++++ .../user/UserAssetsLogRepository.php | 1 + app/controller/api/Auth.php | 24 ++++++++----------- app/controller/api/user/User.php | 20 ++++++++++++++++ route/api.php | 9 +++++-- 5 files changed, 48 insertions(+), 16 deletions(-) diff --git a/app/common/repositories/system/HuitongRepository.php b/app/common/repositories/system/HuitongRepository.php index c227fad..785b1fc 100644 --- a/app/common/repositories/system/HuitongRepository.php +++ b/app/common/repositories/system/HuitongRepository.php @@ -80,7 +80,17 @@ class HuitongRepository extends BaseRepository 'total' => $totalHuitong, )), ]); + } + + public function getCurrent(){ + $last = $this->dao->getLastHuitong(); + if (empty($last)) { + $huitong = 1; + } else { + $huitong = $last['current']; + } + return $huitong; } } diff --git a/app/common/repositories/user/UserAssetsLogRepository.php b/app/common/repositories/user/UserAssetsLogRepository.php index dfd9247..0845ba0 100644 --- a/app/common/repositories/user/UserAssetsLogRepository.php +++ b/app/common/repositories/user/UserAssetsLogRepository.php @@ -125,6 +125,7 @@ class UserAssetsLogRepository extends BaseRepository * {"name":"福利积分--商户--推荐商家奖", "value":1, "key":"welfare_merchant_recommend"} * {"name":"惠通宝增值幅度比例配置", "value":10, "key":"huitong_add"} * {"name":"福利积分--存在分红点用户奖励", "value":10, "key":"share_award"} + * {"name":"消费积分兑换分红点", "value":100, "key":"consume_to_share"} */ public function userPayEvent($groupOrder) { diff --git a/app/controller/api/Auth.php b/app/controller/api/Auth.php index c04ab9c..ff4df94 100644 --- a/app/controller/api/Auth.php +++ b/app/controller/api/Auth.php @@ -16,6 +16,7 @@ namespace app\controller\api; use app\common\repositories\store\order\StoreOrderRepository; use app\common\repositories\store\order\StoreRefundOrderRepository; +use app\common\repositories\system\HuitongRepository; use app\common\repositories\system\notice\SystemNoticeConfigRepository; use app\common\repositories\user\UserAssetsLogRepository; use app\common\repositories\user\UserAssetsRepository; @@ -58,7 +59,7 @@ class Auth extends BaseController // $json = '{"groupOrder":{"uid":3,"group_order_sn":"wxo1710768193328392661","total_postage":"0.00","total_price":"100.00","total_num":1,"real_name":"\u5f20\u51ef\u7fd4","user_phone":"18362705640","user_address":"\u6c5f\u82cf\u5357\u4eac\u5e02\u6816\u971e\u533a\u5c27\u5316\u8857\u9053\u4e1c\u57ce\u4e16\u5bb6(\u5357\u4eac\u5e02\u6816\u971e\u533a\u5c27\u8fb0\u8def3\u53f7)24\u680b501","pay_price":"100.00","coupon_price":"0.00","pay_postage":"0.00","cost":"0.00","coupon_id":"","pay_type":0,"give_coupon_ids":[],"integral":"0","integral_price":"0.00","give_integral":"100","create_time":"2024-03-18 21:23:13","group_order_id":"32","paid":1,"pay_time":"2024-03-18 21:23:13","is_combine":0,"orderList":[{"order_id":33,"main_id":0,"group_order_id":32,"order_sn":"wxo1710768193328392661","uid":3,"spread_uid":0,"top_uid":1,"district_id":3378,"real_name":"\u5f20\u51ef\u7fd4","user_phone":"18362705640","user_address":"\u6c5f\u82cf\u5357\u4eac\u5e02\u6816\u971e\u533a\u5c27\u5316\u8857\u9053\u4e1c\u57ce\u4e16\u5bb6(\u5357\u4eac\u5e02\u6816\u971e\u533a\u5c27\u8fb0\u8def3\u53f7)24\u680b501","cart_id":"77","total_num":1,"total_price":"100.00","total_postage":"0.00","pay_price":"100.00","pay_postage":"0.00","is_selfbuy":0,"extension_one":"0.00","extension_two":"1.20","commission_rate":"30.0000","integral":0,"integral_price":"0.00","give_integral":100,"coupon_id":"","coupon_price":"0.00","platform_coupon_price":"0.00","svip_discount":"0.00","order_type":0,"paid":1,"pay_time":"2024-03-18 21:23:13","pay_type":0,"create_time":"2024-03-18 21:23:13","status":0,"delivery_type":null,"is_virtual":0,"delivery_name":null,"delivery_id":null,"mark":"","remark":null,"admin_mark":null,"verify_code":null,"verify_time":null,"verify_service_id":null,"transaction_id":null,"activity_type":0,"order_extend":null,"mer_id":6,"reconciliation_id":0,"cost":"0.00","is_del":0,"is_system_del":0,"verify_status":0,"user":{"uid":3,"wechat_user_id":3,"account":"18362705640","pwd":"$2y$10$wYWu1Xc.pUqVwldOM3C\/EenyUPFg8DGlVbZuT.H9cIh.YtANOFmK6","real_name":"","sex":0,"birthday":null,"card_id":"","mark":"","label_id":[],"group_id":0,"agent_district_id":0,"agent_district":"","mer_id":1,"nickname":"\u5fae\u4fe1\u7528\u6237","avatar":"https:\/\/thirdwx.qlogo.cn\/mmopen\/vi_32\/POgEwh4mIHO4nibH0KlMECNjjGxQUq24ZEaGT4poC6icRiccVGKSyXwibcPq4BWmiaIGuG1icwxaQX6grC9VemZoJ8rg\/132","phone":"18362705640","addres":null,"cancel_time":null,"create_time":"2024-03-09 22:48:59","last_time":"2024-03-18 13:24:57","last_ip":"180.98.131.161","now_money":"8020.00","brokerage_price":"0.00","status":1,"spread_uid":2,"spread_time":"2024-03-09 22:48:59","spread_limit":null,"brokerage_level":0,"user_type":"routine","promoter_time":null,"is_promoter":0,"main_uid":0,"pay_count":13,"pay_price":"2060.10","spread_count":0,"spread_pay_count":0,"spread_pay_price":"0.00","integral":2070,"member_level":0,"member_value":0,"count_start":0,"count_fans":0,"is_svip":-1,"svip_endtime":null,"svip_save_money":"0.00"},"orderProduct":[{"order_product_id":33,"order_id":33,"uid":3,"cart_id":77,"product_id":203,"extension_one":"0.00","extension_two":"1.20","integral":0,"integral_price":"0.00","integral_total":0,"coupon_price":"0.00","platform_coupon_price":null,"svip_discount":"0.00","postage_price":"0.00","product_sku":"78c5e599c2a0","is_refund":0,"product_num":1,"product_type":0,"activity_id":203,"refund_num":1,"is_reply":0,"cost":"0.00","product_price":"100.00","total_price":"100.00","cart_info":{"product":{"product_id":203,"cate_id":17,"image":"http:\/\/b2.njrenzhou.com\/uploads\/def\/20240314\/e3c14a605d720c3429b6793abbb74e4b.jpg","store_name":"\u6d4b\u8bd5\u5546\u54c1","is_show":1,"status":1,"is_del":0,"unit_name":"\u7247","price":"100.00","mer_status":1,"temp_id":6,"give_coupon_ids":[],"is_gift_bag":0,"is_used":1,"product_type":0,"old_product_id":0,"integral_rate":-1,"delivery_way":"2","delivery_free":0,"type":0,"extend":"","pay_limit":0,"once_max_count":0,"once_min_count":0,"mer_svip_status":1,"svip_price_type":0,"temp":{"shipping_template_id":6,"name":"\u9ed8\u8ba4\u6a21\u677f","type":1,"appoint":0,"undelivery":0,"mer_id":6,"is_default":0,"sort":0,"create_time":"2022-04-24 15:29:04","info":null,"region":[],"undelives":null,"free":[]}},"productAttr":{"image":"http:\/\/b2.njrenzhou.com\/uploads\/def\/20240314\/e3c14a605d720c3429b6793abbb74e4b.jpg","extension_one":"0.00","extension_two":"0.00","product_id":203,"stock":195,"price":"100.00","unique":"78c5e599c2a0","sku":"","volume":"0.00","weight":"0.00","ot_price":"0.00","cost":"0.00","svip_price":"0.00","show_svip_price":false,"product":{"product_id":203,"mer_id":6,"store_name":"\u6d4b\u8bd5\u5546\u54c1","store_info":"dssssss","keyword":"\u6d4b\u8bd5","bar_code":"","brand_id":120,"is_show":1,"status":1,"is_del":0,"mer_status":1,"cate_id":17,"unit_name":"\u7247","sort":0,"rank":0,"sales":5,"price":"100.00","cost":"0.00","ot_price":"0.00","stock":195,"is_hot":1,"is_benefit":0,"is_best":0,"is_new":0,"is_good":1,"product_type":0,"ficti":0,"browse":0,"code_path":"","video_link":"","temp_id":6,"spec_type":0,"extension_type":0,"refusal":null,"rate":"3.0","reply_count":0,"give_coupon_ids":[],"is_gift_bag":0,"create_time":"2024-03-14 20:48:53","care_count":0,"is_used":1,"old_product_id":0,"image":"http:\/\/b2.njrenzhou.com\/uploads\/def\/20240314\/e3c14a605d720c3429b6793abbb74e4b.jpg","slider_image":["http:\/\/b2.njrenzhou.com\/uploads\/def\/20240314\/e3c14a605d720c3429b6793abbb74e4b.jpg"],"guarantee_template_id":0,"once_max_count":0,"once_min_count":0,"integral_rate":-1,"integral_total":0,"integral_price_total":"0.00","labels":"","delivery_way":"2","delivery_free":0,"type":0,"extend":"","pay_limit":0,"svip_price_type":0,"svip_price":0,"mer_svip_status":1,"param_temp_id":"","cash_rate":100,"base":20},"bc_extension_one":2,"bc_extension_two":1},"product_type":0},"create_time":"2024-03-18 21:23:13"}]}],"user":{"uid":3,"wechat_user_id":3,"account":"18362705640","pwd":"$2y$10$wYWu1Xc.pUqVwldOM3C\/EenyUPFg8DGlVbZuT.H9cIh.YtANOFmK6","real_name":"","sex":0,"birthday":null,"card_id":"","mark":"","label_id":[],"group_id":0,"agent_district_id":0,"agent_district":"","mer_id":1,"nickname":"\u5fae\u4fe1\u7528\u6237","avatar":"https:\/\/thirdwx.qlogo.cn\/mmopen\/vi_32\/POgEwh4mIHO4nibH0KlMECNjjGxQUq24ZEaGT4poC6icRiccVGKSyXwibcPq4BWmiaIGuG1icwxaQX6grC9VemZoJ8rg\/132","phone":"18362705640","addres":null,"cancel_time":null,"create_time":"2024-03-09 22:48:59","last_time":"2024-03-18 13:24:57","last_ip":"180.98.131.161","now_money":"8020.00","brokerage_price":"0.00","status":1,"spread_uid":2,"spread_time":"2024-03-09 22:48:59","spread_limit":null,"brokerage_level":0,"user_type":"routine","promoter_time":null,"is_promoter":0,"main_uid":0,"pay_count":13,"pay_price":"2060.10","spread_count":0,"spread_pay_count":0,"spread_pay_price":"0.00","integral":2070,"member_level":0,"member_value":0,"count_start":0,"count_fans":0,"is_svip":-1,"svip_endtime":null,"svip_save_money":"0.00"}}}'; // event("order.paySuccess", json_decode($json, true)); - event('order.statistics'); +// event('order.statistics'); // $json = '{"order":{"order_id":33,"main_id":0,"group_order_id":27,"order_sn":"wxo1710646722542760291","uid":3,"spread_uid":0,"top_uid":0,"district_id":3378,"real_name":"\u5f20\u51ef\u7fd4","user_phone":"18362705640","user_address":"\u6c5f\u82cf\u5357\u4eac\u5e02\u6816\u971e\u533a\u5c27\u5316\u8857\u9053\u4e1c\u57ce\u4e16\u5bb6(\u5357\u4eac\u5e02\u6816\u971e\u533a\u5c27\u8fb0\u8def3\u53f7)24\u680b501","cart_id":"69","total_num":1,"total_price":"180.00","total_postage":"0.00","pay_price":"180.00","pay_postage":"0.00","is_selfbuy":0,"extension_one":"0.00","extension_two":"0.00","commission_rate":"5.0000","integral":0,"integral_price":"0.00","give_integral":180,"coupon_id":"","coupon_price":"0.00","platform_coupon_price":"0.00","svip_discount":"0.00","order_type":0,"paid":1,"pay_time":"2024-03-17 11:38:42","pay_type":0,"create_time":"2024-03-17 11:38:43","status":-1,"delivery_type":null,"is_virtual":0,"delivery_name":null,"delivery_id":null,"mark":"","remark":null,"admin_mark":null,"verify_code":null,"verify_time":null,"verify_service_id":null,"transaction_id":null,"activity_type":0,"order_extend":null,"mer_id":6,"reconciliation_id":0,"cost":"200.00","is_del":0,"is_system_del":0,"verify_status":0,"orderProduct":[{"order_product_id":28,"order_id":28,"uid":3,"cart_id":69,"product_id":6,"extension_one":"0.00","extension_two":"0.00","integral":0,"integral_price":"0.00","integral_total":0,"coupon_price":"0.00","platform_coupon_price":null,"svip_discount":"0.00","postage_price":"0.00","product_sku":"167ac3990130","is_refund":3,"product_num":1,"product_type":0,"activity_id":6,"refund_num":0,"is_reply":0,"cost":"200.00","product_price":"180.00","total_price":"180.00","cart_info":{"product":{"product_id":6,"cate_id":14,"image":"https:\/\/mer.crmeb.net\/uploads\/attach\/2022\/04\/24\/8113054bdc3753c2f4f479e5b04f11d1.png","store_name":"Prada\/\u666e\u62c9\u8fbe\u5973\u58eb\u53d1\u5939\u5934\u9970","is_show":1,"status":1,"is_del":0,"unit_name":"\u4ef6","price":"180.00","mer_status":1,"temp_id":0,"give_coupon_ids":[],"is_gift_bag":0,"is_used":1,"product_type":0,"old_product_id":0,"integral_rate":0,"delivery_way":"2","delivery_free":1,"type":0,"extend":"","pay_limit":0,"once_max_count":0,"once_min_count":0,"mer_svip_status":1,"svip_price_type":0,"temp":null},"productAttr":{"image":"https:\/\/img.alicdn.com\/imgextra\/i2\/2207289125344\/O1CN010XEeaY1pLbHpe8KwV_!!2-item_pic.png","extension_one":"0.00","extension_two":"0.00","product_id":6,"stock":999,"price":"180.00","unique":"167ac3990130","sku":"\u767e\u5408\u8272","volume":"0.00","weight":"0.00","ot_price":"200.00","cost":"200.00","svip_price":"0.00","show_svip_price":false,"bc_extension_one":3.6,"bc_extension_two":1.8},"product_type":0},"create_time":"2024-03-17 11:38:42"}],"presellOrder":null,"groupOrder":{"group_order_id":27,"group_order_sn":"wxo1710646722542760291","uid":3,"total_postage":"0.00","total_price":"180.00","total_num":1,"integral":0,"integral_price":"0.00","give_integral":180,"coupon_price":"0.00","real_name":"\u5f20\u51ef\u7fd4","user_phone":"18362705640","user_address":"\u6c5f\u82cf\u5357\u4eac\u5e02\u6816\u971e\u533a\u5c27\u5316\u8857\u9053\u4e1c\u57ce\u4e16\u5bb6(\u5357\u4eac\u5e02\u6816\u971e\u533a\u5c27\u8fb0\u8def3\u53f7)24\u680b501","pay_price":"180.00","pay_postage":"0.00","cost":"200.00","coupon_id":"","give_coupon_ids":[],"paid":1,"pay_time":"2024-03-17 11:38:42","pay_type":0,"create_time":"2024-03-17 11:38:43","is_remind":0,"is_del":0,"is_combine":0}}}'; // event("order.refundAll", json_decode($json, true)); @@ -183,20 +184,15 @@ class Auth extends BaseController return app('json')->success($data); } + public function exchangeConfig(){ + $config = app(UserAssetsRepository::class)->getConfig(); + $huitong = app(HuitongRepository::class)->getCurrent(); - public function assetsLog(){ - $user = $this->request->userInfo(); - $uid = $user->uid; - $page = $this->request->param('page', 1); - $limit = $this->request->param('limit', 10); - $asset_type = $this->request->param('asset_type', 1); - - $where = array(); - $where[] = array('asset_type','=',$asset_type); - $where[] = array('status','in',[UserAssetsLogRepository::STATUS_FROZEN, UserAssetsLogRepository::STATUS_SUCCESS]); - - return app('json')->success(app(UserAssetsLogRepository::class)->list($uid, $where, $page, $limit)); - + $data = [ + 'consumeToShare' => $config['consume_to_share'], + 'huitongToConsume' => $huitong + ]; + return app('json')->success($data); } /** diff --git a/app/controller/api/user/User.php b/app/controller/api/user/User.php index 1b0d602..31b689a 100644 --- a/app/controller/api/user/User.php +++ b/app/controller/api/user/User.php @@ -18,6 +18,7 @@ use app\common\repositories\store\IntegralRepository; use app\common\repositories\store\service\StoreServiceRepository; use app\common\repositories\system\CacheRepository; use app\common\repositories\user\MemberinterestsRepository; +use app\common\repositories\user\UserAssetsLogRepository; use app\common\repositories\user\UserBillRepository; use app\common\repositories\user\UserBrokerageRepository; use app\common\repositories\user\UserRepository; @@ -43,6 +44,25 @@ class User extends BaseController $this->user = $this->request->userInfo(); } + + public function assetsLog(){ + $user = $this->request->userInfo(); + $uid = $user->uid; +// $uid = 3; + $page = $this->request->param('page', 1); + $limit = $this->request->param('limit', 10); + $asset_type = $this->request->param('asset_type', 1); + + $where = array(); + $where[] = array('asset_type','=',$asset_type); + $where[] = array('status','in',[UserAssetsLogRepository::STATUS_FROZEN, UserAssetsLogRepository::STATUS_SUCCESS, UserAssetsLogRepository::STATUS_USED]); + + return app('json')->success(app(UserAssetsLogRepository::class)->list($uid, $where, $page, $limit)); + } + + + + /** * @return mixed * @author xaboy diff --git a/route/api.php b/route/api.php index 3916966..049b69b 100644 --- a/route/api.php +++ b/route/api.php @@ -21,6 +21,10 @@ use think\facade\Route; Route::group('api/', function () { Route::any('test', 'api.Auth/test'); + + //兑换配置 + Route::get('exchangeConfig', 'api.Auth/exchangeConfig'); + //强制登录 Route::group(function () { Route::group('v2', function () { @@ -35,8 +39,6 @@ Route::group('api/', function () { Route::post('logout', 'api.Auth/logout'); //用户信息 Route::get('user', 'api.Auth/userInfo'); - //用户资产明细 - Route::get('user/assetsLog', 'api.Auth/assetsLog'); //绑定推荐人 Route::post('user/spread', 'api.Auth/spread'); @@ -106,6 +108,9 @@ Route::group('api/', function () { Route::post('user/cancel', 'api.Auth/cancel'); //用户 Route::group('user', function () { + //用户资产明细 + Route::get('assetsLog', 'User/assetsLog'); + //切换账号 Route::get('account', 'User/account'); Route::post('switch', 'User/switchUser');