浏览代码

Merge branch 'cygx_12.2' of http://8.136.199.33:3000/hongze/hongze_cygx into debug

xingzai 1 年之前
父节点
当前提交
b6efdce21e

+ 11 - 3
controllers/activity.go

@@ -30,6 +30,7 @@ type ActivityNoLoginController struct {
 
 // @Title 活动类型列表
 // @Description活动类型列表接口
+// @Param   IsResearch   query   bool  true       "是否为研选"
 // @Success 200 {object} models.ActivityTypeListResp
 // @router /activityTypelist [get]
 func (this *ActivityCoAntroller) List() {
@@ -46,7 +47,14 @@ func (this *ActivityCoAntroller) List() {
 		return
 	}
 	resp := new(models.ActivityTypeListResp)
-	list, err := models.GetActivityTypeList()
+	isResearch, _ := this.GetBool("IsResearch", false)
+	var condition string
+
+	//是否仅展示研选下的活动类型
+	if isResearch {
+		condition = " AND source_type IN (0,2) "
+	}
+	list, err := models.GetActivityTypeList(condition)
 	if err != nil {
 		br.Msg = "获取失败"
 		br.ErrMsg = "获取数据失败,Err:" + err.Error()
@@ -1056,7 +1064,7 @@ func (this *ActivityCoAntroller) GetUserSearchContent() {
 		detail = detailSeearch
 	}
 	isShowJurisdiction, _ := this.GetInt("IsShowJurisdiction")
-	listActivityType, errActivityType := models.GetActivityTypeList()
+	listActivityType, errActivityType := models.GetActivityTypeList("")
 	if errActivityType != nil {
 		br.Msg = "获取失败"
 		br.ErrMsg = "获取数据失败,Err:" + errActivityType.Error()
@@ -1936,7 +1944,7 @@ func (this *ActivityCoAntroller) ActivityListNew() {
 	}
 	//未开始进行中默认按照时间正序
 	if activeState == "1" || activeState == "1,2" || activeState == "" {
-		conditionOrder = ` ORDER BY art.activity_time ASC  `
+		conditionOrder = ` ORDER BY  art.top_time DESC , art.activity_time ASC  `
 	}
 	//conditionActivityKey += condition + conditionOrder
 	condition += conditionOrder

+ 32 - 0
controllers/chart_permission.go

@@ -322,3 +322,35 @@ func (this *ChartPermissionAuthController) ReportDetailV7() {
 	br.Msg = "获取成功"
 	br.Data = resp
 }
+
+// @Title 获取报告医药、消费、科技、智造、策略权限列表(没有买方研选)
+// @Description 获取报告医药、消费、科技、智造、策略权限列表(没有买方研选)
+// @Success 200 {object} models.ChartPermissionResp
+// @router /noyx [get]
+func (this *ChartPermissionAuthController) Noyx() {
+	br := new(models.BaseResponse).Init()
+	defer func() {
+		this.Data["json"] = br
+		this.ServeJSON()
+	}()
+	user := this.User
+	if user == nil {
+		br.Msg = "请重新登录"
+		br.Ret = 408
+		return
+	}
+	var condition string
+	condition += ` AND permission_name IN ('医药','消费','科技','智造','策略') `
+	list, err := models.GetChartPermissionReportAll(condition)
+	if err != nil {
+		br.Msg = "获取信息失败"
+		br.ErrMsg = "获取品种信息失败,Err:" + err.Error()
+		return
+	}
+	resp := new(models.ChartPermissionResp)
+	resp.List = list
+	br.Ret = 200
+	br.Success = true
+	br.Msg = "获取成功"
+	br.Data = resp
+}

+ 35 - 0
controllers/morning_meeting.go

@@ -1,6 +1,7 @@
 package controllers
 
 import (
+	"encoding/json"
 	"github.com/rdlucklib/rdluck_tools/paging"
 	"hongze/hongze_cygx/models"
 	"hongze/hongze_cygx/services"
@@ -193,3 +194,37 @@ func (this *MorningMeetingController) GatherDetail() {
 	br.Msg = "获取成功"
 	br.Data = resp
 }
+
+// @Title 晨会精华点击记录
+// @Description 晨会精华点击记录接口
+// @Param	request	body models.ArticleCollectResp true "type json string"
+// @Success 200
+// @router /history/add [post]
+func (this *MorningMeetingController) SpecialMsg() {
+	br := new(models.BaseResponse).Init()
+	defer func() {
+		this.Data["json"] = br
+		this.ServeJSON()
+	}()
+	user := this.User
+	if user == nil {
+		br.Msg = "请重新登录"
+		br.Ret = 408
+		return
+	}
+	var req models.AddCygxMorningMeetingReviewChapterHistoryReq
+
+	err := json.Unmarshal(this.Ctx.Input.RequestBody, &req)
+	if err != nil {
+		br.Msg = "参数解析异常!"
+		br.ErrMsg = "参数解析失败,Err:" + err.Error()
+		return
+	}
+	articleId := req.Id
+	sourcePage := req.SourcePage
+
+	go services.AddCygxMorningMeetingReviewChapterHistory(user, articleId, sourcePage)
+	br.Ret = 200
+	br.Success = true
+	br.Msg = "操作成功!"
+}

+ 3 - 3
models/activity_type.go

@@ -6,7 +6,7 @@ import (
 
 type ActivityType struct {
 	ActivityTypeId   int    `description:"活动类型id"`
-	ActivityTypeName string `description:"活动名称"`
+	ActivityTypeName string `description:"活动类型名称"`
 	//TemplateP        string `description:"活动模板,带P标签"`
 	//Template         string `description:"活动模板"`
 	ShowType  string `description:"人数限制类型,1不展示限制,2可选限制,3强制限制"`
@@ -19,9 +19,9 @@ type ActivityTypeListResp struct {
 }
 
 // 列表
-func GetActivityTypeList() (items []*ActivityType, err error) {
+func GetActivityTypeList(condition string) (items []*ActivityType, err error) {
 	o := orm.NewOrm()
-	sql := `SELECT * FROM cygx_activity_type ORDER BY sort DESC`
+	sql := `SELECT * FROM cygx_activity_type WHERE 1= 1  ` + condition + `  ORDER BY sort DESC`
 	_, err = o.Raw(sql).QueryRows(&items)
 	return
 }

+ 1 - 0
models/db.go

@@ -179,6 +179,7 @@ func init() {
 		new(CygxYanxuanSpecialCompany),
 		new(CygxQuestionnaireVote),
 		new(CygxQuestionnaireVoteOtherTheme),
+		new(CygxMorningMeetingReviewChapterHistory),
 	)
 	// 记录ORM查询日志
 	orm.Debug = true

+ 35 - 0
models/morning_meeting_review_chapter_history.go

@@ -0,0 +1,35 @@
+package models
+
+import (
+	"github.com/beego/beego/v2/client/orm"
+	"time"
+)
+
+type CygxMorningMeetingReviewChapterHistory struct {
+	Id               int       `orm:"column(id);pk"`
+	ArticleId        int       `description:"文章ID"`
+	UserId           int       `description:"用户ID"`
+	CreateTime       time.Time `description:"创建时间"`
+	Mobile           string    `description:"手机号"`
+	Email            string    `description:"邮箱"`
+	CompanyId        int       `description:"公司id"`
+	CompanyName      string    `description:"公司名称"`
+	RealName         string    `description:"用户实际名称"`
+	SellerName       string    `description:"所属销售"`
+	SourcePage       string    `description:"页面来源 微信、首页、展开"`
+	RegisterPlatform int       `description:"来源 1小程序,2:网页"`
+	ModifyTime       time.Time `description:"更新时间"`
+}
+
+type AddCygxMorningMeetingReviewChapterHistoryReq struct {
+	Id         int    `description:"晨会精华ID"`
+	SourcePage string `description:"页面来源 微信、首页、展开"`
+}
+
+// 添加历史信息
+func AddCygxMorningMeetingReviewChapterHistory(item *CygxMorningMeetingReviewChapterHistory) (lastId int64, err error) {
+	o := orm.NewOrm()
+	item.ModifyTime = time.Now()
+	lastId, err = o.Insert(item)
+	return
+}

+ 18 - 0
routers/commentsRouter.go

@@ -655,6 +655,15 @@ func init() {
             Filters: nil,
             Params: nil})
 
+    beego.GlobalControllerRouter["hongze/hongze_cygx/controllers:ChartPermissionAuthController"] = append(beego.GlobalControllerRouter["hongze/hongze_cygx/controllers:ChartPermissionAuthController"],
+        beego.ControllerComments{
+            Method: "Noyx",
+            Router: `/noyx`,
+            AllowHTTPMethods: []string{"get"},
+            MethodParams: param.Make(),
+            Filters: nil,
+            Params: nil})
+
     beego.GlobalControllerRouter["hongze/hongze_cygx/controllers:ChartPermissionAuthController"] = append(beego.GlobalControllerRouter["hongze/hongze_cygx/controllers:ChartPermissionAuthController"],
         beego.ControllerComments{
             Method: "ReportDetail",
@@ -889,6 +898,15 @@ func init() {
             Filters: nil,
             Params: nil})
 
+    beego.GlobalControllerRouter["hongze/hongze_cygx/controllers:MorningMeetingController"] = append(beego.GlobalControllerRouter["hongze/hongze_cygx/controllers:MorningMeetingController"],
+        beego.ControllerComments{
+            Method: "SpecialMsg",
+            Router: `/history/add`,
+            AllowHTTPMethods: []string{"post"},
+            MethodParams: param.Make(),
+            Filters: nil,
+            Params: nil})
+
     beego.GlobalControllerRouter["hongze/hongze_cygx/controllers:ProductInteriorController"] = append(beego.GlobalControllerRouter["hongze/hongze_cygx/controllers:ProductInteriorController"],
         beego.ControllerComments{
             Method: "Detail",

+ 34 - 0
services/morning_meeting.go

@@ -2,6 +2,7 @@ package services
 
 import (
 	"context"
+	"errors"
 	"fmt"
 	"hongze/hongze_cygx/models"
 	"hongze/hongze_cygx/utils"
@@ -70,5 +71,38 @@ func MakeMorningMeetingReviews(cont context.Context) (err error) {
 	item.Status = 1
 	err = models.AddCygxMorningMeetingGather(item)
 	return
+}
 
+// 添加晨会点评点击记录
+func AddCygxMorningMeetingReviewChapterHistory(user *models.WxUserItem, articleId int, sourcePage string) (err error) {
+	defer func() {
+		if err != nil {
+			go utils.SendAlarmMsg(fmt.Sprint("添加晨会点评点击记录失败 ,AddCygxMorningMeetingReviewChapterHistory err"+err.Error(), "id:", articleId, "sourcePage:", sourcePage, "userid:", user.UserId), 2)
+		}
+	}()
+	historyRecord := new(models.CygxMorningMeetingReviewChapterHistory)
+	historyRecord.UserId = user.UserId
+	historyRecord.ArticleId = articleId
+	historyRecord.SourcePage = sourcePage
+	historyRecord.CreateTime = time.Now()
+	historyRecord.Mobile = user.Mobile
+	historyRecord.Email = user.Email
+	historyRecord.CompanyId = user.CompanyId
+	historyRecord.CompanyName = user.CompanyName
+	historyRecord.RegisterPlatform = utils.REGISTER_PLATFORM
+	sellerItem, e := models.GetSellerByCompanyIdCheckFicc(user.CompanyId, 2)
+	if e != nil && e.Error() != utils.ErrNoRow() {
+		err = errors.New("GetSellerByCompanyIdCheckFicc, Err: " + e.Error())
+		return
+	}
+	historyRecord.RealName = user.RealName
+	if sellerItem != nil {
+		historyRecord.SellerName = sellerItem.RealName
+	}
+	_, e = models.AddCygxMorningMeetingReviewChapterHistory(historyRecord)
+	if e != nil {
+		err = errors.New("AddCygxMorningMeetingReviewChapterHistorymodels, Err: " + e.Error())
+		return
+	}
+	return
 }