Browse Source

fix:bug

token_replace
黄梓健 4 years ago
parent
commit
648c1b13d9
  1. 2
      controllers/client/live.go
  2. 38
      controllers/client/login.go
  3. 4
      go.mod
  4. 4
      go.sum
  5. 3
      main.go
  6. 1
      services/pay/handle.go

2
controllers/client/live.go

@ -161,7 +161,7 @@ func (t *LiveCtl) SendLiveRedPack() {
amount := utils.Float64CusDecimal(t.MustGetDouble("amount"), 2) // 金额
areaId := t.MustGetInt("area_id")
if amount/float64(num) < 1 && amount/float64(num) > 200 { // 平均每个红包不得小于0.3
if amount/float64(num) < 1 || amount/float64(num) > 200 { //
t.ERROR("每个红包的平均金额必须在1.00元到200.00元之间", code.MSG_ERR)
return
}

38
controllers/client/login.go

@ -161,7 +161,7 @@ func (t *UserCtl) WxLogin() {
}
func (t *UserCtl) Login() {
activityId := t.MustGetInt("activity_id")
//activityId := t.MustGetInt("activity_id")
wxcode := t.MustGet("code")
admin := t.DefaultInt("admin", 0)
@ -177,24 +177,24 @@ func (t *UserCtl) Login() {
}
area := &models.AreaStore{}
if admin == 1 {
username := t.MustGet("username")
password := t.MustGet("password")
exist, err := area.Login(activityId, username, password)
t.CheckErr(err)
t.Assert(exist, code.MSG_ERR_Authority, "不存在地区管理员")
if area.UserId != user.Id {
area.UserId = user.Id
_, err = models.Update(area.Id, area, "user_id")
t.CheckErr(err)
}
} else {
exist, err := area.GetByUserId(activityId, user.Id)
t.CheckErr(err)
if exist { // 管理员
admin = 1
}
}
//if admin == 1 {
// username := t.MustGet("username")
// password := t.MustGet("password")
// exist, err := area.Login(activityId, username, password)
// t.CheckErr(err)
// t.Assert(exist, code.MSG_ERR_Authority, "不存在地区管理员")
// if area.UserId != user.Id {
// area.UserId = user.Id
// _, err = models.Update(area.Id, area, "user_id")
// t.CheckErr(err)
// }
//} else {
// exist, err := area.GetByUserId(activityId, user.Id)
// t.CheckErr(err)
// if exist { // 管理员
// admin = 1
// }
//}
jwtToken, err := jwt.GenJwtToken(define.TYPE_H5USER, user.Id, 0, 0, 0, 0)
t.CheckErr(err)

4
go.mod

@ -5,7 +5,7 @@ go 1.12
require (
github.com/360EntSecGroup-Skylar/excelize/v2 v2.0.1
github.com/CloudyKit/fastprinter v0.0.0-20200109182630-33d98a066a53 // indirect
github.com/aws/aws-sdk-go v1.34.10 // indirect
github.com/aws/aws-sdk-go v1.34.12 // indirect
github.com/chanxuehong/wechat v0.0.0-20200409104612-0a1fd76d7a3a
github.com/dgrijalva/jwt-go v3.2.0+incompatible
github.com/elazarl/go-bindata-assetfs v1.0.0 // indirect
@ -41,7 +41,7 @@ require (
go.uber.org/atomic v1.6.0
go.uber.org/zap v1.15.0
golang.org/x/image v0.0.0-20190910094157-69e4b8554b2a // indirect
golang.org/x/sys v0.0.0-20200824131525-c12d262b63d8 // indirect
golang.org/x/sys v0.0.0-20200826173525-f9321e4c35a6 // indirect
google.golang.org/appengine v1.6.5 // indirect
gopkg.in/natefinch/lumberjack.v2 v2.0.0
gopkg.in/olahol/melody.v1 v1.0.0-20170518105555-d52139073376

4
go.sum

@ -77,6 +77,8 @@ github.com/aws/aws-sdk-go v1.34.4 h1:Yx49/+ZMCD9YqIVsO3CsiMs4hnUnokd9otKvWYFjnYw
github.com/aws/aws-sdk-go v1.34.4/go.mod h1:5zCpMtNQVjRREroY7sYe8lOMRSxkhG6MZveU8YkpAk0=
github.com/aws/aws-sdk-go v1.34.10 h1:VU78gcf/3wA4HNEDCHidK738l7K0Bals4SJnfnvXOtY=
github.com/aws/aws-sdk-go v1.34.10/go.mod h1:5zCpMtNQVjRREroY7sYe8lOMRSxkhG6MZveU8YkpAk0=
github.com/aws/aws-sdk-go v1.34.12 h1:7UbBEYDUa4uW0YmRnOd806MS1yoJMcaodBWDzvBShAI=
github.com/aws/aws-sdk-go v1.34.12/go.mod h1:5zCpMtNQVjRREroY7sYe8lOMRSxkhG6MZveU8YkpAk0=
github.com/beorn7/perks v0.0.0-20180321164747-3a771d992973/go.mod h1:Dwedo/Wpr24TaqPxmxbtue+5NUziq4I4S80YR8gNf3Q=
github.com/bndr/gotabulate v1.1.2 h1:yC9izuZEphojb9r+KYL4W9IJKO/ceIO8HDwxMA24U4c=
github.com/bndr/gotabulate v1.1.2/go.mod h1:0+8yUgaPTtLRTjf49E8oju7ojpU11YmXyvq1LbPAb3U=
@ -533,6 +535,8 @@ golang.org/x/sys v0.0.0-20200812155832-6a926be9bd1d h1:QQrM/CCYEzTs91GZylDCQjGHu
golang.org/x/sys v0.0.0-20200812155832-6a926be9bd1d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20200824131525-c12d262b63d8 h1:AvbQYmiaaaza3cW3QXRyPo5kYgpFIzOAfeAAN7m3qQ4=
golang.org/x/sys v0.0.0-20200824131525-c12d262b63d8/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20200826173525-f9321e4c35a6 h1:DvY3Zkh7KabQE/kfzMvYvKirSiguP9Q/veMtkYyf0o8=
golang.org/x/sys v0.0.0-20200826173525-f9321e4c35a6/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
golang.org/x/text v0.3.1-0.20180807135948-17ff2d5776d2/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
golang.org/x/text v0.3.2 h1:tW2bmiBqwgJj/UpqtC8EpXEZVYOwU0yG4iWbprSVAcs=

3
main.go

@ -6,12 +6,11 @@ import (
"hudongzhuanjia/controllers/client"
"hudongzhuanjia/controllers/common"
"hudongzhuanjia/controllers/pc"
"hudongzhuanjia/utils/define"
//_ "net/http/pprof"
)
func main() {
define.SetDebug(true)
//define.SetDebug(true)
// pc
core.GetInstanceRouterManage().Registered(new(pc.WsCtl)) // 用户

1
services/pay/handle.go

@ -19,7 +19,6 @@ func init() {
//处理支付成功之后的回调问题
func HandleSuccess(order *models.UserOrder) error {
if order.GoodType == 4 { // 直播商品
// 可以使用事务进行控制
activity := new(models.Activity)
exist, err := models.Get(activity, order.ActivityId)
if err != nil || !exist {

Loading…
Cancel
Save