feat(merchant): 订单操作流水表与按真实操作人统计
新增 merchant_order_action_log,在结算/撤单/退款/罚单/派单/换打手成功路径写入真实操作人;提供 action-stats / action-operators 接口供经营数据页筛选统计。 Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -79,6 +79,8 @@ from rank.models import DashouBiaoxian, Chenghao, DingdanBiaoqian, YonghuChengha
|
||||
from config.models import (
|
||||
ShangjiaLianjie
|
||||
)
|
||||
from merchant_ops.constants import ACTION_CHANGE_PLAYER
|
||||
from merchant_ops.services.action_log import record_order_action_from_request
|
||||
|
||||
|
||||
|
||||
@@ -1035,9 +1037,9 @@ class AdTongYiTuiKuanShangJia(APIView):
|
||||
if shangjia_id:
|
||||
try:
|
||||
# 查询商家用户主表
|
||||
shangjia_user = User.query.select_related('ShopProfile').get(
|
||||
UserUID=shangjia_id,
|
||||
#user_type='shop'
|
||||
shangjia_user = User.query.select_related('ShopProfile').get(
|
||||
UserUID=shangjia_id,
|
||||
#user_type='shop'
|
||||
)
|
||||
|
||||
# 获取商家扩展表
|
||||
@@ -1935,6 +1937,16 @@ class ZxsjghdsView(APIView):
|
||||
|
||||
logger.info(f"商家{yonghuid}更换打手成功,旧订单{dingdan_id}已退款,新订单{new_dingdan_id}")
|
||||
|
||||
record_order_action_from_request(
|
||||
request,
|
||||
ACTION_CHANGE_PLAYER,
|
||||
dingdan_id,
|
||||
merchant_id=yonghuid,
|
||||
amount=jine,
|
||||
leixing_id=leixing_id,
|
||||
remark=f'新订单:{new_dingdan_id}',
|
||||
)
|
||||
|
||||
return Response({
|
||||
'code': 0,
|
||||
'msg': '更换成功',
|
||||
|
||||
Reference in New Issue
Block a user