소스 검색

update

master
dengbiao 1 일 전
부모
커밋
73fffa3c77
3개의 변경된 파일31개의 추가작업 그리고 1개의 파일을 삭제
  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 파일 보기

@@ -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 파일 보기

@@ -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 파일 보기

@@ -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 (


불러오는 중...
취소
저장