xingzai 1 год назад
Родитель
Сommit
f9097ef9e8

+ 31 - 31
controllers/base_auth_mobile.go

@@ -43,44 +43,44 @@ func (this *BaseAuthMobileController) Prepare() {
 			}
 			}
 			this.Token = authorization
 			this.Token = authorization
 			if authorization == "" {
 			if authorization == "" {
-				this.JSON(models.BaseResponse{Ret: 408, Msg: "请重新授权!", ErrMsg: "请重新授权:Token is empty or account is empty"}, false, false)
-				this.StopRun()
-				return
-			}
-			session, err := models.GetCygxSessionMobile(authorization)
-			if err != nil {
-				if err.Error() == utils.ErrNoRow() {
-					this.JSON(models.BaseResponse{Ret: 408, Msg: "信息已变更,请重新登陆!", ErrMsg: "Token 信息已变更:Token: " + authorization}, false, false)
+				nilWxUser := new(models.WxUserItem)
+				this.User = nilWxUser
+			} else {
+				session, err := models.GetCygxSessionMobile(authorization)
+				if err != nil {
+					if err.Error() == utils.ErrNoRow() {
+						this.JSON(models.BaseResponse{Ret: 408, Msg: "信息已变更,请重新登陆!", ErrMsg: "Token 信息已变更:Token: " + authorization}, false, false)
+						this.StopRun()
+						return
+					}
+					this.JSON(models.BaseResponse{Ret: 408, Msg: "网络异常,请稍后重试!", ErrMsg: "获取用户信息异常,Eerr:" + err.Error()}, false, false)
 					this.StopRun()
 					this.StopRun()
 					return
 					return
 				}
 				}
-				this.JSON(models.BaseResponse{Ret: 408, Msg: "网络异常,请稍后重试!", ErrMsg: "获取用户信息异常,Eerr:" + err.Error()}, false, false)
-				this.StopRun()
-				return
-			}
-			if session == nil {
-				this.JSON(models.BaseResponse{Ret: 408, Msg: "网络异常,请稍后重试!", ErrMsg: "sesson is empty "}, false, false)
-				this.StopRun()
-				return
-			}
-			//wxUser, err := models.GetWxUserItemByUserId(session.UserId)
-			wxUser, err := models.GetWxUserAouthByMobile(session.Mobile)
-			if err != nil && err != services.ERR_USER_NOT_BIND {
-				if err.Error() == utils.ErrNoRow() {
-					this.JSON(models.BaseResponse{Ret: 408, Msg: "信息已变更,请重新登陆!", ErrMsg: "获取信息失败 " + strconv.Itoa(session.UserId)}, false, false)
+				if session == nil {
+					this.JSON(models.BaseResponse{Ret: 408, Msg: "网络异常,请稍后重试!", ErrMsg: "sesson is empty "}, false, false)
 					this.StopRun()
 					this.StopRun()
 					return
 					return
 				}
 				}
-				this.JSON(models.BaseResponse{Ret: 408, Msg: "网络异常,请稍后重试!", ErrMsg: "获取wx_user信息异常,Eerr:" + err.Error()}, false, false)
-				this.StopRun()
-				return
-			}
-			if wxUser == nil {
-				this.JSON(models.BaseResponse{Ret: 408, Msg: "网络异常,请稍后重试!", ErrMsg: "admin is empty "}, false, false)
-				this.StopRun()
-				return
+				//wxUser, err := models.GetWxUserItemByUserId(session.UserId)
+				wxUser, err := models.GetWxUserAouthByMobile(session.Mobile)
+				if err != nil && err != services.ERR_USER_NOT_BIND {
+					if err.Error() == utils.ErrNoRow() {
+						this.JSON(models.BaseResponse{Ret: 408, Msg: "信息已变更,请重新登陆!", ErrMsg: "获取信息失败 " + strconv.Itoa(session.UserId)}, false, false)
+						this.StopRun()
+						return
+					}
+					this.JSON(models.BaseResponse{Ret: 408, Msg: "网络异常,请稍后重试!", ErrMsg: "获取wx_user信息异常,Eerr:" + err.Error()}, false, false)
+					this.StopRun()
+					return
+				}
+				if wxUser == nil {
+					this.JSON(models.BaseResponse{Ret: 408, Msg: "网络异常,请稍后重试!", ErrMsg: "admin is empty "}, false, false)
+					this.StopRun()
+					return
+				}
+				this.User = wxUser
 			}
 			}
