Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
S
system_pay
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
王沛
system_pay
Commits
8ee86ced
Commit
8ee86ced
authored
Jun 27, 2023
by
wangp
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
lakala
parent
1f086487
Changes
8
Show whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
237 additions
and
172 deletions
+237
-172
config.yaml
conf/dev/config.yaml
+2
-1
notice.go
controller/api/v1/pay/notice.go
+1
-0
docs.go
docs/docs.go
+78
-0
swagger.json
docs/swagger.json
+78
-0
swagger.yaml
docs/swagger.yaml
+51
-0
notice.go
repository/pay/notice.go
+3
-4
pay.go
repository/pay/pay.go
+17
-161
setting.go
setting/setting.go
+7
-6
No files found.
conf/dev/config.yaml
View file @
8ee86ced
...
@@ -59,7 +59,8 @@ log:
...
@@ -59,7 +59,8 @@ log:
# smscontent: '【谛宝医生】登录验证码为:%s'
# smscontent: '【谛宝医生】登录验证码为:%s'
# 支付
# 支付
#payurl:
payurl
:
domainname
:
'
http://tpay-v2.pet-dbc.cn:14880'
# checkorder: 'https://tpay.pet-dbc.cn/v1/pay/unified_order'
# checkorder: 'https://tpay.pet-dbc.cn/v1/pay/unified_order'
# orderstate: 'https://tpay.pet-dbc.cn/v1/pay/order_state/'
# orderstate: 'https://tpay.pet-dbc.cn/v1/pay/order_state/'
...
...
controller/api/v1/pay/notice.go
View file @
8ee86ced
...
@@ -17,6 +17,7 @@ type NoticeController struct {
...
@@ -17,6 +17,7 @@ type NoticeController struct {
// @Tags 拉卡拉统一支付回调
// @Tags 拉卡拉统一支付回调
// @Accept application/json
// @Accept application/json
// @Produce application/json
// @Produce application/json
// @Param body body models.WxNoticeInput 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/wx_notice [post]
// @router /api/v1/pay/wx_notice [post]
...
...
docs/docs.go
View file @
8ee86ced
...
@@ -59,6 +59,43 @@ var doc = `{
...
@@ -59,6 +59,43 @@ var doc = `{
}
}
}
}
}
}
},
"/api/v1/pay/wx_notice": {
"post": {
"description": "拉卡拉统一支付微信回调",
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"拉卡拉统一支付回调"
],
"summary": "拉卡拉统一支付微信回调",
"parameters": [
{
"description": "参数",
"name": "body",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/models.WxNoticeInput"
}
},
{
"type": "string",
"description": "语言类型 zh-CN简体中文 en-US英文 ja 日文 默认中文",
"name": "language",
"in": "header"
}
],
"responses": {
"200": {
"description": ""
}
}
}
}
}
},
},
"definitions": {
"definitions": {
...
@@ -129,6 +166,47 @@ var doc = `{
...
@@ -129,6 +166,47 @@ var doc = `{
"type": "string"
"type": "string"
}
}
}
}
},
"models.WxNoticeInput": {
"type": "object",
"properties": {
"channel_id": {
"type": "integer"
},
"merchant_no": {
"type": "string"
},
"order_create_time": {
"type": "string"
},
"order_efficient_time": {
"type": "string"
},
"order_info": {
"type": "string"
},
"order_status": {
"type": "number"
},
"out_order_no": {
"type": "string"
},
"pay_order_no": {
"type": "integer"
},
"term_no": {
"type": "integer"
},
"total_amount": {
"type": "string"
},
"trans_merchant_no": {
"type": "string"
},
"trans_term_no": {
"type": "string"
}
}
}
}
},
},
"securityDefinitions": {
"securityDefinitions": {
...
...
docs/swagger.json
View file @
8ee86ced
...
@@ -43,6 +43,43 @@
...
@@ -43,6 +43,43 @@
}
}
}
}
}
}
},
"/api/v1/pay/wx_notice"
:
{
"post"
:
{
"description"
:
"拉卡拉统一支付微信回调"
,
"consumes"
:
[
"application/json"
],
"produces"
:
[
"application/json"
],
"tags"
:
[
"拉卡拉统一支付回调"
],
"summary"
:
"拉卡拉统一支付微信回调"
,
"parameters"
:
[
{
"description"
:
"参数"
,
"name"
:
"body"
,
"in"
:
"body"
,
"required"
:
true
,
"schema"
:
{
"$ref"
:
"#/definitions/models.WxNoticeInput"
}
},
{
"type"
:
"string"
,
"description"
:
"语言类型 zh-CN简体中文 en-US英文 ja 日文 默认中文"
,
"name"
:
"language"
,
"in"
:
"header"
}
],
"responses"
:
{
"200"
:
{
"description"
:
""
}
}
}
}
}
},
},
"definitions"
:
{
"definitions"
:
{
...
@@ -113,6 +150,47 @@
...
@@ -113,6 +150,47 @@
"type"
:
"string"
"type"
:
"string"
}
}
}
}
},
"models.WxNoticeInput"
:
{
"type"
:
"object"
,
"properties"
:
{
"channel_id"
:
{
"type"
:
"integer"
},
"merchant_no"
:
{
"type"
:
"string"
},
"order_create_time"
:
{
"type"
:
"string"
},
"order_efficient_time"
:
{
"type"
:
"string"
},
"order_info"
:
{
"type"
:
"string"
},
"order_status"
:
{
"type"
:
"number"
},
"out_order_no"
:
{
"type"
:
"string"
},
"pay_order_no"
:
{
"type"
:
"integer"
},
"term_no"
:
{
"type"
:
"integer"
},
"total_amount"
:
{
"type"
:
"string"
},
"trans_merchant_no"
:
{
"type"
:
"string"
},
"trans_term_no"
:
{
"type"
:
"string"
}
}
}
}
},
},
"securityDefinitions"
:
{
"securityDefinitions"
:
{
...
...
docs/swagger.yaml
View file @
8ee86ced
...
@@ -44,6 +44,33 @@ definitions:
...
@@ -44,6 +44,33 @@ definitions:
wap_url
:
wap_url
:
type
:
string
type
:
string
type
:
object
type
:
object
models.WxNoticeInput
:
properties
:
channel_id
:
type
:
integer
merchant_no
:
type
:
string
order_create_time
:
type
:
string
order_efficient_time
:
type
:
string
order_info
:
type
:
string
order_status
:
type
:
number
out_order_no
:
type
:
string
pay_order_no
:
type
:
integer
term_no
:
type
:
integer
total_amount
:
type
:
string
trans_merchant_no
:
type
:
string
trans_term_no
:
type
:
string
type
:
object
info
:
info
:
contact
:
{}
contact
:
{}
description
:
采购订单项目
description
:
采购订单项目
...
@@ -74,6 +101,30 @@ paths:
...
@@ -74,6 +101,30 @@ paths:
summary
:
拉卡拉统一支付
summary
:
拉卡拉统一支付
tags
:
tags
:
-
拉卡拉统一支付
-
拉卡拉统一支付
/api/v1/pay/wx_notice
:
post
:
consumes
:
-
application/json
description
:
拉卡拉统一支付微信回调
parameters
:
-
description
:
参数
in
:
body
name
:
body
required
:
true
schema
:
$ref
:
'
#/definitions/models.WxNoticeInput'
-
description
:
语言类型 zh-CN简体中文 en-US英文 ja 日文 默认中文
in
:
header
name
:
language
type
:
string
produces
:
-
application/json
responses
:
"
200"
:
description
:
"
"
summary
:
拉卡拉统一支付微信回调
tags
:
-
拉卡拉统一支付回调
securityDefinitions
:
securityDefinitions
:
ApiKeyAuth
:
ApiKeyAuth
:
in
:
header
in
:
header
...
...
repository/pay/notice.go
View file @
8ee86ced
...
@@ -4,7 +4,6 @@ import (
...
@@ -4,7 +4,6 @@ import (
"database/sql"
"database/sql"
"encoding/json"
"encoding/json"
"fmt"
"fmt"
"strconv"
"system_pay/controller/base"
"system_pay/controller/base"
"system_pay/models"
"system_pay/models"
"system_pay/mysql"
"system_pay/mysql"
...
@@ -13,7 +12,7 @@ import (
...
@@ -13,7 +12,7 @@ import (
// 拉卡拉微信支付回调 - AliPayNotice
// 拉卡拉微信支付回调 - AliPayNotice
func
WxNotice
(
input
*
models
.
WxNoticeInput
)
(
*
base
.
ResponseDataWxNotice
,
error
)
{
func
WxNotice
(
input
*
models
.
WxNoticeInput
)
(
*
base
.
ResponseDataWxNotice
,
error
)
{
fmt
.
Println
(
"
接口
输入参数"
)
fmt
.
Println
(
"
拉卡拉微信回调
输入参数"
)
fmt
.
Println
(
input
)
fmt
.
Println
(
input
)
response
:=
new
(
base
.
ResponseDataWxNotice
)
response
:=
new
(
base
.
ResponseDataWxNotice
)
...
@@ -93,8 +92,8 @@ func WxNotice(input *models.WxNoticeInput) (*base.ResponseDataWxNotice, error) {
...
@@ -93,8 +92,8 @@ func WxNotice(input *models.WxNoticeInput) (*base.ResponseDataWxNotice, error) {
callbackResponse
.
ReturnMsg
=
"SUCCESS"
callbackResponse
.
ReturnMsg
=
"SUCCESS"
//callbackResponse.OutTradeNo = input.OutTradeNo
//callbackResponse.OutTradeNo = input.OutTradeNo
//callbackResponse.TransactionID = input.TransactionId
//callbackResponse.TransactionID = input.TransactionId
callbackResponse
.
OutTradeNo
=
strconv
.
Itoa
(
input
.
PayOrderNo
)
//交易凭据单号 todo
callbackResponse
.
OutTradeNo
=
input
.
OutOrderNo
//交易凭据单号 todo
callbackResponse
.
TransactionID
=
strconv
.
Itoa
(
input
.
PayOrderNo
)
//交易凭据单号 todo
callbackResponse
.
TransactionID
=
input
.
OutOrderNo
//交易凭据单号 todo strconv.Itoa(
attachMap
:=
make
(
map
[
string
]
interface
{},
0
)
attachMap
:=
make
(
map
[
string
]
interface
{},
0
)
_
=
json
.
Unmarshal
([]
byte
(
attach
),
&
attachMap
)
_
=
json
.
Unmarshal
([]
byte
(
attach
),
&
attachMap
)
...
...
repository/pay/pay.go
View file @
8ee86ced
...
@@ -19,6 +19,7 @@ import (
...
@@ -19,6 +19,7 @@ import (
"strings"
"strings"
"system_pay/models"
"system_pay/models"
"system_pay/mysql"
"system_pay/mysql"
"system_pay/setting"
"time"
"time"
)
)
...
@@ -29,13 +30,7 @@ func UnifiedOrder(input *models.PlaceAnOrderParamInput) (interface{}, error) {
...
@@ -29,13 +30,7 @@ func UnifiedOrder(input *models.PlaceAnOrderParamInput) (interface{}, error) {
// return nil, errors.New("输入项为空")
// return nil, errors.New("输入项为空")
//}
//}
//db, err := mysql.NewShopConn()
fmt
.
Println
(
"谛宝多多输入参数"
)
//if err != nil {
// return nil, err
//}
//rtn := make(map[string]string)
fmt
.
Println
(
"拉卡拉支付接口输入参数"
)
fmt
.
Println
(
input
)
fmt
.
Println
(
input
)
orderID
:=
GetUID
()
orderID
:=
GetUID
()
...
@@ -67,31 +62,12 @@ func UnifiedOrder(input *models.PlaceAnOrderParamInput) (interface{}, error) {
...
@@ -67,31 +62,12 @@ func UnifiedOrder(input *models.PlaceAnOrderParamInput) (interface{}, error) {
return
nil
,
err
return
nil
,
err
}
}
//数据重组 - start
data
:=
make
(
map
[
string
]
interface
{})
data
:=
make
(
map
[
string
]
interface
{})
data
[
"req_time"
]
=
"20230626100000"
data
[
"req_time"
]
=
"20230626100000"
data
[
"version"
]
=
"3.0"
data
[
"version"
]
=
"3.0"
data
[
"out_org_code"
]
=
"OP00000003"
data
[
"out_org_code"
]
=
"OP00000003"
//"out_order_no": "KFPT20220714160009228907288",
// "merchant_no": "8222900701106PZ",
// "vpos_id": "587305941625155584",
// "channel_id": "2021052614391",
// "total_amount": "1",
// "busi_mode": "PAY",
// "order_efficient_time": "20220714170009",
// "notify_url": "http://run.mocky.io/v3/b02c9448-20a2-4ff6-a678-38ecab30161d",
// "support_cancel": "0",
// "support_refund": "1",
// "support_repeat_pay": "1",
// "busi_type_param": "[{\"busi_type\":\"UPCARD\",\"params\":{\"crd_flg\":\"CRDFLG_D|CRDFLG_C|CRDFLG_OTH\"}},{\"busi_type\":\"SCPAY\",\"params\":{\"pay_mode\":\"WECHAT\",\"crd_flg\":\"CRDFLG_D\"}}]",
// "counter_param": "{\"pay_mode\":\"ALIPAY\"}",
// "out_user_id": "",
// "order_info": "自动化测试",
// "extend_info": "自动化测试",
// "callback_url": ""
//input.NoticeURL = "https://test.pet-dbc.cn/uni/api/repayment/PayCallBack"
//input.NoticeURL = "https://test.pet-dbc.cn/mobile/notifywx.php"
input
.
ReturnURL
=
"https://test.pet-dbc.cn"
input
.
ReturnURL
=
"https://test.pet-dbc.cn"
// 构造回调url
// 构造回调url
...
@@ -100,20 +76,19 @@ func UnifiedOrder(input *models.PlaceAnOrderParamInput) (interface{}, error) {
...
@@ -100,20 +76,19 @@ func UnifiedOrder(input *models.PlaceAnOrderParamInput) (interface{}, error) {
//p.ServeNoticeUrl = noticeURLx
//p.ServeNoticeUrl = noticeURLx
data2
:=
make
(
map
[
string
]
interface
{})
data2
:=
make
(
map
[
string
]
interface
{})
//data2["out_trade_no"] = "FD660E1FAA3A4470933CDEDAE1EC1DUU"
data2
[
"out_trade_no"
]
=
RandomString
(
32
)
//data2["merchant_no"] = "822290070111135"
data2
[
"merchant_no"
]
=
"8222900701107M5"
data2
[
"merchant_no"
]
=
"8222900701107M5"
data2
[
"term_no"
]
=
"29034705"
data2
[
"term_no"
]
=
"29034705"
//data2["merchant_no"] = "8222900581201QB"
//data2["auth_code"] = "135178236713755038" delete ?
//data2["term_no"] = "D0027598"
data2
[
"auth_code"
]
=
"135178236713755038"
data2
[
"total_amount"
]
=
"1"
//data2["out_order_no"] = "08F4542EEC6A4497BC419161747A92UU"
data2
[
"out_order_no"
]
=
RandomString
(
32
)
data2
[
"order_efficient_time"
]
=
"20230630235959"
//订单有效期 格式yyyyMMddHHmmss,最大支持下单时间+2天
//data2["total_amount"] = "1"
data2
[
"total_amount"
]
=
input
.
GoodsPrice
data2
[
"out_trade_no"
]
=
orderID
//随机生成的订单号
//data2["out_order_no"] = RandomString(32)
//data2["out_trade_no"] = input.AttachInfo
//data2["out_order_no"] = input.AttachInfo
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"
]
=
"必康测试订单标题"
//订单标题,在使用收银台扫码支付时必输入,交易时送往账户端
...
@@ -121,39 +96,8 @@ func UnifiedOrder(input *models.PlaceAnOrderParamInput) (interface{}, error) {
...
@@ -121,39 +96,8 @@ func UnifiedOrder(input *models.PlaceAnOrderParamInput) (interface{}, error) {
data
[
"req_data"
]
=
make
(
map
[
string
]
interface
{})
data
[
"req_data"
]
=
make
(
map
[
string
]
interface
{})
data
[
"req_data"
]
=
data2
data
[
"req_data"
]
=
data2
//data3 := make(map[string]interface{})
//data3["request_ip"] = "10.176.1.192"
//data3["location"] = "+37.123456789,-121.123456789"
//data2["location_info"] = make(map[string]inteace{})
//data2["location_info"] = data3
//data2["out_order_no"] = input.AttachInfo //商户订单号
//data2["total_amount"] = input.AttachInfo //订单金额,单位:分
//data2["order_efficient_time"] = input.AttachInfo //订单有效期 格式yyyyMMddHHmmss,最大支持下单时间+2天
//
//data2["notify_url"] = input.AttachInfo //订单支付成功后商户接收订单通知的地址 http://xxx.xxx.com
//data2["callback_url"] = input.AttachInfo //商户订单号
//data2["order_info"] = input.AttachInfo //订单标题,在使用收银台扫码支付时必输入,交易时送往账户端
//data2["goods_mark"] = input.AttachInfo //商品信息标识 (1:含商品信息,不填默认不含商品信息)
//var data model.LakalaParamInput
//data.Version = "3.0"
//data.ReqTime = "20220714160009"
//
//data.ReqData.OutOrderNo = input.AttachInfo //商户订单号
////data.ReqData.MerchantNo = //银联商户号
//data.ReqData.TotalAmount = input.GoodsPrice //订单金额,单位:分
////data.ReqData.OrderEfficientTime = //订单有效期 格式yyyyMMddHHmmss,最大支持下单时间+2天
//
//data.ReqData.NotifyUrl = input.NoticeURL //订单支付成功后商户接收订单通知的地址 http://xxx.xxx.com
//data.ReqData.CallbackUrl = input.ReturnURL //客户端下单完成支付后返回的商户网页跳转地址
////data.ReqData.OrderInfo = input.OrderId //订单标题,在使用收银台扫码支付时必输入,交易时送往账户端
//data.ReqData.GoodsMark = input.GoodsDes //商品信息标识 (1:含商品信息,不填默认不含商品信息)
//数据重组 - end
//数据重组 - end
////var data = input.ReqData
//fmt.Println(111)
fmt
.
Println
(
"拉卡拉输入参数"
)
fmt
.
Println
(
"拉卡拉输入参数"
)
fmt
.
Println
(
data
)
fmt
.
Println
(
data
)
...
@@ -199,96 +143,6 @@ func UnifiedOrder(input *models.PlaceAnOrderParamInput) (interface{}, error) {
...
@@ -199,96 +143,6 @@ func UnifiedOrder(input *models.PlaceAnOrderParamInput) (interface{}, error) {
}
}
return
response
,
nil
return
response
,
nil
//1.校验供应商账号(手机号)是否已注册
//err = db.QueryRow(`SELECT user_name, phone_mob, available, steps
// FROM ecm_member WHERE user_type=2 AND user_id=? LIMIT 1`,
// seller_id).Scan(&seller_name, &phone_mob, &available, &steps)
//if err != nil && err != sql.ErrNoRows {
// return nil, err
//}
//2.获取医院Id
//var buyer_id string
//err = db.QueryRow(`SELECT user_id FROM ecm_member WHERE user_type=1 AND chain_code=? AND hospital_code=? LIMIT 1`,
// input.ChainCode, input.HospitalCode).Scan(&buyer_id)
//if err != nil && err != sql.ErrNoRows {
// return nil, err
//}
//if (buyer_id=="") {
// return nil, errors.New("未绑定,请先绑定谛宝医院")
//}
//
////3.谛宝医生与供应商已绑定校验
//var seller_id2 string
//err = db.QueryRow(`SELECT mc.seller_id FROM ecm_member_cross mc
// LEFT JOIN ecm_member m ON mc.seller_id=m.user_id WHERE buyer_id=? AND vendor_id=?`,
// buyer_id, input.VendorId).Scan(&seller_id2)
//if err != nil && err != sql.ErrNoRows {
// return "", err
//}
//
////3.1已绑定其它账号
//if seller_id2!="" && seller_id2!=seller_id {
// return nil, errors.New("已绑定其它账号,请勿重复绑定")
//}
//
////3.2已绑定,返回token,完成登录
//if seller_id2==seller_id {
// //token, err := utils.GetToken(phone_mob, seller_id, seller_name)
// //if err != nil {
// // return "", err
// //}
// //
// //rtn["token"] = token
// //rtn["user_id"] = seller_id
// ////rtn["user_name"] = seller_name
// return nil, nil
// //return nil, errors.New("已绑定该账号,请勿重复绑定")
//}
////fmt.Println(buyer_id)
////fmt.Println(seller_id)
////fmt.Println(input.VendorId)
//
//var vendor_id string
//err = db.QueryRow(`SELECT vendor_id FROM ecm_member_cross mc
// LEFT JOIN ecm_member m ON mc.seller_id=m.user_id WHERE buyer_id=? AND seller_id=?`,
// buyer_id, seller_id).Scan(&vendor_id)
//if err != nil && err != sql.ErrNoRows {
// return "", err
//}
//
//if vendor_id!="" && vendor_id!=input.VendorId {
// //3.3更新绑定
// //sql := "UPDATE ecm_member_cross SET " +
// // "vendor_id='" + input.VendorId + "' " +
// // "WHERE buyer_id=? AND seller_id=?"
// //_, err = db.Exec(sql, buyer_id, seller_id)
// //if err != nil {
// // return nil, err
// //}
// return nil, errors.New("已绑定其它账号,请勿重复绑定")
//}
//
////3.4添加绑定
//exec, err := db.Exec(`INSERT INTO ecm_member_cross (buyer_id, seller_id, vendor_id) VALUES (?,?,?)`,
// buyer_id, seller_id, input.VendorId)
//_, err = exec, err
//if err != nil {
// return nil, err
//}
//3.4绑定完成,返回token,完成登录
//token, err := utils.GetToken(phone_mob, seller_id, seller_name)
//if err != nil {
// return "", err
//}
//rtn["token"] = token
//rtn["user_id"] = seller_id
//rtn["user_name"] = seller_name
//return nil, nil
}
}
func
UnifiedOrder2
(
input
*
models
.
PlaceAnOrderParamInput
)
(
interface
{},
error
)
{
func
UnifiedOrder2
(
input
*
models
.
PlaceAnOrderParamInput
)
(
interface
{},
error
)
{
...
@@ -560,15 +414,17 @@ func RandomString(n int) string {
...
@@ -560,15 +414,17 @@ func RandomString(n int) string {
// GetNoticeURL is 获取回调地址
// GetNoticeURL is 获取回调地址
func
GetNoticeURL
(
sourceCode
uint8
)
string
{
func
GetNoticeURL
(
sourceCode
uint8
)
string
{
domainName
:=
beego
.
AppConfig
.
String
(
"DomainName"
)
//domainName := beego.AppConfig.String("DomainName")
domainName
:=
setting
.
Conf
.
PayUrl
.
DomainName
//domainName = "http://tpay-v2.pet-dbc.cn:14880";
// <= 5 是微信
// <= 5 是微信
if
sourceCode
<
5
{
if
sourceCode
<
5
{
return
domainName
+
"/v1/pay/wx_notice"
return
domainName
+
"/
api/
v1/pay/wx_notice"
}
}
// > 5 是支付宝
// > 5 是支付宝
return
domainName
+
"/v1/pay/alipay_notice"
return
domainName
+
"/
api/
v1/pay/alipay_notice"
//
//
//if isServe == 0 {
//if isServe == 0 {
// // payType 1: 原生 2: paymax
// // payType 1: 原生 2: paymax
...
...
setting/setting.go
View file @
8ee86ced
...
@@ -28,7 +28,7 @@ type Config struct {
...
@@ -28,7 +28,7 @@ type Config struct {
//GateWay *GateWayDetail `mapstructure:"gateway"`
//GateWay *GateWayDetail `mapstructure:"gateway"`
//GateWayDev *GateWayDevDetail `mapstructure:"gatewaydev"`
//GateWayDev *GateWayDevDetail `mapstructure:"gatewaydev"`
//Mongo *MongoConfig `mapstructure:"mongo"`
//Mongo *MongoConfig `mapstructure:"mongo"`
//
PayUrl *PayUrlDetail `mapstructure:"payurl"`
PayUrl
*
PayUrlDetail
`mapstructure:"payurl"`
}
}
type
App
struct
{
type
App
struct
{
...
@@ -110,10 +110,11 @@ type SmsInternationalConfig struct {
...
@@ -110,10 +110,11 @@ type SmsInternationalConfig struct {
//}
//}
//
//
//// PayUrlDetail 网关
//// PayUrlDetail 网关
//type PayUrlDetail struct {
type
PayUrlDetail
struct
{
// CheckOrder string `mapstructure:"checkorder"`
DomainName
string
`mapstructure:"domainname"`
// OrderState string `mapstructure:"orderstate"`
//CheckOrder string `mapstructure:"checkorder"`
//}
//OrderState string `mapstructure:"orderstate"`
}
type
UploadImage
struct
{
type
UploadImage
struct
{
UploadDir
string
`mapstructure:"upload_dir"`
UploadDir
string
`mapstructure:"upload_dir"`
...
@@ -145,7 +146,7 @@ type Esign struct {
...
@@ -145,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
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment