新增操作记录日志
This commit is contained in:
@@ -119,7 +119,7 @@ func (r *OrderProductService) GetOrderProduct(orderProductId int64) (getOrderPro
|
||||
}
|
||||
|
||||
// CancelOrderProduct 取消药品订单
|
||||
func (r *OrderProductService) CancelOrderProduct(req requests.CancelOrderProduct, orderProductId int64) (bool, error) {
|
||||
func (r *OrderProductService) CancelOrderProduct(req requests.CancelOrderProduct, orderProductId, adminUserId int64) (bool, error) {
|
||||
// 获取药品订单详情
|
||||
orderProductDao := dao.OrderProductDao{}
|
||||
orderProduct, err := orderProductDao.GetOrderProductPreloadById(orderProductId)
|
||||
@@ -283,6 +283,22 @@ func (r *OrderProductService) CancelOrderProduct(req requests.CancelOrderProduct
|
||||
return false, errors.New(err.Error())
|
||||
}
|
||||
|
||||
// 记录日志
|
||||
orderOperationLog := &model.OrderOperationLog{
|
||||
OrderId: orderProduct.OrderProductId,
|
||||
OrderNo: orderProduct.OrderProductNo,
|
||||
OrderType: 2,
|
||||
OperatorId: adminUserId,
|
||||
OperationContent: "取消订单并退款",
|
||||
}
|
||||
|
||||
orderOperationLogDao := dao.OrderOperationLogDao{}
|
||||
orderOperationLog, err = orderOperationLogDao.AddOrderOperationLog(tx, orderOperationLog)
|
||||
if err != nil || orderOperationLog == nil {
|
||||
tx.Rollback()
|
||||
return false, errors.New(err.Error())
|
||||
}
|
||||
|
||||
tx.Commit()
|
||||
|
||||
return true, nil
|
||||
|
||||
Reference in New Issue
Block a user