瀏覽代碼

物料链接转发

renjiaojiao 1 月之前
父節點
當前提交
689782af82
共有 1 個文件被更改,包括 6 次插入6 次删除
  1. 6 6
      src/jfw/front/material.go

+ 6 - 6
src/jfw/front/material.go

@@ -2,7 +2,6 @@ package front
 
 import (
 	util "app.yhyue.com/moapp/jybase/common"
-	"app.yhyue.com/moapp/jybase/encrypt"
 	"app.yhyue.com/moapp/jybase/go-xweb/xweb"
 	"app.yhyue.com/moapp/jybase/redis"
 	"app.yhyue.com/moapp/jypkg/public"
@@ -55,11 +54,11 @@ func (m *Material) FileDownload() error {
 // 物料二维码链接或者图文链接中转接口  //链接格式   /material?mid=
 func (m *Material) LinkTransfer(mid, personChannel string) error {
 	sess := m.Session().GetMultiple()
-	mlid := encrypt.SE.DecodeString(mid)
+	mlid := util.IntAll(mid)
 	types, _ := m.GetInteger("types")
 
 	realUrl, imgWebpage := "", ""
-	res := public.Mysql.SelectBySql("SELECT qrcode_url,img_webpage FROM bi_service.operating_materials WHERE id = ?", util.IntAll(mlid))
+	res := public.Mysql.SelectBySql("SELECT qrcode_url,img_webpage FROM bi_service.operating_materials WHERE id = ?", mlid)
 	if res != nil && len(*res) > 0 {
 		realUrl = util.InterfaceToStr((*res)[0]["qrcode_url"])
 		imgWebpage = util.InterfaceToStr((*res)[0]["img_webpage"])
@@ -68,13 +67,14 @@ func (m *Material) LinkTransfer(mid, personChannel string) error {
 		return m.Redirect(util.InterfaceToStr(config.Sysconfig["webdomain"]))
 	}
 	redis.Put("limitation", fmt.Sprintf("firstVisitTagByWX_%s", m.Session().Id()), fmt.Sprintf("materials_%s", personChannel), cacheTimeOut) //登录注册 用户标识
-	addLog(sess, m.Request, util.IntAll(mlid), types, personChannel, realUrl)
+	addLog(sess, m.Request, mlid, types, personChannel, realUrl)
 	log.Println("重定向链接:", mlid, realUrl, imgWebpage)
-	if types == 1 {
+	if types == 1 && imgWebpage != "" {
 		return m.Redirect(imgWebpage)
-	} else {
+	} else if types == 0 && realUrl != "" {
 		return m.Redirect(realUrl)
 	}
+	return m.Redirect(util.InterfaceToStr(config.Sysconfig["webdomain"]))
 }
 
 func ImageToBase64(img image.Image, format string) (string, error) {