正在显示
7 个修改的文件
包含
167 行增加
和
4 行删除
| @@ -23,6 +23,13 @@ func (srv AuthService) AuthLogin(loginCommand *command.LoginCommand) (interface{ | @@ -23,6 +23,13 @@ func (srv AuthService) AuthLogin(loginCommand *command.LoginCommand) (interface{ | ||
| 23 | result interface{} | 23 | result interface{} |
| 24 | err error | 24 | err error |
| 25 | ) | 25 | ) |
| 26 | + creationUserGateway := allied_creation_user.NewHttplibAlliedCreationUser(domain.Operator{}) | ||
| 27 | + _, err = creationUserGateway.AuthRefreshIM(allied_creation_user.ReqAuthRefreshIM{ | ||
| 28 | + Phone: loginCommand.Phone, | ||
| 29 | + }) | ||
| 30 | + if err != nil { | ||
| 31 | + return nil, application.ThrowError(application.TRANSACTION_ERROR, "系统错误") | ||
| 32 | + } | ||
| 26 | switch loginCommand.GrantType { | 33 | switch loginCommand.GrantType { |
| 27 | case "signInPassword": | 34 | case "signInPassword": |
| 28 | result, err = srv.SignInPassword(loginCommand.Phone, loginCommand.Password) | 35 | result, err = srv.SignInPassword(loginCommand.Phone, loginCommand.Password) |
| @@ -347,6 +354,8 @@ func (srv AuthService) GetUserInfo(userInfoCommand *command.UserInfoCommand) (in | @@ -347,6 +354,8 @@ func (srv AuthService) GetUserInfo(userInfoCommand *command.UserInfoCommand) (in | ||
| 347 | "userName": resultUser.UserInfo.UserName, | 354 | "userName": resultUser.UserInfo.UserName, |
| 348 | "userPhone": resultUser.UserInfo.Phone, | 355 | "userPhone": resultUser.UserInfo.Phone, |
| 349 | "userAvatar": resultUser.UserInfo.Avatar, | 356 | "userAvatar": resultUser.UserInfo.Avatar, |
| 357 | + //"userCode": resultUser.UserInfo.UserCode, | ||
| 358 | + "email": resultUser.UserInfo.Email, | ||
| 350 | }, | 359 | }, |
| 351 | "department": resultUser.Department, | 360 | "department": resultUser.Department, |
| 352 | "company": map[string]interface{}{ | 361 | "company": map[string]interface{}{ |
| @@ -193,3 +193,34 @@ func (gateway HttplibAlliedCreationUser) AuthResetPhone(param ReqAuthResetPhone) | @@ -193,3 +193,34 @@ func (gateway HttplibAlliedCreationUser) AuthResetPhone(param ReqAuthResetPhone) | ||
| 193 | err = gateway.GetResponseData(result, &data) | 193 | err = gateway.GetResponseData(result, &data) |
| 194 | return &data, err | 194 | return &data, err |
| 195 | } | 195 | } |
| 196 | + | ||
| 197 | +//RefreshIM 刷新IM信息 | ||
| 198 | +func (gateway HttplibAlliedCreationUser) AuthRefreshIM(param ReqAuthRefreshIM) (*DataAuthRefreshIM, error) { | ||
| 199 | + url := gateway.baseUrL + "/auth/refresh-im" | ||
| 200 | + method := "POST" | ||
| 201 | + req := gateway.CreateRequest(url, method) | ||
| 202 | + log.Logger.Debug("向用户模块请求数据:刷新IM信息。", map[string]interface{}{ | ||
| 203 | + "api": method + ":" + url, | ||
| 204 | + "param": param, | ||
| 205 | + }) | ||
| 206 | + req, err := req.JSONBody(param) | ||
| 207 | + if err != nil { | ||
| 208 | + return nil, fmt.Errorf("请求刷新IM信息失败:%w", err) | ||
| 209 | + } | ||
| 210 | + | ||
| 211 | + byteResult, err := req.Bytes() | ||
| 212 | + if err != nil { | ||
| 213 | + return nil, fmt.Errorf("获取刷新IM信息失败:%w", err) | ||
| 214 | + } | ||
| 215 | + log.Logger.Debug("获取用户模块请求数据:刷新IM信息。", map[string]interface{}{ | ||
| 216 | + "result": string(byteResult), | ||
| 217 | + }) | ||
| 218 | + var result service_gateway.GatewayResponse | ||
| 219 | + err = json.Unmarshal(byteResult, &result) | ||
| 220 | + if err != nil { | ||
| 221 | + return nil, fmt.Errorf("解析刷新IM信息:%w", err) | ||
| 222 | + } | ||
| 223 | + var data DataAuthRefreshIM | ||
| 224 | + err = gateway.GetResponseData(result, &data) | ||
| 225 | + return &data, err | ||
| 226 | +} |
| @@ -59,3 +59,21 @@ type ( | @@ -59,3 +59,21 @@ type ( | ||
| 59 | ReqAuthResetPassword struct{} | 59 | ReqAuthResetPassword struct{} |
| 60 | DataAuthResetPassword struct{} | 60 | DataAuthResetPassword struct{} |
| 61 | ) | 61 | ) |
| 62 | + | ||
| 63 | +//重置手机号 | ||
| 64 | +type ( | ||
| 65 | + ReqAuthRefreshIM struct { | ||
| 66 | + // 手机号码 | ||
| 67 | + Phone string `cname:"手机号码" json:"phone" valid:"Required"` | ||
| 68 | + // 刷新标识 0:刷新IM信息,并返回 1:使用旧的im信息 | ||
| 69 | + RefreshFlag int `cname:"刷新标识" json:"refreshFlag"` | ||
| 70 | + } | ||
| 71 | + DataAuthRefreshIM struct { | ||
| 72 | + // 网易云信ID | ||
| 73 | + Accid string `json:"accid"` | ||
| 74 | + // 网易云信Token | ||
| 75 | + ImToken string `json:"imToken"` | ||
| 76 | + // 系统分配客服ID | ||
| 77 | + CsAccountId string `json:"csAccountId"` | ||
| 78 | + } | ||
| 79 | +) |
| @@ -41,6 +41,6 @@ func (controller *baseController) GetOperator() domain.Operator { | @@ -41,6 +41,6 @@ func (controller *baseController) GetOperator() domain.Operator { | ||
| 41 | UserId: 9, | 41 | UserId: 9, |
| 42 | CompanyId: 23, | 42 | CompanyId: 23, |
| 43 | OrgId: 45, | 43 | OrgId: 45, |
| 44 | - UserBaseId: 1, | 44 | + UserBaseId: 5, |
| 45 | } | 45 | } |
| 46 | } | 46 | } |
| 1 | +package web_client | ||
| 2 | + | ||
| 3 | +import ( | ||
| 4 | + "gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/application/web/cooperationMode/command" | ||
| 5 | + "gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/application/web/cooperationMode/query" | ||
| 6 | + "gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/application/web/cooperationMode/service" | ||
| 7 | + "strconv" | ||
| 8 | +) | ||
| 9 | + | ||
| 10 | +type CooperationModeController struct { | ||
| 11 | + baseController | ||
| 12 | +} | ||
| 13 | + | ||
| 14 | +func (controller *CooperationModeController) CreateCooperationMode() { | ||
| 15 | + svr := service.CooperationModeService{} | ||
| 16 | + cmd := &command.CreateCooperationModeCommand{} | ||
| 17 | + err := controller.Unmarshal(cmd) | ||
| 18 | + if err != nil { | ||
| 19 | + controller.Response(nil, err) | ||
| 20 | + return | ||
| 21 | + } | ||
| 22 | + cmd.Operator = controller.GetOperator() | ||
| 23 | + data, err := svr.CreateCooperationMode(cmd) | ||
| 24 | + controller.Response(data, err) | ||
| 25 | +} | ||
| 26 | + | ||
| 27 | +func (controller *CooperationModeController) UpdateCooperationMode() { | ||
| 28 | + svr := service.CooperationModeService{} | ||
| 29 | + cmd := &command.UpdateCooperationModeCommand{} | ||
| 30 | + err := controller.Unmarshal(cmd) | ||
| 31 | + if err != nil { | ||
| 32 | + controller.Response(nil, err) | ||
| 33 | + return | ||
| 34 | + } | ||
| 35 | + cooperationModeId := controller.GetString(":cooperationModeId") | ||
| 36 | + cmd.CooperationModeId, _ = strconv.Atoi(cooperationModeId) | ||
| 37 | + cmd.Operator = controller.GetOperator() | ||
| 38 | + data, err := svr.UpdateCooperationMode(cmd) | ||
| 39 | + controller.Response(data, err) | ||
| 40 | +} | ||
| 41 | + | ||
| 42 | +func (controller *CooperationModeController) GetCooperationMode() { | ||
| 43 | + svr := service.CooperationModeService{} | ||
| 44 | + cmd := &query.GetCooperationModeQuery{} | ||
| 45 | + err := controller.Unmarshal(cmd) | ||
| 46 | + if err != nil { | ||
| 47 | + controller.Response(nil, err) | ||
| 48 | + return | ||
| 49 | + } | ||
| 50 | + cooperationModeId := controller.GetString(":cooperationModeId") | ||
| 51 | + cmd.CooperationModeId, _ = strconv.Atoi(cooperationModeId) | ||
| 52 | + cmd.Operator = controller.GetOperator() | ||
| 53 | + data, err := svr.GetCooperationMode(cmd) | ||
| 54 | + controller.Response(data, err) | ||
| 55 | +} | ||
| 56 | + | ||
| 57 | +func (controller *CooperationModeController) RemoveCooperationMode() { | ||
| 58 | + svr := service.CooperationModeService{} | ||
| 59 | + cmd := &command.RemoveCooperationModeCommand{} | ||
| 60 | + err := controller.Unmarshal(cmd) | ||
| 61 | + if err != nil { | ||
| 62 | + controller.Response(nil, err) | ||
| 63 | + return | ||
| 64 | + } | ||
| 65 | + cooperationModeId := controller.GetString(":cooperationModeId") | ||
| 66 | + cmd.CooperationModeId, _ = strconv.Atoi(cooperationModeId) | ||
| 67 | + cmd.Operator = controller.GetOperator() | ||
| 68 | + data, err := svr.RemoveCooperationMode(cmd) | ||
| 69 | + controller.Response(data, err) | ||
| 70 | +} | ||
| 71 | + | ||
| 72 | +func (controller *CooperationModeController) SearchCooperationMode() { | ||
| 73 | + svr := service.CooperationModeService{} | ||
| 74 | + cmd := &query.ListCooperationModeQuery{} | ||
| 75 | + err := controller.Unmarshal(cmd) | ||
| 76 | + if err != nil { | ||
| 77 | + controller.Response(nil, err) | ||
| 78 | + return | ||
| 79 | + } | ||
| 80 | + cmd.Operator = controller.GetOperator() | ||
| 81 | + cnt, data, err := svr.ListCooperationMode(cmd) | ||
| 82 | + controller.returnPageListData(cnt, data, err, cmd.PageNumber) | ||
| 83 | +} | ||
| 84 | + | ||
| 85 | +func (controller *CooperationModeController) ListCooperationMode() { | ||
| 86 | + svr := service.CooperationModeService{} | ||
| 87 | + cmd := &query.ListCooperationModeQuery{} | ||
| 88 | + err := controller.Unmarshal(cmd) | ||
| 89 | + if err != nil { | ||
| 90 | + controller.Response(nil, err) | ||
| 91 | + return | ||
| 92 | + } | ||
| 93 | + cmd.Operator = controller.GetOperator() | ||
| 94 | + _, data, err := svr.ListCooperationMode(cmd) | ||
| 95 | + controller.Response(data, err) | ||
| 96 | +} |
| @@ -12,7 +12,7 @@ func init() { | @@ -12,7 +12,7 @@ func init() { | ||
| 12 | web.Router("/v1/app/auth/access-token", &mobile_client.AuthController{}, "Post:GetAuthAccessToken") | 12 | web.Router("/v1/app/auth/access-token", &mobile_client.AuthController{}, "Post:GetAuthAccessToken") |
| 13 | web.Router("/v1/app/auth/refresh-token", &mobile_client.AuthController{}, "Post:RefreshAuthAccessToken") | 13 | web.Router("/v1/app/auth/refresh-token", &mobile_client.AuthController{}, "Post:RefreshAuthAccessToken") |
| 14 | 14 | ||
| 15 | - web.Router("/v1/app/auth/user-info", &mobile_client.AuthController{}, "Post:GetUserInfo") | ||
| 16 | - web.Router("/v1/app/auth/user-menu", &mobile_client.AuthController{}, "Post:GetUserMenus") | ||
| 17 | - web.Router("/v1/app/auth/user-orgs", &mobile_client.AuthController{}, "Post:GetUserOrg") | 15 | + web.Router("/v1/app/user/user-info", &mobile_client.AuthController{}, "Post:GetUserInfo") |
| 16 | + web.Router("/v1/app/user/user-menu", &mobile_client.AuthController{}, "Post:GetUserMenus") | ||
| 17 | + web.Router("/v1/app/user/user-orgs", &mobile_client.AuthController{}, "Post:GetUserOrg") | ||
| 18 | } | 18 | } |
| @@ -11,4 +11,13 @@ func init() { | @@ -11,4 +11,13 @@ func init() { | ||
| 11 | web.Router("/v1/web/cooperation-projects/:projectId", &web_client.CooperationProjectController{}, "Get:GetCooperationProject") | 11 | web.Router("/v1/web/cooperation-projects/:projectId", &web_client.CooperationProjectController{}, "Get:GetCooperationProject") |
| 12 | web.Router("/v1/web/cooperation-projects/search", &web_client.CooperationProjectController{}, "Post:ListCooperationProject") | 12 | web.Router("/v1/web/cooperation-projects/search", &web_client.CooperationProjectController{}, "Post:ListCooperationProject") |
| 13 | web.Router("/v1/web/cooperation-projects/end", &web_client.CooperationProjectController{}, "Put:EndCooperationProject") | 13 | web.Router("/v1/web/cooperation-projects/end", &web_client.CooperationProjectController{}, "Put:EndCooperationProject") |
| 14 | + | ||
| 15 | + /***** 1.共创模式 *****/ | ||
| 16 | + web.Router("/v1/web/cooperation-modes/", &web_client.CooperationModeController{}, "Post:CreateCooperationMode") | ||
| 17 | + web.Router("/v1/web/cooperation-modes/:cooperationModeId", &web_client.CooperationModeController{}, "Put:UpdateCooperationMode") | ||
| 18 | + web.Router("/v1/web/cooperation-modes/:cooperationModeId", &web_client.CooperationModeController{}, "Get:GetCooperationMode") | ||
| 19 | + web.Router("/v1/web/cooperation-modes/:cooperationModeId", &web_client.CooperationModeController{}, "Delete:RemoveCooperationMode") | ||
| 20 | + web.Router("/v1/web/cooperation-modes/search", &web_client.CooperationModeController{}, "Post:SearchCooperationMode") | ||
| 21 | + web.Router("/v1/web/cooperation-modes/", &web_client.CooperationModeController{}, "Get:ListCooperationMode") | ||
| 22 | + | ||
| 14 | } | 23 | } |
-
请 注册 或 登录 后发表评论