|
@@ -11,7 +11,7 @@ import (
|
|
|
. "app.yhyue.com/moapp/jypkg/ent/util"
|
|
|
)
|
|
|
|
|
|
-//当前登录用户
|
|
|
+// 当前登录用户
|
|
|
var VarCurrentUser = &CurrentUser{}
|
|
|
|
|
|
type CurrentUser struct {
|
|
@@ -34,7 +34,7 @@ type CurrentUser struct {
|
|
|
NicheDis int //商机分配权限 1:企业商机分配管理员 2:部门商机分配管理员
|
|
|
}
|
|
|
|
|
|
-//获取当前登录用户的手机号
|
|
|
+// 获取当前登录用户的手机号
|
|
|
func (c *CurrentUser) Phone(userId string) (string, string) {
|
|
|
u, ok := MQFW.FindById("user", userId, `{"s_phone":1,"s_m_phone":1}`)
|
|
|
if ok && u != nil {
|
|
@@ -47,7 +47,7 @@ func (c *CurrentUser) Phone(userId string) (string, string) {
|
|
|
return "", ""
|
|
|
}
|
|
|
|
|
|
-//当前登录用户的信息
|
|
|
+// 当前登录用户的信息
|
|
|
func (c *CurrentUser) EntInfo(entId, entUserId int) *CurrentUser {
|
|
|
currentUser := &CurrentUser{
|
|
|
Ent: &EntInfo{},
|
|
@@ -123,7 +123,7 @@ func (c *CurrentUser) EntInfo(entId, entUserId int) *CurrentUser {
|
|
|
return currentUser
|
|
|
}
|
|
|
|
|
|
-//手机号是否被占用
|
|
|
+// 手机号是否被占用
|
|
|
func (c *CurrentUser) PhoneIsOccupy(userId, phone string) (bool, int, string) {
|
|
|
user, ok := MQFW.FindById("user", userId, `{"i_appid":1}`)
|
|
|
if !ok || user == nil {
|
|
@@ -185,7 +185,7 @@ func (c *CurrentUser) PhoneIsOccupy(userId, phone string) (bool, int, string) {
|
|
|
if unionId == "" {
|
|
|
return true, 2, ""
|
|
|
}
|
|
|
- exists, relationPhoneId := jy.NewPhoneUtil(MQFW).BindPhoneIsOccupy(userId, unionId, phone)
|
|
|
+ exists, relationPhoneId, _ := jy.NewPhoneUtil(MQFW).BindPhoneIsOccupy(userId, unionId, phone)
|
|
|
if !exists {
|
|
|
return false, 2, relationPhoneId
|
|
|
}
|
|
@@ -195,7 +195,7 @@ func (c *CurrentUser) PhoneIsOccupy(userId, phone string) (bool, int, string) {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
-//绑定手机号
|
|
|
+// 绑定手机号
|
|
|
func (c *CurrentUser) BindPhone(userId, phone, email string) (bool, int) {
|
|
|
isOccupy, appid, _ := c.PhoneIsOccupy(userId, phone)
|
|
|
if isOccupy {
|
|
@@ -215,7 +215,7 @@ func (c *CurrentUser) BindPhone(userId, phone, email string) (bool, int) {
|
|
|
}), appid
|
|
|
}
|
|
|
|
|
|
-//更换手机号
|
|
|
+// 更换手机号
|
|
|
func (c *CurrentUser) ReplacePhone(userId, phone string, entId int) (int, int) {
|
|
|
isOccupy, appid, _ := c.PhoneIsOccupy(userId, phone)
|
|
|
if isOccupy {
|
|
@@ -234,7 +234,7 @@ func (c *CurrentUser) ReplacePhone(userId, phone string, entId int) (int, int) {
|
|
|
return 0, appid
|
|
|
}
|
|
|
|
|
|
-//个人信息
|
|
|
+// 个人信息
|
|
|
func (c *CurrentUser) UserInfo(userId string) *CurrentUser {
|
|
|
currentUser := &CurrentUser{}
|
|
|
user, ok := MQFW.FindById("user", userId, `{"s_phone":1,"s_m_phone":1,"s_avatar":1,"s_headimage":1,"s_headimageurl":1,"s_nickname":1}`)
|