|
@@ -53,20 +53,20 @@ func (s *switchService) Get(session *httpsession.Session, m MongodbSim) string {
|
|
|
|
|
|
func (s *switchService) GetEntniche(session *httpsession.Session, m MongodbSim, sql *mysql.Mysql) string {
|
|
|
userId, _ := session.Get("userId").(string)
|
|
|
- entUserId := util.IntAll(session.Get("entUserId"))
|
|
|
v, _ := session.Get(s.SessionKey).(string)
|
|
|
- u, ok := m.FindById("user", userId, `{"i_member_status":1,"i_vip_status":1}`)
|
|
|
+ u, ok := m.FindById("user", userId, `{"i_member_status":1,"i_vip_status":1,"s_phone":1,"s_m_phone":1}`)
|
|
|
entniche := false
|
|
|
- if entUserId != 0 {
|
|
|
- res := sql.SelectBySql(`SELECT i.isNew,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
|
|
|
- where u.id=? `, entUserId)
|
|
|
- if res != nil && len(*res) > 0 {
|
|
|
- //已购买企业未过期-商机管理用户
|
|
|
- for _, v := range *res {
|
|
|
- if util.IntAll(v["status"]) == 1 && util.IntAll(v["power"]) == 1 && util.IntAll(v["isNew"]) == 1 {
|
|
|
- //d["isFree"] = false
|
|
|
- //d["entniche"] = true
|
|
|
+ phone:=""
|
|
|
+ if s_phone, _ := (*u)["s_phone"].(string); s_phone != "" {
|
|
|
+ phone = s_phone
|
|
|
+ } else if s_m_phone, _ := (*u)["s_m_phone"].(string); s_m_phone != "" {
|
|
|
+ phone = s_m_phone
|
|
|
+ }
|
|
|
+ if phone != "" {
|
|
|
+ //已购买企业未过期
|
|
|
+ if entInfo := sql.SelectBySql(`SELECT status,isNew 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 && util.IntAll(v["isNew"]) == 1{
|
|
|
entniche = true
|
|
|
break
|
|
|
}
|