|
@@ -368,8 +368,80 @@ func (s *Short) Article(stype, id string) error {
|
|
|
return nil
|
|
|
}
|
|
|
|
|
|
+func CNode(userId string) bool {
|
|
|
+ rdataOne, ok := mongodb.FindOne("saleLeads", map[string]interface{}{
|
|
|
+ "userid": userId,
|
|
|
+ "source": map[string]interface{}{
|
|
|
+ "$regex": "jyarticle_see3_plus",
|
|
|
+ },
|
|
|
+ })
|
|
|
+ data := make(map[string]interface{})
|
|
|
+ if rdataOne != nil && ok {
|
|
|
+ data = *rdataOne
|
|
|
+ }
|
|
|
+
|
|
|
+ if userinfo, uok := mongodb.FindById("user", userId, `{"s_phone":1,"s_m_phone":1,"s_myemail":1,"s_company":1,"o_jy":1,"o_vipjy":1}`); userinfo != nil && uok && len(*userinfo) > 0 {
|
|
|
+ s_phone := util.ObjToString((*userinfo)["s_phone"])
|
|
|
+ phone := util.If(s_phone == "", util.ObjToString((*userinfo)["s_m_phone"]), s_phone)
|
|
|
+
|
|
|
+ data["phone"] = phone
|
|
|
+ mail := util.ObjToString((*userinfo)["s_myemail"])
|
|
|
+ //获取邮箱 1.超级订阅邮箱、订阅邮箱、数据导出填写邮箱
|
|
|
+ if mail == "" {
|
|
|
+ if vipjy, _ := (*userinfo)["o_vipjy"].(map[string]interface{}); vipjy != nil && len(vipjy) > 0 {
|
|
|
+ mail = util.ObjToString(vipjy["s_email"])
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if mail == "" {
|
|
|
+ if ojy, _ := (*userinfo)["o_jy"].(map[string]interface{}); ojy != nil && len(ojy) > 0 {
|
|
|
+ mail = util.ObjToString(ojy["s_email"])
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if mail == "" {
|
|
|
+ if list := public.Mysql.SelectBySql(`select user_mail from
|
|
|
+ dataexport_order where user_id =? and user_mail IS NOT NULL order by id desc`, userId); list != nil && len(*list) > 0 {
|
|
|
+ mail = util.ObjToString((*list)[0]["user_mail"])
|
|
|
+ }
|
|
|
+ }
|
|
|
+ data["mail"] = mail
|
|
|
+ data["company"] = util.ObjToString((*userinfo)["s_company"])
|
|
|
+ }
|
|
|
+ //rM := map[string]interface{}{}
|
|
|
+ rdata, sok := mongodb.Find("saleLeads", map[string]interface{}{
|
|
|
+ "userid": userId,
|
|
|
+ }, `{"createtime":-1}`, nil, false, 0, 10)
|
|
|
+ if rdata != nil && len(*rdata) > 0 && sok {
|
|
|
+ for _, v := range *rdata {
|
|
|
+ for kk, vv := range v {
|
|
|
+ if vv == nil {
|
|
|
+ continue
|
|
|
+ }
|
|
|
+ if data[kk] != nil {
|
|
|
+ continue
|
|
|
+ }
|
|
|
+ data[kk] = vv
|
|
|
+ }
|
|
|
+ }
|
|
|
+ delete(data, "_id")
|
|
|
+ delete(data, "userid")
|
|
|
+ delete(data, "createtime")
|
|
|
+ delete(data, "client")
|
|
|
+ }
|
|
|
+ var ss = []string{"name", "phone", "company", "position", "branch"}
|
|
|
+ for _, v := range ss {
|
|
|
+ if vlu, ok1 := data[v]; !ok1 || vlu == "" {
|
|
|
+ return false
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return true
|
|
|
+}
|
|
|
+
|
|
|
//查看公告详情次数限制
|
|
|
func SeeDetailLimit(obj map[string]interface{}, userId, sid string) bool {
|
|
|
+ //检验是否留资
|
|
|
+ if CNode(userId) {
|
|
|
+ return true
|
|
|
+ }
|
|
|
watchKey := fmt.Sprintf("article_count_%d_%s_%d_%s", time.Now().Year(), time.Now().Month(), time.Now().Day(), userId)
|
|
|
if strings.Contains(obj["subtype"].(string), "拟建") || strings.Contains(obj["subtype"].(string), "采购意向") {
|
|
|
return false
|