huangjiajun 1 giorno fa
parent
commit
8f1bb68cbe
2 ha cambiato i file con 16 aggiunte e 0 eliminazioni
  1. +15
    -0
      app/hdl/hdl_login.go
  2. +1
    -0
      app/md/md_login.go

+ 15
- 0
app/hdl/hdl_login.go Vedi File

@@ -216,6 +216,21 @@ func Register(c *gin.Context) {
e.OutErr(c, e.ERR_DB_ORM, "新增 记录失败")
return
}
if utils.StrToInt(req.AgentId) > 0 {
NewAgentWithMediumDb := implement2.NewAgentWithMediumDb(db.Db)
data := NewAgentWithMediumDb.GetAgentWithMediumByMediumIdAndAgentId(utils.StrToInt(mediumId), utils.StrToInt(req.AgentId))
if data != nil {
e.OutErr(c, 400, e.NewErr(400, "已绑定过该渠道代理"))
return
}
var tmp = model.AgentWithMedium{
AgentId: utils.StrToInt(req.AgentId),
MediumId: utils.StrToInt(mediumId),
CreateAt: time.Now().Format("2006-01-02 15:04:05"),
UpdateAt: time.Now().Format("2006-01-02 15:04:05"),
}
db.Db.InsertOne(&tmp)
}
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 Vedi File

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

Caricamento…
Annulla
Salva