新增操作记录日志

This commit is contained in:
2023-09-14 14:38:21 +08:00
parent 16615530de
commit e1887b52e7
8 changed files with 192 additions and 7 deletions
+17 -1
View File
@@ -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