From 8948cd054a1c25344f0300aa071fe0e6c15d8fea Mon Sep 17 00:00:00 2001 From: DengBiao <2319963317@qq.com> Date: Mon, 21 Aug 2023 15:33:51 +0800 Subject: [PATCH] update --- app/db/db_qrcode.go | 4 +++- app/db/model/qrcode.go | 2 +- app/hdl/hdl_demo.go | 4 ++-- app/hdl/hdl_wx.go | 9 ++++++++- app/svc/svc_qrcode.go | 2 +- 5 files changed, 15 insertions(+), 6 deletions(-) diff --git a/app/db/db_qrcode.go b/app/db/db_qrcode.go index 7fa05a7..89e4ecb 100644 --- a/app/db/db_qrcode.go +++ b/app/db/db_qrcode.go @@ -4,6 +4,7 @@ import ( "applet/app/db/model" "applet/app/enum" "applet/app/utils/logx" + "fmt" "xorm.io/xorm" ) @@ -28,8 +29,9 @@ func (qrcodeDb *QrcodeDb) GetQrcode(id int) (m *model.Qrcode, err error) { } func (qrcodeDb *QrcodeDb) GetQrcodeByIndex(index string) (m *model.Qrcode, err error) { + fmt.Println(">>>>>>>>>>>>>>>>>>identity<<<<<<<<<<<<<<", index) m = new(model.Qrcode) - has, err := qrcodeDb.Db.Where("index =?", index).Get(m) + has, err := qrcodeDb.Db.Where("identity =?", index).Get(m) if err != nil { return nil, logx.Error(err) } diff --git a/app/db/model/qrcode.go b/app/db/model/qrcode.go index b01be06..a4957ff 100644 --- a/app/db/model/qrcode.go +++ b/app/db/model/qrcode.go @@ -4,7 +4,7 @@ type Qrcode struct { Id int `json:"id" xorm:"not null pk autoincr INT(11)"` Url string `json:"url" xorm:"not null default '' comment('url地址') VARCHAR(255)"` State int32 `json:"state" xorm:"not null default 1 comment('状态(1:可用 2:不可用) ') TINYINT(1)"` - Index string `json:"index" xorm:"not null default '' comment('唯一标识符(随机6位字母+数字)') CHAR(50)"` + Identity string `json:"identity" xorm:"not null default '' comment('唯一标识符(随机6位字母+数字)') CHAR(50)"` CreateAt string `json:"create_at" xorm:"not null default CURRENT_TIMESTAMP comment('创建时间') TIMESTAMP"` UpdateAt string `json:"update_at" xorm:"not null default CURRENT_TIMESTAMP comment('更新时间') TIMESTAMP"` } diff --git a/app/hdl/hdl_demo.go b/app/hdl/hdl_demo.go index 6cc9769..5f62687 100644 --- a/app/hdl/hdl_demo.go +++ b/app/hdl/hdl_demo.go @@ -27,8 +27,8 @@ func Demo(c *gin.Context) { func Demo1(c *gin.Context) { post, err := utils.CurlPost("http://pay.com/wx/redPackage/index", map[string]string{ - "openid": "oLAbGuMC5o6fJRcLSicj0MENGoEo", - "amount": "0.1", + "re_openid": "oLAbGuMC5o6fJRcLSicj0MENGoEo", + "amount": "100.00", }, nil) if err != nil { fmt.Println(err) diff --git a/app/hdl/hdl_wx.go b/app/hdl/hdl_wx.go index 8e248b5..c3b6f82 100644 --- a/app/hdl/hdl_wx.go +++ b/app/hdl/hdl_wx.go @@ -214,10 +214,17 @@ func DealCallBack(openId, ticket string) error { } //4、发送微信红包 - post, err := utils.CurlPost("http://pay.com/wx/redPackage/index", map[string]string{ + post, err := utils.CurlPost("http://pay.izhyin.com/wx/redPackage/index", map[string]string{ "openid": openId, "amount": utils.Float64ToStr(utils.StrToFloat64(qrcodeWithBatchRecord.Amount) * 100), }, nil) + utils.FilePutContents("send_redPackage", utils.SerializeStr(map[string]interface{}{ + "args": map[string]string{ + "openid": openId, + "amount": utils.Float64ToStr(utils.StrToFloat64(qrcodeWithBatchRecord.Amount) * 100), + }, + "resp": post, + })) if err != nil { return err } diff --git a/app/svc/svc_qrcode.go b/app/svc/svc_qrcode.go index f5a56cd..02595b4 100644 --- a/app/svc/svc_qrcode.go +++ b/app/svc/svc_qrcode.go @@ -54,7 +54,7 @@ func CreateQrcode(createNums int) (err error) { insertData = append(insertData, &model.Qrcode{ Url: qrcodeUrl, State: enum.QrcodeSateAllowUse, - Index: sceneStr, + Identity: sceneStr, CreateAt: now.Format("2006-01-02 15:00:00"), UpdateAt: now.Format("2006-01-02 15:00:00"), })