|
@@ -1207,6 +1207,71 @@ func UpdateCygxRaiServeBillByCompanyIds() (err error) {
|
|
|
}
|
|
|
//报告精选阅读记录 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.GetCygxRaiServeBillListAll(conditionBill, parsBill)
|
|
|
+ if e != nil {
|
|
|
+ err = errors.New("GetCygxRaiServeBillListAll, Err: " + e.Error())
|
|
|
+ return
|
|
|
+ }
|
|
|
+
|
|
|
+ mapRscalendarBill := make(map[string]bool)
|
|
|
+ for _, v := range listBillProductInterior {
|
|
|
+ mapRscalendarBill[fmt.Sprint("UID_", v.UserId, "SID_", v.SourceId)] = true
|
|
|
+ }
|
|
|
+
|
|
|
+ mapDelRscalendarBill := make(map[string]bool)
|
|
|
+ for _, v := range userProductInteriorList {
|
|
|
+ mapDelRscalendarBill[fmt.Sprint("UID_", v.UserId, "SID_", v.ProductInteriorId)] = true
|
|
|
+ }
|
|
|
+ for _, v := range listBillProductInterior {
|
|
|
+ if !mapDelRscalendarBill[fmt.Sprint("UID_", v.UserId, "SID_", v.SourceId)] { // 如果内容存在就插入删除ID中
|
|
|
+ delBillIds = append(delBillIds, v.BillId)
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ for _, v := range userProductInteriorList {
|
|
|
+ if mapRscalendarBill[fmt.Sprint("UID_", v.UserId, "SID_", v.ProductInteriorId)] { // 如果内容存在就不插入
|
|
|
+ continue
|
|
|
+ }
|
|
|
+ item := new(rai_serve.CygxRaiServeBill)
|
|
|
+ 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.ProductInteriorId
|
|
|
+ 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
|
|
|
+
|
|
|
if len(items) > 0 {
|
|
|
var itemsAdd []*rai_serve.CygxRaiServeBill
|
|
|
for k, v := range items {
|