Browse Source

update

master
dengbiao 1 month ago
parent
commit
73fffa3c77
3 changed files with 31 additions and 1 deletions
  1. +29
    -0
      app/hdl/hdl_login.go
  2. +1
    -0
      app/md/md_login.go
  3. +1
    -1
      go.mod

+ 29
- 0
app/hdl/hdl_login.go View File

@@ -210,12 +210,41 @@ func Register(c *gin.Context) {
}
insertAffected, err = db.Db.Insert(&MediumDivisionStrategyModel)
if err != nil {
e.OutErr(c, e.ERR_DB_ORM, err.Error())
return
}
if insertAffected <= 0 {
e.OutErr(c, e.ERR_DB_ORM, "新增 记录失败")
return
}

//5、判断是否为渠道代理邀请
if req.AgentId != "" {
agentDb := implement.NewAgentDb(engine)
agent, err1 := agentDb.GetAgent(utils.StrToInt(req.AgentId))
if err1 != nil {
e.OutErr(c, e.ERR_DB_ORM, err1.Error())
return
}
if agent != nil {
//5.1 新增agent_with_medium记录
agentWithMediumDb := implement2.NewAgentWithMediumDb(engine)
insertAffected, err = agentWithMediumDb.AgentWithMediumInsert(&model.AgentWithMedium{
AgentId: utils.StrToInt(req.AgentId),
MediumId: utils.StrToInt(mediumId),
CreateAt: now.Format("2006-01-02 15:04:05"),
UpdateAt: now.Format("2006-01-02 15:04:05"),
})
if err != nil {
e.OutErr(c, e.ERR_DB_ORM, err.Error())
return
}
if insertAffected <= 0 {
e.OutErr(c, e.ERR_DB_ORM, "新增 agent_with_medium 记录失败")
return
}
}
}
ip := utils.GetIP(c.Request)
key := fmt.Sprintf(md.JwtTokenKey, ip, utils.AnyToString(mediumModel.Id))
token, err := svc.HandleLoginToken(key, &mediumModel)


+ 1
- 0
app/md/md_login.go View File

@@ -16,6 +16,7 @@ type LoginPhoneReq struct {
}
type RegisterReq struct {
UserName string `json:"username" binding:"required" example:"登录账号"`
AgentId string `json:"agent_id" example:"代理id"`
Captcha string `json:"captcha" binding:"required" example:"验证码"`
PassWord string `json:"password" binding:"required" example:"登录密码"`
}

+ 1
- 1
go.mod View File

@@ -2,7 +2,7 @@ module applet

go 1.18

//replace code.fnuoos.com/zhimeng/model.git => E:/company/ad/models
replace code.fnuoos.com/zhimeng/model.git => E:/company/ad/models

//
require (


Loading…
Cancel
Save