-			this.User = wxUser
 		} else {
 		} else {
 			this.JSON(models.BaseResponse{Ret: 408, Msg: "请求异常,请联系客服!", ErrMsg: "POST之外的请求,暂不支持"}, false, false)
 			this.JSON(models.BaseResponse{Ret: 408, Msg: "请求异常,请联系客服!", ErrMsg: "POST之外的请求,暂不支持"}, false, false)
 			this.StopRun()
 			this.StopRun()

+ 6 - 0
controllers/home.go

@@ -19,6 +19,7 @@ type BaseHomeController struct {
 // @Title 最新首页列表接口
 // @Title 最新首页列表接口
 // @Description 最新首页列表接口
 // @Description 最新首页列表接口
 // @Param   LabelKeyword   query   string  true       "标签关键词"
 // @Param   LabelKeyword   query   string  true       "标签关键词"
+// @Param   HashtagKeyword   query   string  true       "主题关键词"
 // @Param   KeyWord   query   string  true       "搜索关键词"
 // @Param   KeyWord   query   string  true       "搜索关键词"
 // @Param   PageSize   query   int  true       "每页数据条数"
 // @Param   PageSize   query   int  true       "每页数据条数"
 // @Param   CurrentIndex   query   int  true       "当前页页码,从1开始"
 // @Param   CurrentIndex   query   int  true       "当前页页码,从1开始"
@@ -40,6 +41,7 @@ func (this *HomeController) NewList() {
 	pageSize, _ := this.GetInt("PageSize")
 	pageSize, _ := this.GetInt("PageSize")
 	currentIndex, _ := this.GetInt("CurrentIndex")
 	currentIndex, _ := this.GetInt("CurrentIndex")
 	labelKeyword := this.GetString("LabelKeyword")
 	labelKeyword := this.GetString("LabelKeyword")
+	hashtagKeyword := this.GetString("HashtagKeyword")
 	keyWord := this.GetString("KeyWord")
 	keyWord := this.GetString("KeyWord")
 
 
 	var startSize int
 	var startSize int
@@ -58,6 +60,10 @@ func (this *HomeController) NewList() {
 	var yanxuanArticleIds []int
 	var yanxuanArticleIds []int
 	//var yanxuanspecialIds []int
 	//var yanxuanspecialIds []int
 
 
+	if hashtagKeyword != "" {
+
+	}
+
 	//var total int
 	//var total int
 	resp := new(models.HomeResourceDataListResp)
 	resp := new(models.HomeResourceDataListResp)
 	condition += " AND source IN ('article','activity','yanxuanspecial')   " // 只有研选的文章、研选的活动、研选的专栏这三种
 	condition += " AND source IN ('article','activity','yanxuanspecial')   " // 只有研选的文章、研选的活动、研选的专栏这三种

+ 11 - 23
controllers/report.go

@@ -2,8 +2,6 @@ package controllers
 
 
 import (
 import (
 	"hongze/hongze_mfyx/models"
 	"hongze/hongze_mfyx/models"
-	"hongze/hongze_mfyx/services"
-	"hongze/hongze_mfyx/utils"
 )
 )
 
 
 // 报告
 // 报告
@@ -15,8 +13,8 @@ type ReportCommonController struct {
 	BaseCommonController
 	BaseCommonController
 }
 }
 
 
-// @Title 是否展示绝密内参
-// @Description 获取是否展示绝密内参接口
+// @Title 相关按钮是否展示接口
+// @Description 相关按钮是否展示接口
 // @Param	request	body models.IsShow true "type json string"
 // @Param	request	body models.IsShow true "type json string"
 // @Success 200
 // @Success 200
 // @router /isShow [get]
 // @router /isShow [get]
@@ -33,30 +31,20 @@ func (this *ReportController) IsShow() {
 		return
 		return
 	}
 	}
 	var resp models.IsShow
 	var resp models.IsShow
-	IsShowFreeButton, err := services.GetfreeButtonIsShow(user)
+	var condition string
+	var pars []interface{}
+	condition += ` AND  a.user_id = ?    `
+	pars = append(pars, user.UserId)
+	total, err := models.GetCygxYanxuanSpecialAuthorCount(condition, pars)
 	if err != nil {
 	if err != nil {
 		br.Msg = "获取失败"
 		br.Msg = "获取失败"
-		br.ErrMsg = "获取失败,GetfreeButtonIsShow Err:" + err.Error()
+		br.ErrMsg = "获取失败,Err:" + err.Error()
 		return
 		return
 	}
 	}
-	resp.IsShowChart = true
-	//resp.IsShowResearch = true
-	resp.LinkWxExplain = utils.LINK_WX_EXPLAIN
-	resp.ActivitySpecialExplain = utils.ACTIVITY_SPECIAL_EXPLAIN
-	//resp.YanXuan_Explain = true
-	resp.IsShowFreeButton = IsShowFreeButton
-	resp.IsBelongRai = services.GetBelongingRai(user.Mobile)
-	//resp.IsShowQuestionnaire = services.GetQuestionnaireButtonIsShow() // 获取研选问卷调查按钮是否展示
-	resp.IsShowResearchPoints = true
-	if utils.RunMode == "release" { //是否展示关于我们的视频,测试环境审核做隐藏
-		resp.IsShowAboutVideo = true
+
+	if total > 0 {
+		resp.IsYanxuanSpecialAuthor = true
 	}
 	}
-	resp.IsShowList = true
-	resp.SearchTxtList.SummarySearch = "全局搜索"
-	resp.SearchTxtList.ReportSearch = "全局搜索"
-	resp.SearchTxtList.YanXuanSearch = "全局搜索"
-	resp.SearchTxtList.ActivitySearch = "全局搜索"
-	resp.SearchTxtList.TabSearch = "请输入关键词"
 	resp.IsShow = true
 	resp.IsShow = true
 	br.Ret = 200
 	br.Ret = 200
 	br.Success = true
 	br.Success = true

+ 15 - 4
controllers/yanxuan_special.go

@@ -15,6 +15,10 @@ type YanxuanSpecialController struct {
 	BaseAuthController
 	BaseAuthController
 }
 }
 
 
+type YanxuanSpecialNoLoginController struct {
+	BaseAuthMobileController
+}
+
 // @Title 专栏列表
 // @Title 专栏列表
 // @Description 专栏列表
 // @Description 专栏列表
 // @Param   UserId   query   int  true       "用户ID"
 // @Param   UserId   query   int  true       "用户ID"
@@ -23,7 +27,7 @@ type YanxuanSpecialController struct {
 // @Param   Status   query   int  false       "研选专栏装态"
 // @Param   Status   query   int  false       "研选专栏装态"
 // @Success 200 {object} models.SpecialListResp
 // @Success 200 {object} models.SpecialListResp
 // @router /list [get]
 // @router /list [get]
-func (this *YanxuanSpecialController) List() {
+func (this *BaseAuthMobileController) List() {
 	br := new(models.BaseResponse).Init()
 	br := new(models.BaseResponse).Init()
 	defer func() {
 	defer func() {
 		this.Data["json"] = br
 		this.Data["json"] = br
@@ -114,6 +118,9 @@ func (this *YanxuanSpecialController) List() {
 			}
 			}
 			v.Tags += v.IndustryTags
 			v.Tags += v.IndustryTags
 		}
 		}
+		if userId == 0 {
+			v.Content = utils.InterceptHtmlLength(v.Content, 240) // 截取前80个字
+		}
 	}
 	}
 
 
 	isAuthor, isImproveInformation := services.GetYanxuanSpecialAuthorInfo(sysUser) //用户是否没开通研选专栏以及,专栏信息是否完善
 	isAuthor, isImproveInformation := services.GetYanxuanSpecialAuthorInfo(sysUser) //用户是否没开通研选专栏以及,专栏信息是否完善
@@ -135,7 +142,7 @@ func (this *YanxuanSpecialController) List() {
 // @Param   Id   query   int  true       "详情ID"
 // @Param   Id   query   int  true       "详情ID"
 // @Success 200 {object} models.AddEnglishReportResp
 // @Success 200 {object} models.AddEnglishReportResp
 // @router /detail [get]
 // @router /detail [get]
-func (this *YanxuanSpecialController) Detail() {
+func (this *BaseAuthMobileController) Detail() {
 	br := new(models.BaseResponse).Init()
 	br := new(models.BaseResponse).Init()
 	defer func() {
 	defer func() {
 		this.Data["json"] = br
 		this.Data["json"] = br
@@ -144,7 +151,7 @@ func (this *YanxuanSpecialController) Detail() {
 	sysUser := this.User
 	sysUser := this.User
 	if sysUser == nil {
 	if sysUser == nil {
 		br.Msg = "请登录"
 		br.Msg = "请登录"
-		br.ErrMsg = "请登录,SysUser Is Empty"
+		br.ErrMsg = "请登录1,SysUser Is Empty"
 		br.Ret = 408
 		br.Ret = 408
 		return
 		return
 	}
 	}
@@ -157,7 +164,7 @@ func (this *YanxuanSpecialController) Detail() {
 		br.ErrMsg = "参数错误"
 		br.ErrMsg = "参数错误"
 		return
 		return
 	}
 	}
-
+	userId := sysUser.UserId
 	item, tmpErr := models.GetYanxuanSpecialById(specialId, sysUser.UserId)
 	item, tmpErr := models.GetYanxuanSpecialById(specialId, sysUser.UserId)
 	if tmpErr != nil {
 	if tmpErr != nil {
 		br.Msg = "获取失败"
 		br.Msg = "获取失败"
@@ -227,6 +234,10 @@ func (this *YanxuanSpecialController) Detail() {
 		resp.ContentHasStyle = true
 		resp.ContentHasStyle = true
 	}
 	}
 
 
+	if userId == 0 {
+		resp.Content = utils.InterceptHtmlLength(resp.Content, 240) // 截取前80个字
+	}
+
 	br.Data = resp
 	br.Data = resp
 	br.Ret = 200
 	br.Ret = 200
 	br.Success = true
 	br.Success = true

+ 0 - 1
models/db.go

@@ -113,7 +113,6 @@ func init() {
 		new(CygxSessionMobile),
 		new(CygxSessionMobile),
 		new(CygxSearchKeyWordLog),
 		new(CygxSearchKeyWordLog),
 		new(CygxActivity),
 		new(CygxActivity),
-		new(CygxYidongActivityMeetingApiLog),
 		new(CygxIndustrialActivityGroupManagement),
 		new(CygxIndustrialActivityGroupManagement),
 		new(CygxIndustrialActivityGroupSubject),
 		new(CygxIndustrialActivityGroupSubject),
 		new(CygxActivityVoiceHistory),
 		new(CygxActivityVoiceHistory),

+ 3 - 13
models/report.go

@@ -371,19 +371,9 @@ func GetWhichDepartmentCount(condition string) (count int, err error) {
 }
 }
 
 
 type IsShow struct {
 type IsShow struct {
-	IsShow                 bool      `description:"绝密内参按钮是否展示"`
-	IsShowFreeButton       bool      `description:"免费送月卡按钮是否展示"`
-	IsShowResearch         bool      `description:"研选是否展示限免"`
-	IsShowChart            bool      `description:"图表是否展示限免"`
-	IsShowList             bool      `description:"榜单是否展示"`
-	LinkWxExplain          string    `description:"关注微信公众号链接说明地址"`
-	YanXuan_Explain        bool      `description:"研选说明"`
-	ActivitySpecialExplain string    `description:"专项调研活动"`
-	SearchTxtList          SearchTxt `description:"搜索栏回显内容说明"`
-	IsBelongRai            bool      `description:"是否属于权益内部人员"`
-	IsShowResearchPoints   bool      `description:"是否展示研选扣点搜索"`
-	IsShowQuestionnaire    bool      `description:"是否展示研选问卷调查"`
-	IsShowAboutVideo       bool      `description:"是否展示关于我们的视频"`
+	IsShow                 bool   `description:"绝密内参按钮是否展示"`
+	IsYanxuanSpecialAuthor bool   `description:"绝密内参按钮是否展示"`
+	LinkWxExplain          string `description:"关注微信公众号链接说明地址"`
 }
 }
 
 
 type SearchTxt struct {
 type SearchTxt struct {

+ 0 - 20
models/yidong_activity_meeting_api_log.go

@@ -1,20 +0,0 @@
-package models
-
-import (
-	"github.com/beego/beego/v2/client/orm"
-	"time"
-)
-
-type CygxYidongActivityMeetingApiLog struct {
-	Id               int       `orm:"column(id);pk"`
-	Data             string    `description:"返回结果数据"`
-	YidongActivityId string    `description:"易董活动ID"`
-	CreateTime       time.Time `description:"本地创建时间"`
-}
-
-//新增
-func AddCygxYidongActivityMeetingApiLog(item *CygxYidongActivityMeetingApiLog) (err error) {
-	o := orm.NewOrm()
-	_, err = o.Insert(item)
-	return
-}

+ 18 - 9
routers/commentsRouter.go

@@ -223,6 +223,15 @@ func init() {
             Filters: nil,
             Filters: nil,
             Params: nil})
             Params: nil})
 
 
+    beego.GlobalControllerRouter["hongze/hongze_mfyx/controllers:BaseAuthMobileController"] = append(beego.GlobalControllerRouter["hongze/hongze_mfyx/controllers:BaseAuthMobileController"],
+        beego.ControllerComments{
+            Method: "Detail",
+            Router: `/detail`,
+            AllowHTTPMethods: []string{"get"},
+            MethodParams: param.Make(),
+            Filters: nil,
+            Params: nil})
+
     beego.GlobalControllerRouter["hongze/hongze_mfyx/controllers:BaseConfigController"] = append(beego.GlobalControllerRouter["hongze/hongze_mfyx/controllers:BaseConfigController"],
     beego.GlobalControllerRouter["hongze/hongze_mfyx/controllers:BaseConfigController"] = append(beego.GlobalControllerRouter["hongze/hongze_mfyx/controllers:BaseConfigController"],
         beego.ControllerComments{
         beego.ControllerComments{
             Method: "HotDetail",
             Method: "HotDetail",
@@ -286,6 +295,15 @@ func init() {
             Filters: nil,
             Filters: nil,
             Params: nil})
             Params: nil})
 
 
+    beego.GlobalControllerRouter["hongze/hongze_mfyx/controllers:ReportController"] = append(beego.GlobalControllerRouter["hongze/hongze_mfyx/controllers:ReportController"],
+        beego.ControllerComments{
+            Method: "IsShow",
+            Router: `/isShow`,
+            AllowHTTPMethods: []string{"get"},
+            MethodParams: param.Make(),
+            Filters: nil,
+            Params: nil})
+
     beego.GlobalControllerRouter["hongze/hongze_mfyx/controllers:ResearchController"] = append(beego.GlobalControllerRouter["hongze/hongze_mfyx/controllers:ResearchController"],
     beego.GlobalControllerRouter["hongze/hongze_mfyx/controllers:ResearchController"] = append(beego.GlobalControllerRouter["hongze/hongze_mfyx/controllers:ResearchController"],
         beego.ControllerComments{
         beego.ControllerComments{
             Method: "ArticleHotList",
             Method: "ArticleHotList",
@@ -763,15 +781,6 @@ func init() {
             Filters: nil,
             Filters: nil,
             Params: nil})
             Params: nil})
 
 
-    beego.GlobalControllerRouter["hongze/hongze_mfyx/controllers:YanxuanSpecialController"] = append(beego.GlobalControllerRouter["hongze/hongze_mfyx/controllers:YanxuanSpecialController"],
-        beego.ControllerComments{
-            Method: "Detail",
-            Router: `/detail`,
-            AllowHTTPMethods: []string{"get"},
-            MethodParams: param.Make(),
-            Filters: nil,
-            Params: nil})
-
     beego.GlobalControllerRouter["hongze/hongze_mfyx/controllers:YanxuanSpecialController"] = append(beego.GlobalControllerRouter["hongze/hongze_mfyx/controllers:YanxuanSpecialController"],
     beego.GlobalControllerRouter["hongze/hongze_mfyx/controllers:YanxuanSpecialController"] = append(beego.GlobalControllerRouter["hongze/hongze_mfyx/controllers:YanxuanSpecialController"],
         beego.ControllerComments{
         beego.ControllerComments{
             Method: "Enable",
             Method: "Enable",

+ 8 - 1
routers/router.go

@@ -64,7 +64,11 @@ func init() {
 				&controllers.ResourceController{},
 				&controllers.ResourceController{},
 			),
 			),
 		),
 		),
-
+		web.NSNamespace("/report",
+			web.NSInclude(
+				&controllers.ReportController{},
+			),
+		),
 		web.NSNamespace("/activity",
 		web.NSNamespace("/activity",
 			web.NSInclude(
 			web.NSInclude(
 				&controllers.ActivityCoAntroller{},
 				&controllers.ActivityCoAntroller{},
@@ -100,6 +104,9 @@ func init() {
 			web.NSInclude(
 			web.NSInclude(
 				&controllers.YanxuanSpecialController{},
 				&controllers.YanxuanSpecialController{},
 			),
 			),
+			web.NSInclude(
+				&controllers.BaseAuthMobileController{},
+			),
 		),
 		),
 	)
 	)
 	web.AddNamespace(ns)
 	web.AddNamespace(ns)

+ 11 - 0
utils/common.go

@@ -935,3 +935,14 @@ func ExtractText(body string) (result string, err error) {
 
 
 	return
 	return
 }
 }
+func InterceptHtmlLength(body string, length int) (newbody string) {
+	re := regexp.MustCompile(`s*<p>(.*?)</p>`)
+	matches := re.FindAllStringSubmatch(body, 1)
+	// 提取匹配到的文本
+	text := matches[0][1]
+	// 截取前 多少 个字
+	text = text[:length]
+	// 格式化输出
+	newbody = fmt.Sprint("<p>", strings.TrimSpace(text), "</p>")
+	return
+}