From cf0882575ee41aabef91589872609ce1d9f92e79 Mon Sep 17 00:00:00 2001 From: XingQue Date: Fri, 26 Jun 2026 17:08:50 +0800 Subject: [PATCH] =?UTF-8?q?=E5=95=86=E5=AE=B6=E9=A6=96=E9=A1=B5=E5=9B=BE?= =?UTF-8?q?=E6=A0=87key=E5=88=86=E7=A6=BB=E3=80=81=E5=95=86=E5=AE=B6?= =?UTF-8?q?=E6=94=B9=E6=98=B5=E7=A7=B0=E6=8E=A5=E5=8F=A3=E3=80=81=E6=8A=A2?= =?UTF-8?q?=E5=8D=95=E5=88=97=E8=A1=A8sj=5Favatar?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- jituan/services/miniapp_assets.py | 34 +++++++++++++++++++++++-------- users/urls.py | 3 ++- users/views.py | 32 +++++++++++++++++++++++++++++ 3 files changed, 59 insertions(+), 10 deletions(-) diff --git a/jituan/services/miniapp_assets.py b/jituan/services/miniapp_assets.py index 9097fa8..38d0948 100644 --- a/jituan/services/miniapp_assets.py +++ b/jituan/services/miniapp_assets.py @@ -6,15 +6,24 @@ ICON_FOLDER = 'beijing/tubiao/chengxutubiao' # icon_key -> 后台展示名(文件名固定为 {icon_key}.png) MINIAPP_ICON_META = [ ('merchant_gold_banner', '商家金牌横幅(抢单/订单列表顶部)'), - ('merchant_regular_dispatch', '常规派单'), - ('merchant_custom_dispatch', '自定义派单'), - ('merchant_pending_settle', '待清算'), - ('merchant_kefu_key', '客服密钥'), - ('merchant_kefu_list', '客服列表'), - ('merchant_link_dispatch', '链接派单'), - ('merchant_punish', '处罚记录'), - ('merchant_rank', '商家排行'), - ('merchant_refresh', '商家刷新'), + # 商家首页大图(与「我的」页小图标分开配置) + ('merchant_home_regular', '商家首页-常规派单大图'), + ('merchant_home_custom', '商家首页-自定义派单大图'), + ('merchant_home_link', '商家首页-链接派单大图'), + ('merchant_home_kefu_key', '商家首页-客服密钥'), + ('merchant_home_kefu_list', '商家首页-客服列表'), + ('merchant_home_notice', '商家首页-公告图标'), + ('merchant_home_stat_bg', '商家首页-统计卡背景'), + # 商家「我的」页功能小图标 + ('merchant_regular_dispatch', '我的页-常规派单'), + ('merchant_custom_dispatch', '我的页-自定义派单'), + ('merchant_pending_settle', '我的页-待清算'), + ('merchant_kefu_key', '我的页-客服密钥'), + ('merchant_kefu_list', '我的页-客服列表'), + ('merchant_link_dispatch', '我的页-链接派单'), + ('merchant_punish', '我的页-处罚记录'), + ('merchant_rank', '我的页-商家排行'), + ('merchant_refresh', '我的页-刷新'), ('fighter_recharge_member', '打手中心-会员充值横幅(左侧)'), ('fighter_recharge_deposit', '打手中心-保证金充值横幅(右侧)'), ('mine_pindao', '频道入口'), @@ -34,6 +43,13 @@ MINIAPP_ICON_DEFAULTS = { MINIAPP_ICON_DEFAULTS['icon_refresh'] = 'beijing/guanshiduan/icon-refresh.png' MINIAPP_ICON_DEFAULTS['merchant_refresh'] = 'beijing/guanshiduan/icon-refresh.png' MINIAPP_ICON_DEFAULTS['merchant_gold_banner'] = 'beijing/tubiao/chengxutubiao/merchant_gold_banner.png' +MINIAPP_ICON_DEFAULTS['merchant_home_regular'] = 'beijing/shangjiaduan/home/regular_dispatch.png' +MINIAPP_ICON_DEFAULTS['merchant_home_custom'] = 'beijing/shangjiaduan/home/custom_dispatch.png' +MINIAPP_ICON_DEFAULTS['merchant_home_link'] = 'beijing/shangjiaduan/home/link_dispatch.png' +MINIAPP_ICON_DEFAULTS['merchant_home_kefu_key'] = 'beijing/shangjiaduan/home/kefu_key.png' +MINIAPP_ICON_DEFAULTS['merchant_home_kefu_list'] = 'beijing/shangjiaduan/home/kefu_list.png' +MINIAPP_ICON_DEFAULTS['merchant_home_notice'] = 'beijing/shangjiaduan/home/notice.png' +MINIAPP_ICON_DEFAULTS['merchant_home_stat_bg'] = 'beijing/shangjiaduan/stat_card_bg.png' MINIAPP_ICON_DEFAULTS['fighter_recharge_member'] = f'{ICON_FOLDER}/fighter_recharge_member.png' MINIAPP_ICON_DEFAULTS['fighter_recharge_deposit'] = f'{ICON_FOLDER}/fighter_recharge_deposit.png' MINIAPP_ICON_DEFAULTS['mine_pindao'] = 'beijing/tubiao/grzx_guanzhualong.jpg' diff --git a/users/urls.py b/users/urls.py index 435939e..de9b5da 100644 --- a/users/urls.py +++ b/users/urls.py @@ -1,7 +1,7 @@ from django.urls import path, include from django.views.decorators.csrf import csrf_exempt from .views import WechatMiniProgramLoginView, UserInfoUpdateView, DashouXinxiAPIView, \ - ZaixianZhuangtaiAPIView, GuanshiXinxiView, ShangJiaXinXiView, BossBiaoshiView, YaoqingmaView, \ + ZaixianZhuangtaiAPIView, GuanshiXinxiView, ShangJiaXinXiView, ShangjiaNichengGengxinView, BossBiaoshiView, YaoqingmaView, \ DashouZhuceView, GuanshiYaoqingDashouListView, TixianXinxiHuoquView, ShoukuanXinxiShangchuanView, \ TixianShenqingView, TixianJiluHuoquViewV2, AdminLoginView, AdminFinancialDataView, AdGetOrderList, \ AdGetOrderTypes, AdGuanLiYongHu, AdYaoQingDaShou, CfGuanLi, AdTongYiChuFa, AdckyhxqView, AdcjxgView, AddtxshView, \ @@ -31,6 +31,7 @@ urlpatterns = [ path('zaixianzhuangtai', ZaixianZhuangtaiAPIView.as_view(), name='打手在线状态更改'), path('guanshixinxi', GuanshiXinxiView.as_view(), name='获取管事信息'), path('shangjiaxinxi', ShangJiaXinXiView.as_view(), name='获取商家信息'), + path('shangjiagxnc', ShangjiaNichengGengxinView.as_view(), name='商家修改昵称'), path('bossbiaoshi', BossBiaoshiView.as_view(), name='获取老板标识'), path('yaoqingma', YaoqingmaView.as_view(), name='管事生成邀请码'), path('dashouzhuce',DashouZhuceView.as_view(), name='打手邀请码注册'), diff --git a/users/views.py b/users/views.py index bd9da83..35855f8 100644 --- a/users/views.py +++ b/users/views.py @@ -1072,8 +1072,10 @@ class ShangJiaXinXiView(APIView): # ------------------- 1. 从 UserShangjia 获取基础字段 ------------------- response_data = { + 'nicheng': shangjia.nicheng or '', 'sjzhzhuangtai': shangjia.zhuangtai, # 商家账号状态 'fadanzong': shangjia.fabu, # 发单总量(累计) + 'fabu': shangjia.fabu, 'tuikuanzong': shangjia.tuikuan, # 退款总量(累计) 'sjyue': float(shangjia.yue), # 商家余额 # 'riliushui' 和 'yueliushui' 将从统计表计算,不再使用原字段 @@ -1143,6 +1145,36 @@ class ShangJiaXinXiView(APIView): +class ShangjiaNichengGengxinView(APIView): + """商家老板修改昵称 POST /yonghu/shangjiagxnc""" + permission_classes = [IsAuthenticated] + + def post(self, request): + from merchant_ops.services.authz import is_merchant_owner + + if not is_merchant_owner(request.user): + return Response({'code': 403, 'msg': '仅商家老板可修改昵称', 'data': None}, status=status.HTTP_200_OK) + + nicheng = (request.data.get('nicheng') or '').strip() + if not nicheng: + return Response({'code': 400, 'msg': '昵称不能为空', 'data': None}, status=status.HTTP_200_OK) + if len(nicheng) > 20: + return Response({'code': 400, 'msg': '昵称不能超过20字', 'data': None}, status=status.HTTP_200_OK) + + try: + shangjia = request.user.ShopProfile + except ObjectDoesNotExist: + return Response({'code': 4001, 'msg': '商家资料不存在', 'data': None}, status=status.HTTP_200_OK) + + if UserShangjia.query.filter(nicheng=nicheng).exclude(user=request.user).exists(): + return Response({'code': 400, 'msg': '该昵称已被使用', 'data': None}, status=status.HTTP_200_OK) + + shangjia.nicheng = nicheng + shangjia.save(update_fields=['nicheng', 'UpdateTime']) + + return Response({'code': 200, 'msg': '昵称已更新', 'data': {'nicheng': nicheng}}, status=status.HTTP_200_OK) + + class BossBiaoshiView(APIView): """ 获取用户的GoEasy标识 - 极简实现