|
@@ -713,9 +713,61 @@ func GetPhone(u map[string]interface{}) string {
|
|
|
}
|
|
|
|
|
|
//
|
|
|
-func PushUrlEntIdentity(entId, entUserId int, entName string) string {
|
|
|
- if entId > 0 && entUserId > 0 {
|
|
|
- return "__" + "V20221215-" + Se.Encode2HexByCheck(fmt.Sprintf("%d_%d_%s", entId, entUserId, entName))
|
|
|
+func GetAllByEntUserId(mgo *MongodbSim, msl *Mysql, entUserId, tp int) (*map[string]interface{}, *map[string]interface{}) {
|
|
|
+ entUsers := msl.SelectBySql(`select phone from entniche_user where id=?`, entUserId)
|
|
|
+ if entUsers == nil || len(*entUsers) == 0 {
|
|
|
+ logger.Info("entniche_user表中没有找到该企业用户", entUserId)
|
|
|
+ return nil, nil
|
|
|
}
|
|
|
- return ""
|
|
|
+ phone, _ := (*entUsers)[0]["phone"].(string)
|
|
|
+ if phone == "" {
|
|
|
+ return nil, nil
|
|
|
+ }
|
|
|
+ users, ok := mgo.Find(Mgo_User, map[string]interface{}{
|
|
|
+ "$or": []map[string]interface{}{
|
|
|
+ map[string]interface{}{
|
|
|
+ "s_phone": phone,
|
|
|
+ },
|
|
|
+ map[string]interface{}{
|
|
|
+ "s_m_phone": phone,
|
|
|
+ },
|
|
|
+ },
|
|
|
+ }, map[string]interface{}{
|
|
|
+ "_id": 0,
|
|
|
+ "s_m_openid": 1,
|
|
|
+ "i_ispush": 1,
|
|
|
+ "s_jpushid": 1,
|
|
|
+ "s_opushid": 1,
|
|
|
+ "s_appponetype": 1,
|
|
|
+ }, `{"s_phone":-1}`, false, -1, -1)
|
|
|
+ if !ok || users == nil || len(*users) == 0 {
|
|
|
+ logger.Info("user表中没有找到该企业用户", entUserId)
|
|
|
+ return nil, nil
|
|
|
+ }
|
|
|
+ user := map[string]interface{}{}
|
|
|
+ for _, v := range *users {
|
|
|
+ s_m_openid := util.ObjToString(v["s_m_openid"])
|
|
|
+ i_ispush := util.IntAll(v["i_ispush"])
|
|
|
+ s_jpushid := util.ObjToString(v["s_jpushid"])
|
|
|
+ s_opushid := util.ObjToString(v["s_opushid"])
|
|
|
+ s_appponetype := util.ObjToString(v["s_appponetype"])
|
|
|
+ if user["s_m_openid"] == nil && user["i_ispush"] == nil && s_m_openid != "" && i_ispush == 1 {
|
|
|
+ user["s_m_openid"] = s_m_openid
|
|
|
+ user["i_ispush"] = i_ispush
|
|
|
+ }
|
|
|
+ if user["s_jpushid"] == nil && user["s_opushid"] == nil && user["s_appponetype"] == nil && s_appponetype != "" && (s_jpushid != "" || s_opushid != "") {
|
|
|
+ user["s_jpushid"] = s_jpushid
|
|
|
+ user["s_opushid"] = s_opushid
|
|
|
+ user["s_appponetype"] = s_appponetype
|
|
|
+ }
|
|
|
+ }
|
|
|
+ entniche_rule, ok := mgo.FindOneByField("entniche_rule", map[string]interface{}{
|
|
|
+ "i_userid": entUserId,
|
|
|
+ "i_type": tp,
|
|
|
+ }, `{"o_entniche":1,"l_endtime":1,"i_status":1}`)
|
|
|
+ if !ok || entniche_rule == nil || len(*entniche_rule) == 0 {
|
|
|
+ logger.Info("没有找到该企业用户的订阅设置", entUserId)
|
|
|
+ return nil, nil
|
|
|
+ }
|
|
|
+ return &user, entniche_rule
|
|
|
}
|