41 lines
874 B
Go
41 lines
874 B
Go
package front
|
|
|
|
import (
|
|
"github.com/gin-gonic/gin"
|
|
"qteam/app/constants/common"
|
|
"qteam/app/http/controllers"
|
|
"qteam/app/http/entities/front"
|
|
"qteam/app/models/ordermodel"
|
|
"qteam/app/services"
|
|
)
|
|
|
|
func MarketCallback(c *gin.Context) {
|
|
req := controllers.GetRequest(c).(*front.MarketApiRequest)
|
|
response := front.MarketApiResponse{TradeNo: req.TradeNo}
|
|
|
|
order := ordermodel.Order{OrderNo: req.TradeNo}
|
|
has, err := services.OrderDetailService(&order)
|
|
if err != nil {
|
|
c.JSON(200, response)
|
|
return
|
|
}
|
|
if !has {
|
|
response.Msg = "订单不存在"
|
|
c.JSON(200, response)
|
|
return
|
|
}
|
|
if req.CnclSt == "4" {
|
|
update := front.OrdersUpdateRequest{
|
|
Id: order.Id,
|
|
Status: common.ORDER_STATUS_OFFSET,
|
|
}
|
|
err = services.OrdersUpdateService(update)
|
|
if err != nil {
|
|
c.JSON(200, response)
|
|
return
|
|
}
|
|
response.Code = "0000"
|
|
}
|
|
c.JSON(200, response)
|
|
}
|