|
@@ -9,7 +9,6 @@ import (
|
|
|
"jy/src/jfw/wx"
|
|
|
"log"
|
|
|
"math/rand"
|
|
|
- "net/http"
|
|
|
"net/url"
|
|
|
"regexp"
|
|
|
"strconv"
|
|
@@ -74,18 +73,20 @@ type Front struct {
|
|
|
pcAjaxReq xweb.Mapper `xweb:"/front/pcAjaxReq"`
|
|
|
myFeedbacks xweb.Mapper `xweb:"/swordfish/myFeedbacks"`
|
|
|
wxerr xweb.Mapper `xweb:"/mob/err"`
|
|
|
- getRecomKWs xweb.Mapper `xweb:"/member/getRecomKWs"` //获取推荐关键词
|
|
|
- behaviorRecord xweb.Mapper `xweb:"/member/behaviorRecord"` //记录用户点击的关键词
|
|
|
- tSGuide xweb.Mapper `xweb:"/front/tenderSubscribe/guide"` //引导页
|
|
|
- transfer xweb.Mapper `xweb:"/front/transfer"` //原文链接中转
|
|
|
-
|
|
|
- jyCms xweb.Mapper `xweb:"/jyCms/(.*)/index([^.]*).html"` //剑鱼栏目列表页
|
|
|
- encrypt xweb.Mapper `xweb:"/share/encrypt"` //分享三级页加密
|
|
|
- newhistorypush xweb.Mapper `xweb:"/swordfish/newhistorypush"` //新的历时推送记录
|
|
|
- historypush xweb.Mapper `xweb:"/swordfish/historypush"` //历时推送记录
|
|
|
- historypushPaging xweb.Mapper `xweb:"/swordfish/historypush/paging"` //历时推送记录--分页
|
|
|
- aboutus xweb.Mapper `xweb:"/front/aboutus.html"` //关于我们
|
|
|
- busicooperation xweb.Mapper `xweb:"/front/busicooperation.html"` //商务合作
|
|
|
+ getRecomKWs xweb.Mapper `xweb:"/member/getRecomKWs"` //获取推荐关键词
|
|
|
+ behaviorRecord xweb.Mapper `xweb:"/member/behaviorRecord"` //记录用户点击的关键词
|
|
|
+ tSGuide xweb.Mapper `xweb:"/front/tenderSubscribe/guide"` //引导页
|
|
|
+ transfer xweb.Mapper `xweb:"/front/transfer"` //原文链接中转
|
|
|
+ jyblog xweb.Mapper `xweb:"/jyblog/index([^.]*).html"` //剑鱼标讯博客
|
|
|
+ jybdetail xweb.Mapper `xweb:"/jyblog/([^.]*).html"` //剑鱼标讯博客三级页
|
|
|
+ blogpraise xweb.Mapper `xweb:"/jyblog/blogpraise"` //剑鱼标讯博客三级页点赞
|
|
|
+ jyCms xweb.Mapper `xweb:"/jyCms/(.*)/index([^.]*).html"` //剑鱼栏目列表页
|
|
|
+ encrypt xweb.Mapper `xweb:"/share/encrypt"` //分享三级页加密
|
|
|
+ newhistorypush xweb.Mapper `xweb:"/swordfish/newhistorypush"` //新的历时推送记录
|
|
|
+ historypush xweb.Mapper `xweb:"/swordfish/historypush"` //历时推送记录
|
|
|
+ historypushPaging xweb.Mapper `xweb:"/swordfish/historypush/paging"` //历时推送记录--分页
|
|
|
+ aboutus xweb.Mapper `xweb:"/front/aboutus.html"` //关于我们
|
|
|
+ busicooperation xweb.Mapper `xweb:"/front/busicooperation.html"` //商务合作
|
|
|
|
|
|
/********************wxkeyset:v1.8**************************/
|
|
|
wxKeysetAjaxReq xweb.Mapper `xweb:"/wxkeyset/ajaxReq"` //订阅词ajax请求
|
|
@@ -164,24 +165,25 @@ func init() {
|
|
|
urlMap = config.Sysconfig["redirect"].(map[string]interface{})
|
|
|
}
|
|
|
|
|
|
-// 前端页面加载
|
|
|
+//前端页面加载
|
|
|
func (this *Front) ReloadTo(href string) {
|
|
|
this.T["transfer"] = fmt.Sprintf("%s/%s", config.Sysconfig["webdomain"].(string), href)
|
|
|
this.Render("/pc/reloadTo.html", &this.T)
|
|
|
}
|
|
|
|
|
|
-// 获取打赏标语
|
|
|
+//获取打赏标语
|
|
|
func (this *Front) RewardText() {
|
|
|
rewardText, _ := getRewardText()
|
|
|
this.Write(rewardText)
|
|
|
return
|
|
|
}
|
|
|
|
|
|
+//
|
|
|
func (f *Front) Hp() error {
|
|
|
return f.Redirect("/")
|
|
|
}
|
|
|
|
|
|
-// 二维码图片
|
|
|
+//二维码图片
|
|
|
func (f *Front) Qr() error {
|
|
|
w := f.ResponseWriter
|
|
|
w.Header().Set("Cache-Control", "no-cache, no-store, must-revalidate")
|
|
@@ -194,7 +196,7 @@ func (f *Front) Qr() error {
|
|
|
return err
|
|
|
}
|
|
|
|
|
|
-// 二维码图片
|
|
|
+//二维码图片
|
|
|
func (f *Front) Hpshare() error {
|
|
|
w := f.ResponseWriter
|
|
|
w.Header().Set("Cache-Control", "no-cache, no-store, must-revalidate")
|
|
@@ -235,6 +237,7 @@ func (p *Front) PayIndex() error {
|
|
|
return p.Render("/weixin/pay.html", &p.T)
|
|
|
}
|
|
|
|
|
|
+//
|
|
|
func (f *Front) RecInof() error {
|
|
|
var msg = ""
|
|
|
var flag = true
|
|
@@ -357,7 +360,7 @@ func (f *Front) RecInof() error {
|
|
|
return nil
|
|
|
}
|
|
|
|
|
|
-// 更新取到的权重最低的字段到bidding表
|
|
|
+//更新取到的权重最低的字段到bidding表
|
|
|
func updateLastWrongField(id, result string) {
|
|
|
if result == "" {
|
|
|
return
|
|
@@ -369,7 +372,7 @@ func updateLastWrongField(id, result string) {
|
|
|
})
|
|
|
}
|
|
|
|
|
|
-// 轮询查登录状态
|
|
|
+//轮询查登录状态
|
|
|
func (f *Front) AjaxPolling() {
|
|
|
reqType, _ := f.GetInteger("reqType")
|
|
|
if reqType == 1 {
|
|
@@ -416,7 +419,7 @@ func (f *Front) AjaxPolling() {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
-// 广告服务
|
|
|
+//广告服务
|
|
|
func (f *Front) Advservices() error {
|
|
|
var shareid = f.GetString("id")
|
|
|
if len(shareid) == 0 {
|
|
@@ -427,12 +430,12 @@ func (f *Front) Advservices() error {
|
|
|
return f.Render("/pc/advservices.html", &f.T)
|
|
|
}
|
|
|
|
|
|
-// 移动端专题推广
|
|
|
+//移动端专题推广
|
|
|
func (f *Front) Mobtopics() error {
|
|
|
return f.Render("/active/mobtopics.html")
|
|
|
}
|
|
|
|
|
|
-// 移动端专题推广
|
|
|
+//移动端专题推广
|
|
|
func (f *Front) Extension(page string) error {
|
|
|
//今日头条和百度推广用的同一个页面,如以后有变动,需拆分成两个。
|
|
|
if page != "tengxun" {
|
|
@@ -441,7 +444,7 @@ func (f *Front) Extension(page string) error {
|
|
|
return f.Render("/active/ext-" + page + ".html")
|
|
|
}
|
|
|
|
|
|
-// SEM推广
|
|
|
+//SEM推广
|
|
|
func (f *Front) Topics() error {
|
|
|
f.T["logid"] = config.Seoconfig["jySEMtgy"].(string)
|
|
|
userId, _ := f.GetSession("userId").(string)
|
|
@@ -482,6 +485,7 @@ func (f *Front) Topics() error {
|
|
|
return f.Render("/pc/landingpage.html", &f.T)
|
|
|
}
|
|
|
|
|
|
+//
|
|
|
func (f *Front) Notin() error {
|
|
|
refer := "/"
|
|
|
tmp := f.Header("Referer")
|
|
@@ -503,6 +507,7 @@ func (f *Front) Notin() error {
|
|
|
return f.Render("/pc/notin.html", &f.T)
|
|
|
}
|
|
|
|
|
|
+//
|
|
|
func (f *Front) Followinfo() error {
|
|
|
var pid = f.GetString("pid")
|
|
|
var kid = f.GetString("kid")
|
|
@@ -587,6 +592,7 @@ func (f *Front) Followinfo() error {
|
|
|
return nil
|
|
|
}
|
|
|
|
|
|
+//
|
|
|
func (f *Front) Login(key string) error {
|
|
|
shareid := se.DecodeString(key)
|
|
|
openid := redis.GetStr("sso", "p_usershare_"+shareid)
|
|
@@ -609,7 +615,7 @@ func (f *Front) Login(key string) error {
|
|
|
return nil
|
|
|
}
|
|
|
|
|
|
-// 用户是否登录
|
|
|
+//用户是否登录
|
|
|
func (f *Front) HasSign() error {
|
|
|
sessVal := f.Session().GetMultiple()
|
|
|
if userId, _ := sessVal["mgoUserId"].(string); userId != "" {
|
|
@@ -662,31 +668,11 @@ func (f *Front) SignOut() error {
|
|
|
config.Middleground.PowerCheckCenter.DelCheckRedis("10000", positionId)
|
|
|
}
|
|
|
f.Session().Clear()
|
|
|
- f.ClearCookie(fmt.Sprintf("%s,%s", jyutil.SKCookieName, jyutil.KeepLoginCookieName))
|
|
|
+ jyutil.ClearCookie(f.ResponseWriter, fmt.Sprintf("%s,%s", jyutil.SKCookieName, jyutil.KeepLoginCookieName))
|
|
|
f.ServeJson("ok")
|
|
|
return nil
|
|
|
}
|
|
|
|
|
|
-// ClearCookie 清楚前端cookie 缓存
|
|
|
-func (f *Front) ClearCookie(name string) {
|
|
|
- if name == "" {
|
|
|
- name = jyutil.SKCookieName
|
|
|
- }
|
|
|
- for _, nk := range strings.Split(name, ",") {
|
|
|
- if nk != "" {
|
|
|
- http.SetCookie(f.ResponseWriter, &http.Cookie{
|
|
|
- Name: nk,
|
|
|
- Value: "",
|
|
|
- Path: "/",
|
|
|
- HttpOnly: false,
|
|
|
- MaxAge: -1,
|
|
|
- Expires: time.Now().Add(-1),
|
|
|
- Domain: httpsession.Domain,
|
|
|
- })
|
|
|
- }
|
|
|
- }
|
|
|
-}
|
|
|
-
|
|
|
// GetLoginNum 微信公众号获取数字
|
|
|
func (f *Front) GetLoginNum(prestr string) error {
|
|
|
var oid = f.GetString("oid")
|
|
@@ -704,7 +690,7 @@ func (f *Front) GetLoginNum(prestr string) error {
|
|
|
return nil
|
|
|
}
|
|
|
|
|
|
-// 一键报告
|
|
|
+//一键报告
|
|
|
func (m *Front) Onekey() error {
|
|
|
defer util.Catch()
|
|
|
fkid := encrypt.DecodeArticleId2ByCheck(m.GetString("fkid"))[0]
|
|
@@ -770,6 +756,7 @@ func (m *Front) Onekey() error {
|
|
|
return nil
|
|
|
}
|
|
|
|
|
|
+//
|
|
|
func (m *Front) Encrypt() error {
|
|
|
defer util.Catch()
|
|
|
id := m.GetString("id")
|
|
@@ -792,11 +779,12 @@ func (m *Front) Encrypt() error {
|
|
|
return nil
|
|
|
}
|
|
|
|
|
|
+//
|
|
|
func (m *Front) Wxerr() error {
|
|
|
return m.Render("/_err.html")
|
|
|
}
|
|
|
|
|
|
-// 查找用户并创建session
|
|
|
+//查找用户并创建session
|
|
|
func FindUserAndCreateSess(openid string, sess *httpsession.Session, typ string, flag, isSwitchToBestIdentity bool) (bool, *map[string]interface{}, map[string]interface{}) {
|
|
|
return CreateSession(map[string]interface{}{
|
|
|
"s_m_openid": openid,
|
|
@@ -860,7 +848,7 @@ func CreateSession(q map[string]interface{}, sess *httpsession.Session, typ stri
|
|
|
|
|
|
var bindUrl = "/front/account/phone/bind?mode=mergeBind"
|
|
|
|
|
|
-// 微信跳转创建session
|
|
|
+//微信跳转创建session
|
|
|
func (m *Front) Sess(ostr string) error {
|
|
|
defer util.Catch()
|
|
|
if strings.Contains(ostr, "&") {
|
|
@@ -978,7 +966,7 @@ func (m *Front) Sess(ostr string) error {
|
|
|
return nil
|
|
|
}
|
|
|
|
|
|
-// 删除模板缓存
|
|
|
+//删除模板缓存
|
|
|
func (d *Front) Delc(url string) {
|
|
|
defer util.Catch()
|
|
|
d.App.TemplateMgr.CacheDelete(strings.Replace(url, "GG", "/", 1))
|
|
@@ -989,12 +977,12 @@ func (m *Front) Viewdemo() {
|
|
|
m.Redirect("/swordfish/guide/-1")
|
|
|
}
|
|
|
|
|
|
-// 剑鱼标讯用户协议
|
|
|
+//剑鱼标讯用户协议
|
|
|
func (m *Front) Wxprotocol() error {
|
|
|
return m.Render("/weixin/wxprotocol.html")
|
|
|
}
|
|
|
|
|
|
-// 推送列表
|
|
|
+//推送列表
|
|
|
func (m *Front) WxpushListInfo(_id string) error {
|
|
|
return m.Redirect("/swordfish/historypush")
|
|
|
}
|
|
@@ -1074,7 +1062,7 @@ func (m *Front) Isrecord(name string) {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
-// 招标订阅向导
|
|
|
+//招标订阅向导
|
|
|
func (f *Front) TSGuide() error {
|
|
|
defer util.Catch()
|
|
|
userid := util.ObjToString(f.GetSession("userId"))
|
|
@@ -1177,12 +1165,12 @@ func isInTSguide(userid string) bool {
|
|
|
return false
|
|
|
}
|
|
|
|
|
|
-// 查看原文中转
|
|
|
+//查看原文中转
|
|
|
func (f *Front) Transfer() error {
|
|
|
return f.Redirect(f.GetString("url"))
|
|
|
}
|
|
|
|
|
|
-// 关于我们
|
|
|
+//关于我们
|
|
|
func (f *Front) Aboutus() error {
|
|
|
code := f.GetString("code")
|
|
|
if mobileReg.MatchString(f.UserAgent()) {
|
|
@@ -1200,7 +1188,7 @@ func (f *Front) Aboutus() error {
|
|
|
return f.SetBody(content)
|
|
|
}
|
|
|
|
|
|
-// 商务合作
|
|
|
+//商务合作
|
|
|
func (f *Front) Busicooperation() error {
|
|
|
var shareid = f.GetString("id")
|
|
|
if len(shareid) == 0 {
|
|
@@ -1230,7 +1218,7 @@ func (f *Front) Gethotkey() error {
|
|
|
return nil
|
|
|
}
|
|
|
|
|
|
-// redis存储用户搜索关键词 企业 项目信息
|
|
|
+//redis存储用户搜索关键词 企业 项目信息
|
|
|
func (f *Front) Rediskw() error {
|
|
|
skw := f.GetString("skw")
|
|
|
num := f.GetString("num")
|
|
@@ -1297,7 +1285,7 @@ func (f *Front) DownloadJyApp() error {
|
|
|
return f.Redirect(getDownloadUri(code, source, domain+apkurl))
|
|
|
}
|
|
|
|
|
|
-// 获取app下载地址,不通code对应不通渠道的app包
|
|
|
+//获取app下载地址,不通code对应不通渠道的app包
|
|
|
func getDownloadUri(code, source, download string) string {
|
|
|
jyapp := config.Sysconfig["jyapp"].(map[string]interface{})
|
|
|
channelMap := jyapp["channelDir"].(map[string]interface{})
|
|
@@ -1389,7 +1377,7 @@ func (f *Front) LimitSearchText() {
|
|
|
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))
|
|
|
}
|
|
|
|
|
|
-// 设置js css 版本号,修改以后记得同步更新seo.json中的值
|
|
|
+//设置js css 版本号,修改以后记得同步更新seo.json中的值
|
|
|
func (f *Front) SetSeoVersion() {
|
|
|
//!@111qqq@! md5=51a3b7b4ed3cf140
|
|
|
if f.GetString("p") != "51a3b7b4ed3cf140" {
|
|
@@ -1517,6 +1505,7 @@ func (f *Front) YmResult() error {
|
|
|
|
|
|
}
|
|
|
|
|
|
+//
|
|
|
func (f *Front) JylabShareTimeline() {
|
|
|
userid := util.ObjToString(f.GetSession("userId"))
|
|
|
if userid == "" {
|
|
@@ -1542,8 +1531,7 @@ func (f *Front) JylabShareTimeline() {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
-/*
|
|
|
-*
|
|
|
+/**
|
|
|
成功分享后 更改分享相关信息
|
|
|
|
|
|
shareType - 分享类型 1-详情页 2-推送列表 3-实验室
|
|
@@ -1628,6 +1616,7 @@ func encodeURIComponent(str string) string {
|
|
|
return r
|
|
|
}
|
|
|
|
|
|
+//
|
|
|
func (f *Front) GetAdByCode() {
|
|
|
m := map[string]interface{}{}
|
|
|
if ad_name := f.GetString("ad_name"); ad_name != "" {
|