Commit c5969647 authored by wangp's avatar wangp

拉卡拉支付查询 post => get

parent 5efaccf2
......@@ -90,22 +90,16 @@ func (l *PayController) UnifiedRefund(c *gin.Context) {
// @Tags 拉卡拉支付查询
// @Accept 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日文 默认中文"
// @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) {
ph := new(models.OrderStateInput)
err := c.ShouldBindJSON(ph)
if err != nil {
zap.L().Error(err.Error()) //logs错误日志
base.ResponseErrorWithMsg(c, base.ServerError)
return
}
orderID := c.Param("order_id")
// 拉卡拉支付查询
rtn, err := pay.OrderState(ph)
rtn, err := pay.OrderState(orderID)
if err != nil {
zap.L().Error(err.Error())
base.ResponseErrorMsg(c, err.Error())
......
......@@ -60,8 +60,8 @@ var doc = `{
}
}
},
"/api/v1/pay/order_state": {
"post": {
"/api/v1/pay/order_state/{order_id}": {
"get": {
"description": "拉卡拉支付查询",
"consumes": [
"application/json"
......@@ -75,13 +75,11 @@ var doc = `{
"summary": "拉卡拉支付查询",
"parameters": [
{
"description": "参数",
"name": "body",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/models.OrderStateInput"
}
"type": "string",
"description": "订单号",
"name": "order_id",
"in": "path",
"required": true
},
{
"type": "string",
......@@ -269,15 +267,6 @@ var doc = `{
}
}
},
"models.OrderStateInput": {
"type": "object",
"properties": {
"order_id": {
"description": "订单号",
"type": "string"
}
}
},
"models.PlaceAnOrderParamInput": {
"type": "object",
"properties": {
......
......@@ -44,8 +44,8 @@
}
}
},
"/api/v1/pay/order_state": {
"post": {
"/api/v1/pay/order_state/{order_id}": {
"get": {
"description": "拉卡拉支付查询",
"consumes": [
"application/json"
......@@ -59,13 +59,11 @@
"summary": "拉卡拉支付查询",
"parameters": [
{
"description": "参数",
"name": "body",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/models.OrderStateInput"
}
"type": "string",
"description": "订单号",
"name": "order_id",
"in": "path",
"required": true
},
{
"type": "string",
......@@ -253,15 +251,6 @@
}
}
},
"models.OrderStateInput": {
"type": "object",
"properties": {
"order_id": {
"description": "订单号",
"type": "string"
}
}
},
"models.PlaceAnOrderParamInput": {
"type": "object",
"properties": {
......
......@@ -42,12 +42,6 @@ definitions:
description: 交易终端号
type: string
type: object
models.OrderStateInput:
properties:
order_id:
description: 订单号
type: string
type: object
models.PlaceAnOrderParamInput:
properties:
app_id:
......@@ -233,18 +227,17 @@ paths:
summary: 拉卡拉统一支付回调(收银台)
tags:
- 拉卡拉统一支付回调
/api/v1/pay/order_state:
post:
/api/v1/pay/order_state/{order_id}:
get:
consumes:
- application/json
description: 拉卡拉支付查询
parameters:
- description: 参数
in: body
name: body
- description: 订单号
in: path
name: order_id
required: true
schema:
$ref: '#/definitions/models.OrderStateInput'
type: string
- description: 语言类型 zh-CN简体中文 en-US英文 ja-JP日文 默认中文
in: header
name: language
......
......@@ -37,9 +37,9 @@ type RefundParamInput struct {
}
//支付查询
type OrderStateInput struct {
OrderId string `json:"order_id"` //订单号
}
//type OrderStateInput struct {
// OrderId string `json:"order_id"` //订单号
//}
type LakalaParamInput struct {
Version string `json:"version"` //版本
......
......@@ -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(input)
//refundID := GetUID()
fmt.Println(order_id)
order_id := input.OrderId
if order_id == "" {
return nil, errors.New("账单不存在")
return nil, errors.New("输入参数为空错误")
}
// 插入数据库
......@@ -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 = ?`
result := new(models.OrderState)
//var result_code uint8
var sourceCode, platformType uint
var paymentOrderCode string
var attach string
......
......@@ -20,7 +20,7 @@ func PayRouter (r *gin.Engine) {
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)
......
......@@ -125,7 +125,7 @@ type Lakala struct {
// Init 支持热修改的viper设置
func Init() error {
viper.SetConfigFile("conf/config.yaml") // 指定配置文件路径
viper.SetConfigFile("conf/dev/config.yaml") // 指定配置文件路径
err := viper.ReadInConfig() // 读取配置信息
if err != nil { // 读取配置信息失败
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