|
@@ -8,6 +8,7 @@ import (
|
|
|
"hongze/hongze_yb/models/tables/company"
|
|
|
"hongze/hongze_yb/models/tables/company_product"
|
|
|
"hongze/hongze_yb/models/tables/rddp/msg_code"
|
|
|
+ "hongze/hongze_yb/models/tables/research_group_relation"
|
|
|
"hongze/hongze_yb/models/tables/wx_user"
|
|
|
"hongze/hongze_yb/models/tables/yb_apply_record"
|
|
|
"hongze/hongze_yb/models/tables/yb_message"
|
|
@@ -109,6 +110,7 @@ type Detail struct {
|
|
|
SellerMobile string `json:"seal_mobile" description:"所属销售手机号"`
|
|
|
PermissionList []CompanyPermission `json:"permission_list" description:"权限列表"`
|
|
|
IsInner int `json:"is_inner" description:"是否为内部员工"`
|
|
|
+ IsResearcher int `json:"is_researcher" description:"是否为研究员"`
|
|
|
AdminInfo *admin2.Admin `json:"admin_info" description:"系统管理员信息"`
|
|
|
UnRead int64 `json:"un_read" description:"消息未读数"`
|
|
|
NickName string `json:"nick_name" description:"用户昵称"`
|
|
@@ -220,18 +222,33 @@ func GetUserInfo(userInfo user.UserInfo) (userDetail Detail, err error, errMsg s
|
|
|
if headimgurl == "" {
|
|
|
headimgurl = utils.DEFAULT_HONGZE_USER_LOGO
|
|
|
}
|
|
|
+ // 查询是否为研究员
|
|
|
+ isResearcher := 0
|
|
|
+ if isInner == 1 {
|
|
|
+ researchGroupList, e := research_group_relation.GetResearchGroupRelationByAdminId(int(adminInfo.AdminID))
|
|
|
+ if e != nil {
|
|
|
+ errMsg = "查询是否为研究员失败"
|
|
|
+ err = errors.New("用户身份信息有误")
|
|
|
+ return
|
|
|
+ }
|
|
|
+ if len(researchGroupList) > 0 {
|
|
|
+ isResearcher = 1
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
userDetail = Detail{
|
|
|
- CompanyName: companyName, //客户名称(公司名称)
|
|
|
- Status: status, //产品状态
|
|
|
- IsSuspend: isSuspend, //是否启用
|
|
|
+ CompanyName: companyName, //客户名称(公司名称)
|
|
|
+ Status: status, //产品状态
|
|
|
+ IsSuspend: isSuspend, //是否启用
|
|
|
RealName: userInfo.RealName,
|
|
|
Mobile: userInfo.Mobile,
|
|
|
Email: userInfo.Email,
|
|
|
SellerName: sellerName,
|
|
|
SellerMobile: sellerMobile,
|
|
|
- PermissionList: list, //权限列表
|
|
|
- IsInner: isInner, // 是否为内部员工
|
|
|
- AdminInfo: adminInfo, // 系统管理员信息
|
|
|
+ PermissionList: list, //权限列表
|
|
|
+ IsInner: isInner, // 是否为内部员工
|
|
|
+ IsResearcher: isResearcher, // 是否为研究员
|
|
|
+ AdminInfo: adminInfo, // 系统管理员信息
|
|
|
UnRead: unRead,
|
|
|
NickName: userInfo.NickName,
|
|
|
HeadImgUrl: headimgurl,
|
|
@@ -246,14 +263,14 @@ func SetUserInfo(userInfo user.UserInfo, req userReq.SetUserInfoReq) (err error)
|
|
|
// todo 用户如果没有设置头像,用默认头像也允许上传
|
|
|
// 校验昵称长度
|
|
|
// 校验头像地址是否正确
|
|
|
- if !strings.Contains(req.HeadImgUrl, "http://") && !strings.Contains(req.HeadImgUrl, "https://") {
|
|
|
+ if !strings.Contains(req.HeadImgUrl, "http://") && !strings.Contains(req.HeadImgUrl, "https://") {
|
|
|
err = errors.New("上传头像出错")
|
|
|
return
|
|
|
}
|
|
|
wxUser := userInfo.WxUser
|
|
|
wxUser.NickName = req.NickName
|
|
|
wxUser.Headimgurl = req.HeadImgUrl
|
|
|
- err = wxUser.Update([]string{"nick_name","headimgurl"})
|
|
|
+ err = wxUser.Update([]string{"nick_name", "headimgurl"})
|
|
|
if err != nil {
|
|
|
err = errors.New("更新用户信息操作失败")
|
|
|
return
|
|
@@ -294,7 +311,7 @@ func Apply(userId int, companyId int64, mobile, email string, applyInfo userReq.
|
|
|
|
|
|
tmpmYbApplyRecord, err := yb_apply_record.GetLastNotOpRecordByUserId(userId)
|
|
|
if err == nil {
|
|
|
- ybApplyRecord = tmpmYbApplyRecord // 申请来源每一种只存在一条数据
|
|
|
+ ybApplyRecord = tmpmYbApplyRecord // 申请来源每一种只存在一条数据
|
|
|
return
|
|
|
} else {
|
|
|
if err != utils.ErrNoRow {
|
|
@@ -355,7 +372,7 @@ func Apply(userId int, companyId int64, mobile, email string, applyInfo userReq.
|
|
|
CompanyIDPay: int(companyId),
|
|
|
CompanyNamePay: companyName,
|
|
|
CreateTime: time.Now(),
|
|
|
- Source: applyInfo.Source,
|
|
|
+ Source: applyInfo.Source,
|
|
|
SourceAgent: applyInfo.SourceAgent,
|
|
|
FromPage: applyInfo.FromPage,
|
|
|
}
|
|
@@ -467,4 +484,4 @@ func PcSendEmailCode(email string) (err error, errMsg string) {
|
|
|
}
|
|
|
|
|
|
return
|
|
|
-}
|
|
|
+}
|