作者 yangfu

获取用户信息修改

@@ -548,6 +548,10 @@ type Picture struct { @@ -548,6 +548,10 @@ type Picture struct {
548 //JobId string `json:"job_id"` 548 //JobId string `json:"job_id"`
549 } 549 }
550 550
  551 +type Avatar struct {
  552 + Path string `json:"path"`
  553 +}
  554 +
551 //视频 555 //视频
552 type Video struct { 556 type Video struct {
553 Path string `json:"path"` 557 Path string `json:"path"`
@@ -13,6 +13,10 @@ var errmessge ErrorMap = map[int]string{ @@ -13,6 +13,10 @@ var errmessge ErrorMap = map[int]string{
13 5: "繁忙,请稍后再试", 13 5: "繁忙,请稍后再试",
14 101: "clientId或clientSecret无效", 14 101: "clientId或clientSecret无效",
15 113: "签名验证失败", 15 113: "签名验证失败",
  16 + 502: "用户不存在",
  17 + 503: "用户被禁用",
  18 + 601: "公司被禁用",
  19 + 602: "用户无模块权限",
16 1009: "验证码已失效", 20 1009: "验证码已失效",
17 1011: "获取验证码次数超出限制,请联系管理员", 21 1011: "获取验证码次数超出限制,请联系管理员",
18 1012: "请输入正确的验证码", 22 1012: "请输入正确的验证码",
@@ -64,14 +64,14 @@ type UserStatisticsResponse struct { @@ -64,14 +64,14 @@ type UserStatisticsResponse struct {
64 } 64 }
65 65
66 type User struct { 66 type User struct {
67 - UserId int64 `json:"uid"`  
68 - MUserId int64 `json:"muid"` //中台用户ID  
69 - Name string `json:"uname"`  
70 - Phone string `json:"phone"`  
71 - Image Picture `json:"image"`  
72 - Department Dep `json:"dep"`  
73 - Position Job `json:"job"`  
74 - ImToken string `json:"imToken"` 67 + UserId int64 `json:"uid"`
  68 + MUserId int64 `json:"muid"` //中台用户ID
  69 + Name string `json:"uname"`
  70 + Phone string `json:"phone"`
  71 + Image Avatar `json:"image"`
  72 + Department Dep `json:"dep"`
  73 + Position Job `json:"job"`
  74 + ImToken string `json:"imToken"`
75 75
76 //companys 76 //companys
77 CompanyId int `json:"companyId"` 77 CompanyId int `json:"companyId"`
@@ -302,6 +302,11 @@ func Authorize(header *protocol.RequestHeader, request *protocol.AuthorizeReques @@ -302,6 +302,11 @@ func Authorize(header *protocol.RequestHeader, request *protocol.AuthorizeReques
302 userCompany *models.UserCompany 302 userCompany *models.UserCompany
303 company *models.Company 303 company *models.Company
304 ) 304 )
  305 + //验证 当前登录的公司是否有模块权限
  306 + if err = CheckBusinessAuth(header, request.Muid); err != nil {
  307 + log.Error(request.Muid, err)
  308 + return
  309 + }
305 //判断用户是否添加 310 //判断用户是否添加
306 user, err = models.GetUserByUcenterId(id) 311 user, err = models.GetUserByUcenterId(id)
307 if err != nil { 312 if err != nil {
@@ -347,11 +352,6 @@ func Authorize(header *protocol.RequestHeader, request *protocol.AuthorizeReques @@ -347,11 +352,6 @@ func Authorize(header *protocol.RequestHeader, request *protocol.AuthorizeReques
347 err = protocol.NewCustomMessage(2002, "版本不足,请升级app") //账号不存在 352 err = protocol.NewCustomMessage(2002, "版本不足,请升级app") //账号不存在
348 return 353 return
349 } 354 }
350 - //验证 当前登录的公司是否有模块权限  
351 - if err = CheckBusinessAuth(header, request.Muid); err != nil {  
352 - log.Error(request.Muid, err)  
353 - return  
354 - }  
355 //获取最后一次公司编号给统一用户中心 355 //获取最后一次公司编号给统一用户中心
356 //if u, e := models.GetUserAuthByUserId(user.Id, protocol.DeviceType); e == nil && user.UserCenterId == id { 356 //if u, e := models.GetUserAuthByUserId(user.Id, protocol.DeviceType); e == nil && user.UserCenterId == id {
357 // if currentCompany, e = models.GetCompanyById(u.CurrentCompanyId); e == nil { 357 // if currentCompany, e = models.GetCompanyById(u.CurrentCompanyId); e == nil {
@@ -361,10 +361,8 @@ func UserInfo(header *protocol.RequestHeader, request *protocol.UserInfoRequest) @@ -361,10 +361,8 @@ func UserInfo(header *protocol.RequestHeader, request *protocol.UserInfoRequest)
361 MUserId: header.UserId, 361 MUserId: header.UserId,
362 Name: userBaseAgg.User.NickName, 362 Name: userBaseAgg.User.NickName,
363 Phone: userBaseAgg.User.Phone, 363 Phone: userBaseAgg.User.Phone,
364 - Image: protocol.Picture{ 364 + Image: protocol.Avatar{
365 Path: userBaseAgg.User.Icon, 365 Path: userBaseAgg.User.Icon,
366 - H: 0,  
367 - W: 0,  
368 }, 366 },
369 ImToken: userBaseAgg.User.ImToken, 367 ImToken: userBaseAgg.User.ImToken,
370 CompanyId: int(companyId), 368 CompanyId: int(companyId),
@@ -475,13 +473,12 @@ func UserInfoV3(header *protocol.RequestHeader, request *protocol.UserInfoReques @@ -475,13 +473,12 @@ func UserInfoV3(header *protocol.RequestHeader, request *protocol.UserInfoReques
475 } 473 }
476 rsp = &protocol.UserInfoResponse{ 474 rsp = &protocol.UserInfoResponse{
477 User: protocol.User{ 475 User: protocol.User{
478 - UserId: header.UserId,  
479 - Name: userBaseAgg.User.NickName,  
480 - Phone: userBaseAgg.User.Phone,  
481 - Image: protocol.Picture{ 476 + UserId: header.UserId,
  477 + MUserId: header.UserId,
  478 + Name: userBaseAgg.User.NickName,
  479 + Phone: userBaseAgg.User.Phone,
  480 + Image: protocol.Avatar{
482 Path: userBaseAgg.User.Icon, 481 Path: userBaseAgg.User.Icon,
483 - H: 0,  
484 - W: 0,  
485 }, 482 },
486 ImToken: userBaseAgg.User.ImToken, 483 ImToken: userBaseAgg.User.ImToken,
487 CompanyId: int(companyId), 484 CompanyId: int(companyId),