第二轮:客服额度资金闭环与收回额度

- 划额度扣商家余额,客服派单/链接只扣个人额度
- 新增 wallet/revoke 收回未使用额度,权限 wallet_revoke
- 客服额度单撤销/退款只释放额度,不再误退商家余额
- 链接待填单(13)可撤销;总管/财务可划收额度
This commit is contained in:
XingQue
2026-06-20 04:59:29 +08:00
parent b2520726dc
commit d68a1da2c2
10 changed files with 234 additions and 50 deletions

View File

@@ -8114,12 +8114,14 @@ class KefuMerchantRefundView(APIView):
except (User.DoesNotExist, ObjectDoesNotExist):
logger.warning(f"商家退款:打手 {jiedan_dashou_id} 不存在,跳过更新")
# 更新商家
# 更新商家(客服额度出资的订单不退商家余额,仅释放子客服额度)
try:
from merchant_ops.services.wallet import is_staff_quota_order
shangjia_user = User.query.get(UserUID=shangjia_id)
shangjia_profile = shangjia_user.ShopProfile
shangjia_profile.tuikuan += 1
shangjia_profile.yue += jine
if not is_staff_quota_order(dingdan_id):
shangjia_profile.yue += jine
shangjia_profile.save()
except (User.DoesNotExist, ObjectDoesNotExist):
logger.warning(f"商家退款:商家 {shangjia_id} 不存在,跳过更新")