37 lines
1.1 KiB
Go
37 lines
1.1 KiB
Go
package gateway
|
|
|
|
import (
|
|
"gateway/internal/schema/response"
|
|
"gateway/internal/service"
|
|
"strings"
|
|
|
|
"github.com/beego/beego/v2/server/web"
|
|
)
|
|
|
|
type BaseGateway struct {
|
|
web.Controller
|
|
}
|
|
|
|
// PayPrepare 获取商户请求过来的基本参数参数
|
|
func (c *BaseGateway) PayPrepare() *response.PayBaseResp {
|
|
// 获取客户端的ip
|
|
p := service.GetMerchantInfo(map[string]string{
|
|
"exValue": strings.TrimSpace(c.GetString("exValue")),
|
|
"orderNo": strings.TrimSpace(c.GetString("orderNo")),
|
|
"orderPeriod": strings.TrimSpace(c.GetString("orderPeriod")),
|
|
"productCode": strings.TrimSpace(c.GetString("productCode")),
|
|
"orderPrice": strings.TrimSpace(c.GetString("orderPrice")),
|
|
"notifyUrl": strings.TrimSpace(c.GetString("notifyUrl")),
|
|
"payKey": strings.TrimSpace(c.GetString("payKey")),
|
|
"timestamp": strings.TrimSpace(c.GetString("timestamp")),
|
|
"sign": strings.TrimSpace(c.GetString("sign")),
|
|
"ip": strings.TrimSpace(c.GetString("ip")),
|
|
})
|
|
p.ClientIP = strings.TrimSpace(c.GetString("ip"))
|
|
p = service.JudgeParams(p)
|
|
if p.Code != -1 {
|
|
p.Code = 200
|
|
}
|
|
return p
|
|
}
|