正在显示
4 个修改的文件
包含
24 行增加
和
5 行删除
@@ -40,7 +40,7 @@ func (usersService *UsersService) CompanyUserGet(companyUserGetQuery *query.Comp | @@ -40,7 +40,7 @@ func (usersService *UsersService) CompanyUserGet(companyUserGetQuery *query.Comp | ||
40 | } | 40 | } |
41 | datas := map[string]interface{}{ | 41 | datas := map[string]interface{}{ |
42 | "user": user, | 42 | "user": user, |
43 | - "userMenu": "", | 43 | + "userMenu": "", //TODO |
44 | } | 44 | } |
45 | return datas, err | 45 | return datas, err |
46 | } | 46 | } |
@@ -18,6 +18,9 @@ func NewHttplibAlliedCreationUser(companyId int64, orgId int64, userId int64) *H | @@ -18,6 +18,9 @@ func NewHttplibAlliedCreationUser(companyId int64, orgId int64, userId int64) *H | ||
18 | BaseServiceGateway: service_gateway.BaseServiceGateway{ | 18 | BaseServiceGateway: service_gateway.BaseServiceGateway{ |
19 | ConnectTimeout: 100 * time.Second, | 19 | ConnectTimeout: 100 * time.Second, |
20 | ReadWriteTimeout: 30 * time.Second, | 20 | ReadWriteTimeout: 30 * time.Second, |
21 | + CompanyId: companyId, | ||
22 | + OrgId: orgId, | ||
23 | + UserId: userId, | ||
21 | }, | 24 | }, |
22 | baseUrL: constant.ALLIED_CREATION_USER_HOST, | 25 | baseUrL: constant.ALLIED_CREATION_USER_HOST, |
23 | } | 26 | } |
@@ -3,6 +3,7 @@ package service_gateway | @@ -3,6 +3,7 @@ package service_gateway | ||
3 | import ( | 3 | import ( |
4 | "encoding/json" | 4 | "encoding/json" |
5 | "fmt" | 5 | "fmt" |
6 | + "strconv" | ||
6 | "time" | 7 | "time" |
7 | 8 | ||
8 | "github.com/beego/beego/v2/client/httplib" | 9 | "github.com/beego/beego/v2/client/httplib" |
@@ -22,6 +23,9 @@ type GatewayResponse struct { | @@ -22,6 +23,9 @@ type GatewayResponse struct { | ||
22 | type BaseServiceGateway struct { | 23 | type BaseServiceGateway struct { |
23 | ConnectTimeout time.Duration | 24 | ConnectTimeout time.Duration |
24 | ReadWriteTimeout time.Duration | 25 | ReadWriteTimeout time.Duration |
26 | + CompanyId int64 | ||
27 | + OrgId int64 | ||
28 | + UserId int64 | ||
25 | } | 29 | } |
26 | 30 | ||
27 | func (gateway BaseServiceGateway) CreateRequest(url string, method string) *httplib.BeegoHTTPRequest { | 31 | func (gateway BaseServiceGateway) CreateRequest(url string, method string) *httplib.BeegoHTTPRequest { |
@@ -40,6 +44,9 @@ func (gateway BaseServiceGateway) CreateRequest(url string, method string) *http | @@ -40,6 +44,9 @@ func (gateway BaseServiceGateway) CreateRequest(url string, method string) *http | ||
40 | default: | 44 | default: |
41 | request = httplib.Get(url) | 45 | request = httplib.Get(url) |
42 | } | 46 | } |
47 | + request.Header("companyId", strconv.FormatInt(gateway.CompanyId, 10)) | ||
48 | + request.Header("orgId", strconv.FormatInt(gateway.OrgId, 10)) | ||
49 | + request.Header("userId", strconv.FormatInt(gateway.UserId, 10)) | ||
43 | return request.SetTimeout(gateway.ConnectTimeout, gateway.ReadWriteTimeout) | 50 | return request.SetTimeout(gateway.ConnectTimeout, gateway.ReadWriteTimeout) |
44 | } | 51 | } |
45 | 52 |
@@ -11,6 +11,15 @@ type UsersController struct { | @@ -11,6 +11,15 @@ type UsersController struct { | ||
11 | beego.BaseController | 11 | beego.BaseController |
12 | } | 12 | } |
13 | 13 | ||
14 | +func (controller *UsersController) returnPageListData(count int64, data interface{}, err error, pageNumber int) { | ||
15 | + dataMap := map[string]interface{}{ | ||
16 | + "totalRow": count, | ||
17 | + "pageNumber": pageNumber, | ||
18 | + "list": data, | ||
19 | + } | ||
20 | + controller.Response(dataMap, err) | ||
21 | +} | ||
22 | + | ||
14 | func (controller *UsersController) CompanyUserAdd() { | 23 | func (controller *UsersController) CompanyUserAdd() { |
15 | usersService := service.NewUsersService(nil) | 24 | usersService := service.NewUsersService(nil) |
16 | companyUserAddCommand := &command.CompanyUserAddCommand{} | 25 | companyUserAddCommand := &command.CompanyUserAddCommand{} |
@@ -30,9 +39,9 @@ func (controller *UsersController) CompanyUserUpdate() { | @@ -30,9 +39,9 @@ func (controller *UsersController) CompanyUserUpdate() { | ||
30 | func (controller *UsersController) CompanyUserList() { | 39 | func (controller *UsersController) CompanyUserList() { |
31 | usersService := service.NewUsersService(nil) | 40 | usersService := service.NewUsersService(nil) |
32 | companyUserListQuery := &query.CompanyUserListQuery{} | 41 | companyUserListQuery := &query.CompanyUserListQuery{} |
42 | + controller.Unmarshal(companyUserListQuery) | ||
33 | cnt, data, err := usersService.CompanyUserList(companyUserListQuery) | 43 | cnt, data, err := usersService.CompanyUserList(companyUserListQuery) |
34 | - _ = cnt | ||
35 | - controller.Response(data, err) | 44 | + controller.returnPageListData(cnt, data, err, companyUserListQuery.PageNumber) |
36 | } | 45 | } |
37 | 46 | ||
38 | func (controller *UsersController) CompanyUserGet() { | 47 | func (controller *UsersController) CompanyUserGet() { |
@@ -79,9 +88,9 @@ func (controller *UsersController) CooperationUserUpdate() { | @@ -79,9 +88,9 @@ func (controller *UsersController) CooperationUserUpdate() { | ||
79 | func (controller *UsersController) CooperationUserList() { | 88 | func (controller *UsersController) CooperationUserList() { |
80 | usersService := service.NewUsersService(nil) | 89 | usersService := service.NewUsersService(nil) |
81 | cooperationUserListQuery := &query.CooperationUserListQuery{} | 90 | cooperationUserListQuery := &query.CooperationUserListQuery{} |
91 | + controller.Unmarshal(cooperationUserListQuery) | ||
82 | cnt, data, err := usersService.CooperationUserList(cooperationUserListQuery) | 92 | cnt, data, err := usersService.CooperationUserList(cooperationUserListQuery) |
83 | - _ = cnt | ||
84 | - controller.Response(data, err) | 93 | + controller.returnPageListData(cnt, data, err, cooperationUserListQuery.PageNumber) |
85 | } | 94 | } |
86 | 95 | ||
87 | func (controller *UsersController) CooperationUserGet() { | 96 | func (controller *UsersController) CooperationUserGet() { |
-
请 注册 或 登录 后发表评论