...
|
...
|
@@ -19,7 +19,6 @@ import ( |
|
|
"strings"
|
|
|
)
|
|
|
|
|
|
//用户信息
|
|
|
func UserInfo(header *protocol.RequestHeader, request *protocol.UserInfoRequest) (rsp *protocol.UserInfoResponse, err error) {
|
|
|
var (
|
|
|
partnerInfo *domain.PartnerInfo
|
...
|
...
|
@@ -37,6 +36,7 @@ func UserInfo(header *protocol.RequestHeader, request *protocol.UserInfoRequest) |
|
|
defer func() {
|
|
|
transactionContext.RollbackTransaction()
|
|
|
}()
|
|
|
|
|
|
rsp = &protocol.UserInfoResponse{}
|
|
|
|
|
|
funcPartnerInfo := func() {
|
...
|
...
|
@@ -47,6 +47,7 @@ func UserInfo(header *protocol.RequestHeader, request *protocol.UserInfoRequest) |
|
|
if company, err = CompanyRepository.FindOne(map[string]interface{}{"id": header.CompanyId}); err != nil {
|
|
|
return
|
|
|
}
|
|
|
|
|
|
rsp.User = protocol.User{
|
|
|
Id: partnerInfo.Id,
|
|
|
PartnerName: partnerInfo.PartnerName,
|
...
|
...
|
@@ -204,6 +205,7 @@ func UserInfoV2(header *protocol.RequestHeader, request *protocol.UserInfoReques |
|
|
}()
|
|
|
rsp = &protocol.UserInfoResponse{}
|
|
|
rspMap := make(map[string]interface{})
|
|
|
|
|
|
funcPartnerInfo := func() {
|
|
|
if partnerInfo, err = PartnerInfoService.FindOne(map[string]interface{}{"id": header.UserId}); err != nil {
|
|
|
err = protocol.NewErrWithMessage(502, err) //账号不存在
|
...
|
...
|
@@ -231,15 +233,33 @@ func UserInfoV2(header *protocol.RequestHeader, request *protocol.UserInfoReques |
|
|
PartnerName: partnerInfo.PartnerName,
|
|
|
Phone: partnerInfo.Account,
|
|
|
CooperateCompany: userx.Company{
|
|
|
Id: company.Id,
|
|
|
Name: company.Name,
|
|
|
Phone: company.Phone,
|
|
|
SerialNo: partnerInfo.Id,
|
|
|
CooperateTime: partnerInfo.CooperateTime.Unix() * 1000,
|
|
|
MiniProgram: miniProgram,
|
|
|
District: map[string]interface{}{"id": partnerInfo.RegionInfo.RegionId, "name": partnerInfo.RegionInfo.RegionName},
|
|
|
Id: company.Id,
|
|
|
Name: company.Name,
|
|
|
Phone: company.Phone,
|
|
|
SerialNo: partnerInfo.Id,
|
|
|
CareerSerialNo: "",
|
|
|
BusinessSerialNo: "",
|
|
|
DevelopSerialNo: "",
|
|
|
AppSerialNo: "",
|
|
|
CooperateTime: partnerInfo.CooperateTime.Unix() * 1000,
|
|
|
MiniProgram: miniProgram,
|
|
|
District: map[string]interface{}{"id": partnerInfo.RegionInfo.RegionId, "name": partnerInfo.RegionInfo.RegionName},
|
|
|
},
|
|
|
}
|
|
|
|
|
|
// 获取编号
|
|
|
for _, partnerCategoryInfo := range partnerInfo.PartnerCategoryInfos {
|
|
|
if partnerCategoryInfo.Id == 1 {
|
|
|
u.CooperateCompany.CareerSerialNo = partnerCategoryInfo.Code
|
|
|
} else if partnerCategoryInfo.Id == 2 {
|
|
|
u.CooperateCompany.BusinessSerialNo = partnerCategoryInfo.Code
|
|
|
} else if partnerCategoryInfo.Id == 3 {
|
|
|
u.CooperateCompany.DevelopSerialNo = partnerCategoryInfo.Code
|
|
|
} else if partnerCategoryInfo.Id == 4 {
|
|
|
u.CooperateCompany.AppSerialNo = partnerCategoryInfo.Code
|
|
|
}
|
|
|
}
|
|
|
|
|
|
if len(partnerInfo.Salesman) > 0 {
|
|
|
u.CooperateCompany.Salesman = map[string]interface{}{"uname": partnerInfo.Salesman[0].Name, "phone": partnerInfo.Salesman[0].Telephone}
|
|
|
} else {
|
...
|
...
|
@@ -248,6 +268,7 @@ func UserInfoV2(header *protocol.RequestHeader, request *protocol.UserInfoReques |
|
|
rspMap["user"] = u
|
|
|
rsp = rspMap
|
|
|
}
|
|
|
|
|
|
funcManagerInfo := func() {
|
|
|
if user, err = UsersRepository.FindOne(map[string]interface{}{"id": header.UserId}); err != nil {
|
|
|
err = protocol.NewErrWithMessage(502, err) //账号不存在
|
...
|
...
|
@@ -269,6 +290,7 @@ func UserInfoV2(header *protocol.RequestHeader, request *protocol.UserInfoReques |
|
|
}
|
|
|
rsp = rspMap
|
|
|
}
|
|
|
|
|
|
switch header.AdminType {
|
|
|
case int(protocolx.AdminTypePartner):
|
|
|
funcPartnerInfo()
|
...
|
...
|
|