Browse Source

no message

xingzai 5 months ago
parent
commit
b27ebefe5e
2 changed files with 36 additions and 1 deletions
  1. 31 0
      controllers/roadshow/calendar.go
  2. 5 1
      models/roadshow/calendar.go

+ 31 - 0
controllers/roadshow/calendar.go

@@ -205,6 +205,17 @@ func (this *CalendarController) Add() {
 		return
 	}
 
+	//如果是权益客户,添加销售跟共享销售的信息
+	var productItemRai *company.CompanyProduct
+	if req.CompanyId > 0 {
+		productItemRai, e = company.GetCompanyProductByCompanyIdAndProductId(req.CompanyId, utils.COMPANY_PRODUCT_RAI_ID)
+		if e != nil && e.Error() != utils.ErrNoRow() {
+			br.Msg = "客户信息有误"
+			br.ErrMsg = "获取客户信息失败, Err: " + e.Error()
+			return
+		}
+	}
+
 	rsCalendar := new(roadshow.RsCalendar)
 	rsCalendar.SysUserId = sysUser.AdminId
 	rsCalendar.SysUserRealName = sysUser.RealName
@@ -226,6 +237,10 @@ func (this *CalendarController) Add() {
 	rsCalendar.Source = 0
 	rsCalendar.EnglishCompany = req.EnglishCompany
 	rsCalendar.Title = getTitle(req.ActivityType, req.RoadshowType, req.ActivityCategory, req.RoadshowPlatform, req.Province, req.City)
+	if productItemRai != nil {
+		rsCalendar.SellerId = productItemRai.SellerId
+		rsCalendar.ShareSellerId = productItemRai.ShareSellerId
+	}
 	rsCalendarId, err := roadshow.AddRsCalendar(rsCalendar)
 	if err != nil {
 		br.Msg = "保存失败!"
@@ -1282,6 +1297,18 @@ func (this *CalendarController) CalendarList() {
 			englishMap[englishList[i].CompanyId] = englishList[i]
 		}
 	}
+
+	//获取所有自定义的权益研究员
+	sysUserList, err := cygx.GetAskEmailList()
+	if err != nil {
+		br.Msg = "获取失败"
+		br.ErrMsg = "获取失败,GetAskEmailList Err: " + err.Error()
+		return
+	}
+	raiAskadminMap := make(map[string]bool, 0)
+	for _, v := range sysUserList {
+		raiAskadminMap[strconv.Itoa(v.AdminId)] = true
+	}
 	mapRaiSllerId := make(map[int]bool)  // 是否为权益销售
 	mapMeetingCount := make(map[int]int) // 路演参会人员数量
 	if len(adminIds) > 0 {
@@ -1323,6 +1350,10 @@ func (this *CalendarController) CalendarList() {
 				dataList[i].ViewButton = true
 			}
 		}
+		//权益研究员的【路演】和【沙龙】,未结束时,显示修改按钮
+		if raiAskadminMap[dataList[i].ResearcherId] && utils.InArrayByStr([]string{"路演", "沙龙"}, dataList[i].ActivityType) && dataList[i].Status == 2 {
+			dataList[i].EditButton = true
+		}
 	}
 
 	resp.Paging = page

+ 5 - 1
models/roadshow/calendar.go

@@ -64,6 +64,8 @@ type RsCalendar struct {
 	IsSynced         int    `description:"是否与上海同步 0:未同步 1:已同步"`
 	UnionCode        string `description:"公开会议联合编码"`
 	EnglishCompany   int    `description:"是否为英文客户: 0-否; 1-是"`
+	SellerId         int    `description:"销售id"`
+	ShareSellerId    int    `description:"共享销售员id"`
 }
 
 type RsCalendarResearcher struct {
@@ -298,6 +300,7 @@ type CalendarListView struct {
 	EnglishViewTotal       int    `description:"英文客户-累计点击量"`
 	SubmitButton           bool   `description:"提交按钮是否展示"`
 	ViewButton             bool   `description:"查看按钮是否展示"`
+	EditButton             bool   `description:"修改按钮是否展示"`
 }
 
 type CalendarListResp struct {
@@ -369,7 +372,8 @@ func GetCalendarList(condition string, pars []interface{}, startSize, pageSize,
 		if calendarType == 1 {
 			sql += ` ORDER BY b.create_time ASC LIMIT ?,? `
 		} else {
-			sql += ` ORDER BY b.create_time DESC LIMIT ?,? `
+			//sql += ` ORDER BY b.create_time DESC LIMIT ?,? `
+			sql += ` ORDER BY b.start_date DESC , b.start_time DESC  LIMIT ?,? ` // 已处理申请,按照活动开始时间倒序(包括ficc的)
 		}
 		_, err = o.Raw(sql, pars, startSize, pageSize).QueryRows(&list)
 	}