|
@@ -43,6 +43,11 @@ type PublishRankedReport struct {
|
|
|
PermissionNames interface{} `json:"permissionNames,omitempty"`
|
|
|
PublishedTime string `json:"publishedTime"`
|
|
|
CoverUrl string `json:"coverUrl"`
|
|
|
+ RiskLevel string `json:"riskLevel"`
|
|
|
+ IsFree bool `json:"isFree"`
|
|
|
+ Price string `json:"price"`
|
|
|
+ IsSubscribe bool `json:"isSubscribe"`
|
|
|
+ Login bool `json:"login"`
|
|
|
}
|
|
|
|
|
|
type HotRankedReport struct {
|
|
@@ -56,6 +61,11 @@ type HotRankedReport struct {
|
|
|
Permissions map[int]string `json:"-"`
|
|
|
PermissionNames interface{} `json:"permissionNames,omitempty"`
|
|
|
CoverUrl string `json:"coverUrl"`
|
|
|
+ RiskLevel string `json:"riskLevel"`
|
|
|
+ IsFree bool `json:"isFree"`
|
|
|
+ Price string `json:"price"`
|
|
|
+ IsSubscribe bool `json:"isSubscribe"`
|
|
|
+ Login bool `json:"login"`
|
|
|
}
|
|
|
|
|
|
//type PermissionNode struct {
|
|
@@ -141,7 +151,23 @@ func matchRiskLevel(userId int, report reportService.ReportDTO) (riskLevelMatch
|
|
|
return
|
|
|
}
|
|
|
}
|
|
|
-
|
|
|
+func getHighestRiskLevel(permissions []permissionService.PermissionDTO) (riskLevelNum int) {
|
|
|
+ for _, permission := range permissions {
|
|
|
+ pRiskNum, err := parseRiskLevel(permission.RiskLevel)
|
|
|
+ if err != nil {
|
|
|
+ logger.Error("解析风险等级失败:%v", err)
|
|
|
+ continue
|
|
|
+ }
|
|
|
+ if riskLevelNum == 0 {
|
|
|
+ riskLevelNum = pRiskNum
|
|
|
+ } else {
|
|
|
+ if riskLevelNum < pRiskNum {
|
|
|
+ riskLevelNum = pRiskNum
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return
|
|
|
+}
|
|
|
func getLowestRiskLevel(permissions []permissionService.PermissionDTO) (riskLevelNum int) {
|
|
|
for _, permission := range permissions {
|
|
|
pRiskNum, err := parseRiskLevel(permission.RiskLevel)
|
|
@@ -336,7 +362,7 @@ func parseRiskLevel(level string) (int, error) {
|
|
|
return number, nil
|
|
|
}
|
|
|
|
|
|
-func SearchReportList(key string, Ids []int, pageInfo page.PageInfo) (reports []reportService.ReportDTO, err error) {
|
|
|
+func SearchReportList(key string, Ids []int, pageInfo page.PageInfo, isLogin bool, userId int) (reports []reportService.ReportDTO, err error) {
|
|
|
offset := page.StartIndex(pageInfo.Current, pageInfo.PageSize)
|
|
|
reports, err = reportService.SearchReportList(key, Ids, offset, pageInfo.PageSize, pageInfo.LatestId)
|
|
|
var wg sync.WaitGroup
|
|
@@ -344,7 +370,11 @@ func SearchReportList(key string, Ids []int, pageInfo page.PageInfo) (reports []
|
|
|
for i := 0; i < len(reports); i++ {
|
|
|
go func(report *reportService.ReportDTO) {
|
|
|
defer wg.Done()
|
|
|
+ report.Login = isLogin
|
|
|
report.PermissionNames = getReportPermissionNames(report.OrgId, report.Source)
|
|
|
+ permissions := getReportSecondPermissions(report.OrgId, report.Source)
|
|
|
+ riskNum := getHighestRiskLevel(permissions)
|
|
|
+ report.RiskLevel = strings.Join([]string{"R", strconv.Itoa(riskNum)}, "")
|
|
|
var src string
|
|
|
src, err = mediaService.GetImageSrc(report.CoverSrc)
|
|
|
if err != nil {
|
|
@@ -353,6 +383,39 @@ func SearchReportList(key string, Ids []int, pageInfo page.PageInfo) (reports []
|
|
|
} else {
|
|
|
report.CoverUrl = src
|
|
|
}
|
|
|
+ //下查询产品信息
|
|
|
+ product, pdErr := productService.GetProductBySourceId(report.ReportID, productDao.Report)
|
|
|
+ if pdErr != nil {
|
|
|
+ if errors.Is(pdErr, gorm.ErrRecordNotFound) {
|
|
|
+ report.Price = defaultProductPrice
|
|
|
+ report.IsFree = true
|
|
|
+ report.IsSubscribe = false
|
|
|
+ } else {
|
|
|
+ report.Price = defaultProductPrice
|
|
|
+ report.IsFree = false
|
|
|
+ report.IsSubscribe = false
|
|
|
+ }
|
|
|
+ return
|
|
|
+ }
|
|
|
+ report.Price = product.Price.String()
|
|
|
+ report.IsFree = false
|
|
|
+ subscribe, subscribeErr := userService.GetUserSubscribe(product.Id, userId)
|
|
|
+ if subscribeErr != nil {
|
|
|
+ report.IsSubscribe = false
|
|
|
+ return
|
|
|
+ }
|
|
|
+ report.IsSubscribe = subscribe.Status == userDao.SubscribeValid
|
|
|
+ pdRiskNum, parseErr := parseRiskLevel(product.RiskLevel)
|
|
|
+ if parseErr != nil {
|
|
|
+ return
|
|
|
+ }
|
|
|
+ rpRiskNum, parseErr := parseRiskLevel(report.RiskLevel)
|
|
|
+ if parseErr != nil {
|
|
|
+ return
|
|
|
+ }
|
|
|
+ if rpRiskNum <= pdRiskNum {
|
|
|
+ report.RiskLevel = product.RiskLevel
|
|
|
+ }
|
|
|
}(&reports[i])
|
|
|
}
|
|
|
wg.Wait()
|
|
@@ -474,6 +537,9 @@ func GetReportPage(pageInfo page.PageInfo, orgIds map[string][]int, searchAll bo
|
|
|
defer wg.Done()
|
|
|
report.Login = isLogin
|
|
|
report.PermissionNames = getReportPermissionNames(report.OrgId, report.Source)
|
|
|
+ permissions := getReportSecondPermissions(report.OrgId, report.Source)
|
|
|
+ riskNum := getHighestRiskLevel(permissions)
|
|
|
+ report.RiskLevel = strings.Join([]string{"R", strconv.Itoa(riskNum)}, "")
|
|
|
var src string
|
|
|
src, err = mediaService.GetImageSrc(report.CoverSrc)
|
|
|
if err != nil {
|
|
@@ -482,10 +548,11 @@ func GetReportPage(pageInfo page.PageInfo, orgIds map[string][]int, searchAll bo
|
|
|
} else {
|
|
|
report.CoverUrl = src
|
|
|
}
|
|
|
+
|
|
|
//下查询产品信息
|
|
|
product, pdErr := productService.GetProductBySourceId(report.ReportID, productDao.Report)
|
|
|
if pdErr != nil {
|
|
|
- if errors.Is(err, gorm.ErrRecordNotFound) {
|
|
|
+ if errors.Is(pdErr, gorm.ErrRecordNotFound) {
|
|
|
report.Price = defaultProductPrice
|
|
|
report.IsFree = true
|
|
|
report.IsSubscribe = false
|
|
@@ -504,6 +571,17 @@ func GetReportPage(pageInfo page.PageInfo, orgIds map[string][]int, searchAll bo
|
|
|
return
|
|
|
}
|
|
|
report.IsSubscribe = subscribe.Status == userDao.SubscribeValid
|
|
|
+ pdRiskNum, parseErr := parseRiskLevel(product.RiskLevel)
|
|
|
+ if parseErr != nil {
|
|
|
+ return
|
|
|
+ }
|
|
|
+ rpRiskNum, parseErr := parseRiskLevel(report.RiskLevel)
|
|
|
+ if parseErr != nil {
|
|
|
+ return
|
|
|
+ }
|
|
|
+ if rpRiskNum <= pdRiskNum {
|
|
|
+ report.RiskLevel = product.RiskLevel
|
|
|
+ }
|
|
|
}(&list[i])
|
|
|
}
|
|
|
wg.Wait()
|
|
@@ -537,10 +615,11 @@ func CountReport(count RecordCount) (traceId string, err error) {
|
|
|
dto := convertToRecordCountDTO(count)
|
|
|
return userService.CountReport(dto)
|
|
|
}
|
|
|
-func GetRandedReportByWeeklyHot(limit int) (reports []HotRankedReport, err error) {
|
|
|
+func GetRandedReportByWeeklyHot(limit int, isLogin bool, userId int, pdRiskLevel string) (reports []HotRankedReport, err error) {
|
|
|
end := time.Now()
|
|
|
begin := date.GetBeginOfTheWeek(end, time.Monday)
|
|
|
hotReports := userService.GetHotReports(begin.Format(time.DateOnly), end.Format(time.DateOnly), limit)
|
|
|
+
|
|
|
if len(hotReports) > 0 {
|
|
|
var dtoList []reportService.ReportDTO
|
|
|
var ids []int
|
|
@@ -548,30 +627,116 @@ func GetRandedReportByWeeklyHot(limit int) (reports []HotRankedReport, err error
|
|
|
ids = append(ids, hotReports[i].ReportId)
|
|
|
}
|
|
|
dtoList, err = reportService.GetListByCondition("id", ids)
|
|
|
-
|
|
|
if err != nil {
|
|
|
logger.Error("获取本周最热研报列表失败:%v", err)
|
|
|
err = exception.New(exception.GetHotRandListFailed)
|
|
|
return
|
|
|
}
|
|
|
+ var filterList []reportService.ReportDTO
|
|
|
+ if pdRiskLevel != "" {
|
|
|
+ for _, report := range dtoList {
|
|
|
+ product, pdErr := productService.GetProductBySourceId(report.ReportID, productDao.Report)
|
|
|
+ if pdErr != nil {
|
|
|
+ if errors.Is(pdErr, gorm.ErrRecordNotFound) {
|
|
|
+ report.Price = defaultProductPrice
|
|
|
+ report.IsFree = true
|
|
|
+ report.IsSubscribe = false
|
|
|
+ } else {
|
|
|
+ logger.Error("查询产品失败:%v", pdErr)
|
|
|
+ report.Price = defaultProductPrice
|
|
|
+ report.IsFree = false
|
|
|
+ report.IsSubscribe = false
|
|
|
+ }
|
|
|
+ filterList = append(filterList, report)
|
|
|
+ } else {
|
|
|
+ pdRiskNum, paresErr := parseRiskLevel(product.RiskLevel)
|
|
|
+ if paresErr != nil {
|
|
|
+ logger.Error("解析风险等级失败:%v", err)
|
|
|
+ continue
|
|
|
+ }
|
|
|
+ reRiskNum, paresErr := parseRiskLevel(pdRiskLevel)
|
|
|
+ if paresErr != nil {
|
|
|
+ logger.Error("解析风险等级失败:%v", err)
|
|
|
+ continue
|
|
|
+ }
|
|
|
+ report.RiskLevel = product.RiskLevel
|
|
|
+ if isLogin {
|
|
|
+ subscribe, subErr := userService.GetUserSubscribe(product.Id, userId)
|
|
|
+ if subErr != nil {
|
|
|
+ logger.Error("查询用户订阅信息失败:%v,productId:%v,userId:%v", err, product.Id, userId)
|
|
|
+ report.Price = product.Price.String()
|
|
|
+ report.IsFree = false
|
|
|
+ report.IsSubscribe = false
|
|
|
+ } else {
|
|
|
+ report.Price = product.Price.String()
|
|
|
+ report.IsFree = false
|
|
|
+ report.IsSubscribe = subscribe.Status == userDao.SubscribeValid
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if pdRiskNum <= reRiskNum {
|
|
|
+ filterList = append(filterList, report)
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ filterList = dtoList
|
|
|
+ for _, report := range filterList {
|
|
|
+ product, pdErr := productService.GetProductBySourceId(report.ReportID, productDao.Report)
|
|
|
+ if pdErr != nil {
|
|
|
+ if errors.Is(pdErr, gorm.ErrRecordNotFound) {
|
|
|
+ report.Price = defaultProductPrice
|
|
|
+ report.IsFree = true
|
|
|
+ report.IsSubscribe = false
|
|
|
+ } else {
|
|
|
+ logger.Error("查询产品失败:%v", pdErr)
|
|
|
+ report.Price = defaultProductPrice
|
|
|
+ report.IsFree = false
|
|
|
+ report.IsSubscribe = false
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ report.Price = product.Price.String()
|
|
|
+ report.IsFree = false
|
|
|
+ report.IsSubscribe = false
|
|
|
+ report.RiskLevel = product.RiskLevel
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
var wg sync.WaitGroup
|
|
|
- wg.Add(len(dtoList))
|
|
|
- for i := 0; i < len(dtoList); i++ {
|
|
|
+ wg.Add(len(filterList))
|
|
|
+ for i := 0; i < len(filterList); i++ {
|
|
|
go func(report *reportService.ReportDTO) {
|
|
|
defer wg.Done()
|
|
|
+ report.Login = isLogin
|
|
|
report.Permissions = getReportPermissionsMap(report.OrgId, report.Source)
|
|
|
report.SecondPermission = getReportSecondPermissionsMap(report.OrgId, report.Source)
|
|
|
+ permissions := getReportSecondPermissions(report.OrgId, report.Source)
|
|
|
+ riskNum := getHighestRiskLevel(permissions)
|
|
|
+ if report.RiskLevel == "" {
|
|
|
+ report.RiskLevel = strings.Join([]string{"R", strconv.Itoa(riskNum)}, "")
|
|
|
+ } else {
|
|
|
+ reRiskNum, paresErr := parseRiskLevel(report.RiskLevel)
|
|
|
+ if paresErr != nil {
|
|
|
+ logger.Error("解析风险等级失败:%v", err)
|
|
|
+ report.RiskLevel = strings.Join([]string{"R", strconv.Itoa(riskNum)}, "")
|
|
|
+ } else {
|
|
|
+ if reRiskNum <= riskNum {
|
|
|
+ report.RiskLevel = strings.Join([]string{"R", strconv.Itoa(riskNum)}, "")
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
var label []string
|
|
|
for _, permission := range report.Permissions {
|
|
|
label = append(label, permission)
|
|
|
}
|
|
|
+
|
|
|
report.PermissionNames = label
|
|
|
- }(&dtoList[i])
|
|
|
+ }(&filterList[i])
|
|
|
}
|
|
|
wg.Wait()
|
|
|
reports = make([]HotRankedReport, len(ids))
|
|
|
- for i := 0; i < len(dtoList); i++ {
|
|
|
- report := convertToHotRankedReport(dtoList[i])
|
|
|
+ for i := 0; i < len(filterList); i++ {
|
|
|
+ report := convertToHotRankedReport(filterList[i])
|
|
|
for j := 0; j < len(hotReports); j++ {
|
|
|
if hotReports[j].ReportId == report.Id {
|
|
|
report.Count = hotReports[j].Count
|
|
@@ -586,26 +751,111 @@ func GetRandedReportByWeeklyHot(limit int) (reports []HotRankedReport, err error
|
|
|
return
|
|
|
}
|
|
|
|
|
|
-func GetRandedReportByPublishTimeWeekly(limit int, week bool) (reports []PublishRankedReport, err error) {
|
|
|
+func GetRandedReportByPublishTimeWeekly(limit int, week bool, isLogin bool, userId int, pdRiskLevel string) (reports []PublishRankedReport, err error) {
|
|
|
dtoList, err := reportService.GetListOrderByConditionWeekly(week, "published_time", limit, reportService.DESC)
|
|
|
if err != nil {
|
|
|
logger.Error("获取最新发布的研报列表失败:%v", err)
|
|
|
err = exception.New(exception.GetPublishedRandListFailed)
|
|
|
return
|
|
|
}
|
|
|
+ var filterList []reportService.ReportDTO
|
|
|
+ if pdRiskLevel != "" {
|
|
|
+ for _, report := range dtoList {
|
|
|
+ product, pdErr := productService.GetProductBySourceId(report.ReportID, productDao.Report)
|
|
|
+ if pdErr != nil {
|
|
|
+ if errors.Is(pdErr, gorm.ErrRecordNotFound) {
|
|
|
+ report.Price = defaultProductPrice
|
|
|
+ report.IsFree = true
|
|
|
+ report.IsSubscribe = false
|
|
|
+ } else {
|
|
|
+ logger.Error("查询产品失败:%v", pdErr)
|
|
|
+ report.Price = defaultProductPrice
|
|
|
+ report.IsFree = false
|
|
|
+ report.IsSubscribe = false
|
|
|
+ }
|
|
|
+ filterList = append(filterList, report)
|
|
|
+ } else {
|
|
|
+ pdRiskNum, paresErr := parseRiskLevel(product.RiskLevel)
|
|
|
+ if paresErr != nil {
|
|
|
+ logger.Error("解析风险等级失败:%v", err)
|
|
|
+ continue
|
|
|
+ }
|
|
|
+ reRiskNum, paresErr := parseRiskLevel(pdRiskLevel)
|
|
|
+ if paresErr != nil {
|
|
|
+ logger.Error("解析风险等级失败:%v", err)
|
|
|
+ continue
|
|
|
+ }
|
|
|
+ report.RiskLevel = product.RiskLevel
|
|
|
+ if isLogin {
|
|
|
+ subscribe, subErr := userService.GetUserSubscribe(product.Id, userId)
|
|
|
+ if subErr != nil {
|
|
|
+ logger.Error("查询用户订阅信息失败:%v,productId:%v,userId:%v", err, product.Id, userId)
|
|
|
+ report.Price = product.Price.String()
|
|
|
+ report.IsFree = false
|
|
|
+ report.IsSubscribe = false
|
|
|
+ } else {
|
|
|
+ report.Price = product.Price.String()
|
|
|
+ report.IsFree = false
|
|
|
+ report.IsSubscribe = subscribe.Status == userDao.SubscribeValid
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if pdRiskNum <= reRiskNum {
|
|
|
+ filterList = append(filterList, report)
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ filterList = dtoList
|
|
|
+ for _, report := range filterList {
|
|
|
+ product, pdErr := productService.GetProductBySourceId(report.ReportID, productDao.Report)
|
|
|
+ if pdErr != nil {
|
|
|
+ if errors.Is(pdErr, gorm.ErrRecordNotFound) {
|
|
|
+ report.Price = defaultProductPrice
|
|
|
+ report.IsFree = true
|
|
|
+ report.IsSubscribe = false
|
|
|
+ } else {
|
|
|
+ logger.Error("查询产品失败:%v", pdErr)
|
|
|
+ report.Price = defaultProductPrice
|
|
|
+ report.IsFree = false
|
|
|
+ report.IsSubscribe = false
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ report.Price = product.Price.String()
|
|
|
+ report.IsFree = false
|
|
|
+ report.IsSubscribe = false
|
|
|
+ report.RiskLevel = product.RiskLevel
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
//并发获取研报的标签
|
|
|
var wg sync.WaitGroup
|
|
|
- wg.Add(len(dtoList))
|
|
|
- for i := 0; i < len(dtoList); i++ {
|
|
|
+ wg.Add(len(filterList))
|
|
|
+ for i := 0; i < len(filterList); i++ {
|
|
|
go func(report *reportService.ReportDTO) {
|
|
|
defer wg.Done()
|
|
|
+ report.Login = isLogin
|
|
|
report.Permissions = getReportPermissionsMap(report.OrgId, report.Source)
|
|
|
report.SecondPermission = getReportSecondPermissionsMap(report.OrgId, report.Source)
|
|
|
report.PermissionNames = getReportPermissionNames(report.OrgId, report.Source)
|
|
|
- }(&dtoList[i])
|
|
|
+ permissions := getReportSecondPermissions(report.OrgId, report.Source)
|
|
|
+ riskNum := getHighestRiskLevel(permissions)
|
|
|
+ if report.RiskLevel == "" {
|
|
|
+ report.RiskLevel = strings.Join([]string{"R", strconv.Itoa(riskNum)}, "")
|
|
|
+ } else {
|
|
|
+ reRiskNum, paresErr := parseRiskLevel(report.RiskLevel)
|
|
|
+ if paresErr != nil {
|
|
|
+ logger.Error("解析风险等级失败:%v", err)
|
|
|
+ report.RiskLevel = strings.Join([]string{"R", strconv.Itoa(riskNum)}, "")
|
|
|
+ } else {
|
|
|
+ if reRiskNum <= riskNum {
|
|
|
+ report.RiskLevel = strings.Join([]string{"R", strconv.Itoa(riskNum)}, "")
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }(&filterList[i])
|
|
|
}
|
|
|
wg.Wait()
|
|
|
- reports = convertToPublishRankedReportList(dtoList)
|
|
|
+ reports = convertToPublishRankedReportList(filterList)
|
|
|
return
|
|
|
}
|
|
|
|
|
@@ -624,6 +874,11 @@ func getReportSecondPermissionsMap(id int, source string) (permissionMap map[int
|
|
|
}
|
|
|
return
|
|
|
}
|
|
|
+
|
|
|
+func getReportSecondPermissions(id int, source string) (permissionList []permissionService.PermissionDTO) {
|
|
|
+ return reportService.GetReportSecondPermissionsById(id, source)
|
|
|
+
|
|
|
+}
|
|
|
func getReportPermissionsMap(id int, source string) (permissionMap map[int]string) {
|
|
|
permissionMap = make(map[int]string)
|
|
|
permissions := reportService.GetReportPermissionsById(id, source)
|
|
@@ -634,34 +889,8 @@ func getReportPermissionsMap(id int, source string) (permissionMap map[int]strin
|
|
|
}
|
|
|
func GetPermissionList() (root *permissionService.PermissionNode, err error) {
|
|
|
return permissionService.GetPermissionList()
|
|
|
- //if err != nil {
|
|
|
- // logger.Error("获取品种列表失败:%v", err)
|
|
|
- // err = exception.New(exception.GetPermissionListFailed)
|
|
|
- // return
|
|
|
- //}
|
|
|
- ////root = &PermissionNode{
|
|
|
- //// ID: 0,
|
|
|
- //// ParentID: 0,
|
|
|
- ////}
|
|
|
- ////assemblePermissionNode(list, root, 0, 2)
|
|
|
- //return
|
|
|
}
|
|
|
|
|
|
-// func assemblePermissionNode(list []reportService.PermissionDTO, node *PermissionNode, current int, level int) {
|
|
|
-// if node != nil && current < level {
|
|
|
-// for _, permission := range list {
|
|
|
-// if permission.ParentID == node.ID {
|
|
|
-// childNode := &PermissionNode{
|
|
|
-// ID: permission.ID,
|
|
|
-// Name: permission.Name,
|
|
|
-// ParentID: permission.ParentID,
|
|
|
-// }
|
|
|
-// node.Children = append(node.Children, childNode)
|
|
|
-// assemblePermissionNode(list, childNode, current+1, level)
|
|
|
-// }
|
|
|
-// }
|
|
|
-// }
|
|
|
-// }
|
|
|
func convertToHotRankedReport(dto reportService.ReportDTO) (report HotRankedReport) {
|
|
|
src, err := mediaService.GetImageSrc(dto.CoverSrc)
|
|
|
if err != nil {
|
|
@@ -678,6 +907,11 @@ func convertToHotRankedReport(dto reportService.ReportDTO) (report HotRankedRepo
|
|
|
Permissions: dto.Permissions,
|
|
|
PermissionNames: dto.PermissionNames,
|
|
|
CoverUrl: src,
|
|
|
+ IsSubscribe: dto.IsSubscribe,
|
|
|
+ IsFree: dto.IsFree,
|
|
|
+ Price: dto.Price,
|
|
|
+ RiskLevel: dto.RiskLevel,
|
|
|
+ Login: dto.Login,
|
|
|
}
|
|
|
return
|
|
|
}
|
|
@@ -699,6 +933,11 @@ func convertToPublishRankedReportList(dtoList []reportService.ReportDTO) (report
|
|
|
SecondPermissions: dto.SecondPermission,
|
|
|
PermissionNames: dto.PermissionNames,
|
|
|
CoverUrl: src,
|
|
|
+ IsSubscribe: dto.IsSubscribe,
|
|
|
+ IsFree: dto.IsFree,
|
|
|
+ Price: dto.Price,
|
|
|
+ RiskLevel: dto.RiskLevel,
|
|
|
+ Login: dto.Login,
|
|
|
}
|
|
|
reports = append(reports, report)
|
|
|
}
|
|
@@ -727,7 +966,7 @@ func GetReportByIdListByOrgIds(orgIds map[string][]int) (ids []int, err error) {
|
|
|
return
|
|
|
}
|
|
|
|
|
|
-func RangePermissionIds(isLogin bool, userId int) (filterPermissionIds []int, err error) {
|
|
|
+func RangePermissionIds(isLogin bool, userId int) (filterPermissionIds []int, riskLevel string, err error) {
|
|
|
if isLogin {
|
|
|
userProfile, userErr := user.GetUserProfile(userId)
|
|
|
if userErr != nil {
|
|
@@ -757,6 +996,7 @@ func RangePermissionIds(isLogin bool, userId int) (filterPermissionIds []int, er
|
|
|
//获取所有设置风险等级的品种
|
|
|
permissionList, err = permissionService.GetPermissionListWithRisk()
|
|
|
permissionList = filterPermissionsByRisk(permissionList, mapping.ProductRiskLevel)
|
|
|
+ riskLevel = mapping.ProductRiskLevel
|
|
|
if len(permissionList) == 0 {
|
|
|
return
|
|
|
}
|