|
@@ -153,6 +153,7 @@ func UpdateCygxRaiCompanyUserBill() (err error) {
|
|
|
item.CreateTime = time.Now()
|
|
|
item.ViewTime = v.CreateTime
|
|
|
item.WeekStartDate, item.WeekEndDate = utils.GetMondayAndSundayByTimeString(item.ViewTime)
|
|
|
+ item.MonthStartDate, item.MonthEndDate = utils.GetFirstAndLastDayOfMonth(item.ViewTime)
|
|
|
items = append(items, item)
|
|
|
}
|
|
|
}
|
|
@@ -222,6 +223,7 @@ func UpdateCygxRaiCompanyUserBill() (err error) {
|
|
|
item.CreateTime = time.Now()
|
|
|
item.ViewTime = v.CreateTime
|
|
|
item.WeekStartDate, item.WeekEndDate = utils.GetMondayAndSundayByTimeString(item.ViewTime)
|
|
|
+ item.MonthStartDate, item.MonthEndDate = utils.GetFirstAndLastDayOfMonth(item.ViewTime)
|
|
|
|
|
|
if strings.Contains(v.CategoryName, "固收") {
|
|
|
item.ChartPermissionName = utils.GU_SHOU_NAME
|
|
@@ -312,6 +314,7 @@ func UpdateCygxRaiCompanyUserBill() (err error) {
|
|
|
item.ChartPermissionName = v.ChartPermissionName
|
|
|
item.ChartPermissionId = v.ChartPermissionId
|
|
|
item.WeekStartDate, item.WeekEndDate = utils.GetMondayAndSundayByTimeString(item.ViewTime)
|
|
|
+ item.MonthStartDate, item.MonthEndDate = utils.GetFirstAndLastDayOfMonth(item.ViewTime)
|
|
|
items = append(items, item)
|
|
|
}
|
|
|
}
|
|
@@ -379,6 +382,7 @@ func UpdateCygxRaiCompanyUserBill() (err error) {
|
|
|
item.ChartPermissionName = v.ChartPermissionName
|
|
|
item.ChartPermissionId = v.ChartPermissionId
|
|
|
item.WeekStartDate, item.WeekEndDate = utils.GetMondayAndSundayByTimeString(item.ViewTime)
|
|
|
+ item.MonthStartDate, item.MonthEndDate = utils.GetFirstAndLastDayOfMonth(item.ViewTime)
|
|
|
items = append(items, item)
|
|
|
}
|
|
|
}
|
|
@@ -477,6 +481,7 @@ func UpdateCygxRaiCompanyUserBill() (err error) {
|
|
|
item.CreateTime = time.Now()
|
|
|
item.ViewTime = v.StartDate + " " + v.StartTime
|
|
|
item.WeekStartDate, item.WeekEndDate = utils.GetMondayAndSundayByTimeString(item.ViewTime)
|
|
|
+ item.MonthStartDate, item.MonthEndDate = utils.GetFirstAndLastDayOfMonth(item.ViewTime)
|
|
|
|
|
|
if utils.InArrayByStr(guShouResearcherName, item.Content) {
|
|
|
item.ChartPermissionName = utils.GU_SHOU_NAME
|
|
@@ -550,10 +555,294 @@ func UpdateCygxRaiCompanyUserBill() (err error) {
|
|
|
item.CreateTime = time.Now()
|
|
|
item.ViewTime = v.CreateTime
|
|
|
item.WeekStartDate, item.WeekEndDate = utils.GetMondayAndSundayByTimeString(item.ViewTime)
|
|
|
+ item.MonthStartDate, item.MonthEndDate = utils.GetFirstAndLastDayOfMonth(item.ViewTime)
|
|
|
items = append(items, item)
|
|
|
}
|
|
|
}
|
|
|
//交流反馈 end
|
|
|
+
|
|
|
+ //图表浏览记录
|
|
|
+ {
|
|
|
+ condition = " AND b.company_id IN (" + utils.GetOrmInReplace(lencompanyId) + ") AND b.create_time > ? GROUP BY b.record_id "
|
|
|
+ userChartRecordList, e := models.GetCygxChartRecordListNoLimit(condition, pars)
|
|
|
+ if e != nil {
|
|
|
+ err = errors.New("GetCygxChartRecordListNoLimit, Err: " + e.Error())
|
|
|
+ return
|
|
|
+ }
|
|
|
+
|
|
|
+ //图表浏览记录明细
|
|
|
+ var conditionBill string
|
|
|
+ var parsBill []interface{}
|
|
|
+ conditionBill = " AND source = 'newchart' AND company_id IN (" + utils.GetOrmInReplace(lencompanyId) + ") AND view_time > ? "
|
|
|
+ parsBill = append(parsBill, companyIds, startWeekDate)
|
|
|
+ listBillByChart, e := rai_serve.GetCygxRaiCompanyUserBillListAll(conditionBill, parsBill)
|
|
|
+ if e != nil {
|
|
|
+ err = errors.New("GetCygxRaiServeBillListAll, Err: " + e.Error())
|
|
|
+ return
|
|
|
+ }
|
|
|
+
|
|
|
+ mapChartBill := make(map[string]bool)
|
|
|
+ for _, v := range listBillByChart {
|
|
|
+ mapChartBill[fmt.Sprint("UID_", v.UserId, "SID_", v.RecordId)] = true
|
|
|
+ }
|
|
|
+
|
|
|
+ for _, v := range userChartRecordList {
|
|
|
+ if mapChartBill[fmt.Sprint("UID_", v.UserId, "SID_", v.RecordId)] { // 如果内容存在就不插入
|
|
|
+ continue
|
|
|
+ }
|
|
|
+ item := new(rai_serve.CygxRaiCompanyUserBill)
|
|
|
+ item.Content = v.Title
|
|
|
+ item.ServeTypeId = 7
|
|
|
+ item.ServeTypeName = "图表阅读uv"
|
|
|
+ item.UserId = v.UserId
|
|
|
+ item.Mobile = v.Mobile
|
|
|
+ item.Email = v.Email
|
|
|
+ item.CompanyId = v.CompanyId
|
|
|
+ item.CompanyName = v.CompanyName
|
|
|
+ item.RealName = v.RealName
|
|
|
+ item.ServeCount = 0.5
|
|
|
+ if mapUserMaker[v.UserId] {
|
|
|
+ item.IsKp = 1
|
|
|
+ item.ServeCount = item.ServeCount * 3
|
|
|
+ }
|
|
|
+ item.SourceId = v.ChartId
|
|
|
+ item.RecordId = v.RecordId
|
|
|
+ item.Source = utils.CYGX_OBJ_NEWCHART
|
|
|
+ item.CreateTime = time.Now()
|
|
|
+ item.ViewTime = v.CreateTime
|
|
|
+ item.WeekStartDate, item.WeekEndDate = utils.GetMondayAndSundayByTimeString(item.ViewTime)
|
|
|
+ item.MonthStartDate, item.MonthEndDate = utils.GetFirstAndLastDayOfMonth(item.ViewTime)
|
|
|
+ items = append(items, item)
|
|
|
+ }
|
|
|
+ }
|
|
|
+ //图表浏览记录 end
|
|
|
+
|
|
|
+ //活动音频记录
|
|
|
+ {
|
|
|
+ condition = " AND b.company_id IN (" + utils.GetOrmInReplace(lencompanyId) + ") AND b.create_time > ? GROUP BY b.id "
|
|
|
+ userActivityVoiceList, e := models.GetCygxActivityVoiceHistoryListNoLimit(condition, pars)
|
|
|
+ if e != nil {
|
|
|
+ err = errors.New("GetCygxActivityVoiceHistoryListNoLimit, Err: " + e.Error())
|
|
|
+ return
|
|
|
+ }
|
|
|
+
|
|
|
+ //活动音频记录 明细
|
|
|
+ var conditionBill string
|
|
|
+ var parsBill []interface{}
|
|
|
+ conditionBill = " AND source = 'activityvoice' AND company_id IN (" + utils.GetOrmInReplace(lencompanyId) + ") AND view_time > ? "
|
|
|
+ parsBill = append(parsBill, companyIds, startWeekDate)
|
|
|
+ listBillActivityVoice, e := rai_serve.GetCygxRaiCompanyUserBillListAll(conditionBill, parsBill)
|
|
|
+ if e != nil {
|
|
|
+ err = errors.New("GetCygxRaiServeBillListAll, Err: " + e.Error())
|
|
|
+ return
|
|
|
+ }
|
|
|
+
|
|
|
+ mapActivityVoiceBill := make(map[string]bool)
|
|
|
+ for _, v := range listBillActivityVoice {
|
|
|
+ mapActivityVoiceBill[fmt.Sprint("UID_", v.UserId, "SID_", v.RecordId)] = true
|
|
|
+ }
|
|
|
+
|
|
|
+ for _, v := range userActivityVoiceList {
|
|
|
+ if mapActivityVoiceBill[fmt.Sprint("UID_", v.UserId, "SID_", v.RecordId)] { // 如果内容存在就不插入
|
|
|
+ continue
|
|
|
+ }
|
|
|
+ item := new(rai_serve.CygxRaiCompanyUserBill)
|
|
|
+ item.Content = v.VoiceName
|
|
|
+ item.ServeTypeId = 8
|
|
|
+ item.ServeTypeName = "路演回放"
|
|
|
+ item.UserId = v.UserId
|
|
|
+ item.Mobile = v.Mobile
|
|
|
+ item.Email = v.Email
|
|
|
+ item.CompanyId = v.CompanyId
|
|
|
+ item.CompanyName = v.CompanyName
|
|
|
+ item.RealName = v.RealName
|
|
|
+ item.ServeCount = 0.5
|
|
|
+ if mapUserMaker[v.UserId] {
|
|
|
+ item.IsKp = 1
|
|
|
+ item.ServeCount = item.ServeCount * 3
|
|
|
+ }
|
|
|
+ item.SourceId = v.ActivityVoiceId
|
|
|
+ item.RecordId = v.RecordId
|
|
|
+ item.ActivityId = v.ActivityId
|
|
|
+ item.Source = utils.CYGX_OBJ_ACTIVITYVOICE
|
|
|
+ item.CreateTime = time.Now()
|
|
|
+ item.ViewTime = v.CreateTime
|
|
|
+ item.WeekStartDate, item.WeekEndDate = utils.GetMondayAndSundayByTimeString(item.ViewTime)
|
|
|
+ item.MonthStartDate, item.MonthEndDate = utils.GetFirstAndLastDayOfMonth(item.ViewTime)
|
|
|
+ items = append(items, item)
|
|
|
+ }
|
|
|
+ }
|
|
|
+ //活动音频记录 end
|
|
|
+
|
|
|
+ //活动视频记录
|
|
|
+ {
|
|
|
+ condition = " AND b.company_id IN (" + utils.GetOrmInReplace(lencompanyId) + ") AND b.create_time > ? GROUP BY b.id "
|
|
|
+ userActivityVideoList, e := models.GetCygxActivityVideoHistoryListNoLimit(condition, pars)
|
|
|
+ if e != nil {
|
|
|
+ err = errors.New("GetCygxChartRecordListNoLimit, Err: " + e.Error())
|
|
|
+ return
|
|
|
+ }
|
|
|
+
|
|
|
+ //活动视频记录 明细
|
|
|
+ var conditionBill string
|
|
|
+ var parsBill []interface{}
|
|
|
+ conditionBill = " AND source = 'activityvideo' AND company_id IN (" + utils.GetOrmInReplace(lencompanyId) + ") AND view_time > ? "
|
|
|
+ parsBill = append(parsBill, companyIds, startWeekDate)
|
|
|
+ listBillActivityVideo, e := rai_serve.GetCygxRaiCompanyUserBillListAll(conditionBill, parsBill)
|
|
|
+ if e != nil {
|
|
|
+ err = errors.New("GetCygxRaiServeBillListAll, Err: " + e.Error())
|
|
|
+ return
|
|
|
+ }
|
|
|
+
|
|
|
+ mapActivityVideoBill := make(map[string]bool)
|
|
|
+ for _, v := range listBillActivityVideo {
|
|
|
+ mapActivityVideoBill[fmt.Sprint("UID_", v.UserId, "SID_", v.RecordId)] = true
|
|
|
+ }
|
|
|
+
|
|
|
+ for _, v := range userActivityVideoList {
|
|
|
+ if mapActivityVideoBill[fmt.Sprint("UID_", v.UserId, "SID_", v.RecordId)] { // 如果内容存在就不插入
|
|
|
+ continue
|
|
|
+ }
|
|
|
+ item := new(rai_serve.CygxRaiCompanyUserBill)
|
|
|
+ item.Content = v.VideoName
|
|
|
+ item.ServeTypeId = 8
|
|
|
+ item.ServeTypeName = "路演回放"
|
|
|
+ item.UserId = v.UserId
|
|
|
+ item.Mobile = v.Mobile
|
|
|
+ item.Email = v.Email
|
|
|
+ item.CompanyId = v.CompanyId
|
|
|
+ item.CompanyName = v.CompanyName
|
|
|
+ item.RealName = v.RealName
|
|
|
+ item.ServeCount = 0.5
|
|
|
+ if mapUserMaker[v.UserId] {
|
|
|
+ item.IsKp = 1
|
|
|
+ item.ServeCount = item.ServeCount * 3
|
|
|
+ }
|
|
|
+ item.SourceId = v.VideoId
|
|
|
+ item.RecordId = v.RecordId
|
|
|
+ item.ActivityId = v.ActivityId
|
|
|
+ item.Source = utils.CYGX_OBJ_ACTIVITYVIDEO
|
|
|
+ item.CreateTime = time.Now()
|
|
|
+ item.ViewTime = v.CreateTime
|
|
|
+ item.WeekStartDate, item.WeekEndDate = utils.GetMondayAndSundayByTimeString(item.ViewTime)
|
|
|
+ item.MonthStartDate, item.MonthEndDate = utils.GetFirstAndLastDayOfMonth(item.ViewTime)
|
|
|
+ items = append(items, item)
|
|
|
+ }
|
|
|
+ }
|
|
|
+ //活动视频记录 end
|
|
|
+
|
|
|
+ //报告精选阅读记录
|
|
|
+ {
|
|
|
+ condition = " AND b.company_id IN (" + utils.GetOrmInReplace(lencompanyId) + ") AND b.create_time > ? GROUP BY b.id "
|
|
|
+ userReportSelectionList, e := models.GetCygxReportSelectionHistoryRecordRespLimit(condition, pars)
|
|
|
+ if e != nil {
|
|
|
+ err = errors.New("GetCygxChartRecordListNoLimit, Err: " + e.Error())
|
|
|
+ return
|
|
|
+ }
|
|
|
+
|
|
|
+ //报告精选阅读记录 明细
|
|
|
+ var conditionBill string
|
|
|
+ var parsBill []interface{}
|
|
|
+ conditionBill = " AND source = 'reportselection' AND company_id IN (" + utils.GetOrmInReplace(lencompanyId) + ") AND view_time > ? "
|
|
|
+ parsBill = append(parsBill, companyIds, startWeekDate)
|
|
|
+ listBillReportSelection, e := rai_serve.GetCygxRaiCompanyUserBillListAll(conditionBill, parsBill)
|
|
|
+ if e != nil {
|
|
|
+ err = errors.New("GetCygxRaiServeBillListAll, Err: " + e.Error())
|
|
|
+ return
|
|
|
+ }
|
|
|
+
|
|
|
+ mapReportSelectionBill := make(map[string]bool)
|
|
|
+ for _, v := range listBillReportSelection {
|
|
|
+ mapReportSelectionBill[fmt.Sprint("UID_", v.UserId, "SID_", v.RecordId)] = true
|
|
|
+ }
|
|
|
+
|
|
|
+ for _, v := range userReportSelectionList {
|
|
|
+ if mapReportSelectionBill[fmt.Sprint("UID_", v.UserId, "SID_", v.RecordId)] { // 如果内容存在就不插入
|
|
|
+ continue
|
|
|
+ }
|
|
|
+ item := new(rai_serve.CygxRaiCompanyUserBill)
|
|
|
+ item.Content = "重点公司"
|
|
|
+ item.ServeTypeId = 5
|
|
|
+ item.ServeTypeName = "阅读uv"
|
|
|
+ item.UserId = v.UserId
|
|
|
+ item.Mobile = v.Mobile
|
|
|
+ item.Email = v.Email
|
|
|
+ item.CompanyId = v.CompanyId
|
|
|
+ item.CompanyName = v.CompanyName
|
|
|
+ item.RealName = v.RealName
|
|
|
+ item.ServeCount = 0.5
|
|
|
+ if mapUserMaker[v.UserId] {
|
|
|
+ item.IsKp = 1
|
|
|
+ item.ServeCount = item.ServeCount * 3
|
|
|
+ }
|
|
|
+ item.SourceId = v.ArticleId
|
|
|
+ item.RecordId = v.RecordId
|
|
|
+ item.Source = utils.CYGX_OBJ_REPORTSELECTION
|
|
|
+ item.CreateTime = time.Now()
|
|
|
+ item.ViewTime = v.CreateTime
|
|
|
+ item.WeekStartDate, item.WeekEndDate = utils.GetMondayAndSundayByTimeString(item.ViewTime)
|
|
|
+ item.MonthStartDate, item.MonthEndDate = utils.GetFirstAndLastDayOfMonth(item.ViewTime)
|
|
|
+ items = append(items, item)
|
|
|
+ }
|
|
|
+ }
|
|
|
+ //报告精选阅读记录 end
|
|
|
+
|
|
|
+ //产品内测阅读记录
|
|
|
+ {
|
|
|
+ condition = " AND b.company_id IN (" + utils.GetOrmInReplace(lencompanyId) + ") AND b.create_time > ? GROUP BY b.id "
|
|
|
+ userProductInteriorList, e := models.GetCygxProductInteriorHistoryListData(condition, pars)
|
|
|
+ if e != nil {
|
|
|
+ err = errors.New("GetCygxChartRecordListNoLimit, Err: " + e.Error())
|
|
|
+ return
|
|
|
+ }
|
|
|
+
|
|
|
+ //产品内测阅读记录 明细
|
|
|
+ var conditionBill string
|
|
|
+ var parsBill []interface{}
|
|
|
+ conditionBill = " AND source = 'productinterior' AND company_id IN (" + utils.GetOrmInReplace(lencompanyId) + ") AND view_time > ? "
|
|
|
+ parsBill = append(parsBill, companyIds, startWeekDate)
|
|
|
+ listBillProductInterior, e := rai_serve.GetCygxRaiCompanyUserBillListAll(conditionBill, parsBill)
|
|
|
+ if e != nil {
|
|
|
+ err = errors.New("GetCygxRaiServeBillListAll, Err: " + e.Error())
|
|
|
+ return
|
|
|
+ }
|
|
|
+
|
|
|
+ mapProductInteriorBill := make(map[string]bool)
|
|
|
+ for _, v := range listBillProductInterior {
|
|
|
+ mapProductInteriorBill[fmt.Sprint("UID_", v.UserId, "SID_", v.RecordId)] = true
|
|
|
+ }
|
|
|
+
|
|
|
+ for _, v := range userProductInteriorList {
|
|
|
+ if mapProductInteriorBill[fmt.Sprint("UID_", v.UserId, "SID_", v.RecordId)] { // 如果内容存在就不插入
|
|
|
+ continue
|
|
|
+ }
|
|
|
+ item := new(rai_serve.CygxRaiCompanyUserBill)
|
|
|
+ item.Content = v.Title
|
|
|
+ item.ServeTypeId = 5
|
|
|
+ item.ServeTypeName = "阅读uv"
|
|
|
+ item.UserId = v.UserId
|
|
|
+ item.Mobile = v.Mobile
|
|
|
+ item.Email = v.Email
|
|
|
+ item.CompanyId = v.CompanyId
|
|
|
+ item.CompanyName = v.CompanyName
|
|
|
+ item.RealName = v.RealName
|
|
|
+ item.ServeCount = 0.5
|
|
|
+ if mapUserMaker[v.UserId] {
|
|
|
+ item.IsKp = 1
|
|
|
+ item.ServeCount = item.ServeCount * 3
|
|
|
+ }
|
|
|
+ item.SourceId = v.ProductInteriorId
|
|
|
+ item.RecordId = v.RecordId
|
|
|
+ item.Source = utils.CYGX_OBJ_PRODUCTINTERIOR
|
|
|
+ item.CreateTime = time.Now()
|
|
|
+ item.ViewTime = v.CreateTime
|
|
|
+ item.WeekStartDate, item.WeekEndDate = utils.GetMondayAndSundayByTimeString(item.ViewTime)
|
|
|
+ item.MonthStartDate, item.MonthEndDate = utils.GetFirstAndLastDayOfMonth(item.ViewTime)
|
|
|
+ items = append(items, item)
|
|
|
+ }
|
|
|
+ }
|
|
|
+ //产品内测阅读记录 end
|
|
|
+
|
|
|
//fmt.Println("items", len(items))
|
|
|
//return
|
|
|
if len(items) > 0 {
|
|
@@ -628,3 +917,53 @@ func UpdateCompanyProductIsUserMaker() (err error) {
|
|
|
fmt.Println(" UpdateCompanyProductIsUserMaker end")
|
|
|
return
|
|
|
}
|
|
|
+
|
|
|
+//func init() {
|
|
|
+// initCRm_16_9_v2()
|
|
|
+//}
|
|
|
+
|
|
|
+func initCRm_16_9() {
|
|
|
+
|
|
|
+ var conditionBill string
|
|
|
+ var parsBill []interface{}
|
|
|
+ conditionBill = " AND month_start_date = '' LIMIT 10000 "
|
|
|
+ listBillByYanxuanspecial, e := rai_serve.GetCygxRaiCompanyUserBillListAll(conditionBill, parsBill)
|
|
|
+ if e != nil {
|
|
|
+ fmt.Println(e)
|
|
|
+ return
|
|
|
+ }
|
|
|
+
|
|
|
+ for _, v := range listBillByYanxuanspecial {
|
|
|
+ v.MonthStartDate, v.MonthEndDate = utils.GetFirstAndLastDayOfMonth(v.ViewTime)
|
|
|
+ }
|
|
|
+
|
|
|
+ e = rai_serve.UpdateCygxRaiCompanyUserBillMulti(listBillByYanxuanspecial)
|
|
|
+ if e != nil {
|
|
|
+ fmt.Println(e)
|
|
|
+ return
|
|
|
+ }
|
|
|
+ fmt.Println("end")
|
|
|
+}
|
|
|
+
|
|
|
+func initCRm_16_9_v2() {
|
|
|
+
|
|
|
+ var conditionBill string
|
|
|
+ var parsBill []interface{}
|
|
|
+ conditionBill = " AND month_start_date = '' LIMIT 10000 "
|
|
|
+ listBillByYanxuanspecial, e := rai_serve.GetCygxRaiServeBillListAll(conditionBill, parsBill)
|
|
|
+ if e != nil {
|
|
|
+ fmt.Println(e)
|
|
|
+ return
|
|
|
+ }
|
|
|
+
|
|
|
+ for _, v := range listBillByYanxuanspecial {
|
|
|
+ v.MonthStartDate, v.MonthEndDate = utils.GetFirstAndLastDayOfMonth(v.ViewTime)
|
|
|
+ }
|
|
|
+
|
|
|
+ e = rai_serve.UpdateCygxRaiServeBillMulti(listBillByYanxuanspecial)
|
|
|
+ if e != nil {
|
|
|
+ fmt.Println(e)
|
|
|
+ return
|
|
|
+ }
|
|
|
+ fmt.Println("end")
|
|
|
+}
|