瀏覽代碼

branch fix

ziwen 3 年之前
父節點
當前提交
c8e6ae3e3f
共有 2 個文件被更改,包括 1 次插入107 次删除
  1. 0 104
      logic/report/research_report.go
  2. 1 3
      models/tables/user_record/user_record.go

+ 0 - 104
logic/report/research_report.go

@@ -1,17 +1,10 @@
 package report
 
 import (
-	"errors"
-	"fmt"
-	"hongze/hongze_yb/models/tables/company"
 	"hongze/hongze_yb/models/tables/company_report_permission"
 	"hongze/hongze_yb/models/tables/research_report"
 	"hongze/hongze_yb/models/tables/research_report_type"
-	"hongze/hongze_yb/models/tables/user_view_history"
-	"hongze/hongze_yb/models/tables/wx_user"
 	"hongze/hongze_yb/utils"
-	"strconv"
-	"time"
 )
 
 type ResearchReportInfo struct {
@@ -67,61 +60,11 @@ func GetResearchReportInfo(researchReportId, userId uint64) (result ResearchRepo
 		}
 	}
 
-	// 联系人信息
-	strInt64 := strconv.FormatUint(userId, 10)
-	id, _ := strconv.Atoi(strInt64)
-	wxUserInfo, err := wx_user.GetByUserId(id)
-	if err != nil {
-		fmt.Println("GetByUserId:", err.Error())
-		return
-	}
-	companyInfo, tmpErr := company.GetByCompanyId(wxUserInfo.CompanyID)
-	if tmpErr != nil {
-		err = tmpErr
-		if tmpErr == utils.ErrNoRow {
-			err = errors.New("找不到该客户")
-			return
-		}
-		return
-	}
-
-	//查询是否读过这篇报告,如果未读过则阅读人数+1
-	_, err = user_view_history.GetReportByUserId(userId, reportInfo.ResearchReportID)
-	if err != nil {
-		err = reportInfo.UpdateViewers()
-		if err != nil {
-			fmt.Println("UpdateViewers err:", err.Error())
-		}
-	}
-
-	//新增userViewHistory记录
-	userViewHistory := &user_view_history.UserViewHistory{
-		ViewHistoryID:        0,
-		UserID:               userId,
-		Mobile:               wxUserInfo.Mobile,
-		Email:                wxUserInfo.Email,
-		RealName:             wxUserInfo.RealName,
-		CompanyName:          companyInfo.CompanyName,
-		ViewTitle:            "",
-		ViewPage:             "",
-		ReportChapterModule:  "",
-		CreatedTime:          time.Now(),
-		LastUpdatedTime:      time.Now(),
-		Type:                 "weekly_report",
-		ResearchReportID:     reportInfo.ResearchReportID,
-		ResearchReportTypeID: 0,
-	}
-	err = userViewHistory.AddUserViewHistory()
-	if err != nil {
-		fmt.Println("AddUserViewHistory err", err.Error())
-	}
-
 	result = ResearchReportInfo{
 		ResearchReportInfo:     reportInfo,
 		ResearchReportTypeList: researchReportTypeList,
 		HasMenu:                1,
 	}
-
 	if len(researchReportTypeList) <= 0 {
 
 	} else if len(researchReportTypeList) == 1 {
@@ -198,54 +141,7 @@ func GetResearchReportTypeContentInfo(researchReportTypeId, userId uint64) (resu
 	if len(researchReportTypeContentList) > 0 {
 		add = 0
 	}
-	// 联系人信息
-	strInt64 := strconv.FormatUint(userId, 10)
-	id, _ := strconv.Atoi(strInt64)
-	wxUserInfo, err := wx_user.GetByUserId(id)
-	if err != nil {
-		fmt.Println("GetByUserId:", err.Error())
-		return
-	}
-	companyInfo, tmpErr := company.GetByCompanyId(wxUserInfo.CompanyID)
-	if tmpErr != nil {
-		err = tmpErr
-		if tmpErr == utils.ErrNoRow {
-			err = errors.New("找不到该客户")
-			return
-		}
-		return
-	}
 
-	//查询是否读过这篇章节,如果未读过则阅读人数+1
-	_, err = user_view_history.GetReportTypeByUserId(userId, researchReportTypeId)
-	if err != nil {
-		err = reportInfo.UpdateViewers()
-		if err != nil {
-			fmt.Println("UpdateViewers err:", err.Error())
-		}
-	}
-
-	//新增userViewHistory记录
-	userViewHistory := &user_view_history.UserViewHistory{
-		ViewHistoryID:        0,
-		UserID:               userId,
-		Mobile:               wxUserInfo.Mobile,
-		Email:                wxUserInfo.Email,
-		RealName:             wxUserInfo.RealName,
-		CompanyName:          companyInfo.CompanyName,
-		ViewTitle:            "",
-		ViewPage:             "",
-		ReportChapterModule:  "",
-		CreatedTime:          time.Now(),
-		LastUpdatedTime:      time.Now(),
-		Type:                 "weekly_report",
-		ResearchReportID:     reportInfo.ResearchReportID,
-		ResearchReportTypeID: researchReportTypeId,
-	}
-	err = userViewHistory.AddUserViewHistory()
-	if err != nil {
-		fmt.Println("AddUserViewHistory err", err.Error())
-	}
 	result = ResearchReportTypeContentInfo{
 		ResearchReportTypeContentList: researchReportTypeContentList,
 		ResearchReportTypeInfo:        researchReportTypeInfo,

+ 1 - 3
models/tables/user_record/user_record.go

@@ -1,8 +1,6 @@
 package user_record
 
-import (
-	"time"
-)
+import "time"
 
 // UserRecord 联系人表
 type UserRecord struct {