|
@@ -172,7 +172,7 @@ func MySonAccounts(Mgo *MongodbSim, coll, userId string, field map[string]interf
|
|
|
}
|
|
|
|
|
|
//是否购买此服务
|
|
|
-func HasService(mysql *Mysql, userId string, params ...int) *MemberService {
|
|
|
+func HasService(msl *Mysql, userId string, params ...int) *MemberService {
|
|
|
args := []interface{}{}
|
|
|
ws := []string{}
|
|
|
for _, v := range params {
|
|
@@ -181,7 +181,7 @@ func HasService(mysql *Mysql, userId string, params ...int) *MemberService {
|
|
|
}
|
|
|
args = append(args, args...)
|
|
|
args = append(args, userId, NowFormat(Date_Full_Layout))
|
|
|
- list := mysql.SelectBySql(`SELECT a.l_starttime,b.id from jianyu.bigmember_service_user a
|
|
|
+ list := msl.SelectBySql(`SELECT a.l_starttime,b.id from jianyu.bigmember_service_user a
|
|
|
INNER JOIN jianyu.bigmember_service b on (((b.id in (`+strings.Join(ws, ",")+`) and a.s_serviceid=b.id) or (b.i_pid in (`+strings.Join(ws, ",")+`) and a.s_serviceid=b.i_pid)) and b.i_status=0 and a.s_userid=? and a.i_status=0 and a.l_endtime>?)`, args...)
|
|
|
ms := &MemberService{
|
|
|
Services: map[int]*memberService{},
|
|
@@ -437,7 +437,7 @@ func SortListSplit(list *SortList, f func(v interface{})) {
|
|
|
}
|
|
|
|
|
|
//获取企业授权超级订阅/大会员的用户
|
|
|
-func LoadEntProductUsers(m *Mysql, testUserIds []int) (map[string]*UserInfo, map[int]*UserInfo, map[int]*UserInfo, []*UserInfo) {
|
|
|
+func LoadEntProductUsers(msl *Mysql, testUserIds []int) (map[string]*UserInfo, map[int]*UserInfo, map[int]*UserInfo, []*UserInfo) {
|
|
|
logger.Info("开始加载企业授权用户。。。")
|
|
|
phoneMap := map[string]*UserInfo{}
|
|
|
userMap := map[int]*UserInfo{}
|
|
@@ -455,7 +455,7 @@ func LoadEntProductUsers(m *Mysql, testUserIds []int) (map[string]*UserInfo, map
|
|
|
}
|
|
|
query += `b.ent_user_id=c.id)
|
|
|
inner join jianyu.entniche_info d on (d.id=a.ent_id)`
|
|
|
- m.SelectByBath(200, func(l *[]map[string]interface{}) bool {
|
|
|
+ msl.SelectByBath(200, func(l *[]map[string]interface{}) bool {
|
|
|
for _, v := range *l {
|
|
|
phone, _ := v["phone"].(string)
|
|
|
if phone == "" {
|
|
@@ -492,10 +492,10 @@ func LoadEntProductUsers(m *Mysql, testUserIds []int) (map[string]*UserInfo, map
|
|
|
}
|
|
|
|
|
|
//加载商机管理用户
|
|
|
-func LoadEntnicheUsers(m *Mysql) map[string]bool {
|
|
|
+func LoadEntnicheUsers(msl *Mysql) map[string]bool {
|
|
|
logger.Info("开始加载新版商机管理用户。。。")
|
|
|
r := map[string]bool{}
|
|
|
- m.SelectByBath(200, func(l *[]map[string]interface{}) bool {
|
|
|
+ msl.SelectByBath(200, func(l *[]map[string]interface{}) bool {
|
|
|
for _, v := range *l {
|
|
|
phone := util.ObjToString(v["phone"])
|
|
|
if phone != "" {
|
|
@@ -549,8 +549,8 @@ func GetAllByEntUserId(mgo *MongodbSim, msl *Mysql, entUserId int) *map[string]i
|
|
|
}
|
|
|
|
|
|
//
|
|
|
-func GetAllByEntPositionId(mgo *MongodbSim, tidb, msl *Mysql, positionId int) *map[string]interface{} {
|
|
|
- position := tidb.SelectBySql(`select a.ent_id,b.phone from base_service.base_position a inner join base_service.base_user b on (a.id=? and a.user_id=b.id)`, positionId)
|
|
|
+func GetAllByEntPositionId(mgo *MongodbSim, msl *Mysql, positionId int) *map[string]interface{} {
|
|
|
+ position := msl.SelectBySql(`select a.ent_id,b.phone from base_service.base_position a inner join base_service.base_user b on (a.id=? and a.user_id=b.id)`, positionId)
|
|
|
if position == nil || len(*position) == 0 {
|
|
|
logger.Info("无效的职位id", position)
|
|
|
return nil
|
|
@@ -683,13 +683,13 @@ func GetEntUserSubset(mgo *MongodbSim, entUserId, tp int) map[string]interface{}
|
|
|
}
|
|
|
|
|
|
//根据企业员工id获取身份信息
|
|
|
-func IdentityByEntUserId(base, main *Mysql, entUserId int64) *IdentityInfo {
|
|
|
- ents := main.SelectBySql(`SELECT a.id,a.name,a.phone,a.ent_id,b.name as ent_name from jianyu.entniche_user a inner join jianyu.entniche_info b on (a.id=? and a.ent_id=b.id) limit 1`, entUserId)
|
|
|
+func IdentityByEntUserId(msl *Mysql, entUserId int64) *IdentityInfo {
|
|
|
+ ents := msl.SelectBySql(`SELECT a.id,a.name,a.phone,a.ent_id,b.name as ent_name from jianyu.entniche_user a inner join jianyu.entniche_info b on (a.id=? and a.ent_id=b.id) limit 1`, entUserId)
|
|
|
if ents == nil || len(*ents) == 0 {
|
|
|
return nil
|
|
|
}
|
|
|
if entId := Int64All((*ents)[0]["ent_id"]); entId > 0 {
|
|
|
- list := base.SelectBySql(`SELECT a.id as position_id,c.person_id,a.person_name,a.account_id,a.type as position_type,d.id as user_id,b.id as ent_account_id from base_service.base_user d
|
|
|
+ list := msl.SelectBySql(`SELECT a.id as position_id,c.person_id,a.person_name,a.account_id,a.type as position_type,d.id as user_id,b.id as ent_account_id from base_service.base_user d
|
|
|
inner join base_service.base_position a on (d.phone=? and a.ent_id=? and a.type=1 and d.id=a.user_id)
|
|
|
inner join base_service.base_account c on (c.ent_id=? and c.type=1 and a.account_id=c.id)
|
|
|
inner join base_service.base_account b on (b.type=1 and b.person_id=0 and b.ent_id=?) limit 1`, ObjToString((*ents)[0]["phone"]), entId, entId, entId)
|
|
@@ -760,11 +760,11 @@ func MonitorTimeOut(pool chan bool, timeout time.Duration, warn string, f func()
|
|
|
}
|
|
|
|
|
|
//根据baseUserId获取个人身份信息
|
|
|
-func GetPersonalIdentityByBaseUserId(base, main *Mysql, baseUserId int64) *IdentityInfo {
|
|
|
+func GetPersonalIdentityByBaseUserId(msl *Mysql, baseUserId int64) *IdentityInfo {
|
|
|
if baseUserId == 0 {
|
|
|
return nil
|
|
|
}
|
|
|
- list := base.SelectBySql(`select a.id as position_id , b.person_id ,a.type as position_type, a.account_id,a.person_name from base_service.base_position a
|
|
|
+ list := msl.SelectBySql(`select a.id as position_id , b.person_id ,a.type as position_type, a.account_id,a.person_name from base_service.base_position a
|
|
|
inner join base_service.base_account b on (a.account_id=b.id and a.user_id=? and a.type=0) limit 1`, baseUserId)
|
|
|
if list != nil && len(*list) == 1 {
|
|
|
identity := &IdentityInfo{
|
|
@@ -781,7 +781,7 @@ func GetPersonalIdentityByBaseUserId(base, main *Mysql, baseUserId int64) *Ident
|
|
|
}
|
|
|
|
|
|
//根据MONGOUSERID获取个人身份信息
|
|
|
-func GetPersonalIdentityByMgoId(base *Mysql, mgo *MongodbSim, userId string) *IdentityInfo {
|
|
|
+func GetPersonalIdentityByMgoId(msl *Mysql, mgo *MongodbSim, userId string) *IdentityInfo {
|
|
|
if userId == "" {
|
|
|
return nil
|
|
|
}
|
|
@@ -790,7 +790,7 @@ func GetPersonalIdentityByMgoId(base *Mysql, mgo *MongodbSim, userId string) *Id
|
|
|
return nil
|
|
|
}
|
|
|
baseUserId := util.Int64All((*data)["base_user_id"])
|
|
|
- list := base.SelectBySql(`select a.id as position_id , b.person_id ,a.type as position_type, a.account_id,a.person_name from base_service.base_position a
|
|
|
+ list := msl.SelectBySql(`select a.id as position_id , b.person_id ,a.type as position_type, a.account_id,a.person_name from base_service.base_position a
|
|
|
inner join base_service.base_account b on (a.account_id=b.id and a.user_id=? and a.type=0) limit 1`, baseUserId)
|
|
|
if list != nil && len(*list) == 1 {
|
|
|
identity := &IdentityInfo{
|
|
@@ -807,8 +807,8 @@ func GetPersonalIdentityByMgoId(base *Mysql, mgo *MongodbSim, userId string) *Id
|
|
|
}
|
|
|
|
|
|
//根据职位id获取用户信息
|
|
|
-func GetUserInfoByPosition(base *Mysql, mgo *MongodbSim, id int64) *UserInfo {
|
|
|
- list := base.SelectBySql(`select user_id from base_service.base_position where id=?`, id)
|
|
|
+func GetUserInfoByPosition(msl *Mysql, mgo *MongodbSim, id int64) *UserInfo {
|
|
|
+ list := msl.SelectBySql(`select user_id from base_service.base_position where id=?`, id)
|
|
|
if list == nil || len(*list) == 0 {
|
|
|
return nil
|
|
|
}
|