|
@@ -1,85 +1,85 @@
|
|
|
package front
|
|
|
|
|
|
import (
|
|
|
- "app.yhyue.com/moapp/jybase/go-xweb/httpsession"
|
|
|
- "fmt"
|
|
|
- "jy/src/jfw/modules/app/src/app/jylabutil"
|
|
|
- "jy/src/jfw/modules/app/src/jfw/config"
|
|
|
- "log"
|
|
|
- "strings"
|
|
|
- "sync"
|
|
|
- "time"
|
|
|
-
|
|
|
- util "app.yhyue.com/moapp/jybase/common"
|
|
|
- "app.yhyue.com/moapp/jybase/encrypt"
|
|
|
- elastic "app.yhyue.com/moapp/jybase/esv1"
|
|
|
- "app.yhyue.com/moapp/jypkg/common/src/qfw/util/jy"
|
|
|
- "app.yhyue.com/moapp/jypkg/public"
|
|
|
- . "jy/src/jfw/modules/app/src/app/jyutil"
|
|
|
- utils "jy/src/jfw/modules/app/src/app/jyutil"
|
|
|
-
|
|
|
- "app.yhyue.com/moapp/jybase/go-xweb/xweb"
|
|
|
- "github.com/SKatiyar/qr"
|
|
|
- "github.com/dchest/captcha"
|
|
|
- "go.mongodb.org/mongo-driver/bson"
|
|
|
+ "app.yhyue.com/moapp/jybase/go-xweb/httpsession"
|
|
|
+ "fmt"
|
|
|
+ "jy/src/jfw/modules/app/src/app/jylabutil"
|
|
|
+ "jy/src/jfw/modules/app/src/jfw/config"
|
|
|
+ "log"
|
|
|
+ "strings"
|
|
|
+ "sync"
|
|
|
+ "time"
|
|
|
+
|
|
|
+ util "app.yhyue.com/moapp/jybase/common"
|
|
|
+ "app.yhyue.com/moapp/jybase/encrypt"
|
|
|
+ elastic "app.yhyue.com/moapp/jybase/esv1"
|
|
|
+ "app.yhyue.com/moapp/jypkg/common/src/qfw/util/jy"
|
|
|
+ "app.yhyue.com/moapp/jypkg/public"
|
|
|
+ . "jy/src/jfw/modules/app/src/app/jyutil"
|
|
|
+ utils "jy/src/jfw/modules/app/src/app/jyutil"
|
|
|
+
|
|
|
+ "app.yhyue.com/moapp/jybase/go-xweb/xweb"
|
|
|
+ "github.com/SKatiyar/qr"
|
|
|
+ "github.com/dchest/captcha"
|
|
|
+ "go.mongodb.org/mongo-driver/bson"
|
|
|
)
|
|
|
|
|
|
type Front struct {
|
|
|
- *xweb.Action
|
|
|
- feedback xweb.Mapper `xweb:"/jyapp/swordfish/feedback"` //意见反馈
|
|
|
- praise xweb.Mapper `xweb:"/jyapp/swordfish/praise"`
|
|
|
- myFeedbacks xweb.Mapper `xweb:"/jyapp/swordfish/myFeedbacks"`
|
|
|
- ajaxReq xweb.Mapper `xweb:"/jyapp/member/swordfish/ajaxReq"`
|
|
|
- wxsearchlistPaging xweb.Mapper `xweb:"/jyapp/swordfish/searchlist/paging"` //剑鱼标讯微信查询结果展示--分页
|
|
|
- wxKeyset xweb.Mapper `xweb:"/jyapp/wxkeyset/keyset/(\\w+)"` //订阅词设置
|
|
|
- wxKeysetAjaxReq xweb.Mapper `xweb:"/jyapp/wxkeyset/ajaxReq"` //订阅词ajax请求
|
|
|
- wxpushView xweb.Mapper `xweb:"/jyapp/wxpush/wxpushview"` //推送结果预览
|
|
|
- wxpushViewPaging xweb.Mapper `xweb:"/jyapp/wxpush/wxpushview/paging"` //推送结果预览--分页
|
|
|
- historypush xweb.Mapper `xweb:"/jyapp/swordfish/historypush"` //历时推送记录
|
|
|
- historypushPaging xweb.Mapper `xweb:"/jyapp/swordfish/historypush/paging"` //历时推送记录--分页
|
|
|
- tSGuide xweb.Mapper `xweb:"/jyapp/tenderSubscribe/guide"` //引导页
|
|
|
- getRecomKWs xweb.Mapper `xweb:"/jyapp/member/getRecomKWs"` //获取推荐关键词
|
|
|
- behaviorRecord xweb.Mapper `xweb:"/jyapp/member/behaviorRecord"` //记录用户点击的关键词
|
|
|
- wxpushAjaxReq xweb.Mapper `xweb:"/jyapp/wxpush/bid/ajaxReq"`
|
|
|
- delWxHistorySearch xweb.Mapper `xweb:"/jyapp/swordfish/delWxHistorySearch"` //剑鱼标讯微信删除历史搜索
|
|
|
- delOL xweb.Mapper `xweb:"/jyapp/swordfish/delovertimelist"` //手动删除30天无更新数据
|
|
|
- wxpushListInfo xweb.Mapper `xweb:"/jyapp/wxpush/bidinfo/(.*)"` //推送列表
|
|
|
- /*不需要登录*/
|
|
|
- wxerr xweb.Mapper `xweb:"/jyapp/free/mob/err"`
|
|
|
- about xweb.Mapper `xweb:"/jyapp/free/swordfish/about"`
|
|
|
- transfer xweb.Mapper `xweb:"/jyapp/free/transfer"` //原文链接中转
|
|
|
- captcha xweb.Mapper `xweb:"/jyapp/free/captcha"` //生成验证码图片
|
|
|
- getIndexData xweb.Mapper `xweb:"/jyapp/free/front/getIndexData"`
|
|
|
- limitSearchText xweb.Mapper `xweb:"/jyapp/front/limitSearchText"`
|
|
|
- index xweb.Mapper `xweb:"/jyapp/free/index"` //打开app跳转
|
|
|
- kicked xweb.Mapper `xweb:"/jyapp/free/kicked"` //被踢人之后跳转
|
|
|
- setSeoVersion xweb.Mapper `xweb:"/jyapp/free/setSeoVersion"`
|
|
|
- receive xweb.Mapper `xweb:"/jyapp/free/message/receive"`
|
|
|
- jylabShareTimeline xweb.Mapper `xweb:"/jyapp/jylabShareTimeline"`
|
|
|
- //修改强制分享主动分享状态和时间
|
|
|
- updateShareStatus xweb.Mapper `xweb:"/jyapp/share/updateShareStatus"`
|
|
|
- changePro xweb.Mapper `xweb:"/jyapp/jylab/changePro"` //修改提示信息状态
|
|
|
- hasPushHistory xweb.Mapper `xweb:"/jyapp/front/hasPushHistory"`
|
|
|
- showRedSpotOnMenu xweb.Mapper `xweb:"/jyapp/free/showRedSpotOnMenu"`
|
|
|
- goToUpdate xweb.Mapper `xweb:"/jyapp/free/goToUpdate"`
|
|
|
- //许可协议及隐私政策 v2.9.4新增
|
|
|
- policy xweb.Mapper `xweb:"/jyapp/free/policy"`
|
|
|
- pushMsgCallback xweb.Mapper `xweb:"/jyapp/pushmessage/callback"` //app客户端收到消息回调服务端地址
|
|
|
-
|
|
|
- //静态页面通用地址
|
|
|
- staticPage xweb.Mapper `xweb:"/jyapp/front/staticPage/(.+)"`
|
|
|
- //商机管理推送
|
|
|
- entnichePushList xweb.Mapper `xweb:"/jyapp/entniche/pushlist"`
|
|
|
- entnichePush xweb.Mapper `xweb:"/jyapp/entniche/push"`
|
|
|
- delc xweb.Mapper `xweb:"/jyapp/free/delcache/(.+)"` //删除模板缓存
|
|
|
- iosExam xweb.Mapper `xweb:"/jyapp/free/iosexam"` //ios审核
|
|
|
-
|
|
|
- downloadJyAppQrOther xweb.Mapper `xweb:"/jyapp/front/downloadJyApp/qrOther"` //扫码下载
|
|
|
-
|
|
|
- qRCodePage xweb.Mapper `xweb:"/jyapp/free/qRCodePage"` //二维码页面
|
|
|
-
|
|
|
- appConfig xweb.Mapper `xweb:"/jyapp/free/config"` //app配置项
|
|
|
- shareDomain xweb.Mapper `xweb:"/jyapp/free/shareDomain"` //app分享 域名配置项
|
|
|
+ *xweb.Action
|
|
|
+ feedback xweb.Mapper `xweb:"/jyapp/swordfish/feedback"` //意见反馈
|
|
|
+ praise xweb.Mapper `xweb:"/jyapp/swordfish/praise"`
|
|
|
+ myFeedbacks xweb.Mapper `xweb:"/jyapp/swordfish/myFeedbacks"`
|
|
|
+ ajaxReq xweb.Mapper `xweb:"/jyapp/member/swordfish/ajaxReq"`
|
|
|
+ wxsearchlistPaging xweb.Mapper `xweb:"/jyapp/swordfish/searchlist/paging"` //剑鱼标讯微信查询结果展示--分页
|
|
|
+ wxKeyset xweb.Mapper `xweb:"/jyapp/wxkeyset/keyset/(\\w+)"` //订阅词设置
|
|
|
+ wxKeysetAjaxReq xweb.Mapper `xweb:"/jyapp/wxkeyset/ajaxReq"` //订阅词ajax请求
|
|
|
+ wxpushView xweb.Mapper `xweb:"/jyapp/wxpush/wxpushview"` //推送结果预览
|
|
|
+ wxpushViewPaging xweb.Mapper `xweb:"/jyapp/wxpush/wxpushview/paging"` //推送结果预览--分页
|
|
|
+ historypush xweb.Mapper `xweb:"/jyapp/swordfish/historypush"` //历时推送记录
|
|
|
+ historypushPaging xweb.Mapper `xweb:"/jyapp/swordfish/historypush/paging"` //历时推送记录--分页
|
|
|
+ tSGuide xweb.Mapper `xweb:"/jyapp/tenderSubscribe/guide"` //引导页
|
|
|
+ getRecomKWs xweb.Mapper `xweb:"/jyapp/member/getRecomKWs"` //获取推荐关键词
|
|
|
+ behaviorRecord xweb.Mapper `xweb:"/jyapp/member/behaviorRecord"` //记录用户点击的关键词
|
|
|
+ wxpushAjaxReq xweb.Mapper `xweb:"/jyapp/wxpush/bid/ajaxReq"`
|
|
|
+ delWxHistorySearch xweb.Mapper `xweb:"/jyapp/swordfish/delWxHistorySearch"` //剑鱼标讯微信删除历史搜索
|
|
|
+ delOL xweb.Mapper `xweb:"/jyapp/swordfish/delovertimelist"` //手动删除30天无更新数据
|
|
|
+ wxpushListInfo xweb.Mapper `xweb:"/jyapp/wxpush/bidinfo/(.*)"` //推送列表
|
|
|
+ /*不需要登录*/
|
|
|
+ wxerr xweb.Mapper `xweb:"/jyapp/free/mob/err"`
|
|
|
+ about xweb.Mapper `xweb:"/jyapp/free/swordfish/about"`
|
|
|
+ transfer xweb.Mapper `xweb:"/jyapp/free/transfer"` //原文链接中转
|
|
|
+ captcha xweb.Mapper `xweb:"/jyapp/free/captcha"` //生成验证码图片
|
|
|
+ getIndexData xweb.Mapper `xweb:"/jyapp/free/front/getIndexData"`
|
|
|
+ limitSearchText xweb.Mapper `xweb:"/jyapp/front/limitSearchText"`
|
|
|
+ index xweb.Mapper `xweb:"/jyapp/free/index"` //打开app跳转
|
|
|
+ kicked xweb.Mapper `xweb:"/jyapp/free/kicked"` //被踢人之后跳转
|
|
|
+ setSeoVersion xweb.Mapper `xweb:"/jyapp/free/setSeoVersion"`
|
|
|
+ receive xweb.Mapper `xweb:"/jyapp/free/message/receive"`
|
|
|
+ jylabShareTimeline xweb.Mapper `xweb:"/jyapp/jylabShareTimeline"`
|
|
|
+ //修改强制分享主动分享状态和时间
|
|
|
+ updateShareStatus xweb.Mapper `xweb:"/jyapp/share/updateShareStatus"`
|
|
|
+ changePro xweb.Mapper `xweb:"/jyapp/jylab/changePro"` //修改提示信息状态
|
|
|
+ hasPushHistory xweb.Mapper `xweb:"/jyapp/front/hasPushHistory"`
|
|
|
+ showRedSpotOnMenu xweb.Mapper `xweb:"/jyapp/free/showRedSpotOnMenu"`
|
|
|
+ goToUpdate xweb.Mapper `xweb:"/jyapp/free/goToUpdate"`
|
|
|
+ //许可协议及隐私政策 v2.9.4新增
|
|
|
+ policy xweb.Mapper `xweb:"/jyapp/free/policy"`
|
|
|
+ pushMsgCallback xweb.Mapper `xweb:"/jyapp/pushmessage/callback"` //app客户端收到消息回调服务端地址
|
|
|
+
|
|
|
+ //静态页面通用地址
|
|
|
+ staticPage xweb.Mapper `xweb:"/jyapp/front/staticPage/(.+)"`
|
|
|
+ //商机管理推送
|
|
|
+ entnichePushList xweb.Mapper `xweb:"/jyapp/entniche/pushlist"`
|
|
|
+ entnichePush xweb.Mapper `xweb:"/jyapp/entniche/push"`
|
|
|
+ delc xweb.Mapper `xweb:"/jyapp/free/delcache/(.+)"` //删除模板缓存
|
|
|
+ iosExam xweb.Mapper `xweb:"/jyapp/free/iosexam"` //ios审核
|
|
|
+
|
|
|
+ downloadJyAppQrOther xweb.Mapper `xweb:"/jyapp/front/downloadJyApp/qrOther"` //扫码下载
|
|
|
+
|
|
|
+ qRCodePage xweb.Mapper `xweb:"/jyapp/free/qRCodePage"` //二维码页面
|
|
|
+
|
|
|
+ appConfig xweb.Mapper `xweb:"/jyapp/free/config"` //app配置项
|
|
|
+ shareDomain xweb.Mapper `xweb:"/jyapp/free/shareDomain"` //app分享 域名配置项
|
|
|
}
|
|
|
|
|
|
var sewx encrypt.SimpleEncrypt //微信的加密方法
|
|
@@ -90,399 +90,399 @@ var sortArray []string
|
|
|
var mLock *sync.Mutex
|
|
|
|
|
|
func init() {
|
|
|
- mLock = new(sync.Mutex)
|
|
|
- sewx = encrypt.SimpleEncrypt{Key: "topnet"}
|
|
|
- xweb.AddAction(&Front{})
|
|
|
- industrylist, sortArray = jy.Getindustrys(util.ObjToString(config.Sysconfig["industry"]), mongodb)
|
|
|
+ mLock = new(sync.Mutex)
|
|
|
+ sewx = encrypt.SimpleEncrypt{Key: "topnet"}
|
|
|
+ xweb.AddAction(&Front{})
|
|
|
+ industrylist, sortArray = jy.Getindustrys(util.ObjToString(config.Sysconfig["industry"]), mongodb)
|
|
|
}
|
|
|
|
|
|
func (f *Front) PushMsgCallback() {
|
|
|
- f.ServeJson(map[string]interface{}{})
|
|
|
+ f.ServeJson(map[string]interface{}{})
|
|
|
}
|
|
|
|
|
|
// Policy 许可协议及隐私政策
|
|
|
func (f *Front) Policy() {
|
|
|
- status := 0
|
|
|
- data := map[string]interface{}{}
|
|
|
- policy := util.ObjToMap(config.Sysconfig["policy"])
|
|
|
- title := util.ObjToString((*policy)["title"])
|
|
|
- content := util.ObjToString((*policy)["content"])
|
|
|
- href := util.ObjArrToStringArr((*policy)["href"].([]interface{}))
|
|
|
- name := util.ObjArrToStringArr((*policy)["name"].([]interface{}))
|
|
|
- if content != "" && title != "" {
|
|
|
- status = 1
|
|
|
- data = map[string]interface{}{
|
|
|
- "title": title,
|
|
|
- "content": content,
|
|
|
- "href": href,
|
|
|
- "name": name,
|
|
|
- }
|
|
|
- }
|
|
|
- //转义
|
|
|
- f.ServeJson(map[string]interface{}{
|
|
|
- "status": status,
|
|
|
- "data": data,
|
|
|
- })
|
|
|
+ status := 0
|
|
|
+ data := map[string]interface{}{}
|
|
|
+ policy := util.ObjToMap(config.Sysconfig["policy"])
|
|
|
+ title := util.ObjToString((*policy)["title"])
|
|
|
+ content := util.ObjToString((*policy)["content"])
|
|
|
+ href := util.ObjArrToStringArr((*policy)["href"].([]interface{}))
|
|
|
+ name := util.ObjArrToStringArr((*policy)["name"].([]interface{}))
|
|
|
+ if content != "" && title != "" {
|
|
|
+ status = 1
|
|
|
+ data = map[string]interface{}{
|
|
|
+ "title": title,
|
|
|
+ "content": content,
|
|
|
+ "href": href,
|
|
|
+ "name": name,
|
|
|
+ }
|
|
|
+ }
|
|
|
+ //转义
|
|
|
+ f.ServeJson(map[string]interface{}{
|
|
|
+ "status": status,
|
|
|
+ "data": data,
|
|
|
+ })
|
|
|
}
|
|
|
|
|
|
func (m *Front) Receive() error {
|
|
|
- defer util.Catch()
|
|
|
- url_mid := m.GetString("url")
|
|
|
- mid := ""
|
|
|
- url := ""
|
|
|
- if len(strings.Split(url_mid, "==")) > 1 {
|
|
|
- mid = strings.Split(url_mid, "==")[1]
|
|
|
- url = strings.Split(url_mid, "==")[0]
|
|
|
- } else {
|
|
|
- log.Println("非message消息通知")
|
|
|
- return nil
|
|
|
- }
|
|
|
- recType := m.GetString("rectype")
|
|
|
- //这是客户端发的请求,之前是openid,后来改成userid了,参数名没变还是openid,但值是userid
|
|
|
- userId := m.GetString("openid")
|
|
|
- if userId == "" {
|
|
|
- userId, _ = m.GetSession("userId").(string)
|
|
|
- }
|
|
|
- defer mLock.Unlock()
|
|
|
- mLock.Lock()
|
|
|
- var ok = false
|
|
|
- if recType == "D" && mid != "" && len([]rune(mid)) > 12 {
|
|
|
- field := "i_delivery"
|
|
|
- ok = mongodb.UpdateById("message_app", mid, map[string]interface{}{"$inc": map[string]interface{}{field: 1}})
|
|
|
- } else if recType == "C" && mid != "" && len([]rune(mid)) > 12 {
|
|
|
- field := "i_click"
|
|
|
- //打开计算一次 是否已经打开过
|
|
|
- if c := mongodb.Count("jyapp_notice", map[string]interface{}{
|
|
|
- "s_id": mid, //信息id
|
|
|
- "s_userid": userId,
|
|
|
- "i_unread": 1, //1:未打开;0:已打开
|
|
|
- }); c == 1 {
|
|
|
- //更新信息为已读状态
|
|
|
- mongodb.Update("jyapp_notice", map[string]interface{}{
|
|
|
- "s_id": mid, //信息id
|
|
|
- "s_userid": userId,
|
|
|
- }, map[string]interface{}{
|
|
|
- "$set": map[string]interface{}{
|
|
|
- "i_unread": 0,
|
|
|
- "l_timestamp": time.Now().Unix(),
|
|
|
- },
|
|
|
- }, false, false)
|
|
|
- //信息总量打开率+1
|
|
|
- ok = mongodb.UpdateById("message_app", mid, map[string]interface{}{"$inc": map[string]interface{}{field: 1}})
|
|
|
- }
|
|
|
- } else if recType == "A" && mid != "" && len([]rune(mid)) > 12 {
|
|
|
- field := "i_delivery"
|
|
|
- field1 := "i_click"
|
|
|
- //打开计算一次 是否已经打开过
|
|
|
- if c := mongodb.Count("jyapp_notice", map[string]interface{}{
|
|
|
- "s_id": mid, //信息id
|
|
|
- "s_userid": userId,
|
|
|
- "i_unread": 1, //1:未打开;0:已打开
|
|
|
- }); c == 1 {
|
|
|
- ok = mongodb.UpdateById("message_app", mid, map[string]interface{}{"$inc": map[string]interface{}{field: 1, field1: 1}})
|
|
|
- mongodb.Update("jyapp_notice", map[string]interface{}{
|
|
|
- "s_id": mid, //信息id
|
|
|
- "s_userid": userId,
|
|
|
- }, map[string]interface{}{
|
|
|
- "$set": map[string]interface{}{
|
|
|
- "i_unread": 0,
|
|
|
- "l_timestamp": time.Now().Unix(),
|
|
|
- },
|
|
|
- }, false, false)
|
|
|
- }
|
|
|
- }
|
|
|
- if ok {
|
|
|
- go mesCaLog(mid, url, userId, recType)
|
|
|
- } else {
|
|
|
- log.Println(recType, "--err: $inc")
|
|
|
- }
|
|
|
- m.ServeJson(map[string]interface{}{
|
|
|
- "flag": ok,
|
|
|
- })
|
|
|
- return nil
|
|
|
+ defer util.Catch()
|
|
|
+ url_mid := m.GetString("url")
|
|
|
+ mid := ""
|
|
|
+ url := ""
|
|
|
+ if len(strings.Split(url_mid, "==")) > 1 {
|
|
|
+ mid = strings.Split(url_mid, "==")[1]
|
|
|
+ url = strings.Split(url_mid, "==")[0]
|
|
|
+ } else {
|
|
|
+ log.Println("非message消息通知")
|
|
|
+ return nil
|
|
|
+ }
|
|
|
+ recType := m.GetString("rectype")
|
|
|
+ //这是客户端发的请求,之前是openid,后来改成userid了,参数名没变还是openid,但值是userid
|
|
|
+ userId := m.GetString("openid")
|
|
|
+ if userId == "" {
|
|
|
+ userId, _ = m.GetSession("userId").(string)
|
|
|
+ }
|
|
|
+ defer mLock.Unlock()
|
|
|
+ mLock.Lock()
|
|
|
+ var ok = false
|
|
|
+ if recType == "D" && mid != "" && len([]rune(mid)) > 12 {
|
|
|
+ field := "i_delivery"
|
|
|
+ ok = mongodb.UpdateById("message_app", mid, map[string]interface{}{"$inc": map[string]interface{}{field: 1}})
|
|
|
+ } else if recType == "C" && mid != "" && len([]rune(mid)) > 12 {
|
|
|
+ field := "i_click"
|
|
|
+ //打开计算一次 是否已经打开过
|
|
|
+ if c := mongodb.Count("jyapp_notice", map[string]interface{}{
|
|
|
+ "s_id": mid, //信息id
|
|
|
+ "s_userid": userId,
|
|
|
+ "i_unread": 1, //1:未打开;0:已打开
|
|
|
+ }); c == 1 {
|
|
|
+ //更新信息为已读状态
|
|
|
+ mongodb.Update("jyapp_notice", map[string]interface{}{
|
|
|
+ "s_id": mid, //信息id
|
|
|
+ "s_userid": userId,
|
|
|
+ }, map[string]interface{}{
|
|
|
+ "$set": map[string]interface{}{
|
|
|
+ "i_unread": 0,
|
|
|
+ "l_timestamp": time.Now().Unix(),
|
|
|
+ },
|
|
|
+ }, false, false)
|
|
|
+ //信息总量打开率+1
|
|
|
+ ok = mongodb.UpdateById("message_app", mid, map[string]interface{}{"$inc": map[string]interface{}{field: 1}})
|
|
|
+ }
|
|
|
+ } else if recType == "A" && mid != "" && len([]rune(mid)) > 12 {
|
|
|
+ field := "i_delivery"
|
|
|
+ field1 := "i_click"
|
|
|
+ //打开计算一次 是否已经打开过
|
|
|
+ if c := mongodb.Count("jyapp_notice", map[string]interface{}{
|
|
|
+ "s_id": mid, //信息id
|
|
|
+ "s_userid": userId,
|
|
|
+ "i_unread": 1, //1:未打开;0:已打开
|
|
|
+ }); c == 1 {
|
|
|
+ ok = mongodb.UpdateById("message_app", mid, map[string]interface{}{"$inc": map[string]interface{}{field: 1, field1: 1}})
|
|
|
+ mongodb.Update("jyapp_notice", map[string]interface{}{
|
|
|
+ "s_id": mid, //信息id
|
|
|
+ "s_userid": userId,
|
|
|
+ }, map[string]interface{}{
|
|
|
+ "$set": map[string]interface{}{
|
|
|
+ "i_unread": 0,
|
|
|
+ "l_timestamp": time.Now().Unix(),
|
|
|
+ },
|
|
|
+ }, false, false)
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if ok {
|
|
|
+ go mesCaLog(mid, url, userId, recType)
|
|
|
+ } else {
|
|
|
+ log.Println(recType, "--err: $inc")
|
|
|
+ }
|
|
|
+ m.ServeJson(map[string]interface{}{
|
|
|
+ "flag": ok,
|
|
|
+ })
|
|
|
+ return nil
|
|
|
}
|
|
|
|
|
|
func mesCaLog(mid, url, userId, recType string) {
|
|
|
- defer util.Catch()
|
|
|
- userData := utils.Compatible.Select(userId, `{"s_province":1,"s_city":1,"s_nickname":1}`)
|
|
|
- mesData, ok2 := mongodb.FindById("message_app", mid, `{"s_title":1,"s_subtitle":1}`)
|
|
|
- if ok2 && *mesData != nil && *userData != nil {
|
|
|
- public.Mgo_Log.Save("jy_message", map[string]interface{}{
|
|
|
- "openid": userId, //之前存的是openid,用户合并以后存的是userid
|
|
|
- "mid": mid,
|
|
|
- "title": util.ObjToString((*mesData)["s_title"]),
|
|
|
- "subtitle": util.ObjToString((*mesData)["s_subtitle"]),
|
|
|
- "province": util.ObjToString((*userData)["s_province"]),
|
|
|
- "city": util.ObjToString((*userData)["s_city"]),
|
|
|
- "nickname": util.ObjToString((*userData)["s_nickname"]),
|
|
|
- "action": recType, //S:发送 D:送达 C:打开
|
|
|
- "date": time.Now().Unix(),
|
|
|
- "url": url,
|
|
|
- })
|
|
|
- } else {
|
|
|
- log.Println(mid, "-", userId, "mongodb 保存报错")
|
|
|
- }
|
|
|
+ defer util.Catch()
|
|
|
+ userData := utils.Compatible.Select(userId, `{"s_province":1,"s_city":1,"s_nickname":1}`)
|
|
|
+ mesData, ok2 := mongodb.FindById("message_app", mid, `{"s_title":1,"s_subtitle":1}`)
|
|
|
+ if ok2 && *mesData != nil && *userData != nil {
|
|
|
+ public.Mgo_Log.Save("jy_message", map[string]interface{}{
|
|
|
+ "openid": userId, //之前存的是openid,用户合并以后存的是userid
|
|
|
+ "mid": mid,
|
|
|
+ "title": util.ObjToString((*mesData)["s_title"]),
|
|
|
+ "subtitle": util.ObjToString((*mesData)["s_subtitle"]),
|
|
|
+ "province": util.ObjToString((*userData)["s_province"]),
|
|
|
+ "city": util.ObjToString((*userData)["s_city"]),
|
|
|
+ "nickname": util.ObjToString((*userData)["s_nickname"]),
|
|
|
+ "action": recType, //S:发送 D:送达 C:打开
|
|
|
+ "date": time.Now().Unix(),
|
|
|
+ "url": url,
|
|
|
+ })
|
|
|
+ } else {
|
|
|
+ log.Println(mid, "-", userId, "mongodb 保存报错")
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
func (m *Front) Wxerr() error {
|
|
|
- return m.Render("/_err.html")
|
|
|
+ return m.Render("/_err.html")
|
|
|
}
|
|
|
func isInTSguide(userid string, session *httpsession.Session) bool {
|
|
|
- if userid == "" {
|
|
|
- return false
|
|
|
- }
|
|
|
- data := jy.GetBigVipUserBaseMsg(session, *config.Middleground)
|
|
|
- //付费用户无免费订阅,不进入订阅向导页面
|
|
|
- if data.Data.Vip.Status > 0 || data.Data.Vip.Status > 0 {
|
|
|
- return false
|
|
|
- }
|
|
|
- i_ts_guide := data.Data.Free.TsGuide
|
|
|
- if i_ts_guide == 2 || (i_ts_guide == 0 && !data.Data.Free.FreeHasKey) {
|
|
|
- return true
|
|
|
- }
|
|
|
- return false
|
|
|
+ if userid == "" {
|
|
|
+ return false
|
|
|
+ }
|
|
|
+ data := jy.GetBigVipUserBaseMsg(session, *config.Middleground)
|
|
|
+ //付费用户无免费订阅,不进入订阅向导页面
|
|
|
+ if data.Data.Vip.Status > 0 || data.Data.Vip.Status > 0 {
|
|
|
+ return false
|
|
|
+ }
|
|
|
+ i_ts_guide := data.Data.Free.TsGuide
|
|
|
+ if i_ts_guide == 2 || (i_ts_guide == 0 && !data.Data.Free.FreeHasKey) {
|
|
|
+ return true
|
|
|
+ }
|
|
|
+ return false
|
|
|
}
|
|
|
func (m *Front) Feedback() error {
|
|
|
- defer util.Catch()
|
|
|
- userId, _ := m.GetSession("userId").(string)
|
|
|
- list, _ := mongodb.Find("interaction", bson.M{"s_submitid": userId}, `{"l_submitdate":-1}`, `{"s_remark":1,"l_submitdate":1,"s_opinion":1,"i_status":1}`, false, 0, 200)
|
|
|
- m.T["list"] = list
|
|
|
- fkid := m.GetString("fkid")
|
|
|
- if fkid != "" {
|
|
|
- fkid = encrypt.DecodeArticleId2ByCheck(fkid)[0]
|
|
|
- }
|
|
|
- fromName := m.GetString("fromName")
|
|
|
- if fromName != "" {
|
|
|
- if fromName == "zndy" {
|
|
|
- fromName = "剑鱼标讯实验室-智能订阅"
|
|
|
- } else if fromName == "sjdc" {
|
|
|
- fromName = "剑鱼标讯实验室-数据导出"
|
|
|
- } else if fromName == "cjss" {
|
|
|
- fromName = "剑鱼标讯实验室-超级搜索"
|
|
|
- } else if fromName == "zbqy" {
|
|
|
- fromName = "剑鱼标讯实验室-中标企业"
|
|
|
- } else if fromName == "gzqy" {
|
|
|
- fromName = "剑鱼标讯实验室-关注企业"
|
|
|
- }
|
|
|
- }
|
|
|
- _, m.T["advertText"] = getRewardText()
|
|
|
- m.T["advertImg"] = config.Sysconfig["advertImg"]
|
|
|
- m.T["advertName"] = config.Sysconfig["advertName"]
|
|
|
- m.T["advertUrl"] = config.Sysconfig["advertUrl"]
|
|
|
- m.T["fkid"] = fkid
|
|
|
- m.T["fromName"] = fromName
|
|
|
- return m.Render("/weixin/feedback.html", &m.T)
|
|
|
+ defer util.Catch()
|
|
|
+ userId, _ := m.GetSession("userId").(string)
|
|
|
+ list, _ := mongodb.Find("interaction", bson.M{"s_submitid": userId}, `{"l_submitdate":-1}`, `{"s_remark":1,"l_submitdate":1,"s_opinion":1,"i_status":1}`, false, 0, 200)
|
|
|
+ m.T["list"] = list
|
|
|
+ fkid := m.GetString("fkid")
|
|
|
+ if fkid != "" {
|
|
|
+ fkid = encrypt.DecodeArticleId2ByCheck(fkid)[0]
|
|
|
+ }
|
|
|
+ fromName := m.GetString("fromName")
|
|
|
+ if fromName != "" {
|
|
|
+ if fromName == "zndy" {
|
|
|
+ fromName = "剑鱼标讯实验室-智能订阅"
|
|
|
+ } else if fromName == "sjdc" {
|
|
|
+ fromName = "剑鱼标讯实验室-数据导出"
|
|
|
+ } else if fromName == "cjss" {
|
|
|
+ fromName = "剑鱼标讯实验室-超级搜索"
|
|
|
+ } else if fromName == "zbqy" {
|
|
|
+ fromName = "剑鱼标讯实验室-中标企业"
|
|
|
+ } else if fromName == "gzqy" {
|
|
|
+ fromName = "剑鱼标讯实验室-关注企业"
|
|
|
+ }
|
|
|
+ }
|
|
|
+ _, m.T["advertText"] = getRewardText()
|
|
|
+ m.T["advertImg"] = config.Sysconfig["advertImg"]
|
|
|
+ m.T["advertName"] = config.Sysconfig["advertName"]
|
|
|
+ m.T["advertUrl"] = config.Sysconfig["advertUrl"]
|
|
|
+ m.T["fkid"] = fkid
|
|
|
+ m.T["fromName"] = fromName
|
|
|
+ return m.Render("/weixin/feedback.html", &m.T)
|
|
|
}
|
|
|
|
|
|
// 招标订阅向导
|
|
|
func (f *Front) TSGuide() error {
|
|
|
- defer util.Catch()
|
|
|
- userid := util.ObjToString(f.GetSession("userId"))
|
|
|
- if f.Method() == "GET" {
|
|
|
- if !isInTSguide(userid, f.Session()) {
|
|
|
- return f.Redirect("/jyapp/wxkeyset/keyset/index")
|
|
|
- }
|
|
|
- return f.Render("/weixin/wxtsguide.html")
|
|
|
- } else {
|
|
|
- reqType := f.GetString("reqType")
|
|
|
- // index, _ := f.GetInteger("index")
|
|
|
- result := make(bson.M)
|
|
|
- if reqType == "save" {
|
|
|
- var keyMaps []map[string]interface{}
|
|
|
- keyWord := f.GetSlice("keyWord")
|
|
|
- area := f.GetString("area")
|
|
|
- if area == "" {
|
|
|
- result["flag"] = false
|
|
|
- } else { //20210930增加免费用户必须选择一个地区
|
|
|
- for _, v := range keyWord {
|
|
|
- vs := processKeyword(v)
|
|
|
- if vs == nil {
|
|
|
- continue
|
|
|
- }
|
|
|
- //多个词合并成一个
|
|
|
- key := ""
|
|
|
- for _, vkeys := range vs {
|
|
|
- key += vkeys
|
|
|
- }
|
|
|
- keyMaps = append(keyMaps, map[string]interface{}{
|
|
|
- "key": []string{key},
|
|
|
- "infotype": []string{},
|
|
|
- "notkey": []string{},
|
|
|
- "from": 1, //用于记录是否可以选择全国
|
|
|
- })
|
|
|
- if len(keyMaps) >= 10 {
|
|
|
- break
|
|
|
- }
|
|
|
- }
|
|
|
- areas := map[string]interface{}{
|
|
|
- area: []string{},
|
|
|
- }
|
|
|
- saveData := bson.M{}
|
|
|
- saveData = bson.M{
|
|
|
- "o_jy.o_area": areas,
|
|
|
- "o_jy.a_key": keyMaps,
|
|
|
- "o_jy.l_modifydate": time.Now().Unix(),
|
|
|
- "i_ts_guide": 2,
|
|
|
- "o_jy.i_newfree": 1,
|
|
|
- }
|
|
|
- result["flag"] = utils.Compatible.Update(userid, bson.M{"$set": saveData})
|
|
|
-
|
|
|
- }
|
|
|
- } else if reqType == "over" {
|
|
|
- saveData := bson.M{
|
|
|
- "i_ts_guide": 1,
|
|
|
- }
|
|
|
- result["flag"] = utils.Compatible.Update(userid, bson.M{"$set": saveData})
|
|
|
- } else if reqType == "preview" {
|
|
|
- rlt := elastic.GetByNgram(INDEX, TYPE, strings.Split(f.GetString("key"), " "), "", FINDF, `{"publishtime":-1}`, `"_id","title","publishtime","toptype","subtype","type","area","href","areaval"`, 0, 10)
|
|
|
- if *rlt != nil && len(*rlt) > 0 {
|
|
|
- for _, v := range *rlt {
|
|
|
- v["_id"] = encrypt.EncodeArticleId2ByCheck(util.ObjToString(v["_id"]))
|
|
|
- }
|
|
|
- }
|
|
|
- result["data"] = rlt
|
|
|
- }
|
|
|
- if result["flag"] != nil && result["flag"].(bool) {
|
|
|
- positionId := util.ObjToString(f.GetSession("positionId"))
|
|
|
- jy.ClearBigVipUserPower(positionId)
|
|
|
- }
|
|
|
- f.ServeJson(result)
|
|
|
- }
|
|
|
- return nil
|
|
|
+ defer util.Catch()
|
|
|
+ userid := util.ObjToString(f.GetSession("userId"))
|
|
|
+ if f.Method() == "GET" {
|
|
|
+ if !isInTSguide(userid, f.Session()) {
|
|
|
+ return f.Redirect("/jyapp/wxkeyset/keyset/index")
|
|
|
+ }
|
|
|
+ return f.Render("/weixin/wxtsguide.html")
|
|
|
+ } else {
|
|
|
+ reqType := f.GetString("reqType")
|
|
|
+ // index, _ := f.GetInteger("index")
|
|
|
+ result := make(bson.M)
|
|
|
+ if reqType == "save" {
|
|
|
+ var keyMaps []map[string]interface{}
|
|
|
+ keyWord := f.GetSlice("keyWord")
|
|
|
+ area := f.GetString("area")
|
|
|
+ if area == "" {
|
|
|
+ result["flag"] = false
|
|
|
+ } else { //20210930增加免费用户必须选择一个地区
|
|
|
+ for _, v := range keyWord {
|
|
|
+ vs := processKeyword(v)
|
|
|
+ if vs == nil {
|
|
|
+ continue
|
|
|
+ }
|
|
|
+ //多个词合并成一个
|
|
|
+ key := ""
|
|
|
+ for _, vkeys := range vs {
|
|
|
+ key += vkeys
|
|
|
+ }
|
|
|
+ keyMaps = append(keyMaps, map[string]interface{}{
|
|
|
+ "key": []string{key},
|
|
|
+ "infotype": []string{},
|
|
|
+ "notkey": []string{},
|
|
|
+ "from": 1, //用于记录是否可以选择全国
|
|
|
+ })
|
|
|
+ if len(keyMaps) >= 10 {
|
|
|
+ break
|
|
|
+ }
|
|
|
+ }
|
|
|
+ areas := map[string]interface{}{
|
|
|
+ area: []string{},
|
|
|
+ }
|
|
|
+ saveData := bson.M{}
|
|
|
+ saveData = bson.M{
|
|
|
+ "o_jy.o_area": areas,
|
|
|
+ "o_jy.a_key": keyMaps,
|
|
|
+ "o_jy.l_modifydate": time.Now().Unix(),
|
|
|
+ "i_ts_guide": 2,
|
|
|
+ "o_jy.i_newfree": 1,
|
|
|
+ }
|
|
|
+ result["flag"] = utils.Compatible.Update(userid, bson.M{"$set": saveData})
|
|
|
+
|
|
|
+ }
|
|
|
+ } else if reqType == "over" {
|
|
|
+ saveData := bson.M{
|
|
|
+ "i_ts_guide": 1,
|
|
|
+ }
|
|
|
+ result["flag"] = utils.Compatible.Update(userid, bson.M{"$set": saveData})
|
|
|
+ } else if reqType == "preview" {
|
|
|
+ rlt := elastic.GetByNgram(INDEX, TYPE, strings.Split(f.GetString("key"), " "), "", FINDF, `{"publishtime":-1}`, `"_id","title","publishtime","toptype","subtype","type","area","href","areaval"`, 0, 10)
|
|
|
+ if *rlt != nil && len(*rlt) > 0 {
|
|
|
+ for _, v := range *rlt {
|
|
|
+ v["_id"] = encrypt.EncodeArticleId2ByCheck(util.ObjToString(v["_id"]))
|
|
|
+ }
|
|
|
+ }
|
|
|
+ result["data"] = rlt
|
|
|
+ }
|
|
|
+ if result["flag"] != nil && result["flag"].(bool) {
|
|
|
+ positionId := util.InterfaceToStr(f.GetSession("positionId"))
|
|
|
+ jy.ClearBigVipUserPower(positionId)
|
|
|
+ }
|
|
|
+ f.ServeJson(result)
|
|
|
+ }
|
|
|
+ return nil
|
|
|
}
|
|
|
|
|
|
// 查看原文中转
|
|
|
func (f *Front) Transfer() error {
|
|
|
- return f.Redirect(f.GetString("url"))
|
|
|
+ return f.Redirect(f.GetString("url"))
|
|
|
}
|
|
|
func (c *Front) Captcha() error {
|
|
|
- id := captcha.NewLen(4) //此id为生成验证码的ID,并不是实际显示的数字,在提交校验时,需要根据此ID进行查询。
|
|
|
- c.SetSession("CheckCodeId", id)
|
|
|
- //校验时调用以下代码
|
|
|
- //ccid,_:=c.GetSession("CheckCodeId").(string)
|
|
|
- //captcha.VerifyString(ccid,"用户输入的校验码")//返回bool
|
|
|
- w := c.ResponseWriter
|
|
|
- w.Header().Set("Cache-Control", "no-cache, no-store, must-revalidate")
|
|
|
- w.Header().Set("Pragma", "no-cache")
|
|
|
- w.Header().Set("Expires", "0")
|
|
|
- w.Header().Set("Content-Type", "image/png")
|
|
|
- return captcha.WriteImage(w, id, 90, 30)
|
|
|
+ id := captcha.NewLen(4) //此id为生成验证码的ID,并不是实际显示的数字,在提交校验时,需要根据此ID进行查询。
|
|
|
+ c.SetSession("CheckCodeId", id)
|
|
|
+ //校验时调用以下代码
|
|
|
+ //ccid,_:=c.GetSession("CheckCodeId").(string)
|
|
|
+ //captcha.VerifyString(ccid,"用户输入的校验码")//返回bool
|
|
|
+ w := c.ResponseWriter
|
|
|
+ w.Header().Set("Cache-Control", "no-cache, no-store, must-revalidate")
|
|
|
+ w.Header().Set("Pragma", "no-cache")
|
|
|
+ w.Header().Set("Expires", "0")
|
|
|
+ w.Header().Set("Content-Type", "image/png")
|
|
|
+ return captcha.WriteImage(w, id, 90, 30)
|
|
|
}
|
|
|
|
|
|
func (m *Front) WxpushListInfo(_id string) error {
|
|
|
- defer util.Catch()
|
|
|
- return m.Redirect("/jyapp/swordfish/historypush")
|
|
|
+ defer util.Catch()
|
|
|
+ return m.Redirect("/jyapp/swordfish/historypush")
|
|
|
}
|
|
|
|
|
|
func (f *Front) LimitSearchText() {
|
|
|
- userId, _ := f.GetSession("userId").(string)
|
|
|
- if userId == "" || !public.Lst.IsCanLogin(userId) {
|
|
|
- f.Write("<meta name=\"viewport\" content=\"width=device-width, initial-scale=1, user-scalable=no\">需要登录!")
|
|
|
- return
|
|
|
- }
|
|
|
- timeout, _ := f.GetInteger("t")
|
|
|
- if timeout > 0 || timeout == -1 {
|
|
|
- public.Lst.TimeOut = timeout
|
|
|
- }
|
|
|
- count, _ := f.GetInteger("c")
|
|
|
- if (count > 0 || count == -1 || count == -2) && count != public.Lst.Count && public.Lst.Flag {
|
|
|
- public.Lst.Count = count
|
|
|
- public.Lst.Init()
|
|
|
- }
|
|
|
- flag, _ := f.GetInteger("f")
|
|
|
- status := ""
|
|
|
- if flag == -2 { //重置
|
|
|
- status = "重置"
|
|
|
- public.InitLimitSearchText(true, config.Sysconfig)
|
|
|
- } else if flag == -1 && public.Lst.Flag { //关闭
|
|
|
- status = "关闭"
|
|
|
- public.Lst.Flag = false
|
|
|
- public.Lst.Clear()
|
|
|
- } else if flag == 1 && !public.Lst.Flag { //打开
|
|
|
- status = "打开"
|
|
|
- public.Lst.Flag = true
|
|
|
- public.Lst.Init()
|
|
|
- } else {
|
|
|
- if public.Lst.Flag {
|
|
|
- status = "打开"
|
|
|
- } else {
|
|
|
- status = "关闭"
|
|
|
- }
|
|
|
- }
|
|
|
- totalPage, _ := f.GetInteger("p")
|
|
|
- if totalPage > 0 && public.Lst.Flag {
|
|
|
- public.Lst.TotalPage = totalPage
|
|
|
- }
|
|
|
- f.Write("<meta name=\"viewport\" content=\"width=device-width, initial-scale=1, user-scalable=no\">" + fmt.Sprintf(public.Lst.Msg, status, public.Lst.Count, public.Lst.TimeOut, public.Lst.TotalPage))
|
|
|
+ userId, _ := f.GetSession("userId").(string)
|
|
|
+ if userId == "" || !public.Lst.IsCanLogin(userId) {
|
|
|
+ f.Write("<meta name=\"viewport\" content=\"width=device-width, initial-scale=1, user-scalable=no\">需要登录!")
|
|
|
+ return
|
|
|
+ }
|
|
|
+ timeout, _ := f.GetInteger("t")
|
|
|
+ if timeout > 0 || timeout == -1 {
|
|
|
+ public.Lst.TimeOut = timeout
|
|
|
+ }
|
|
|
+ count, _ := f.GetInteger("c")
|
|
|
+ if (count > 0 || count == -1 || count == -2) && count != public.Lst.Count && public.Lst.Flag {
|
|
|
+ public.Lst.Count = count
|
|
|
+ public.Lst.Init()
|
|
|
+ }
|
|
|
+ flag, _ := f.GetInteger("f")
|
|
|
+ status := ""
|
|
|
+ if flag == -2 { //重置
|
|
|
+ status = "重置"
|
|
|
+ public.InitLimitSearchText(true, config.Sysconfig)
|
|
|
+ } else if flag == -1 && public.Lst.Flag { //关闭
|
|
|
+ status = "关闭"
|
|
|
+ public.Lst.Flag = false
|
|
|
+ public.Lst.Clear()
|
|
|
+ } else if flag == 1 && !public.Lst.Flag { //打开
|
|
|
+ status = "打开"
|
|
|
+ public.Lst.Flag = true
|
|
|
+ public.Lst.Init()
|
|
|
+ } else {
|
|
|
+ if public.Lst.Flag {
|
|
|
+ status = "打开"
|
|
|
+ } else {
|
|
|
+ status = "关闭"
|
|
|
+ }
|
|
|
+ }
|
|
|
+ totalPage, _ := f.GetInteger("p")
|
|
|
+ if totalPage > 0 && public.Lst.Flag {
|
|
|
+ public.Lst.TotalPage = totalPage
|
|
|
+ }
|
|
|
+ f.Write("<meta name=\"viewport\" content=\"width=device-width, initial-scale=1, user-scalable=no\">" + fmt.Sprintf(public.Lst.Msg, status, public.Lst.Count, public.Lst.TimeOut, public.Lst.TotalPage))
|
|
|
}
|
|
|
|
|
|
func (f *Front) Index() error {
|
|
|
- url := f.Url()
|
|
|
- redirect := "/jyapp/jylab/mainSearch"
|
|
|
- if strings.Contains(url, "sign=") && strings.Contains(url, "url=") && strings.Contains(url, "from=") {
|
|
|
- wh := strings.Split(url, "?")
|
|
|
- redirect = "/jyapp/free/login?" + wh[len(wh)-1]
|
|
|
- }
|
|
|
- return f.Redirect(redirect)
|
|
|
+ url := f.Url()
|
|
|
+ redirect := "/jyapp/jylab/mainSearch"
|
|
|
+ if strings.Contains(url, "sign=") && strings.Contains(url, "url=") && strings.Contains(url, "from=") {
|
|
|
+ wh := strings.Split(url, "?")
|
|
|
+ redirect = "/jyapp/free/login?" + wh[len(wh)-1]
|
|
|
+ }
|
|
|
+ return f.Redirect(redirect)
|
|
|
}
|
|
|
|
|
|
func (f *Front) Kicked() error {
|
|
|
- return f.Redirect("/jyapp/free/login?back=index")
|
|
|
+ return f.Redirect("/jyapp/free/login?back=index")
|
|
|
}
|
|
|
|
|
|
// 设置js css 版本号,修改以后记得同步更新seo.json中的值
|
|
|
func (f *Front) SetSeoVersion() {
|
|
|
- //!@111qqq@! md5=51a3b7b4ed3cf140
|
|
|
- if f.GetString("p") != "51a3b7b4ed3cf140" {
|
|
|
- return
|
|
|
- }
|
|
|
- version := ""
|
|
|
- if f.GetString("v") == "" {
|
|
|
- version = config.Seoconfig_Version
|
|
|
- if version == "" {
|
|
|
- version, _ = config.Seoconfig["version"].(string)
|
|
|
- }
|
|
|
- } else {
|
|
|
- version = f.GetString("v")
|
|
|
- config.Seoconfig_Version = version
|
|
|
- }
|
|
|
- //新的版本号 version作为固定版本号,非大版本不更改,mod_version 作为小版本号 经常变动;
|
|
|
- mod_version := ""
|
|
|
- if f.GetString("mv") == "" {
|
|
|
- mod_version = config.Seoconfig_Mod_Version
|
|
|
- if mod_version == "" {
|
|
|
- mod_version, _ = config.Seoconfig["mod_version"].(string)
|
|
|
- }
|
|
|
- } else {
|
|
|
- mod_version = f.GetString("mv")
|
|
|
- config.Seoconfig_Mod_Version = mod_version
|
|
|
- }
|
|
|
- f.Write("当前版本号:" + mod_version + "-固定版本号:" + version)
|
|
|
+ //!@111qqq@! md5=51a3b7b4ed3cf140
|
|
|
+ if f.GetString("p") != "51a3b7b4ed3cf140" {
|
|
|
+ return
|
|
|
+ }
|
|
|
+ version := ""
|
|
|
+ if f.GetString("v") == "" {
|
|
|
+ version = config.Seoconfig_Version
|
|
|
+ if version == "" {
|
|
|
+ version, _ = config.Seoconfig["version"].(string)
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ version = f.GetString("v")
|
|
|
+ config.Seoconfig_Version = version
|
|
|
+ }
|
|
|
+ //新的版本号 version作为固定版本号,非大版本不更改,mod_version 作为小版本号 经常变动;
|
|
|
+ mod_version := ""
|
|
|
+ if f.GetString("mv") == "" {
|
|
|
+ mod_version = config.Seoconfig_Mod_Version
|
|
|
+ if mod_version == "" {
|
|
|
+ mod_version, _ = config.Seoconfig["mod_version"].(string)
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ mod_version = f.GetString("mv")
|
|
|
+ config.Seoconfig_Mod_Version = mod_version
|
|
|
+ }
|
|
|
+ f.Write("当前版本号:" + mod_version + "-固定版本号:" + version)
|
|
|
}
|
|
|
|
|
|
func (f *Front) JylabShareTimeline() {
|
|
|
- userId, _ := f.GetSession("userId").(string)
|
|
|
- if userId == "" {
|
|
|
- f.ServeJson(map[string]interface{}{
|
|
|
- "status": false,
|
|
|
- })
|
|
|
- return
|
|
|
- }
|
|
|
- reqType := f.GetString("reqType")
|
|
|
- if reqType == "update" {
|
|
|
- public.UpdateShareStatus(userId, "app", 3, 1, 0, false, config.Sysconfig)
|
|
|
- f.ServeJson(map[string]interface{}{
|
|
|
- "status": true,
|
|
|
- })
|
|
|
- } else {
|
|
|
- jylabsharetimeline := 1
|
|
|
- if public.CheckUserNeedForceShare(userId, public.ShareType_lab, config.Sysconfig) {
|
|
|
- jylabsharetimeline = 0
|
|
|
- }
|
|
|
- f.ServeJson(map[string]interface{}{
|
|
|
- "jylabsharetimeline": jylabsharetimeline,
|
|
|
- })
|
|
|
- }
|
|
|
+ userId, _ := f.GetSession("userId").(string)
|
|
|
+ if userId == "" {
|
|
|
+ f.ServeJson(map[string]interface{}{
|
|
|
+ "status": false,
|
|
|
+ })
|
|
|
+ return
|
|
|
+ }
|
|
|
+ reqType := f.GetString("reqType")
|
|
|
+ if reqType == "update" {
|
|
|
+ public.UpdateShareStatus(userId, "app", 3, 1, 0, false, config.Sysconfig)
|
|
|
+ f.ServeJson(map[string]interface{}{
|
|
|
+ "status": true,
|
|
|
+ })
|
|
|
+ } else {
|
|
|
+ jylabsharetimeline := 1
|
|
|
+ if public.CheckUserNeedForceShare(userId, public.ShareType_lab, config.Sysconfig) {
|
|
|
+ jylabsharetimeline = 0
|
|
|
+ }
|
|
|
+ f.ServeJson(map[string]interface{}{
|
|
|
+ "jylabsharetimeline": jylabsharetimeline,
|
|
|
+ })
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
/*
|
|
@@ -493,196 +493,196 @@ shareType - 分享类型 1-详情页 2-推送列表 3-实验室
|
|
|
shareProperty - 分享性质 1-被动分享 2-主动分享
|
|
|
*/
|
|
|
func (s *Front) UpdateShareStatus() error {
|
|
|
- userId, _ := s.GetSession("userId").(string)
|
|
|
- shareType, _ := s.GetInt("shareType")
|
|
|
- shareProperty, _ := s.GetInt("shareProperty")
|
|
|
- public.UpdateShareStatus(userId, "app", shareType, shareProperty, 0, false, config.Sysconfig)
|
|
|
- s.ServeJson(map[string]interface{}{})
|
|
|
- return nil
|
|
|
+ userId, _ := s.GetSession("userId").(string)
|
|
|
+ shareType, _ := s.GetInt("shareType")
|
|
|
+ shareProperty, _ := s.GetInt("shareProperty")
|
|
|
+ public.UpdateShareStatus(userId, "app", shareType, shareProperty, 0, false, config.Sysconfig)
|
|
|
+ s.ServeJson(map[string]interface{}{})
|
|
|
+ return nil
|
|
|
}
|
|
|
func (s *Front) ChangePro() {
|
|
|
- defer util.Catch()
|
|
|
- userid := util.ObjToString(s.GetSession("userId"))
|
|
|
- if userid != "" {
|
|
|
- jylabutil.UpdateAuthory(userid, "i_tablepro", 1)
|
|
|
- }
|
|
|
+ defer util.Catch()
|
|
|
+ userid := util.ObjToString(s.GetSession("userId"))
|
|
|
+ if userid != "" {
|
|
|
+ jylabutil.UpdateAuthory(userid, "i_tablepro", 1)
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
func (s *Front) ShowRedSpotOnMenu() {
|
|
|
- defer util.Catch()
|
|
|
- userid := util.ObjToString(s.GetSession("userId"))
|
|
|
- if userid == "" {
|
|
|
- token := s.GetString("token")
|
|
|
- if token != "" {
|
|
|
- sign, status := analySign("显示小红点", token)
|
|
|
- if status == 1 {
|
|
|
- userid = sign.UserId //xxxxx
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
- subscribe, project, ent, notice := 0, 0, 0, 0
|
|
|
- if userid != "" {
|
|
|
- users := utils.Compatible.Select(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}`)
|
|
|
- user := jy.GetBigVipUserBaseMsg(s.Session(), *config.Middleground)
|
|
|
- uid := ""
|
|
|
- isNew := user.Data.Entniche.IsNew > 0
|
|
|
- if users != nil {
|
|
|
- if jy.SwitchService.IsMember(s.Session(), *config.Middleground) {
|
|
|
- subscribe = util.IntAll((*users)["i_member_apppushunread"])
|
|
|
- } else if isNew {
|
|
|
- subscribe = 0
|
|
|
- } else {
|
|
|
- subscribe = util.IntAll((*users)["i_apppushunread"])
|
|
|
- }
|
|
|
- }
|
|
|
- memberStatus := user.Data.Member.Status
|
|
|
- /* if s_member_mainid := util.ObjToString((*user)["s_member_mainid"]); s_member_mainid != "" && util.IntAll((*user)["i_member_sub_status"]) == 1 && memberStatus > 0 {
|
|
|
- uid = s_member_mainid
|
|
|
- } else {
|
|
|
- uid = userid
|
|
|
- }*/
|
|
|
- if user.Data.Member.Pid != "" {
|
|
|
- uid = user.Data.Member.Pid
|
|
|
- } else {
|
|
|
- uid = userid
|
|
|
- }
|
|
|
- powerMap := user.PowerMap
|
|
|
- if memberStatus > 0 && (powerMap[13] || powerMap[16]) {
|
|
|
- ent = util.IntAll(public.BaseMysql.Count("follow_ent_monitor", map[string]interface{}{
|
|
|
- "i_apppushunread": 1,
|
|
|
- "s_userid": uid,
|
|
|
- }))
|
|
|
- }
|
|
|
- if memberStatus > 0 && powerMap[14] {
|
|
|
- project = util.IntAll(public.BaseMysql.Count("follow_project_monitor", map[string]interface{}{
|
|
|
- "i_apppushunread": 1,
|
|
|
- "s_userid": uid,
|
|
|
- }))
|
|
|
- }
|
|
|
- notice = mongodb.Count("jyapp_notice", map[string]interface{}{
|
|
|
- "i_unread": 1,
|
|
|
- "s_userid": userid,
|
|
|
- })
|
|
|
- }
|
|
|
- s.ServeJson(map[string]interface{}{
|
|
|
- "subscribe": subscribe,
|
|
|
- "my": project + ent + notice,
|
|
|
- "notice": notice,
|
|
|
- "follow_project": project,
|
|
|
- "follow_ent": ent,
|
|
|
- })
|
|
|
+ defer util.Catch()
|
|
|
+ userid := util.ObjToString(s.GetSession("userId"))
|
|
|
+ if userid == "" {
|
|
|
+ token := s.GetString("token")
|
|
|
+ if token != "" {
|
|
|
+ sign, status := analySign("显示小红点", token)
|
|
|
+ if status == 1 {
|
|
|
+ userid = sign.UserId //xxxxx
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ subscribe, project, ent, notice := 0, 0, 0, 0
|
|
|
+ if userid != "" {
|
|
|
+ users := utils.Compatible.Select(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}`)
|
|
|
+ user := jy.GetBigVipUserBaseMsg(s.Session(), *config.Middleground)
|
|
|
+ uid := ""
|
|
|
+ isNew := user.Data.Entniche.IsNew > 0
|
|
|
+ if users != nil {
|
|
|
+ if jy.SwitchService.IsMember(s.Session(), *config.Middleground) {
|
|
|
+ subscribe = util.IntAll((*users)["i_member_apppushunread"])
|
|
|
+ } else if isNew {
|
|
|
+ subscribe = 0
|
|
|
+ } else {
|
|
|
+ subscribe = util.IntAll((*users)["i_apppushunread"])
|
|
|
+ }
|
|
|
+ }
|
|
|
+ memberStatus := user.Data.Member.Status
|
|
|
+ /* if s_member_mainid := util.ObjToString((*user)["s_member_mainid"]); s_member_mainid != "" && util.IntAll((*user)["i_member_sub_status"]) == 1 && memberStatus > 0 {
|
|
|
+ uid = s_member_mainid
|
|
|
+ } else {
|
|
|
+ uid = userid
|
|
|
+ }*/
|
|
|
+ if user.Data.Member.Pid != "" {
|
|
|
+ uid = user.Data.Member.Pid
|
|
|
+ } else {
|
|
|
+ uid = userid
|
|
|
+ }
|
|
|
+ powerMap := user.PowerMap
|
|
|
+ if memberStatus > 0 && (powerMap[13] || powerMap[16]) {
|
|
|
+ ent = util.IntAll(public.BaseMysql.Count("follow_ent_monitor", map[string]interface{}{
|
|
|
+ "i_apppushunread": 1,
|
|
|
+ "s_userid": uid,
|
|
|
+ }))
|
|
|
+ }
|
|
|
+ if memberStatus > 0 && powerMap[14] {
|
|
|
+ project = util.IntAll(public.BaseMysql.Count("follow_project_monitor", map[string]interface{}{
|
|
|
+ "i_apppushunread": 1,
|
|
|
+ "s_userid": uid,
|
|
|
+ }))
|
|
|
+ }
|
|
|
+ notice = mongodb.Count("jyapp_notice", map[string]interface{}{
|
|
|
+ "i_unread": 1,
|
|
|
+ "s_userid": userid,
|
|
|
+ })
|
|
|
+ }
|
|
|
+ s.ServeJson(map[string]interface{}{
|
|
|
+ "subscribe": subscribe,
|
|
|
+ "my": project + ent + notice,
|
|
|
+ "notice": notice,
|
|
|
+ "follow_project": project,
|
|
|
+ "follow_ent": ent,
|
|
|
+ })
|
|
|
}
|
|
|
|
|
|
func (s *Front) GoToUpdate() {
|
|
|
- mustupdate := false
|
|
|
- updateflag, _ := s.GetInt("mustupdate")
|
|
|
- if updateflag == 1 {
|
|
|
- mustupdate = true
|
|
|
- }
|
|
|
- s.T["update"] = config.Sysconfig["update"]
|
|
|
- s.T["mustupdate"] = mustupdate
|
|
|
- s.Render("/app/update.html")
|
|
|
+ mustupdate := false
|
|
|
+ updateflag, _ := s.GetInt("mustupdate")
|
|
|
+ if updateflag == 1 {
|
|
|
+ mustupdate = true
|
|
|
+ }
|
|
|
+ s.T["update"] = config.Sysconfig["update"]
|
|
|
+ s.T["mustupdate"] = mustupdate
|
|
|
+ s.Render("/app/update.html")
|
|
|
}
|
|
|
|
|
|
// 静态页面
|
|
|
func (s *Front) StaticPage(pagename string) error {
|
|
|
- return s.Render("/staticpage/" + pagename)
|
|
|
+ return s.Render("/staticpage/" + pagename)
|
|
|
}
|
|
|
|
|
|
// 商机管理推送列表 --- 下个版本删除
|
|
|
func (s *Front) EntnichePushList() error {
|
|
|
- pi := s.GetString("pi")
|
|
|
- pn := s.GetString("pn")
|
|
|
- if pi != "" && pn != "" {
|
|
|
- d_pn_s := strings.Split(encrypt.SE.Decode4HexByCheck(pi), "_")
|
|
|
- if len(d_pn_s) == 3 && util.ObjToString(d_pn_s[0]) == "entniche" {
|
|
|
- entId := util.IntAll(d_pn_s[1])
|
|
|
- entUserId := util.IntAll(d_pn_s[2])
|
|
|
- entName := encrypt.SE.Decode4HexByCheck(pn)
|
|
|
- s.SetSession("entId", entId)
|
|
|
- s.SetSession("entName", entName)
|
|
|
- s.SetSession("entUserId", entUserId)
|
|
|
- }
|
|
|
- }
|
|
|
- return s.Redirect("/page_entniche/home?f=push&selectTime=" + s.GetString("selectTime"))
|
|
|
+ pi := s.GetString("pi")
|
|
|
+ pn := s.GetString("pn")
|
|
|
+ if pi != "" && pn != "" {
|
|
|
+ d_pn_s := strings.Split(encrypt.SE.Decode4HexByCheck(pi), "_")
|
|
|
+ if len(d_pn_s) == 3 && util.ObjToString(d_pn_s[0]) == "entniche" {
|
|
|
+ entId := util.IntAll(d_pn_s[1])
|
|
|
+ entUserId := util.IntAll(d_pn_s[2])
|
|
|
+ entName := encrypt.SE.Decode4HexByCheck(pn)
|
|
|
+ s.SetSession("entId", entId)
|
|
|
+ s.SetSession("entName", entName)
|
|
|
+ s.SetSession("entUserId", entUserId)
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return s.Redirect("/page_entniche/home?f=push&selectTime=" + s.GetString("selectTime"))
|
|
|
}
|
|
|
|
|
|
// 商机管理推送
|
|
|
func (s *Front) EntnichePush() error {
|
|
|
- pi := s.GetString("pi")
|
|
|
- pn := s.GetString("pn")
|
|
|
- if pi != "" && pn != "" {
|
|
|
- d_pn_s := strings.Split(encrypt.SE.Decode4HexByCheck(pi), "_")
|
|
|
- if len(d_pn_s) == 3 && util.ObjToString(d_pn_s[0]) == "entniche" {
|
|
|
- entId := util.IntAll(d_pn_s[1])
|
|
|
- entUserId := util.IntAll(d_pn_s[2])
|
|
|
- entName := encrypt.SE.Decode4HexByCheck(pn)
|
|
|
- s.SetSession("entId", entId)
|
|
|
- s.SetSession("entName", entName)
|
|
|
- s.SetSession("entUserId", entUserId)
|
|
|
- }
|
|
|
- }
|
|
|
- if s.GetString("type") == "nomsgtip" {
|
|
|
- return s.Redirect("/page_entniche/page/subsetting/sub_entrance.html")
|
|
|
- } else if s.GetString("type") == "subscribepush" {
|
|
|
- return s.Redirect("/jyapp/swordfish/historypush?f=push&t=entniche&pushtime=" + s.GetString("time"))
|
|
|
- } else if s.GetString("type") == "old_subscribepush" {
|
|
|
- return s.Redirect("/page_entniche/home?f=push&selectTime=" + s.GetString("time"))
|
|
|
- }
|
|
|
- return nil
|
|
|
+ pi := s.GetString("pi")
|
|
|
+ pn := s.GetString("pn")
|
|
|
+ if pi != "" && pn != "" {
|
|
|
+ d_pn_s := strings.Split(encrypt.SE.Decode4HexByCheck(pi), "_")
|
|
|
+ if len(d_pn_s) == 3 && util.ObjToString(d_pn_s[0]) == "entniche" {
|
|
|
+ entId := util.IntAll(d_pn_s[1])
|
|
|
+ entUserId := util.IntAll(d_pn_s[2])
|
|
|
+ entName := encrypt.SE.Decode4HexByCheck(pn)
|
|
|
+ s.SetSession("entId", entId)
|
|
|
+ s.SetSession("entName", entName)
|
|
|
+ s.SetSession("entUserId", entUserId)
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if s.GetString("type") == "nomsgtip" {
|
|
|
+ return s.Redirect("/page_entniche/page/subsetting/sub_entrance.html")
|
|
|
+ } else if s.GetString("type") == "subscribepush" {
|
|
|
+ return s.Redirect("/jyapp/swordfish/historypush?f=push&t=entniche&pushtime=" + s.GetString("time"))
|
|
|
+ } else if s.GetString("type") == "old_subscribepush" {
|
|
|
+ return s.Redirect("/page_entniche/home?f=push&selectTime=" + s.GetString("time"))
|
|
|
+ }
|
|
|
+ return nil
|
|
|
}
|
|
|
|
|
|
// 删除模板缓存
|
|
|
func (f *Front) Delc(url string) {
|
|
|
- f.App.TemplateMgr.CacheDelete(strings.Replace(url, "GG", "/", 1))
|
|
|
- f.WriteBytes([]byte("清除路径:" + url))
|
|
|
+ f.App.TemplateMgr.CacheDelete(strings.Replace(url, "GG", "/", 1))
|
|
|
+ f.WriteBytes([]byte("清除路径:" + url))
|
|
|
}
|
|
|
|
|
|
func (f *Front) IosExam() {
|
|
|
- isIosExam, isIosExamPhone, isVip, isEnt := IosExamInfo(f.Action, true, true)
|
|
|
- showVip, showEnt := true, true
|
|
|
- if isIosExam || isIosExamPhone {
|
|
|
- if !isVip {
|
|
|
- showVip = false
|
|
|
- }
|
|
|
- if !isEnt {
|
|
|
- showEnt = false
|
|
|
- }
|
|
|
- }
|
|
|
- f.ServeJson(map[string]interface{}{
|
|
|
- "error_code": 0,
|
|
|
- "data": map[string]interface{}{
|
|
|
- "showVip": showVip,
|
|
|
- "showEnt": showEnt,
|
|
|
- },
|
|
|
- })
|
|
|
+ isIosExam, isIosExamPhone, isVip, isEnt := IosExamInfo(f.Action, true, true)
|
|
|
+ showVip, showEnt := true, true
|
|
|
+ if isIosExam || isIosExamPhone {
|
|
|
+ if !isVip {
|
|
|
+ showVip = false
|
|
|
+ }
|
|
|
+ if !isEnt {
|
|
|
+ showEnt = false
|
|
|
+ }
|
|
|
+ }
|
|
|
+ f.ServeJson(map[string]interface{}{
|
|
|
+ "error_code": 0,
|
|
|
+ "data": map[string]interface{}{
|
|
|
+ "showVip": showVip,
|
|
|
+ "showEnt": showEnt,
|
|
|
+ },
|
|
|
+ })
|
|
|
}
|
|
|
|
|
|
func (f *Front) DownloadJyAppQrOther() error {
|
|
|
- w := f.ResponseWriter
|
|
|
- w.Header().Set("Cache-Control", "no-cache, no-store, must-revalidate")
|
|
|
- w.Header().Set("Pragma", "no-cache")
|
|
|
- w.Header().Set("Expires", "0")
|
|
|
- w.Header().Set("Content-Type", "image/png")
|
|
|
- discored := f.GetString("discored")
|
|
|
- data := config.Seoconfig["jyDomain"].(string) + "/X/" + discored
|
|
|
- r, _ := qr.Encode(data, qr.M)
|
|
|
- pngdat := r.PNG()
|
|
|
- _, err := w.Write(pngdat)
|
|
|
- return err
|
|
|
+ w := f.ResponseWriter
|
|
|
+ w.Header().Set("Cache-Control", "no-cache, no-store, must-revalidate")
|
|
|
+ w.Header().Set("Pragma", "no-cache")
|
|
|
+ w.Header().Set("Expires", "0")
|
|
|
+ w.Header().Set("Content-Type", "image/png")
|
|
|
+ discored := f.GetString("discored")
|
|
|
+ data := config.Seoconfig["jyDomain"].(string) + "/X/" + discored
|
|
|
+ r, _ := qr.Encode(data, qr.M)
|
|
|
+ pngdat := r.PNG()
|
|
|
+ _, err := w.Write(pngdat)
|
|
|
+ return err
|
|
|
}
|
|
|
|
|
|
// QRCodePage 静态页面
|
|
|
func (s *Front) QRCodePage() error {
|
|
|
- s.T["path"] = s.GetString("path")
|
|
|
- return s.Render("/weixin/sharePic.html")
|
|
|
+ s.T["path"] = s.GetString("path")
|
|
|
+ return s.Render("/weixin/sharePic.html")
|
|
|
}
|
|
|
|
|
|
func (s *Front) AppConfig() {
|
|
|
- s.ServeJson(config.Sysconfig["appConfig"])
|
|
|
+ s.ServeJson(config.Sysconfig["appConfig"])
|
|
|
}
|
|
|
|
|
|
// app微信分享域名
|
|
|
func (s *Front) ShareDomain() {
|
|
|
- s.ServeJson(config.Seoconfig["wxDomain"].(string))
|
|
|
+ s.ServeJson(config.Seoconfig["wxDomain"].(string))
|
|
|
}
|