|
@@ -3,6 +3,7 @@ package service
|
|
|
import (
|
|
|
"encoding/json"
|
|
|
"fmt"
|
|
|
+ "log"
|
|
|
"math/rand"
|
|
|
"strings"
|
|
|
"time"
|
|
@@ -179,7 +180,7 @@ func (this *PowerService) Power(userid string, baseUserId, accountId, entId, pos
|
|
|
} else if positionType == 1 {
|
|
|
entnicheUserId := this.GetEntnicheUserId(entId, phone)
|
|
|
//免费
|
|
|
- fdata, ok := this.Conn.MgoJy.FindOne("entniche_rule", map[string]interface{}{
|
|
|
+ fdata, _ := this.Conn.MgoJy.FindOne("entniche_rule", map[string]interface{}{
|
|
|
"i_ent": entId,
|
|
|
"i_userid": entnicheUserId,
|
|
|
"i_type": 2, //0:商机管理 1:超级订阅/大会员 2:免费
|
|
@@ -191,7 +192,7 @@ func (this *PowerService) Power(userid string, baseUserId, accountId, entId, pos
|
|
|
free.IsUpgrade = true //新免费用户
|
|
|
}
|
|
|
//企业
|
|
|
- edata, ok := this.Conn.MgoJy.FindOne("entniche_rule", map[string]interface{}{
|
|
|
+ edata, _ := this.Conn.MgoJy.FindOne("entniche_rule", map[string]interface{}{
|
|
|
"i_ent": entId,
|
|
|
"i_userid": entnicheUserId,
|
|
|
"i_type": 1, //0:商机管理 1:超级订阅/大会员
|
|
@@ -199,16 +200,20 @@ func (this *PowerService) Power(userid string, baseUserId, accountId, entId, pos
|
|
|
"$gt": time.Now().Unix(),
|
|
|
},
|
|
|
})
|
|
|
- if ok && edata != nil && len(*edata) > 0 {
|
|
|
+ eudata, _ := this.Conn.MgoJy.FindOne("ent_user", map[string]interface{}{
|
|
|
+ "i_entid": entId,
|
|
|
+ "i_userid": entnicheUserId,
|
|
|
+ })
|
|
|
+ if eudata != nil && len(*eudata) > 0 {
|
|
|
haskey := false
|
|
|
- status := common.Int64All((*edata)["i_status"])
|
|
|
- starttime := common.Int64All((*edata)["l_starttime"])
|
|
|
- endtime := common.Int64All((*edata)["l_endtime"])
|
|
|
- o_entniche := common.ObjToMap((*edata)["o_entniche"])
|
|
|
- if (*o_entniche)["a_items"] != nil {
|
|
|
- if arr, ok := (*o_entniche)["a_items"].([]interface{}); ok {
|
|
|
- a_items := common.ObjArrToMapArr(arr)
|
|
|
- haskey = HasKey(a_items)
|
|
|
+ o_entniche := &map[string]interface{}{}
|
|
|
+ if edata != nil && len(*edata) > 0 {
|
|
|
+ o_entniche = common.ObjToMap((*edata)["o_entniche"])
|
|
|
+ if (*o_entniche)["a_items"] != nil {
|
|
|
+ if arr, ok := (*o_entniche)["a_items"].([]interface{}); ok {
|
|
|
+ a_items := common.ObjArrToMapArr(arr)
|
|
|
+ haskey = HasKey(a_items)
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
//获取用户是什么版本权益
|
|
@@ -227,6 +232,9 @@ func (this *PowerService) Power(userid string, baseUserId, accountId, entId, pos
|
|
|
buyerclasscount := common.Int64All((*oBuyset)["buyerclasscount"])
|
|
|
newcitys, _ := (*oBuyset)["newcitys"].([]interface{})
|
|
|
newcitysArr := common.InterfaceArrToint64Arr(newcitys)
|
|
|
+ status := common.Int64All((*eudata)["i_vip_status"])
|
|
|
+ starttime := common.Int64All((*eudata)["l_vip_starttime"])
|
|
|
+ endtime := common.Int64All((*eudata)["l_vip_endtime"])
|
|
|
vip = &entity.Vip{
|
|
|
Status: status,
|
|
|
StartTime: starttime,
|
|
@@ -241,6 +249,9 @@ func (this *PowerService) Power(userid string, baseUserId, accountId, entId, pos
|
|
|
}
|
|
|
} else if strings.Contains(product_type, entity.ProductType_member) {
|
|
|
member.PowerType = 2
|
|
|
+ status := common.Int64All((*eudata)["i_member_status"])
|
|
|
+ starttime := common.Int64All((*eudata)["l_member_starttime"])
|
|
|
+ endtime := common.Int64All((*eudata)["l_member_endtime"])
|
|
|
member = &entity.Member{
|
|
|
Status: status,
|
|
|
StartTime: starttime,
|
|
@@ -350,6 +361,7 @@ func (this *PowerService) Power(userid string, baseUserId, accountId, entId, pos
|
|
|
free.IsFree = false
|
|
|
}
|
|
|
}
|
|
|
+ log.Println(vip.Status, vip.StartTime, vip.EndTime)
|
|
|
userPower = entity.Power{
|
|
|
Vip: vip,
|
|
|
Member: member,
|