新增订单轮询

This commit is contained in:
qiyunfanbo126.com 2024-09-04 16:17:57 +08:00
parent 7549facafa
commit 196447c108
1 changed files with 2 additions and 2 deletions

View File

@ -105,7 +105,7 @@ func OrderQueryService(userId int, OrderRequest *front.OrderListRequest) (code i
conn = conn.And(builder.Eq{"a.state": OrderRequest.State})
}
count, err := repo.Where(conn).Alias("a").
Join("INNER", "Products b", "a.product_id = b.id").Select("a.*,b.main_image").
Join("INNER", "products b", "a.product_id = b.id").Select("a.*,b.main_image").
Desc("id").Limit(OrderRequest.PageSize, (OrderRequest.Page-1)*OrderRequest.PageSize).FindAndCount(&data)
code = handErr(err)
return
@ -181,7 +181,7 @@ func OrderRefundService(userId int, orderId int) (code int) {
_, err := ordersmodel.GetInstance().GetDb().Where("id = ?", order.Id).Update(order)
//增加库存
if err == nil {
_, err = ordersmodel.GetInstance().GetDb().Exec("update Products set stock=stock+1 where id = " + strconv.Itoa(order.ProductId))
_, err = ordersmodel.GetInstance().GetDb().Exec("update products set stock=stock+1 where id = " + strconv.Itoa(order.ProductId))
return errorcode.Success
} else {
return errorcode.OrderRefundUpdateFail