商家首页图标key分离、商家改昵称接口、抢单列表sj_avatar

This commit is contained in:
XingQue
2026-06-26 17:08:50 +08:00
parent fc63836cc7
commit cf0882575e
3 changed files with 59 additions and 10 deletions

View File

@@ -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'

View File

@@ -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='打手邀请码注册'),

View File

@@ -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标识 - 极简实现