Commit c5969647 authored by wangp's avatar wangp

拉卡拉支付查询 post => get

parent 5efaccf2
...@@ -90,22 +90,16 @@ func (l *PayController) UnifiedRefund(c *gin.Context) { ...@@ -90,22 +90,16 @@ func (l *PayController) UnifiedRefund(c *gin.Context) {
// @Tags 拉卡拉支付查询 // @Tags 拉卡拉支付查询
// @Accept application/json // @Accept application/json
// @Produce application/json // @Produce application/json
// @Param body body models.OrderStateInput true "参数" // @Param order_id path string true "订单号"
// @Param language header string ture "语言类型 zh-CN简体中文 en-US英文 ja-JP日文 默认中文" // @Param language header string ture "语言类型 zh-CN简体中文 en-US英文 ja-JP日文 默认中文"
// @Success 200 // @Success 200
// @router /api/v1/pay/order_state [post] // @router /api/v1/pay/order_state/{order_id} [get]
func (l *PayController) OrderState(c *gin.Context) { func (l *PayController) OrderState(c *gin.Context) {
ph := new(models.OrderStateInput) orderID := c.Param("order_id")
err := c.ShouldBindJSON(ph)
if err != nil {
zap.L().Error(err.Error()) //logs错误日志
base.ResponseErrorWithMsg(c, base.ServerError)
return
}
// 拉卡拉支付查询 // 拉卡拉支付查询
rtn, err := pay.OrderState(ph) rtn, err := pay.OrderState(orderID)
if err != nil { if err != nil {
zap.L().Error(err.Error()) zap.L().Error(err.Error())
base.ResponseErrorMsg(c, err.Error()) base.ResponseErrorMsg(c, err.Error())
......
...@@ -60,8 +60,8 @@ var doc = `{ ...@@ -60,8 +60,8 @@ var doc = `{
} }
} }
}, },
"/api/v1/pay/order_state": { "/api/v1/pay/order_state/{order_id}": {
"post": { "get": {
"description": "拉卡拉支付查询", "description": "拉卡拉支付查询",
"consumes": [ "consumes": [
"application/json" "application/json"
...@@ -75,13 +75,11 @@ var doc = `{ ...@@ -75,13 +75,11 @@ var doc = `{
"summary": "拉卡拉支付查询", "summary": "拉卡拉支付查询",
"parameters": [ "parameters": [
{ {
"description": "参数", "type": "string",
"name": "body", "description": "订单号",
"in": "body", "name": "order_id",
"required": true, "in": "path",
"schema": { "required": true
"$ref": "#/definitions/models.OrderStateInput"
}
}, },
{ {
"type": "string", "type": "string",
...@@ -269,15 +267,6 @@ var doc = `{ ...@@ -269,15 +267,6 @@ var doc = `{
} }
} }
}, },
"models.OrderStateInput": {
"type": "object",
"properties": {
"order_id": {
"description": "订单号",
"type": "string"
}
}
},
"models.PlaceAnOrderParamInput": { "models.PlaceAnOrderParamInput": {
"type": "object", "type": "object",
"properties": { "properties": {
......
...@@ -44,8 +44,8 @@ ...@@ -44,8 +44,8 @@
} }
} }
}, },
"/api/v1/pay/order_state": { "/api/v1/pay/order_state/{order_id}": {
"post": { "get": {
"description": "拉卡拉支付查询", "description": "拉卡拉支付查询",
"consumes": [ "consumes": [
"application/json" "application/json"
...@@ -59,13 +59,11 @@ ...@@ -59,13 +59,11 @@
"summary": "拉卡拉支付查询", "summary": "拉卡拉支付查询",
"parameters": [ "parameters": [
{ {
"description": "参数", "type": "string",
"name": "body", "description": "订单号",
"in": "body", "name": "order_id",
"required": true, "in": "path",
"schema": { "required": true
"$ref": "#/definitions/models.OrderStateInput"
}
}, },
{ {
"type": "string", "type": "string",
...@@ -253,15 +251,6 @@ ...@@ -253,15 +251,6 @@
} }
} }
}, },
"models.OrderStateInput": {
"type": "object",
"properties": {
"order_id": {
"description": "订单号",
"type": "string"
}
}
},
"models.PlaceAnOrderParamInput": { "models.PlaceAnOrderParamInput": {
"type": "object", "type": "object",
"properties": { "properties": {
......
...@@ -42,12 +42,6 @@ definitions: ...@@ -42,12 +42,6 @@ definitions:
description: 交易终端号 description: 交易终端号
type: string type: string
type: object type: object
models.OrderStateInput:
properties:
order_id:
description: 订单号
type: string
type: object
models.PlaceAnOrderParamInput: models.PlaceAnOrderParamInput:
properties: properties:
app_id: app_id:
...@@ -233,18 +227,17 @@ paths: ...@@ -233,18 +227,17 @@ paths:
summary: 拉卡拉统一支付回调(收银台) summary: 拉卡拉统一支付回调(收银台)
tags: tags:
- 拉卡拉统一支付回调 - 拉卡拉统一支付回调
/api/v1/pay/order_state: /api/v1/pay/order_state/{order_id}:
post: get:
consumes: consumes:
- application/json - application/json
description: 拉卡拉支付查询 description: 拉卡拉支付查询
parameters: parameters:
- description: 参数 - description: 订单号
in: body in: path
name: body name: order_id
required: true required: true
schema: type: string
$ref: '#/definitions/models.OrderStateInput'
- description: 语言类型 zh-CN简体中文 en-US英文 ja-JP日文 默认中文 - description: 语言类型 zh-CN简体中文 en-US英文 ja-JP日文 默认中文
in: header in: header
name: language name: language
......
...@@ -37,9 +37,9 @@ type RefundParamInput struct { ...@@ -37,9 +37,9 @@ type RefundParamInput struct {
} }
//支付查询 //支付查询
type OrderStateInput struct { //type OrderStateInput struct {
OrderId string `json:"order_id"` //订单号 // OrderId string `json:"order_id"` //订单号
} //}
type LakalaParamInput struct { type LakalaParamInput struct {
Version string `json:"version"` //版本 Version string `json:"version"` //版本
......
...@@ -915,15 +915,12 @@ func InsertRefundBill(tx *sql.Tx, p *models.RefundParamInput, refundID string) ( ...@@ -915,15 +915,12 @@ func InsertRefundBill(tx *sql.Tx, p *models.RefundParamInput, refundID string) (
} }
// 拉卡拉支付查询 // 拉卡拉支付查询
func OrderState(input *models.OrderStateInput) (interface{}, error) { func OrderState(order_id string) (interface{}, error) {
fmt.Println("谛宝多多输入参数(支付查询)") fmt.Println("谛宝多多输入参数(支付查询)")
fmt.Println(input) fmt.Println(order_id)
//refundID := GetUID()
order_id := input.OrderId
if order_id == "" { if order_id == "" {
return nil, errors.New("账单不存在") return nil, errors.New("输入参数为空错误")
} }
// 插入数据库 // 插入数据库
...@@ -953,7 +950,6 @@ func OrderState(input *models.OrderStateInput) (interface{}, error) { ...@@ -953,7 +950,6 @@ func OrderState(input *models.OrderStateInput) (interface{}, error) {
querySQL := `select id, source_code, result_code, payment_order_code, attach, _type, platform_type from system_pay_bill where payment_order_code = ?` querySQL := `select id, source_code, result_code, payment_order_code, attach, _type, platform_type from system_pay_bill where payment_order_code = ?`
result := new(models.OrderState) result := new(models.OrderState)
//var result_code uint8
var sourceCode, platformType uint var sourceCode, platformType uint
var paymentOrderCode string var paymentOrderCode string
var attach string var attach string
......
...@@ -20,7 +20,7 @@ func PayRouter (r *gin.Engine) { ...@@ -20,7 +20,7 @@ func PayRouter (r *gin.Engine) {
r.POST(pack.PayUrlPacking("scan_notice"), PayController.ScanNotice) r.POST(pack.PayUrlPacking("scan_notice"), PayController.ScanNotice)
// 拉卡拉支付查询 // 拉卡拉支付查询
r.POST(pack.PayUrlPacking("order_state"), PayController.OrderState) r.GET(pack.PayUrlPacking("order_state/:order_id"), PayController.OrderState)
// 拉卡拉退款 // 拉卡拉退款
r.POST(pack.PayUrlPacking("unified_refund"), PayController.UnifiedRefund) r.POST(pack.PayUrlPacking("unified_refund"), PayController.UnifiedRefund)
......
...@@ -125,7 +125,7 @@ type Lakala struct { ...@@ -125,7 +125,7 @@ type Lakala struct {
// Init 支持热修改的viper设置 // Init 支持热修改的viper设置
func Init() error { func Init() error {
viper.SetConfigFile("conf/config.yaml") // 指定配置文件路径 viper.SetConfigFile("conf/dev/config.yaml") // 指定配置文件路径
err := viper.ReadInConfig() // 读取配置信息 err := viper.ReadInConfig() // 读取配置信息
if err != nil { // 读取配置信息失败 if err != nil { // 读取配置信息失败
fmt.Printf("viper.ReadInConfig failed, new_error:%v\n", err) fmt.Printf("viper.ReadInConfig failed, new_error:%v\n", err)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment