Browse Source

update

master
DengBiao 1 year ago
parent
commit
8c6f6a6dcf
3 changed files with 28 additions and 9 deletions
  1. +1
    -1
      app/db/db_qrcode_with_batch_records.go
  2. +8
    -4
      app/hdl/hdl_demo.go
  3. +19
    -4
      app/hdl/hdl_wx.go

+ 1
- 1
app/db/db_qrcode_with_batch_records.go View File

@@ -60,7 +60,7 @@ func (qrcodeWithBatchRecordsDb *QrcodeWithBatchRecordsDb) FindQrcodeWithBatchRec
return
}
func (qrcodeWithBatchRecordsDb *QrcodeWithBatchRecordsDb) UpdateQrcodeWithBatchRecord(m *model.QrcodeWithBatchRecords) (int64, error) {
affected, err := qrcodeWithBatchRecordsDb.Db.Where("id =?", m.Id).FindAndCount(&m)
affected, err := qrcodeWithBatchRecordsDb.Db.Where("id =?", m.Id).Update(m)
if err != nil {
return 0, err
}


+ 8
- 4
app/hdl/hdl_demo.go View File

@@ -26,14 +26,18 @@ func Demo(c *gin.Context) {
}

func Demo1(c *gin.Context) {
post, err := utils.CurlPost("http://pay.izhyin.com/wx/redPackage/index", map[string]string{
"re_openid": "oLAbGuMC5o6fJRcLSicj0MENGoEo",
"amount": "100.00",
}, nil)
DealCallBack("oLAbGuMC5o6fJRcLSicj0MENGoEo", "1692603601358587_sVxAbe")
post, err := utils.CurlPost("http://pay.com/wx/redPackage/index", utils.SerializeStr(map[string]string{
"openid": "oLAbGuMC5o6fJRcLSicj0MENGoEo",
"amount": "100.00",
}), nil)
if err != nil {
fmt.Println(err)
}

fmt.Println(post)
e.OutSuc(c, post, nil)

//eg := commDb.DBs[c.GetString("mid")]
//sess := eg.NewSession()
////r, err := eg.Table("user_profile").Where("uid=21699").Incr("fin_valid", 10).Exec()


+ 19
- 4
app/hdl/hdl_wx.go View File

@@ -214,26 +214,41 @@ func DealCallBack(openId, ticket string) error {
}

//4、发送微信红包
post, err := utils.CurlPost("http://pay.izhyin.com/wx/redPackage/index", map[string]string{
post, err := utils.CurlPost("http://pay.izhyin.com/wx/redPackage/index", utils.SerializeStr(map[string]string{
"openid": openId,
"amount": utils.Float64ToStr(utils.StrToFloat64(qrcodeWithBatchRecord.Amount) * 100),
}, nil)
}), nil)

if err != nil {
return err
}
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,
"resp": string(post),
}))

var result struct {
Code int `json:"code"`
Msg string `json:"msg"`
Data interface{} `json:"data"`
}
err = json.Unmarshal(post, &result)
if err != nil {
return err
}

var data md.SendRedPackageResp
err = json.Unmarshal(post, &data)
err = json.Unmarshal(utils.Serialize(result.Data), &data)
if err != nil {
return err
}
utils.FilePutContents("send_redPackage", utils.SerializeStr(map[string]interface{}{
"data": data,
}))

if data.ReturnCode != "SUCCESS" || data.ResultCode != "SUCCESS" {
return errors.New(data.ReturnMsg)
}


Loading…
Cancel
Save