作者 tangxuhui

更新 用户模块

... ... @@ -40,7 +40,7 @@ func (usersService *UsersService) CompanyUserGet(companyUserGetQuery *query.Comp
}
datas := map[string]interface{}{
"user": user,
"userMenu": "",
"userMenu": "", //TODO
}
return datas, err
}
... ...
... ... @@ -18,6 +18,9 @@ func NewHttplibAlliedCreationUser(companyId int64, orgId int64, userId int64) *H
BaseServiceGateway: service_gateway.BaseServiceGateway{
ConnectTimeout: 100 * time.Second,
ReadWriteTimeout: 30 * time.Second,
CompanyId: companyId,
OrgId: orgId,
UserId: userId,
},
baseUrL: constant.ALLIED_CREATION_USER_HOST,
}
... ...
... ... @@ -3,6 +3,7 @@ package service_gateway
import (
"encoding/json"
"fmt"
"strconv"
"time"
"github.com/beego/beego/v2/client/httplib"
... ... @@ -22,6 +23,9 @@ type GatewayResponse struct {
type BaseServiceGateway struct {
ConnectTimeout time.Duration
ReadWriteTimeout time.Duration
CompanyId int64
OrgId int64
UserId int64
}
func (gateway BaseServiceGateway) CreateRequest(url string, method string) *httplib.BeegoHTTPRequest {
... ... @@ -40,6 +44,9 @@ func (gateway BaseServiceGateway) CreateRequest(url string, method string) *http
default:
request = httplib.Get(url)
}
request.Header("companyId", strconv.FormatInt(gateway.CompanyId, 10))
request.Header("orgId", strconv.FormatInt(gateway.OrgId, 10))
request.Header("userId", strconv.FormatInt(gateway.UserId, 10))
return request.SetTimeout(gateway.ConnectTimeout, gateway.ReadWriteTimeout)
}
... ...
... ... @@ -11,6 +11,15 @@ type UsersController struct {
beego.BaseController
}
func (controller *UsersController) returnPageListData(count int64, data interface{}, err error, pageNumber int) {
dataMap := map[string]interface{}{
"totalRow": count,
"pageNumber": pageNumber,
"list": data,
}
controller.Response(dataMap, err)
}
func (controller *UsersController) CompanyUserAdd() {
usersService := service.NewUsersService(nil)
companyUserAddCommand := &command.CompanyUserAddCommand{}
... ... @@ -30,9 +39,9 @@ func (controller *UsersController) CompanyUserUpdate() {
func (controller *UsersController) CompanyUserList() {
usersService := service.NewUsersService(nil)
companyUserListQuery := &query.CompanyUserListQuery{}
controller.Unmarshal(companyUserListQuery)
cnt, data, err := usersService.CompanyUserList(companyUserListQuery)
_ = cnt
controller.Response(data, err)
controller.returnPageListData(cnt, data, err, companyUserListQuery.PageNumber)
}
func (controller *UsersController) CompanyUserGet() {
... ... @@ -79,9 +88,9 @@ func (controller *UsersController) CooperationUserUpdate() {
func (controller *UsersController) CooperationUserList() {
usersService := service.NewUsersService(nil)
cooperationUserListQuery := &query.CooperationUserListQuery{}
controller.Unmarshal(cooperationUserListQuery)
cnt, data, err := usersService.CooperationUserList(cooperationUserListQuery)
_ = cnt
controller.Response(data, err)
controller.returnPageListData(cnt, data, err, cooperationUserListQuery.PageNumber)
}
func (controller *UsersController) CooperationUserGet() {
... ...