Browse Source

update

master
DengBiao 1 year ago
parent
commit
8948cd054a
5 changed files with 15 additions and 6 deletions
  1. +3
    -1
      app/db/db_qrcode.go
  2. +1
    -1
      app/db/model/qrcode.go
  3. +2
    -2
      app/hdl/hdl_demo.go
  4. +8
    -1
      app/hdl/hdl_wx.go
  5. +1
    -1
      app/svc/svc_qrcode.go

+ 3
- 1
app/db/db_qrcode.go View File

@@ -4,6 +4,7 @@ import (
"applet/app/db/model" "applet/app/db/model"
"applet/app/enum" "applet/app/enum"
"applet/app/utils/logx" "applet/app/utils/logx"
"fmt"
"xorm.io/xorm" "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) { func (qrcodeDb *QrcodeDb) GetQrcodeByIndex(index string) (m *model.Qrcode, err error) {
fmt.Println(">>>>>>>>>>>>>>>>>>identity<<<<<<<<<<<<<<", index)
m = new(model.Qrcode) 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 { if err != nil {
return nil, logx.Error(err) return nil, logx.Error(err)
} }


+ 1
- 1
app/db/model/qrcode.go View File

@@ -4,7 +4,7 @@ type Qrcode struct {
Id int `json:"id" xorm:"not null pk autoincr INT(11)"` Id int `json:"id" xorm:"not null pk autoincr INT(11)"`
Url string `json:"url" xorm:"not null default '' comment('url地址') VARCHAR(255)"` 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)"` 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"` 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"` UpdateAt string `json:"update_at" xorm:"not null default CURRENT_TIMESTAMP comment('更新时间') TIMESTAMP"`
} }

+ 2
- 2
app/hdl/hdl_demo.go View File

@@ -27,8 +27,8 @@ func Demo(c *gin.Context) {


func Demo1(c *gin.Context) { func Demo1(c *gin.Context) {
post, err := utils.CurlPost("http://pay.com/wx/redPackage/index", map[string]string{ 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) }, nil)
if err != nil { if err != nil {
fmt.Println(err) fmt.Println(err)


+ 8
- 1
app/hdl/hdl_wx.go View File

@@ -214,10 +214,17 @@ func DealCallBack(openId, ticket string) error {
} }


//4、发送微信红包 //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, "openid": openId,
"amount": utils.Float64ToStr(utils.StrToFloat64(qrcodeWithBatchRecord.Amount) * 100), "amount": utils.Float64ToStr(utils.StrToFloat64(qrcodeWithBatchRecord.Amount) * 100),
}, nil) }, 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 { if err != nil {
return err return err
} }


+ 1
- 1
app/svc/svc_qrcode.go View File

@@ -54,7 +54,7 @@ func CreateQrcode(createNums int) (err error) {
insertData = append(insertData, &model.Qrcode{ insertData = append(insertData, &model.Qrcode{
Url: qrcodeUrl, Url: qrcodeUrl,
State: enum.QrcodeSateAllowUse, State: enum.QrcodeSateAllowUse,
Index: sceneStr,
Identity: sceneStr,
CreateAt: now.Format("2006-01-02 15:00:00"), CreateAt: now.Format("2006-01-02 15:00:00"),
UpdateAt: now.Format("2006-01-02 15:00:00"), UpdateAt: now.Format("2006-01-02 15:00:00"),
}) })


Loading…
Cancel
Save