Просмотр исходного кода

Merge branch 'dev4.6.3.7' of http://192.168.3.207:8080/qmx/jy into dev4.6.3.7

tsz 3 лет назад
Родитель
Сommit
f696fa3c4d
1 измененных файлов с 55 добавлено и 19 удалено
  1. 55 19
      src/jfw/modules/app/src/app/front/front.go

+ 55 - 19
src/jfw/modules/app/src/app/front/front.go

@@ -230,25 +230,25 @@ func isInTSguide(userid string) bool {
 	data, ok := mongodb.FindById("user", userid, `{"o_jy":1,"i_ts_guide":1,"":1,"i_member_status":1,"i_vip_status":1,"s_phone":1,"s_m_phone":1}`)
 	if ok {
 		/*phone := ""
-		if s_phone, _ := (*data)["s_phone"].(string); s_phone != "" {
-			phone = s_phone
-		} else if s_m_phone, _ := (*data)["s_m_phone"].(string); s_m_phone != "" {
-			phone = s_m_phone
-		}
-		isEnt := false
-		if phone != "" {
-			//已购买企业未过期
-			if entInfo := public.Mysql.SelectBySql(`SELECT status FROM entniche_info WHERE id  IN (SELECT ent_id FROM entniche_user where phone = ? and power =1)`, phone); len((*entInfo)) > 0 {
-				for _, v := range (*entInfo) {
-					if util.IntAll(v["status"]) == 1 {
-						isEnt = true
-						break
-					}
-				}
-			}
-		}*/
+		  if s_phone, _ := (*data)["s_phone"].(string); s_phone != "" {
+		  	phone = s_phone
+		  } else if s_m_phone, _ := (*data)["s_m_phone"].(string); s_m_phone != "" {
+		  	phone = s_m_phone
+		  }
+		  isEnt := false
+		  if phone != "" {
+		  	//已购买企业未过期
+		  	if entInfo := public.Mysql.SelectBySql(`SELECT status FROM entniche_info WHERE id  IN (SELECT ent_id FROM entniche_user where phone = ? and power =1)`, phone); len((*entInfo)) > 0 {
+		  		for _, v := range (*entInfo) {
+		  			if util.IntAll(v["status"]) == 1 {
+		  				isEnt = true
+		  				break
+		  			}
+		  		}
+		  	}
+		  }*/
 		//付费用户无免费订阅,不进入订阅向导页面
-		if util.IntAll((*data)["i_member_status"]) > 0 || util.IntAll((*data)["i_vip_status"]) > 0  {
+		if util.IntAll((*data)["i_member_status"]) > 0 || util.IntAll((*data)["i_vip_status"]) > 0 {
 			return false
 		}
 		o_jy, _ := (*data)["o_jy"].(map[string]interface{})
@@ -533,11 +533,47 @@ func (s *Front) ShowRedSpotOnMenu() {
 	}
 	subscribe, project, ent, notice := 0, 0, 0, 0
 	if userid != "" {
-		user, ok := mongodb.FindById("user", userid, `{"i_member_status":1,"i_apppushunread":1,"i_member_apppushunread":1,"s_member_mainid":1,"i_member_sub_status":1}`)
+		user, ok := mongodb.FindById("user", userid, `{"s_phone":1,"s_m_phone":1,i_member_status":1,"i_apppushunread":1,"i_member_apppushunread":1,"s_member_mainid":1,"i_member_sub_status":1}`)
 		if ok && user != nil {
 			uid := ""
+			s_phone, _ := (*user)["s_phone"].(string)
+			if s_phone != "" {
+				s_phone = s_phone
+			} else if s_m_phone, _ := (*user)["s_m_phone"].(string); s_m_phone != "" {
+				s_phone = s_m_phone
+			}
+			isNew := false
+			/* if s_phone != "" {
+			    ent := public.Mysql.SelectBySql("select id,isNew,phone,createtime from entniche_info where phone=? and status=1 ", s_phone)
+			    if ent != nil && len(*ent) != 0 {
+
+			        for _, val := range *ent {
+			            if util.IntAll(val["isNew"]) == 1 {
+			                isNew = true
+			            }
+			        }
+			    }
+			}*/
+			res := public.Mysql.SelectBySql(`SELECT i.name,i.phone,i.status,i.auth_status,u.power FROM entniche_user u LEFT JOIN entniche_info i
+			ON u.ent_id=i.id
+			ORDER BY  i.status DESC,i.auth_status DESC, CASE WHEN u.phone=? THEN 0  ELSE 1 END  ASC`, s_phone)
+			if res != nil && len(*res) > 0 {
+				//entname := qutil.ObjToString((*res)[0]["name"])
+				/*d["entname"] = entname*/
+				//已购买企业未过期-商机管理用户
+				for _, v := range *res {
+					if util.IntAll(v["status"]) == 1 && util.IntAll(v["power"]) == 1 {
+						if util.IntAll(v["isNew"]) == 1 {
+							isNew = true
+						}
+						break
+					}
+				}
+			}
 			if jy.SwitchService.IsMember(s.Session(), mongodb) {
 				subscribe = util.IntAll((*user)["i_member_apppushunread"])
+			} else if isNew {
+				subscribe = 0
 			} else {
 				subscribe = util.IntAll((*user)["i_apppushunread"])
 			}