|
|
@ -41,6 +41,27 @@ func (UserRPC) Info(c *hbtp.Context, id string) { |
|
|
|
} |
|
|
|
c.ResJson(hbtp.ResStatusOk, e) |
|
|
|
} |
|
|
|
func (UserRPC) CheckInfo(c *hbtp.Context, m *ruisUtil.Map) { |
|
|
|
xid := m.GetString("xid") |
|
|
|
hash := m.GetString("hash") |
|
|
|
if xid == "" || hash == "" { |
|
|
|
c.ResString(hbtp.ResStatusErr, "param err") |
|
|
|
return |
|
|
|
} |
|
|
|
|
|
|
|
e := &models.SysUser{} |
|
|
|
key := fmt.Sprintf("uinfo:%s", xid) |
|
|
|
if err := gocloud.CacheGets(key, e); err != nil { |
|
|
|
e = userService.FindXid(xid) |
|
|
|
gocloud.CacheSets(key, e, time.Hour*2) |
|
|
|
} |
|
|
|
if hash != utils.CacLoginHash(e.Pass) { |
|
|
|
c.ResString(hbtp.ResStatusErr, "param err") |
|
|
|
return |
|
|
|
} |
|
|
|
|
|
|
|
c.ResJson(hbtp.ResStatusOk, e) |
|
|
|
} |
|
|
|
func (UserRPC) Login(c *hbtp.Context, m *sysBean.LoginReq) { |
|
|
|
if m.Name == "" { |
|
|
|
c.ResString(hbtp.ResStatusErr, "param err:name!") |
|
|
@ -79,6 +100,7 @@ func (UserRPC) Login(c *hbtp.Context, m *sysBean.LoginReq) { |
|
|
|
ret.Uid = usr.Id |
|
|
|
ret.Xid = usr.Xid |
|
|
|
ret.Name = usr.Name |
|
|
|
ret.SetHash(usr.Pass) |
|
|
|
c.ResJson(hbtp.ResStatusOk, ret) |
|
|
|
} |
|
|
|
func (UserRPC) Reg(c *hbtp.Context, m *sysBean.RegReq) { |
|
|
@ -128,6 +150,7 @@ func (UserRPC) Reg(c *hbtp.Context, m *sysBean.RegReq) { |
|
|
|
ret.Uid = ne.Id |
|
|
|
ret.Xid = ne.Xid |
|
|
|
ret.Name = ne.Name |
|
|
|
ret.SetHash(ne.Pass) |
|
|
|
c.ResJson(hbtp.ResStatusOk, ret) |
|
|
|
} |
|
|
|
func (UserRPC) Forgot(c *hbtp.Context, m *sysBean.LoginReq) { |
|
|
@ -160,6 +183,7 @@ func (UserRPC) Forgot(c *hbtp.Context, m *sysBean.LoginReq) { |
|
|
|
ret.Uid = ne.Id |
|
|
|
ret.Xid = ne.Xid |
|
|
|
ret.Name = ne.Name |
|
|
|
ret.SetHash(ne.Pass) |
|
|
|
c.ResJson(hbtp.ResStatusOk, ret) |
|
|
|
} |
|
|
|
func (UserRPC) Uppass(c *hbtp.Context, m *sysBean.UppassReq) { |
|
|
@ -198,10 +222,12 @@ func (UserRPC) Uppass(c *hbtp.Context, m *sysBean.UppassReq) { |
|
|
|
c.ResJson(hbtp.ResStatusOk, ret) |
|
|
|
return |
|
|
|
} |
|
|
|
commCloud.ClearUserCache(ne.Xid) |
|
|
|
|
|
|
|
ret.Stat = 1 |
|
|
|
ret.Uid = ne.Id |
|
|
|
ret.Xid = ne.Xid |
|
|
|
ret.Name = ne.Name |
|
|
|
ret.SetHash(ne.Pass) |
|
|
|
c.ResJson(hbtp.ResStatusOk, ret) |
|
|
|
} |