|
@@ -563,7 +563,6 @@ func (f *Front) Login(key string) error {
|
|
|
|
|
|
//用户是否登录
|
|
|
func (f *Front) HasSign() error {
|
|
|
- log.Println("into~~~~~~~~~~~~~~~~~~~~~~~~")
|
|
|
tmp := f.Session().Get("user")
|
|
|
openid := f.GetSession("s_m_openid")
|
|
|
if openid == nil {
|
|
@@ -583,7 +582,6 @@ func (f *Front) HasSign() error {
|
|
|
"encryptId": se.EncodeString(util.BsonIdToSId(user["_id"])),
|
|
|
})
|
|
|
}
|
|
|
- log.Println("end~~~~~~~~~~~~~~~~~~~~~~")
|
|
|
return nil
|
|
|
}
|
|
|
|
|
@@ -852,8 +850,9 @@ func (m *Front) Wxprotocol() error {
|
|
|
//推送列表
|
|
|
func (m *Front) WxpushListInfo(_id string) error {
|
|
|
defer util.Catch()
|
|
|
- openid, _ := m.Session().Get("s_m_openid").(string)
|
|
|
- if openid == "" {
|
|
|
+ openid := util.ObjToString(m.GetSession("s_m_openid"))
|
|
|
+ userid := util.ObjToString(m.GetSession("userId"))
|
|
|
+ if userid == "" {
|
|
|
m.T["isWeixin"] = 1
|
|
|
return m.Render("/weixin/about.html")
|
|
|
}
|
|
@@ -861,21 +860,21 @@ func (m *Front) WxpushListInfo(_id string) error {
|
|
|
date := util.Int64All(_id)
|
|
|
if date > 0 {
|
|
|
go ca.SaveCache("jy_pushvisit", map[string]interface{}{
|
|
|
- "openid": openid,
|
|
|
+ "openid": userid,
|
|
|
"pdate": date,
|
|
|
"vsid": "-1", //打开列表页,无sid默认为-1
|
|
|
"date": time.Now(),
|
|
|
"isopen": true,
|
|
|
})
|
|
|
//获取已浏览记录
|
|
|
- visited := ca.Search("select vsid from jy_pushvisit where openid=? and pdate=?", openid, date)
|
|
|
+ visited := ca.Search("select vsid from jy_pushvisit where openid=? and pdate=?", userid, date)
|
|
|
vsidList := []string{}
|
|
|
for _, v := range visited {
|
|
|
vsidList = append(vsidList, (v["vsid"]).(string))
|
|
|
}
|
|
|
|
|
|
//获取推送信息
|
|
|
- data := ca.SearchOne("select * from jy_push where id=? and openid=? and date=?", util.FormatDateByInt64(&date, util.Date_Short_Layout), openid, _id)
|
|
|
+ data := ca.SearchOne("select * from jy_push where id=? and openid=? and date=?", util.FormatDateByInt64(&date, util.Date_Short_Layout), userid, _id)
|
|
|
res := make(map[string]interface{})
|
|
|
if len(data) > 0 {
|
|
|
data["visit"] = vsidList
|
|
@@ -924,7 +923,7 @@ func (m *Front) WxpushListInfo(_id string) error {
|
|
|
myavatar, _ := m.Session().Get("s_avatar").(string)
|
|
|
m.T["nickname"] = mynickname
|
|
|
m.T["avatar"] = myavatar
|
|
|
- m.T["forceShareFlag"] = public.CheckUserNeedForceShare(openid, public.ShareType_push)
|
|
|
+ m.T["forceShareFlag"] = public.CheckUserNeedForceShare(userid, public.ShareType_push)
|
|
|
return m.Render("/weixin/wxpush.html", &m.T)
|
|
|
}
|
|
|
func (m *Front) Feedback() error {
|
|
@@ -1232,8 +1231,8 @@ func (f *Front) DownloadJyAppQr() error {
|
|
|
}
|
|
|
|
|
|
func (f *Front) LimitSearchText() {
|
|
|
- openid, _ := f.GetSession("s_m_openid").(string)
|
|
|
- if openid == "" || !public.Lst.IsCanLogin(openid) {
|
|
|
+ userid := util.ObjToString(f.GetSession("userId"))
|
|
|
+ if userid == "" || !public.Lst.IsCanLogin(userid) {
|
|
|
f.Write("<meta name=\"viewport\" content=\"width=device-width, initial-scale=1, user-scalable=no\">需要登录!")
|
|
|
return
|
|
|
}
|
|
@@ -1444,8 +1443,8 @@ func (f *Front) YmResult() error {
|
|
|
|
|
|
//
|
|
|
func (f *Front) JylabShareTimeline() {
|
|
|
- openid, _ := f.GetSession("s_m_openid").(string)
|
|
|
- if openid == "" {
|
|
|
+ userid := util.ObjToString(f.GetSession("userId"))
|
|
|
+ if userid == "" {
|
|
|
f.ServeJson(map[string]interface{}{
|
|
|
"status": false,
|
|
|
})
|
|
@@ -1453,13 +1452,13 @@ func (f *Front) JylabShareTimeline() {
|
|
|
}
|
|
|
reqType := f.GetString("reqType")
|
|
|
if reqType == "update" {
|
|
|
- public.UpdateShareStatus(openid, "wx", 3, 1, 0, false)
|
|
|
+ public.UpdateShareStatus(userid, "wx", 3, 1, 0, false)
|
|
|
f.ServeJson(map[string]interface{}{
|
|
|
"status": true,
|
|
|
})
|
|
|
} else {
|
|
|
jylabsharetimeline := 1
|
|
|
- if public.CheckUserNeedForceShare(openid, public.ShareType_lab) {
|
|
|
+ if public.CheckUserNeedForceShare(userid, public.ShareType_lab) {
|
|
|
jylabsharetimeline = 0
|
|
|
}
|
|
|
f.ServeJson(map[string]interface{}{
|
|
@@ -1475,13 +1474,7 @@ shareType - 分享类型 1-详情页 2-推送列表 3-实验室
|
|
|
shareProperty - 分享性质 1-被动分享 2-主动分享
|
|
|
*/
|
|
|
func (s *Front) UpdateShareStatus() error {
|
|
|
- openId := s.GetString("openId")
|
|
|
- if openId != "" {
|
|
|
- openId = se.DecodeString(openId)
|
|
|
- }
|
|
|
- if openId == "" {
|
|
|
- openId, _ = s.GetSession("s_m_openid").(string)
|
|
|
- }
|
|
|
+ userid := util.ObjToString(s.GetSession("userId"))
|
|
|
shareType, _ := s.GetInt("shareType")
|
|
|
shareProperty, _ := s.GetInt("shareProperty")
|
|
|
ispcforceshare, _ := s.GetInt("ispcforceshare")
|
|
@@ -1489,7 +1482,7 @@ func (s *Front) UpdateShareStatus() error {
|
|
|
if platform == "" {
|
|
|
platform = "wx"
|
|
|
}
|
|
|
- public.UpdateShareStatus(openId, platform, shareType, shareProperty, ispcforceshare, s.GetString("isRepair") == "y")
|
|
|
+ public.UpdateShareStatus(userid, platform, shareType, shareProperty, ispcforceshare, s.GetString("isRepair") == "y")
|
|
|
s.ServeJson(map[string]interface{}{})
|
|
|
return nil
|
|
|
}
|