|
@@ -14,6 +14,7 @@ import (
|
|
|
"log"
|
|
|
"net/http"
|
|
|
"regexp"
|
|
|
+ "strconv"
|
|
|
"strings"
|
|
|
"sync"
|
|
|
"time"
|
|
@@ -59,6 +60,7 @@ type Login struct {
|
|
|
channelSign xweb.Mapper `xweb:"/jyapp/free/channelSign"` //渠道统计
|
|
|
savePushIdMsg xweb.Mapper `xweb:"/jyapp/free/savePushIdMsg"` //推送id记录
|
|
|
setPwd xweb.Mapper `xweb:"/jyapp/free/setPwd"` //修改密码
|
|
|
+ activateLogin xweb.Mapper `xweb:"/jyapp/free/al/(.*)"` //小程序激活活动模拟登录跳转详情页
|
|
|
}
|
|
|
|
|
|
var (
|
|
@@ -79,6 +81,38 @@ func init() {
|
|
|
go rs.GC()
|
|
|
}
|
|
|
|
|
|
+// 小程序激活活动模拟登录跳转详情页
|
|
|
+func (l *Login) ActivateLogin(id string) error {
|
|
|
+ redirectUrl := "pages/tabbar/home/index" //小程序首页地址
|
|
|
+ if id != "" && encrypt.SE.EncodeString(id) != "" {
|
|
|
+ id = encrypt.SE.EncodeString(id)
|
|
|
+ sessVal := l.Session().GetMultiple()
|
|
|
+ userid, _ := sessVal["mgoUserId"].(string)
|
|
|
+ uId, err := strconv.Atoi(id)
|
|
|
+ activateInfos := public.BaseMysql.SelectBySql(`SELECT au.user_id,au.phone,au.position_id,ab.id FROM activate_user au LEFT JOIN activate_bidding ab ON au.id = ab.au_id WHERE au.id = ?`, uId)
|
|
|
+ if activateInfos != nil && len(*activateInfos) > 0 {
|
|
|
+ activateInfo := (*activateInfos)[0]
|
|
|
+ biddingId := qutil.InterfaceToStr(activateInfo["id"])
|
|
|
+ if userid == "" { //模拟登录
|
|
|
+ if err == nil && uId > 0 {
|
|
|
+ mgoUserId := qutil.InterfaceToStr(activateInfo["user_id"])
|
|
|
+ if mgoUserId != "" && biddingId != "" {
|
|
|
+ if ok := jy.JyAppCreateSession(mongodb, l.Session(), mgoUserId, 0, l.ResponseWriter, false, config.Middleground, qutil.ObjToString(config.Sysconfig["appPushServiceRpc"]), qutil.IntAll(config.Sysconfig["criticality"])); ok {
|
|
|
+ sessVal := l.Session().GetMultiple()
|
|
|
+ userid, _ = sessVal["mgoUserId"].(string)
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if userid != "" {
|
|
|
+ biddingId = encrypt.EncodeArticleId2ByCheck(biddingId)
|
|
|
+ redirectUrl = fmt.Sprintf("/jyapp/article/content/%s.html?miniprogram=%s", biddingId, encrypt.SE.Encode2Hex(strconv.FormatInt(time.Now().Unix(), 10)))
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return l.Redirect(redirectUrl)
|
|
|
+}
|
|
|
+
|
|
|
func (l *Login) Login() error {
|
|
|
defer qutil.Catch()
|
|
|
if l.Method() == "GET" {
|