123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103 |
- package entity
- import (
- "app.yhyue.com/moapp/jybase/mysql"
- "github.com/zeromicro/go-zero/core/logx"
- )
- const (
- Pay = "base_pay"
- )
- var (
- Mysql *mysql.Mysql
- JyMysql *mysql.Mysql
- )
- //支付配置
- var PayConf map[string]interface{}
- var AliPayConf map[string]interface{}
- var WxPayConf map[string]interface{}
- type CallBackParam struct {
- TotalFee int //订单价格
- CashFee int //支付金额
- OutTradeno string //订单号(微信支付宝支付使用)
- TimeEnd string //支付时间
- TransactionId string //商户单号(微信支付宝支付)
- Openid string //位置用户标识(仅微信有)
- OrderCode string //线下支付使用
- }
- func init() {
- //qutil.ReadConfig("./pay_config.json", &PayConf)
- //AliPayConf = PayConf["aliPay"].(map[string]interface{})
- //WxPayConf = PayConf["wxPay"].(map[string]interface{})
- }
- func InitMysql(m, n *mysql.Mysql) {
- Mysql = &mysql.Mysql{
- Address: m.Address,
- UserName: m.UserName,
- PassWord: m.PassWord,
- DBName: m.DBName,
- MaxOpenConns: m.MaxOpenConns,
- MaxIdleConns: m.MaxIdleConns,
- }
- Mysql.Init()
- JyMysql = &mysql.Mysql{
- Address: n.Address,
- UserName: n.UserName,
- PassWord: n.PassWord,
- DBName: n.DBName,
- MaxOpenConns: n.MaxOpenConns,
- MaxIdleConns: n.MaxIdleConns,
- }
- JyMysql.Init()
- logx.Info("初始化mysql")
- }
- // func (param *CallBackParam) SaveWxPayRecord() (insert bool) {
- // pay_count := util.Mysql.Count("weixin_pay", map[string]interface{}{
- // "transaction_id": param.TransactionId,
- // "out_trade_no": param.OutTradeno,
- // "user_openid": param.Openid,
- // })
- // if pay_count == 0 {
- // now := time.Now()
- // insert = util.Mysql.Insert("weixin_pay", map[string]interface{}{
- // "transaction_id": param.TransactionId,
- // "out_trade_no": param.OutTradeno,
- // "user_openid": param.Openid,
- // "create_time": qutil.FormatDate(&now, qutil.Date_Full_Layout),
- // "total_fee": param.TotalFee,
- // "cash_fee": param.CashFee,
- // "time_end": param.TimeEnd,
- // }) > 0
- // } else if pay_count > 0 {
- // insert = true
- // }
- // return
- // }
- // func (param *CallBackParam) SaveAliPayRecord() (insert bool) {
- // //支付完成插入
- // pay_count := util.Mysql.Count("ali_pay", map[string]interface{}{
- // "transaction_id": param.TransactionId,
- // "out_trade_no": param.OutTradeno,
- // })
- // if pay_count == 0 {
- // now := time.Now()
- // insert = util.Mysql.Insert("ali_pay", map[string]interface{}{
- // "transaction_id": param.TransactionId,
- // "out_trade_no": param.OutTradeno,
- // "create_time": qutil.FormatDate(&now, qutil.Date_Full_Layout),
- // "total_fee": param.TotalFee,
- // "cash_fee": param.CashFee,
- // "time_end": param.TimeEnd,
- // }) > 0
- // } else {
- // insert = true
- // }
- // return
- // }
|