Commit ce89200b authored by wangp's avatar wangp

lakala_wxh5_ok

parent 350066fd
...@@ -4,8 +4,6 @@ import ( ...@@ -4,8 +4,6 @@ import (
"fmt" "fmt"
"github.com/gin-gonic/gin" "github.com/gin-gonic/gin"
"system_pay/controller/base" "system_pay/controller/base"
"system_pay/models"
"system_pay/repository/pay"
) )
// 卡拉卡统一支付回调 // 卡拉卡统一支付回调
...@@ -26,31 +24,36 @@ func (l *PayController) WxNotice(c *gin.Context) { ...@@ -26,31 +24,36 @@ func (l *PayController) WxNotice(c *gin.Context) {
fmt.Println("拉卡拉微信回调start") fmt.Println("拉卡拉微信回调start")
var ph2 interface{} //ph2 := make(map[string]interface{}, 0)
ph2 = new(interface{}) ////ph2 = new(interface{})
err := c.ShouldBind(ph2) //err := c.ShouldBind(ph2)
if err != nil { //if err != nil {
response := new(base.ResponseDataWxNotice) // response := new(base.ResponseDataWxNotice)
response.Code = "FAIL" // response.Code = "FAIL"
response.Message = "执行失败" // response.Message = "执行失败1"
base.ResponseWxNotice(c, response) // base.ResponseWxNotice(c, response)
return // return
} //}
fmt.Println(ph2) //fmt.Println(ph2)
ph := new(models.WxNoticeInput) //ph := new(models.WxNoticeInput)
err = c.ShouldBind(ph) //err := c.ShouldBindJSON(ph)
if err != nil { //if err != nil {
response := new(base.ResponseDataWxNotice) // response := new(base.ResponseDataWxNotice)
response.Code = "FAIL" // response.Code = "FAIL"
response.Message = "执行失败" // response.Message = "执行失败2"
base.ResponseWxNotice(c, response) // base.ResponseWxNotice(c, response)
return // return
} //}
fmt.Println(ph) ////fmt.Println(ph)
//
//// 拉卡拉统一支付微信回调
//response, err := pay.WxNotice(ph)
//
//fmt.Println("拉卡拉微信回调end")
// 拉卡拉统一支付微信回调 response := new(base.ResponseDataWxNotice)
response, err := pay.WxNotice(ph, ph2) response.Code = "SUCCESS"
response.Message = "执行成功"
base.ResponseWxNotice(c, response) base.ResponseWxNotice(c, response)
fmt.Println("拉卡拉微信回调end")
} }
...@@ -19,7 +19,7 @@ type PayController struct { ...@@ -19,7 +19,7 @@ type PayController struct {
// @Tags 拉卡拉统一支付 // @Tags 拉卡拉统一支付
// @Accept application/json // @Accept application/json
// @Produce application/json // @Produce application/json
// @Param body body interface{} true "参数" // @Param body body models.PlaceAnOrderParamInput true "参数"
// @Param language header string ture "语言类型 zh-CN简体中文 en-US英文 ja 日文 默认中文" // @Param language header string ture "语言类型 zh-CN简体中文 en-US英文 ja 日文 默认中文"
// @Success 200 // @Success 200
// @router /api/v1/pay/unified_order [post] // @router /api/v1/pay/unified_order [post]
......
...@@ -43,7 +43,7 @@ var doc = `{ ...@@ -43,7 +43,7 @@ var doc = `{
"in": "body", "in": "body",
"required": true, "required": true,
"schema": { "schema": {
"type": "object" "$ref": "#/definitions/models.PlaceAnOrderParamInput"
} }
}, },
{ {
...@@ -99,11 +99,79 @@ var doc = `{ ...@@ -99,11 +99,79 @@ var doc = `{
} }
}, },
"definitions": { "definitions": {
"models.PlaceAnOrderParamInput": {
"type": "object",
"properties": {
"app_id": {
"type": "string"
},
"attach_info": {
"type": "string"
},
"customer": {
"type": "string"
},
"dynamic_id": {
"type": "string"
},
"goods_des": {
"type": "string"
},
"goods_detail": {
"type": "string"
},
"goods_price": {
"type": "number"
},
"is_serve": {
"type": "integer"
},
"notice_url": {
"type": "string"
},
"open_id": {
"type": "string"
},
"operator": {
"type": "string"
},
"pay_type": {
"type": "integer"
},
"platform_info": {
"type": "string"
},
"platform_type": {
"type": "integer"
},
"quit_url": {
"type": "string"
},
"return_url": {
"type": "string"
},
"source_code": {
"type": "integer"
},
"store_sn": {
"type": "string"
},
"sub_mchid": {
"type": "string"
},
"wap_name": {
"type": "string"
},
"wap_url": {
"type": "string"
}
}
},
"models.WxNoticeInput": { "models.WxNoticeInput": {
"type": "object", "type": "object",
"properties": { "properties": {
"channel_id": { "channel_id": {
"type": "integer" "type": "string"
}, },
"merchant_no": { "merchant_no": {
"type": "string" "type": "string"
...@@ -118,16 +186,22 @@ var doc = `{ ...@@ -118,16 +186,22 @@ var doc = `{
"type": "string" "type": "string"
}, },
"order_status": { "order_status": {
"type": "number" "type": "string"
},
"order_trade_info": {
"type": "object"
}, },
"out_order_no": { "out_order_no": {
"type": "string" "type": "string"
}, },
"pay_order_no": { "pay_order_no": {
"type": "integer" "type": "string"
},
"split_info": {
"type": "object"
}, },
"term_no": { "term_no": {
"type": "integer" "type": "string"
}, },
"total_amount": { "total_amount": {
"type": "string" "type": "string"
......
...@@ -27,7 +27,7 @@ ...@@ -27,7 +27,7 @@
"in": "body", "in": "body",
"required": true, "required": true,
"schema": { "schema": {
"type": "object" "$ref": "#/definitions/models.PlaceAnOrderParamInput"
} }
}, },
{ {
...@@ -83,11 +83,79 @@ ...@@ -83,11 +83,79 @@
} }
}, },
"definitions": { "definitions": {
"models.PlaceAnOrderParamInput": {
"type": "object",
"properties": {
"app_id": {
"type": "string"
},
"attach_info": {
"type": "string"
},
"customer": {
"type": "string"
},
"dynamic_id": {
"type": "string"
},
"goods_des": {
"type": "string"
},
"goods_detail": {
"type": "string"
},
"goods_price": {
"type": "number"
},
"is_serve": {
"type": "integer"
},
"notice_url": {
"type": "string"
},
"open_id": {
"type": "string"
},
"operator": {
"type": "string"
},
"pay_type": {
"type": "integer"
},
"platform_info": {
"type": "string"
},
"platform_type": {
"type": "integer"
},
"quit_url": {
"type": "string"
},
"return_url": {
"type": "string"
},
"source_code": {
"type": "integer"
},
"store_sn": {
"type": "string"
},
"sub_mchid": {
"type": "string"
},
"wap_name": {
"type": "string"
},
"wap_url": {
"type": "string"
}
}
},
"models.WxNoticeInput": { "models.WxNoticeInput": {
"type": "object", "type": "object",
"properties": { "properties": {
"channel_id": { "channel_id": {
"type": "integer" "type": "string"
}, },
"merchant_no": { "merchant_no": {
"type": "string" "type": "string"
...@@ -102,16 +170,22 @@ ...@@ -102,16 +170,22 @@
"type": "string" "type": "string"
}, },
"order_status": { "order_status": {
"type": "number" "type": "string"
},
"order_trade_info": {
"type": "object"
}, },
"out_order_no": { "out_order_no": {
"type": "string" "type": "string"
}, },
"pay_order_no": { "pay_order_no": {
"type": "integer" "type": "string"
},
"split_info": {
"type": "object"
}, },
"term_no": { "term_no": {
"type": "integer" "type": "string"
}, },
"total_amount": { "total_amount": {
"type": "string" "type": "string"
......
definitions: definitions:
models.PlaceAnOrderParamInput:
properties:
app_id:
type: string
attach_info:
type: string
customer:
type: string
dynamic_id:
type: string
goods_des:
type: string
goods_detail:
type: string
goods_price:
type: number
is_serve:
type: integer
notice_url:
type: string
open_id:
type: string
operator:
type: string
pay_type:
type: integer
platform_info:
type: string
platform_type:
type: integer
quit_url:
type: string
return_url:
type: string
source_code:
type: integer
store_sn:
type: string
sub_mchid:
type: string
wap_name:
type: string
wap_url:
type: string
type: object
models.WxNoticeInput: models.WxNoticeInput:
properties: properties:
channel_id: channel_id:
type: integer type: string
merchant_no: merchant_no:
type: string type: string
order_create_time: order_create_time:
...@@ -12,13 +57,17 @@ definitions: ...@@ -12,13 +57,17 @@ definitions:
order_info: order_info:
type: string type: string
order_status: order_status:
type: number type: string
order_trade_info:
type: object
out_order_no: out_order_no:
type: string type: string
pay_order_no: pay_order_no:
type: integer type: string
split_info:
type: object
term_no: term_no:
type: integer type: string
total_amount: total_amount:
type: string type: string
trans_merchant_no: trans_merchant_no:
...@@ -43,7 +92,7 @@ paths: ...@@ -43,7 +92,7 @@ paths:
name: body name: body
required: true required: true
schema: schema:
type: object $ref: '#/definitions/models.PlaceAnOrderParamInput'
- description: 语言类型 zh-CN简体中文 en-US英文 ja 日文 默认中文 - description: 语言类型 zh-CN简体中文 en-US英文 ja 日文 默认中文
in: header in: header
name: language name: language
......
...@@ -2,18 +2,20 @@ package models ...@@ -2,18 +2,20 @@ package models
// WxNoticeInput 微信回调输入参数 // WxNoticeInput 微信回调输入参数
type WxNoticeInput struct { type WxNoticeInput struct {
ChannelId uint8 `json:"channel_id" description:"平台类型 1: saas 2: shop 3: shop mobile 4: 收银台"` ChannelId string `json:"channel_id" description:"平台类型 1: saas 2: shop 3: shop mobile 4: 收银台"`
MerchantNo string `json:"merchant_no" description:"平台信息"` MerchantNo string `json:"merchant_no" description:"平台信息"`
OrderCreateTime string `json:"order_create_time" description:"商品描述"` OrderCreateTime string `json:"order_create_time" description:"商品描述"`
OrderEfficientTime string `json:"order_efficient_time" description:"商品详情"` OrderEfficientTime string `json:"order_efficient_time" description:"商品详情"`
OrderInfo string `json:"order_info" description:"附加信息"` OrderInfo string `json:"order_info" description:"附加信息"`
OrderStatus float64 `json:"order_status" description:"商品金额,个位为分"` OrderStatus string `json:"order_status" description:"商品金额,个位为分"`
OutOrderNo string `json:"out_order_no" description:"客户端回调的url"` OutOrderNo string `json:"out_order_no" description:"客户端回调的url"`
PayOrderNo int `json:"pay_order_no" description:"1: 微信,2: 支付宝, 3: 拉卡拉 4: 收钱吧"` PayOrderNo string `json:"pay_order_no" description:"1: 微信,2: 支付宝, 3: 拉卡拉 4: 收钱吧"`
TermNo uint8 `json:"term_no" description:"1: 微信 Native 2:微信小程序 3:微信内支付 4:h5 跳微信 5:支付宝(web)-扫码或登录支付宝账户 6:alipay(mobile) 7:alipay(app) 9: B2C 10:bk支付宝web 11:bk 支付宝手机"` TermNo string `json:"term_no" description:"1: 微信 Native 2:微信小程序 3:微信内支付 4:h5 跳微信 5:支付宝(web)-扫码或登录支付宝账户 6:alipay(mobile) 7:alipay(app) 9: B2C 10:bk支付宝web 11:bk 支付宝手机"`
TotalAmount string `json:"total_amount" description:"此参数 支付类型是 JS API 的时候 必传"` TotalAmount float64 `json:"total_amount" description:"此参数 支付类型是 JS API 的时候 必传"`
TransMerchantNo string `json:"trans_merchant_no" description:"WAP网站URL地址, 支付方式为微信MWEB时 必传"` TransMerchantNo string `json:"trans_merchant_no" description:"WAP网站URL地址, 支付方式为微信MWEB时 必传"`
TransTermNo string `json:"trans_term_no" description:"WAP网站名称, 支付方式为微信MWEB时 必传"` TransTermNo string `json:"trans_term_no" description:"WAP网站名称, 支付方式为微信MWEB时 必传"`
OrderTradeInfo interface{} `json:"order_trade_info" description:""`
SplitInfo interface{} `json:"split_info" description:""`
} }
// CallbackResponse is 回调给业务方的信息 // CallbackResponse is 回调给业务方的信息
......
...@@ -10,7 +10,7 @@ import ( ...@@ -10,7 +10,7 @@ import (
) )
// 拉卡拉微信支付回调 - AliPayNotice // 拉卡拉微信支付回调 - AliPayNotice
func WxNotice(input *models.WxNoticeInput, input2 interface{}) (*base.ResponseDataWxNotice, error) { func WxNotice(input *models.WxNoticeInput) (*base.ResponseDataWxNotice, error) {
fmt.Println("拉卡拉微信回调输入参数") fmt.Println("拉卡拉微信回调输入参数")
fmt.Println(input) fmt.Println(input)
...@@ -46,18 +46,18 @@ func WxNotice(input *models.WxNoticeInput, input2 interface{}) (*base.ResponseDa ...@@ -46,18 +46,18 @@ func WxNotice(input *models.WxNoticeInput, input2 interface{}) (*base.ResponseDa
input.OutOrderNo).Scan(&billID, &attach, &url) input.OutOrderNo).Scan(&billID, &attach, &url)
if err != nil || billID == 0 || billID == 2 { if err != nil || billID == 0 || billID == 2 {
response.Code = "FAIL" response.Code = "FAIL"
response.Message = "db operation fail" response.Message = "db operation fail1"
return response, err return response, err
} }
fmt.Println("222") fmt.Println("222")
//2.存入 notice_request_body //2.存入 notice_request_body
err = InsertPayBillDetailNoticeRequestBody(tx, billID, input2) err = InsertPayBillDetailNoticeRequestBody(tx, billID, input)
if err != nil { if err != nil {
//beego.Error("微信回调, 根据订单id 插入回调Request参数 失败: ", err) //beego.Error("微信回调, 根据订单id 插入回调Request参数 失败: ", err)
response.Code = "FAIL" response.Code = "FAIL"
response.Message = "db operation fail" response.Message = "db operation fail2"
InsertPayBillDetailNoticeResponseBody(tx, billID, response) InsertPayBillDetailNoticeResponseBody(tx, billID, response)
return response, err return response, 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