|
@@ -805,7 +805,6 @@ func ScanHandler(w ResponseWriter, r *Request) {
|
|
|
VipStatus: util.IntAll((*m)["i_vip_status"]),
|
|
|
User: *m,
|
|
|
}
|
|
|
-<<<<<<< HEAD
|
|
|
replyText, ri := rs.SubscribeAction()
|
|
|
if replyText != "" {
|
|
|
switch ri {
|
|
@@ -813,145 +812,6 @@ func ScanHandler(w ResponseWriter, r *Request) {
|
|
|
w.ReplyText(replyText)
|
|
|
case 1:
|
|
|
w.PostText(replyText)
|
|
|
-=======
|
|
|
- } else if pccodepre == "11" || pccodepre == "12" || pccodepre == "19" || pccodepre == "17" { //101pc订阅,102pc搜索关键词 22落地页订阅关键词
|
|
|
- var pcresult, subkey string
|
|
|
- var pcUser map[string]interface{}
|
|
|
- if (*m)["i_vip_status"] != nil && util.IntAll((*m)["i_vip_status"]) > 0 {
|
|
|
- shareid := util.ObjToString(r.EventKey)
|
|
|
- subkey = util.ObjToString(redis.Get("sso", "pc_subscribe_"+shareid))
|
|
|
- if subkey != "" {
|
|
|
- resNum := 0
|
|
|
- resNum, subkey, _ = vipFastSubscribe(m, subkey, openid, "1")
|
|
|
- if resNum == -2 {
|
|
|
- pcresult = "repeat"
|
|
|
- } else if resNum == -3 {
|
|
|
- pcresult = "fail"
|
|
|
- } else if resNum == 1 {
|
|
|
- pcresult = "ok"
|
|
|
- }
|
|
|
- //pc端订阅页面 扫码回复vip连接也需要用此码
|
|
|
- if pccodepre == "11" && resNum != -3 {
|
|
|
- redis.Del("sso", "pc_subscribe_"+shareid)
|
|
|
- }
|
|
|
- } else {
|
|
|
- if util.ObjToString(redis.Get("sso", "pc_subscribe_reply_"+shareid)) == "1" {
|
|
|
- pcresult = "vipsubscribe##reply"
|
|
|
- }
|
|
|
- }
|
|
|
- } else {
|
|
|
- pcUser, pcresult, subkey = pcSetUserKeys(*m, r.EventKey, pccodepre)
|
|
|
- i_ts_guide := util.IntAll((*m)["i_ts_guide"])
|
|
|
- //有关键词 切是在订阅设置页面扫码 订阅向导未关闭(=2) 扫码订阅后 关闭订阅向导(=1)
|
|
|
- if i_ts_guide == 0 || (i_ts_guide == 2 && subkey != "") {
|
|
|
- i_ts_guide = 1
|
|
|
- }
|
|
|
- go tools.MQFW.Update("user", &map[string]interface{}{
|
|
|
- "s_m_openid": openid,
|
|
|
- "s_unionid": map[string]interface{}{"$ne": openid},
|
|
|
- }, &map[string]interface{}{
|
|
|
- "$set": map[string]interface{}{
|
|
|
- "o_jy": pcUser["o_jy"],
|
|
|
- "i_ts_guide": i_ts_guide,
|
|
|
- },
|
|
|
- }, false, false)
|
|
|
- }
|
|
|
- if pcresult == "ok" {
|
|
|
- pchints := config.Sysconfig["pchints"].(map[string]interface{})
|
|
|
- url := fmt.Sprintf(config.Sysconfig["proxysess"].(string), se.EncodeString(openid+","+user.UnionId+","+strconv.Itoa(int(time.Now().Unix()))+",rssset"))
|
|
|
- w.ReplyText(fmt.Sprintf(fmt.Sprint(pchints["key_success"]), strings.ReplaceAll(subkey, "++", " "), url))
|
|
|
- } else if pcresult == "repeat" {
|
|
|
- fastSubscribeText := config.Sysconfig["fastSubscribe"].(map[string]interface{})
|
|
|
- exists := fastSubscribeText["exists"].(string)
|
|
|
- w.ReplyText(fmt.Sprintf(exists, strings.ReplaceAll(subkey, "++", " "), fastSubscribeText["skill"].(string)))
|
|
|
- } else if pcresult == "fail" && subkey != "" {
|
|
|
- pchints := config.Sysconfig["pchints"].(map[string]interface{})
|
|
|
- url := fmt.Sprintf(config.Sysconfig["proxysess"].(string), se.EncodeString(openid+","+user.UnionId+","+strconv.Itoa(int(time.Now().Unix()))+",rssset"))
|
|
|
- w.ReplyText(fmt.Sprintf(fmt.Sprint(pchints["key_fail"]), strings.ReplaceAll(subkey, "++", " "), url))
|
|
|
- } else if pcresult == "vipsubscribe##reply" { //老用户扫码
|
|
|
- vipsubReply := config.Sysconfig["vipSubscribeReply"].(map[string]interface{})
|
|
|
- if switchBl, ok := vipsubReply["switch"].(bool); switchBl && ok {
|
|
|
- w.ReplyText(fmt.Sprintf(fmt.Sprint(vipsubReply["content"]), config.Sysconfig["webdomain"].(string)+vipsubReply["href"].(string)))
|
|
|
- }
|
|
|
- }
|
|
|
- } else if pccodepre == "18" { //关注企业
|
|
|
- company := redis.GetStr("sso", "pc_subscribe_"+r.EventKey) //企业名称
|
|
|
- s_id := Findent(company) //查询s_id
|
|
|
- if company != "" {
|
|
|
- if tools.MQFW.Count("jylab_followent", `{"s_userid":"`+userId+`","s_id":"`+s_id+`"}`) > 0 {
|
|
|
- //已经关注过此企业
|
|
|
- pchints := config.Sysconfig["company"].(map[string]interface{})
|
|
|
- url := fmt.Sprintf(config.Sysconfig["proxysess"].(string), se.EncodeString(openid+","+user.UnionId+","+strconv.Itoa(int(time.Now().Unix()))+",entListFollow"))
|
|
|
- w.ReplyText(fmt.Sprintf(fmt.Sprint(pchints["company_repeat"]), company, url))
|
|
|
- } else if tools.MQFW.Count("jylab_followent", `{"s_userid":"`+userId+`"}`) >= util.IntAll(config.Sysconfig["followCompany"]) {
|
|
|
- //超过最大关注数
|
|
|
- pchints := config.Sysconfig["company"].(map[string]interface{})
|
|
|
- url := fmt.Sprintf(config.Sysconfig["proxysess"].(string), se.EncodeString(openid+","+user.UnionId+","+strconv.Itoa(int(time.Now().Unix()))+",entListFollow"))
|
|
|
- w.ReplyText(fmt.Sprintf(fmt.Sprint(pchints["company_fail"]), company, url))
|
|
|
- } else {
|
|
|
- //关注成功
|
|
|
- data := make(map[string]interface{})
|
|
|
- data["s_entname"] = company
|
|
|
- data["s_userid"] = userId
|
|
|
- data["s_openid"] = openid
|
|
|
- data["i_ispush"] = 1
|
|
|
- data["l_createtime"] = time.Now().Unix()
|
|
|
- data["l_lastpushtime"] = time.Now().Unix()
|
|
|
- data["s_id"] = s_id
|
|
|
- if followId := tools.MQFW.Save("jylab_followent", data); len(followId) > 0 {
|
|
|
- pchints := config.Sysconfig["company"].(map[string]interface{})
|
|
|
- url := fmt.Sprintf(config.Sysconfig["proxysess"].(string), se.EncodeString(openid+","+user.UnionId+","+strconv.Itoa(int(time.Now().Unix()))+",newInfoFollow")) + "__" + company + "__" + util.EncodeArticleId2ByCheck(s_id)
|
|
|
- w.ReplyText(fmt.Sprintf(fmt.Sprint(pchints["company_success"]), company, url))
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
- go func() {
|
|
|
- updateUserData := map[string]interface{}{}
|
|
|
- if user.HeadImageUrl != "" {
|
|
|
- updateUserData["s_headimageurl"] = user.HeadImageUrl
|
|
|
- }
|
|
|
- if user.Nickname != "" {
|
|
|
- updateUserData["s_nickname"] = user.Nickname
|
|
|
- }
|
|
|
- if user.Province != "" {
|
|
|
- updateUserData["s_province"] = user.Province
|
|
|
- }
|
|
|
- if user.Country != "" {
|
|
|
- updateUserData["s_country"] = user.Country
|
|
|
- }
|
|
|
- if user.City != "" {
|
|
|
- updateUserData["s_city"] = user.City
|
|
|
- }
|
|
|
- if user.Sex > 0 {
|
|
|
- updateUserData["i_sex"] = user.Sex
|
|
|
- }
|
|
|
- if len(updateUserData) > 0 {
|
|
|
- tools.MQFW.UpdateById("user", userId, &map[string]interface{}{
|
|
|
- "$set": updateUserData,
|
|
|
- })
|
|
|
- }
|
|
|
- }()
|
|
|
- }
|
|
|
- var activesign = config.Sysconfig["activesign"].(bool) //是否有活动进行
|
|
|
- if activesign {
|
|
|
- var activeArr = util.ObjArrToMapArr(config.Sysconfig["activeArr"].([]interface{}))
|
|
|
- if len(activeArr) > 0 {
|
|
|
- for _, v := range activeArr {
|
|
|
- if strings.Contains(r.EventKey, v["activeCode"].(string)) {
|
|
|
- if time.Now().Unix() < util.Int64All(v["activeEnd"]) { //是否已经过了活动结束日期
|
|
|
- var sealflag = false
|
|
|
- var sourceOpenid = strings.Split(r.EventKey, "---")[0]
|
|
|
- _, sealflag = active.SaveActiveLink(sourceOpenid, openid, Mux, v["activeCode"].(string)) //保存活动关系
|
|
|
- var replayFlag = v["replayflag"].(bool) //是否回复用户信息
|
|
|
- if replayFlag && sealflag {
|
|
|
- replayUrl := fmt.Sprintf(config.Sysconfig["proxysess"].(string), se.EncodeString(openid+","+user.UnionId+","+strconv.Itoa(int(time.Now().Unix()))+","+v["scanReplayUrlName"].(string)))
|
|
|
- log.Println("rep:", replayUrl)
|
|
|
- w.PostText(fmt.Sprintf(v["scanReplay"].(string), replayUrl))
|
|
|
- }
|
|
|
- } else {
|
|
|
- w.PostText("本次活动已结束,谢谢参与!")
|
|
|
- }
|
|
|
}
|
|
|
}
|
|
|
}
|