fix: 订单时间字段别名与子客服鉴权/读权限统一
Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -48,7 +48,7 @@ from orders.utils import (
|
||||
)
|
||||
from shop.utils import calculate_pingtai_and_dianpu_shouyi, validate_shangpin_and_dianpu, update_dianpu_daily_stat
|
||||
from products.utils import update_shangpin_daily_stat
|
||||
from backend.utils import update_shangjia_daily, update_dashou_daily_by_action, pick_leixing_id
|
||||
from backend.utils import update_shangjia_daily, update_dashou_daily_by_action, pick_leixing_id, datetime_aliases, fmt_datetime
|
||||
from rank.services import record_dashou_biaoxian
|
||||
from rank.utils import check_dashou_biaoqian_required
|
||||
|
||||
@@ -1097,7 +1097,8 @@ class DingdanHuoquView(APIView):
|
||||
'jieshao': order.Description or '',
|
||||
'beizhu': order.Remark or '',
|
||||
'nicheng': order.Nickname or '',
|
||||
'chuangjianshijian': order.CreateTime.strftime('%Y-%m-%d %H:%M:%S')
|
||||
'chuangjianshijian': fmt_datetime(order.CreateTime),
|
||||
'create_time': fmt_datetime(order.CreateTime),
|
||||
}
|
||||
order_list.append(order_data)
|
||||
|
||||
@@ -1759,12 +1760,12 @@ class ShangpinLeixingView(APIView):
|
||||
if getattr(request, '_staff_member', None) is not None:
|
||||
return True
|
||||
from merchant_ops.services.authz import (
|
||||
get_active_staff_member, is_merchant_owner, member_has_perm,
|
||||
get_active_staff_member, is_merchant_owner, member_has_perm, staff_order_read_perm,
|
||||
)
|
||||
if is_merchant_owner(request.user):
|
||||
return True
|
||||
member = get_active_staff_member(request.user)
|
||||
return bool(member and member_has_perm(member, 'order_dispatch'))
|
||||
return bool(member and staff_order_read_perm(member))
|
||||
|
||||
def post(self, request):
|
||||
|
||||
@@ -2140,7 +2141,7 @@ class ShangjiaDingdanHuoquView(APIView):
|
||||
'leixing_id': order.ProductTypeID,
|
||||
'tupian': order.ImageURL or '',
|
||||
'jiedan_dashou_id': order.PlayerID or '',
|
||||
'CreateTime': order.CreateTime.strftime('%Y-%m-%d %H:%M:%S') if order.CreateTime else ''
|
||||
**datetime_aliases(order.CreateTime),
|
||||
}
|
||||
order_list.append(order_data)
|
||||
|
||||
@@ -2249,6 +2250,8 @@ class ShangjiaDingdanXiangqingView(APIView):
|
||||
).first()
|
||||
fadan_dict = None
|
||||
if fadan_obj:
|
||||
ct = fmt_datetime(fadan_obj.CreateTime)
|
||||
ut = fmt_datetime(fadan_obj.UpdateTime)
|
||||
fadan_dict = {
|
||||
'id': fadan_obj.id,
|
||||
'chufaliyou': fadan_obj.Reason or '',
|
||||
@@ -2258,8 +2261,10 @@ class ShangjiaDingdanXiangqingView(APIView):
|
||||
'shensuliyou': fadan_obj.AppealReason or '',
|
||||
'tongyi_chufaliyou': fadan_obj.ApproveReason or '',
|
||||
'bohuiliyou': fadan_obj.RejectReason or '',
|
||||
'CreateTime': fadan_obj.CreateTime.strftime('%Y-%m-%d %H:%M:%S') if fadan_obj.CreateTime else '',
|
||||
'UpdateTime': fadan_obj.UpdateTime.strftime('%Y-%m-%d %H:%M:%S') if fadan_obj.UpdateTime else '',
|
||||
'CreateTime': ct,
|
||||
'create_time': ct,
|
||||
'UpdateTime': ut,
|
||||
'update_time': ut,
|
||||
}
|
||||
|
||||
# 7. 商家自己的分红利率(用于罚款分红计算)
|
||||
@@ -2297,7 +2302,7 @@ class ShangjiaDingdanXiangqingView(APIView):
|
||||
'jieshao': order.Description or '',
|
||||
'beizhu': order.Remark or '',
|
||||
'nicheng': order.Nickname or '',
|
||||
'CreateTime': order.CreateTime.strftime('%Y-%m-%d %H:%M:%S') if order.CreateTime else '',
|
||||
**datetime_aliases(order.CreateTime),
|
||||
|
||||
# 打手信息
|
||||
'dashou_yonghuid': dashou_yonghuid,
|
||||
@@ -3174,7 +3179,8 @@ class DashouDingdanHuoquView(APIView):
|
||||
'yajin': float(order['CommissionReq']) if order['CommissionReq'] else 0.0,
|
||||
'jieshao': order['Description'] or '',
|
||||
'beizhu': order['Remark'] or '',
|
||||
'creat_time': order['CreateTime'].strftime('%Y-%m-%d %H:%M:%S') if order['CreateTime'] else '',
|
||||
'creat_time': fmt_datetime(order['CreateTime']),
|
||||
'create_time': fmt_datetime(order['CreateTime']),
|
||||
'sjnicheng': order['MerchantNickname'] or '',
|
||||
'zhiding_uid': order['AssignedID'] or '',
|
||||
'zhiding_avatar': info.get('avatar', ''),
|
||||
@@ -3792,7 +3798,7 @@ class DashouDingdanHuoquView1(APIView):
|
||||
'jieshao': order.Description or '',
|
||||
'tupian': order.ImageURL or '',
|
||||
'nicheng': order.Nickname or '',
|
||||
'CreateTime': order.CreateTime.strftime('%Y-%m-%d %H:%M:%S') if order.CreateTime else ''
|
||||
**datetime_aliases(order.CreateTime),
|
||||
}
|
||||
order_list.append(order_data)
|
||||
|
||||
@@ -4324,7 +4330,7 @@ class DashouDingdanXiangqingView(APIView):
|
||||
'tupian': dingdan.ImageURL or '',
|
||||
'nicheng': dingdan.Nickname or '',
|
||||
'beizhu': dingdan.Remark or '',
|
||||
'CreateTime': dingdan.CreateTime.strftime('%Y-%m-%d %H:%M:%S') if dingdan.CreateTime else '',
|
||||
**datetime_aliases(dingdan.CreateTime),
|
||||
'tuikuan_liyou':dingdan.RefundReason or '',
|
||||
'dashou_liuyan': dingdan.PlayerRemark or '',
|
||||
'fuwudashou_id': dingdan.PlayerID or '',
|
||||
@@ -4496,10 +4502,10 @@ class AdGetDingdanXiangQing(APIView):
|
||||
'dashou_liuyan': dingdan_obj.PlayerRemark or '',
|
||||
|
||||
# 时间字段
|
||||
'chuangjianshijian': dingdan_obj.CreateTime.strftime(
|
||||
'%Y-%m-%d %H:%M:%S') if dingdan_obj.CreateTime else '',
|
||||
'genggaishijian': dingdan_obj.UpdateTime.strftime(
|
||||
'%Y-%m-%d %H:%M:%S') if dingdan_obj.UpdateTime else '',
|
||||
'chuangjianshijian': fmt_datetime(dingdan_obj.CreateTime),
|
||||
'create_time': fmt_datetime(dingdan_obj.CreateTime),
|
||||
'genggaishijian': fmt_datetime(dingdan_obj.UpdateTime),
|
||||
'update_time': fmt_datetime(dingdan_obj.UpdateTime),
|
||||
}
|
||||
|
||||
# 8. 根据发单平台查询扩展表数据
|
||||
|
||||
Reference in New Issue
Block a user