|
@@ -216,6 +216,21 @@ func Register(c *gin.Context) { |
|
|
e.OutErr(c, e.ERR_DB_ORM, "新增 记录失败") |
|
|
e.OutErr(c, e.ERR_DB_ORM, "新增 记录失败") |
|
|
return |
|
|
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) |
|
|
ip := utils.GetIP(c.Request) |
|
|
key := fmt.Sprintf(md.JwtTokenKey, ip, utils.AnyToString(mediumModel.Id)) |
|
|
key := fmt.Sprintf(md.JwtTokenKey, ip, utils.AnyToString(mediumModel.Id)) |
|
|
token, err := svc.HandleLoginToken(key, &mediumModel) |
|
|
token, err := svc.HandleLoginToken(key, &mediumModel) |
|
|