Commit 350066fd authored by wangp's avatar wangp

lakala

parent 207dbde0
package pay package pay
import ( import (
"fmt"
"github.com/gin-gonic/gin" "github.com/gin-gonic/gin"
"system_pay/controller/base" "system_pay/controller/base"
"system_pay/models" "system_pay/models"
...@@ -23,8 +24,22 @@ type NoticeController struct { ...@@ -23,8 +24,22 @@ type NoticeController struct {
// @router /api/v1/pay/wx_notice [post] // @router /api/v1/pay/wx_notice [post]
func (l *PayController) WxNotice(c *gin.Context) { func (l *PayController) WxNotice(c *gin.Context) {
fmt.Println("拉卡拉微信回调start")
var ph2 interface{}
ph2 = new(interface{})
err := c.ShouldBind(ph2)
if err != nil {
response := new(base.ResponseDataWxNotice)
response.Code = "FAIL"
response.Message = "执行失败"
base.ResponseWxNotice(c, response)
return
}
fmt.Println(ph2)
ph := new(models.WxNoticeInput) ph := new(models.WxNoticeInput)
err := c.ShouldBind(ph) err = c.ShouldBind(ph)
if err != nil { if err != nil {
response := new(base.ResponseDataWxNotice) response := new(base.ResponseDataWxNotice)
response.Code = "FAIL" response.Code = "FAIL"
...@@ -32,8 +47,10 @@ func (l *PayController) WxNotice(c *gin.Context) { ...@@ -32,8 +47,10 @@ func (l *PayController) WxNotice(c *gin.Context) {
base.ResponseWxNotice(c, response) base.ResponseWxNotice(c, response)
return return
} }
fmt.Println(ph)
// 拉卡拉统一支付微信回调 // 拉卡拉统一支付微信回调
response, err := pay.WxNotice(ph) response, err := pay.WxNotice(ph, ph2)
base.ResponseWxNotice(c, response) base.ResponseWxNotice(c, response)
fmt.Println("拉卡拉微信回调end")
} }
package pay package pay
import ( import (
"fmt"
"github.com/gin-gonic/gin" "github.com/gin-gonic/gin"
"go.uber.org/zap" "go.uber.org/zap"
"system_pay/controller/base" "system_pay/controller/base"
...@@ -18,14 +19,15 @@ type PayController struct { ...@@ -18,14 +19,15 @@ type PayController struct {
// @Tags 拉卡拉统一支付 // @Tags 拉卡拉统一支付
// @Accept application/json // @Accept application/json
// @Produce application/json // @Produce application/json
// @Param body body models.PlaceAnOrderParamInput true "参数" // @Param body body interface{} 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]
func (l *PayController) UnifiedOrder(c *gin.Context) { func (l *PayController) UnifiedOrder(c *gin.Context) {
ph := new(models.PlaceAnOrderParamInput) ph := new(models.PlaceAnOrderParamInput)
err := c.ShouldBind(ph) fmt.Println("ContentType="+c.ContentType())
err := c.ShouldBindJSON(ph)
if err != nil { if err != nil {
zap.L().Error(err.Error()) zap.L().Error(err.Error())
base.ResponseErrorWithMsg(c, base.ServerError) base.ResponseErrorWithMsg(c, base.ServerError)
......
...@@ -43,7 +43,7 @@ var doc = `{ ...@@ -43,7 +43,7 @@ var doc = `{
"in": "body", "in": "body",
"required": true, "required": true,
"schema": { "schema": {
"$ref": "#/definitions/models.PlaceAnOrderParamInput" "type": "object"
} }
}, },
{ {
...@@ -99,74 +99,6 @@ var doc = `{ ...@@ -99,74 +99,6 @@ 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": {
......
...@@ -27,7 +27,7 @@ ...@@ -27,7 +27,7 @@
"in": "body", "in": "body",
"required": true, "required": true,
"schema": { "schema": {
"$ref": "#/definitions/models.PlaceAnOrderParamInput" "type": "object"
} }
}, },
{ {
...@@ -83,74 +83,6 @@ ...@@ -83,74 +83,6 @@
} }
}, },
"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": {
......
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:
...@@ -88,7 +43,7 @@ paths: ...@@ -88,7 +43,7 @@ paths:
name: body name: body
required: true required: true
schema: schema:
$ref: '#/definitions/models.PlaceAnOrderParamInput' type: object
- description: 语言类型 zh-CN简体中文 en-US英文 ja 日文 默认中文 - description: 语言类型 zh-CN简体中文 en-US英文 ja 日文 默认中文
in: header in: header
name: language name: language
......
...@@ -10,7 +10,7 @@ import ( ...@@ -10,7 +10,7 @@ import (
) )
// 拉卡拉微信支付回调 - AliPayNotice // 拉卡拉微信支付回调 - AliPayNotice
func WxNotice(input *models.WxNoticeInput) (*base.ResponseDataWxNotice, error) { func WxNotice(input *models.WxNoticeInput, input2 interface{}) (*base.ResponseDataWxNotice, error) {
fmt.Println("拉卡拉微信回调输入参数") fmt.Println("拉卡拉微信回调输入参数")
fmt.Println(input) fmt.Println(input)
...@@ -53,7 +53,7 @@ func WxNotice(input *models.WxNoticeInput) (*base.ResponseDataWxNotice, error) { ...@@ -53,7 +53,7 @@ func WxNotice(input *models.WxNoticeInput) (*base.ResponseDataWxNotice, error) {
fmt.Println("222") fmt.Println("222")
//2.存入 notice_request_body //2.存入 notice_request_body
err = InsertPayBillDetailNoticeRequestBody(tx, billID, input) err = InsertPayBillDetailNoticeRequestBody(tx, billID, input2)
if err != nil { if err != nil {
//beego.Error("微信回调, 根据订单id 插入回调Request参数 失败: ", err) //beego.Error("微信回调, 根据订单id 插入回调Request参数 失败: ", err)
response.Code = "FAIL" response.Code = "FAIL"
......
...@@ -76,22 +76,28 @@ func UnifiedOrder(input *models.PlaceAnOrderParamInput) (interface{}, error) { ...@@ -76,22 +76,28 @@ func UnifiedOrder(input *models.PlaceAnOrderParamInput) (interface{}, error) {
//p.ServeNoticeUrl = noticeURLx //p.ServeNoticeUrl = noticeURLx
data2 := make(map[string]interface{}) data2 := make(map[string]interface{})
data2["merchant_no"] = "8222900701107M5" //data2["merchant_no"] = "8222900701107M5"
data2["merchant_no"] = "8221210701101SB"
data2["term_no"] = "29034705" data2["term_no"] = "29034705"
//data2["auth_code"] = "135178236713755038" delete ? //data2["auth_code"] = "135178236713755038" //delete ?
//data2["total_amount"] = "1" //data2["total_amount"] = "1"
data2["total_amount"] = input.GoodsPrice data2["total_amount"] = input.GoodsPrice
data2["out_trade_no"] = orderID //随机生成的订单号 //data2["out_trade_no"] = orderID //随机生成的订单号
//data2["out_trade_no"] = RandomString(32)
data2["out_order_no"] = orderID //随机生成的订单号
//data2["out_order_no"] = RandomString(32) //data2["out_order_no"] = RandomString(32)
//data2["out_trade_no"] = input.AttachInfo //data2["out_trade_no"] = input.AttachInfo
//data2["out_order_no"] = input.AttachInfo //data2["out_order_no"] = input.AttachInfo
//data2["counter_param"] = "{\"pay_mode\":\"ALIPAY\"}"
data2["counter_param"] = "{\"pay_mode\":\"WECHAT\"}"
data2["order_efficient_time"] = "20230630235959" //订单有效期 格式yyyyMMddHHmmss,最大支持下单时间+2天 data2["order_efficient_time"] = "20230630235959" //订单有效期 格式yyyyMMddHHmmss,最大支持下单时间+2天
data2["notify_url"] = input.NoticeURL //订单支付成功后商户接收订单通知的地址 http://xxx.xxx.com data2["notify_url"] = input.NoticeURL //订单支付成功后商户接收订单通知的地址 http://xxx.xxx.com
data2["callback_url"] = input.ReturnURL //客户端下单完成支付后返回的商户网页跳转地址 data2["callback_url"] = input.ReturnURL //客户端下单完成支付后返回的商户网页跳转地址
data2["order_info"] = "必康测试订单标题" //订单标题,在使用收银台扫码支付时必输入,交易时送往账户端 data2["order_info"] = "必康测试订单标题2" //订单标题,在使用收银台扫码支付时必输入,交易时送往账户端
//data2["goods_mark"] = input.AttachInfo //商品信息标识 (1:含商品信息,不填默认不含商品信息) //data2["goods_mark"] = input.AttachInfo //商品信息标识 (1:含商品信息,不填默认不含商品信息)
data["req_data"] = make(map[string]interface{}) data["req_data"] = make(map[string]interface{})
......
...@@ -146,7 +146,7 @@ type Esign struct { ...@@ -146,7 +146,7 @@ type Esign 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