user_service.go 20 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618
  1. package user
  2. import (
  3. "encoding/json"
  4. "errors"
  5. logger "eta/eta_mini_ht_api/common/component/log"
  6. "eta/eta_mini_ht_api/common/exception"
  7. "eta/eta_mini_ht_api/common/utils/page"
  8. permissionService "eta/eta_mini_ht_api/domian/config"
  9. analystService "eta/eta_mini_ht_api/domian/financial_analyst"
  10. reportDomian "eta/eta_mini_ht_api/domian/report"
  11. userService "eta/eta_mini_ht_api/domian/user"
  12. merchantDao "eta/eta_mini_ht_api/models/merchant"
  13. userDao "eta/eta_mini_ht_api/models/user"
  14. "eta/eta_mini_ht_api/service/config"
  15. "gorm.io/gorm"
  16. "sort"
  17. "sync"
  18. "time"
  19. )
  20. const (
  21. RiskValid = "valid"
  22. RiskExpired = "expired"
  23. RiskUnTest = "unTest"
  24. SubscribeExpired = "expired"
  25. UnSubscribe = "unSubscribe"
  26. Subscribing = "Subscribing"
  27. ReportBookMark = "report"
  28. ChartBookMark = "chart"
  29. )
  30. type User struct {
  31. Id int `json:"id"`
  32. Username string `json:"username"`
  33. AreaCode string `json:"areaCode"`
  34. Mobile string `json:"mobile"`
  35. OpenId string `json:"openId,omitempty"`
  36. }
  37. type AnalystDetail struct {
  38. AnalystName string `json:"analystName"`
  39. HeadImgUrl string `json:"headImgUrl"`
  40. HeadOriginImgUrl string `json:"headOriginImgUrl"`
  41. Introduction string `json:"introduction"`
  42. Followed string `json:"followed"`
  43. Position string `json:"position"`
  44. InvestmentCertificate string `json:"investmentCertificate"`
  45. ProfessionalCertificate string `json:"professionalCertificate"`
  46. }
  47. type UserProfile struct {
  48. Mobile string `json:"mobile"`
  49. RiskLevel string `json:"riskLevel"`
  50. RiskLevelStatus string `json:"riskLevelStatus"`
  51. UserName string `json:"userName"`
  52. AccountStatus string `json:"accountStatus"`
  53. }
  54. func CheckUserRiskMatchStatus(userId int) (riskLevel string, userRiskLevelStatus string, err error) {
  55. if userId <= 0 {
  56. err = exception.New(exception.IllegalTemplateUserId)
  57. return
  58. }
  59. userProfile, userErr := GetUserProfile(userId)
  60. if userErr != nil {
  61. if errors.Is(userErr, gorm.ErrRecordNotFound) {
  62. err = exception.New(exception.TemplateUserNotFound)
  63. } else {
  64. err = exception.New(exception.TemplateUserFoundFailed)
  65. }
  66. logger.Error("获取临时客户信息失败:%v", err)
  67. return
  68. }
  69. userRiskLevelStatus = userProfile.RiskLevelStatus
  70. //获取产品风险等级
  71. if userProfile.RiskLevelStatus == RiskUnTest {
  72. logger.Warn("客户未做风险等级测评,mobile:%v", userProfile.Mobile)
  73. }
  74. if userProfile.RiskLevelStatus == RiskExpired {
  75. logger.Warn("客户风险等级已过期,mobile:%v", userProfile.Mobile)
  76. }
  77. if userProfile.RiskLevel != "" && userProfile.RiskLevelStatus == RiskValid {
  78. var mapping permissionService.CustomerProductRiskMappingDTO
  79. mapping, err = permissionService.GetRiskMappingByCustomerRiskLevel(userProfile.RiskLevel)
  80. if err != nil {
  81. logger.Error("查询产品风险等级映射失败:%v", err)
  82. return
  83. }
  84. riskLevel = mapping.ProductRiskLevel
  85. }
  86. return
  87. }
  88. // GetRiskLevelPermissionList 删选掉没有配置风险等级的品种,并校验客户的风险等级,riskLevel只有在客户
  89. func GetRiskLevelPermissionList(permissionIds []int, isLogin bool, userId int) (filterPermissionIds []int, riskLevel string, userRiskStatus string, err error) {
  90. if isLogin {
  91. userProfile, userErr := GetUserProfile(userId)
  92. if userErr != nil {
  93. if errors.Is(userErr, gorm.ErrRecordNotFound) {
  94. err = exception.New(exception.TemplateUserNotFound)
  95. } else {
  96. err = exception.New(exception.TemplateUserFoundFailed)
  97. }
  98. logger.Error("获取临时客户信息失败:%v", err)
  99. return
  100. }
  101. var permissionList []permissionService.PermissionDTO
  102. if len(permissionIds) == 0 {
  103. //获取所有设置风险等级的品种
  104. permissionList, err = permissionService.GetPermissionListWithRisk()
  105. } else {
  106. //更具id过滤设置了风险等级的品种
  107. permissionList, err = permissionService.GetPermissionListByIds(permissionIds)
  108. }
  109. if err != nil {
  110. logger.Error("查询有风险等级的品种列表失败:%v", err)
  111. return
  112. }
  113. userRiskStatus = userProfile.RiskLevelStatus
  114. //获取产品风险等级
  115. if userProfile.RiskLevelStatus == RiskUnTest {
  116. logger.Warn("客户未做风险等级测评,mobile:%v", userProfile.Mobile)
  117. //err = exception.New(exception.RiskUnTestError)
  118. }
  119. if userProfile.RiskLevelStatus == RiskExpired {
  120. logger.Warn("客户风险等级已过期,mobile:%v", userProfile.Mobile)
  121. //err = exception.New(exception.RiskExpiredError)
  122. }
  123. if userProfile.RiskLevel != "" && userProfile.RiskLevelStatus == RiskValid {
  124. var mapping permissionService.CustomerProductRiskMappingDTO
  125. mapping, err = permissionService.GetRiskMappingByCustomerRiskLevel(userProfile.RiskLevel)
  126. if err != nil {
  127. logger.Error("查询产品风险等级映射失败:%v", err)
  128. return
  129. }
  130. permissionList = filterPermissionsByRisk(permissionList, mapping.ProductRiskLevel)
  131. riskLevel = mapping.ProductRiskLevel
  132. }
  133. for _, permission := range permissionList {
  134. filterPermissionIds = append(filterPermissionIds, permission.PermissionId)
  135. }
  136. return
  137. } else { //没有登录的时候展示所有设置了风险等级的品种报告,筛选的时候过滤传入ID中没有设置风险等级的品种
  138. var permissionList []permissionService.PermissionDTO
  139. if len(permissionIds) == 0 {
  140. //获取所有设置风险等级的品种
  141. permissionList, err = permissionService.GetPermissionListWithRisk()
  142. } else {
  143. //更具id过滤设置了风险等级的品种
  144. permissionList, err = permissionService.GetPermissionListByIds(permissionIds)
  145. }
  146. if err != nil {
  147. logger.Error("查询有风险等级的品种列表失败:%v", err)
  148. return
  149. }
  150. for _, permission := range permissionList {
  151. filterPermissionIds = append(filterPermissionIds, permission.PermissionId)
  152. }
  153. return
  154. }
  155. }
  156. func filterPermissionsByRisk(permissionList []permissionService.PermissionDTO, riskLevel string) (resultList []permissionService.PermissionDTO) {
  157. if riskLevel != "" {
  158. riskLevelNum, err := config.ParseRiskLevel(riskLevel)
  159. if err != nil {
  160. logger.Error("风险等级解析失败:%v", err)
  161. return
  162. }
  163. for _, permission := range permissionList {
  164. pRiskNum, riskErr := config.ParseRiskLevel(permission.RiskLevel)
  165. if riskErr != nil {
  166. logger.Error("解析品种风险等级失败 permission:%d,risk:%v", permission.PermissionId, permission.RiskLevel)
  167. continue
  168. }
  169. if pRiskNum <= riskLevelNum {
  170. resultList = append(resultList, permission)
  171. }
  172. }
  173. } else {
  174. resultList = permissionList
  175. }
  176. return
  177. }
  178. func convertUserDTOToProfile(dto userService.UserDTO) (profile UserProfile) {
  179. profile = UserProfile{
  180. Mobile: dto.Mobile,
  181. RiskLevel: dto.RiskLevel,
  182. UserName: dto.Username,
  183. }
  184. if profile.UserName == "" {
  185. profile.UserName = dto.Mobile
  186. }
  187. if dto.RiskLevel == "" {
  188. profile.RiskLevelStatus = RiskUnTest
  189. return
  190. }
  191. date, err := time.Parse(time.DateOnly, dto.RiskValidEndDate)
  192. if err != nil {
  193. logger.Error("解析日期失败:%v", err)
  194. profile.RiskLevelStatus = RiskExpired
  195. return
  196. }
  197. currentDate := time.Now().Truncate(24 * time.Hour)
  198. expiryDate := date.Truncate(24 * time.Hour)
  199. if expiryDate.Before(currentDate) {
  200. profile.RiskLevelStatus = RiskExpired
  201. return
  202. }
  203. profile.RiskLevelStatus = RiskValid
  204. return
  205. }
  206. func GetUserProfile(userId int) (userProfile UserProfile, err error) {
  207. userDTO, err := userService.GetUserById(userId)
  208. if err != nil {
  209. if errors.Is(err, gorm.ErrRecordNotFound) {
  210. logger.Error("用户不存在,用户Id:%d", userId)
  211. err = exception.New(exception.TemplateUserNotFound)
  212. } else {
  213. logger.Error("获取用户信息失败:%v", err)
  214. err = exception.New(exception.TemplateUserFoundFailed)
  215. }
  216. return
  217. }
  218. OfficialUser, err := userService.GetUserByTemplateUserId(userId)
  219. if err != nil && !errors.Is(err, gorm.ErrRecordNotFound) {
  220. logger.Error("获取用户信息失败:%v", err)
  221. err = exception.New(exception.OfficialUserFoundError)
  222. return
  223. }
  224. userProfile = convertUserDTOToProfile(userDTO)
  225. if errors.Is(err, gorm.ErrRecordNotFound) {
  226. userProfile.AccountStatus = "unopen"
  227. err = nil
  228. return
  229. } else {
  230. userProfile.AccountStatus = OfficialUser.AccountStatus
  231. }
  232. return
  233. }
  234. func GetAnalystDetail(userId int, analystId int) (analystDetail AnalystDetail, err error) {
  235. analyst, err := analystService.GetAnalystById(analystId)
  236. if err != nil {
  237. logger.Error("研究员信息不存在:%v", err)
  238. err = exception.New(exception.AnalystNotFound)
  239. }
  240. analystDetail = convertToAnalystDetail(analyst)
  241. //研究员关注状态
  242. analystDetail.Followed = userService.GetFollowed(userId, analystId)
  243. return
  244. }
  245. func convertToAnalystDetail(dto analystService.FinancialAnalystDTO) AnalystDetail {
  246. return AnalystDetail{
  247. AnalystName: dto.Name,
  248. HeadImgUrl: dto.HeadImgUrl,
  249. HeadOriginImgUrl: dto.HeadOriginImgUrl,
  250. Introduction: dto.Introduction,
  251. Position: dto.Position,
  252. InvestmentCertificate: dto.InvestmentCertificate,
  253. ProfessionalCertificate: dto.ProfessionalCertificate,
  254. }
  255. }
  256. func FollowAnalystsByName(userId int, analystNames []string, followType string) (err error) {
  257. var followlist []userService.FollowDTO
  258. for _, analystName := range analystNames {
  259. FinancialAnalystDTO, followErr := analystService.GetAnalystByName(analystName)
  260. if followErr != nil {
  261. err = exception.New(exception.AnalystNotFound)
  262. }
  263. if FinancialAnalystDTO.Id == 0 || FinancialAnalystDTO.Name == "" {
  264. continue
  265. }
  266. followDTO := userService.FollowDTO{
  267. UserId: userId,
  268. AnalystId: FinancialAnalystDTO.Id,
  269. AnalystName: FinancialAnalystDTO.Name,
  270. FollowType: followType,
  271. }
  272. followlist = append(followlist, followDTO)
  273. }
  274. err = userService.FollowAnalystsByName(userId, followlist, followType)
  275. if err != nil {
  276. logger.Error("批量关注研究员失败:%v", err)
  277. err = exception.New(exception.BatchFollowingAnalystFailed)
  278. }
  279. return
  280. }
  281. func CheckFollowStatusByNames(userId int, names []string) (list []userService.FollowDTO, err error) {
  282. list, err = userService.CheckFollowStatusByNames(userId, names)
  283. if err != nil {
  284. logger.Error("获取关注状态失败:%v", err)
  285. err = exception.New(exception.CheckFollowStatusByNamesFailed)
  286. }
  287. return
  288. }
  289. func FollowAnalyst(userId int, analystId int, followType string) (err error) {
  290. FinancialAnalystDTO, err := analystService.GetAnalystById(analystId)
  291. if err != nil {
  292. err = exception.New(exception.AnalystNotFound)
  293. }
  294. if FinancialAnalystDTO.Id == 0 || FinancialAnalystDTO.Name == "" {
  295. err = exception.New(exception.AnalystNotFound)
  296. return
  297. }
  298. followDTO := userService.FollowDTO{
  299. UserId: userId,
  300. AnalystId: analystId,
  301. AnalystName: FinancialAnalystDTO.Name,
  302. FollowType: followType,
  303. }
  304. err = userService.FollowAnalyst(followDTO)
  305. if err != nil {
  306. logger.Error("关注研究员失败:%v", err)
  307. err = exception.New(exception.UserFollowAnalystFailed)
  308. }
  309. return
  310. }
  311. func GetFollowingAnalystList(userId int) (analysts []FollowAnalystDTO, err error) {
  312. logger.Info("用户ID:%d", userId)
  313. dtoList, err := userService.GetFollowingAnalystList(userId)
  314. if err != nil {
  315. logger.Error("获取关注列表失败:%v", err)
  316. err = exception.New(exception.GetFollowingAnalystListFailed)
  317. return
  318. }
  319. analysts, err = convertToAnalystList(dtoList)
  320. var wg sync.WaitGroup
  321. wg.Add(len(analysts))
  322. for i := 0; i < len(analysts); i++ {
  323. go func(followDTo *FollowAnalystDTO) {
  324. defer wg.Done()
  325. followDTo.NeedNotice = userService.NeedNotice(userId, followDTo.AnalystId)
  326. var analystsDTO analystService.FinancialAnalystDTO
  327. analystsDTO, err = analystService.GetAnalystById(followDTo.AnalystId)
  328. if err != nil {
  329. logger.Error("获取研究员信息失败")
  330. followDTo.AnalystId = -1
  331. } else {
  332. followDTo.HeadImgUrl = analystsDTO.HeadImgUrl
  333. }
  334. }(&analysts[i])
  335. }
  336. wg.Wait()
  337. //排序
  338. sort.Slice(analysts, func(i, j int) bool {
  339. // 首先按 NeedNotice 排序
  340. if analysts[i].NeedNotice == analysts[j].NeedNotice {
  341. // 对于 NeedNotice 相同的情况下,进行倒序排列
  342. return analysts[i].FollowedTime.After(analysts[j].FollowedTime)
  343. }
  344. // NeedNotice 为 true 的排在 false 的前面
  345. return analysts[i].NeedNotice
  346. })
  347. //if err != nil {
  348. // logger.Error("转换研究员列表失败:%v", err)
  349. // err = exception.New(exception.TransferFollowingAnalystListFailed)
  350. //}
  351. return
  352. }
  353. func GetUnReadMessageList(userId int) (messages []userService.MyMessage, err error) {
  354. messages, err = userService.GetUnReadMessageList(userId)
  355. if err != nil {
  356. err = exception.New(exception.GetUserUnReadMsgFailed)
  357. }
  358. return
  359. }
  360. func ReadMessage(userId int, messageId int) bool {
  361. return userService.ReadMessage(userId, messageId)
  362. }
  363. func ReadMessages(userId int, analystId int) bool {
  364. return userService.ReadMessages(userId, analystId)
  365. }
  366. type FollowAnalystDTO struct {
  367. AnalystId int `json:"analystId"`
  368. AnalystName string `json:"analystName"`
  369. HeadImgUrl string `json:"headImgUrl"`
  370. FollowedTime time.Time `json:"followedTime"`
  371. NeedNotice bool `json:"needNotice"`
  372. }
  373. func convertToAnalystList(dtoList []userService.FollowDTO) (list []FollowAnalystDTO, err error) {
  374. for _, dto := range dtoList {
  375. analyst := FollowAnalystDTO{
  376. AnalystId: dto.AnalystId,
  377. AnalystName: dto.AnalystName,
  378. FollowedTime: dto.FollowedTime,
  379. NeedNotice: false,
  380. }
  381. list = append(list, analyst)
  382. }
  383. return
  384. }
  385. func FollowAnalystByName(userId int, analystName string, followType string) (err error) {
  386. FinancialAnalystDTO, err := analystService.GetAnalystByName(analystName)
  387. if err != nil {
  388. err = exception.New(exception.AnalystNotFound)
  389. }
  390. if FinancialAnalystDTO.Id == 0 || FinancialAnalystDTO.Name == "" {
  391. err = exception.New(exception.AnalystNotFound)
  392. return
  393. }
  394. followDTO := userService.FollowDTO{
  395. UserId: userId,
  396. AnalystId: FinancialAnalystDTO.Id,
  397. AnalystName: FinancialAnalystDTO.Name,
  398. FollowType: followType,
  399. }
  400. err = userService.FollowAnalyst(followDTO)
  401. if err != nil {
  402. logger.Error("关注研究员失败:%v", err)
  403. err = exception.New(exception.UserFollowAnalystFailed)
  404. }
  405. return
  406. }
  407. func FeedBack(userId int, mobile string, message string) (err error) {
  408. feedback := userService.FeedbackDTO{
  409. UserId: userId,
  410. Mobile: mobile,
  411. Message: message,
  412. }
  413. err = userService.FeedBack(feedback)
  414. if err != nil {
  415. err = exception.New(exception.FeedBackError)
  416. }
  417. return
  418. }
  419. func GetUserByMobile(mobile string) (user User, err error) {
  420. userDTO, err := userService.GetUserByMobile(mobile)
  421. if err != nil {
  422. if errors.Is(err, gorm.ErrRecordNotFound) {
  423. err = exception.New(exception.TemplateUserNotFound)
  424. } else {
  425. err = exception.New(exception.TemplateUserFoundFailed)
  426. }
  427. }
  428. user = convertToUser(userDTO)
  429. return
  430. }
  431. func GetUserByOpenId(openId string) (user User, err error) {
  432. userDTO, err := userService.GetUserByOpenId(openId)
  433. if err != nil {
  434. return
  435. }
  436. user = convertToUser(userDTO)
  437. return
  438. }
  439. func convertToUser(userDTO userService.UserDTO) User {
  440. return User{
  441. Id: userDTO.Id,
  442. Username: userDTO.Username,
  443. OpenId: userDTO.OpenId,
  444. AreaCode: userDTO.AreaCode,
  445. Mobile: userDTO.Mobile,
  446. }
  447. }
  448. func GetUserByTemplateUserId(templateUserId int) (officialUser userService.OfficialUserDTO, err error) {
  449. officialUser, err = userService.GetUserByTemplateUserId(templateUserId)
  450. if err != nil {
  451. if errors.Is(err, gorm.ErrRecordNotFound) {
  452. err = exception.New(exception.OfficialUserNotFound)
  453. logger.Info("用户未开户:%v", templateUserId)
  454. } else {
  455. err = exception.NewWithException(exception.OfficialUserFoundError, err.Error())
  456. logger.Error("获取正式用户信息失败:%v", err)
  457. }
  458. }
  459. return
  460. }
  461. func GetUserScribeStatus(productId int, templateUserId int) (subscribe string) {
  462. userSubscribe, err := userService.GetUserSubscribe([]int{productId}, templateUserId)
  463. if err != nil {
  464. logger.Error("获取用户订阅状态失败:%v", err)
  465. return UnSubscribe
  466. }
  467. if len(userSubscribe) == 0 {
  468. return UnSubscribe
  469. }
  470. if userSubscribe[0].ProductType != merchantDao.Package && userSubscribe[0].Status == merchantDao.SubscribeExpired {
  471. logger.Error("用户订阅状态异常:%v,单品状态为过期,productId:%d", productId)
  472. return UnSubscribe
  473. }
  474. switch userSubscribe[0].Status {
  475. case
  476. merchantDao.SubscribeClose:
  477. return UnSubscribe
  478. case merchantDao.SubscribeExpired:
  479. return SubscribeExpired
  480. case merchantDao.SubscribeValid:
  481. return Subscribing
  482. default:
  483. return UnSubscribe
  484. }
  485. }
  486. func BookMark(templateUserId int, sourceId int, sourceType string) error {
  487. return userService.BookMark(templateUserId, sourceId, sourceType)
  488. }
  489. func UnBookMark(templateUserId int, sourceId int, sourceType string) error {
  490. return userService.UnBookMark(templateUserId, sourceId, sourceType)
  491. }
  492. func CheckBookMarkStatus(templateUserId int, sourceId int, sourceType string) (isBookMarked bool, err error) {
  493. status, err := userService.CheckBookMarkStatus(templateUserId, sourceId, sourceType)
  494. if err != nil {
  495. logger.Error("获取收藏状态失败:%v", err)
  496. return
  497. }
  498. isBookMarked = status == string(userDao.Marked)
  499. return
  500. }
  501. func GetTotalBookMarkPageBySourceType(userId int, sourceType string) (total int64, sourceIds []int, err error) {
  502. return userService.GetTotalBookMarkPageBySourceType(userId, sourceType)
  503. }
  504. func GetBookMarkPageBySourceType(userId int, pageInfo page.PageInfo, sourceType string) (sourceIds []int, err error) {
  505. return userService.GetBookMarkPageBySourceType(userId, sourceType, pageInfo)
  506. }
  507. func GetBookMarkListBySourceType(userId int, sourceType string) (sourceIds []int, err error) {
  508. return userService.GetBookMarkListBySourceType(userId, sourceType)
  509. }
  510. func GetBookMarkPageRangeBySourceType(userId int, pageInfo page.PageInfo, sourceType string, sourceIds []int) (filterSourceIds []int, err error) {
  511. return userService.GetBookMarkPageRangeBySourceType(userId, sourceType, pageInfo, sourceIds)
  512. }
  513. func GetReportBookMarked(sourceId int, templateUserId int) (collected bool, err error) {
  514. bookMark, err := userService.GetBookMarkedBySource(sourceId, templateUserId, ReportBookMark)
  515. if err != nil && !errors.Is(err, gorm.ErrRecordNotFound) {
  516. return
  517. }
  518. if errors.Is(err, gorm.ErrRecordNotFound) {
  519. err = nil
  520. return
  521. }
  522. collected = bookMark.Status == string(userDao.Marked)
  523. return
  524. }
  525. type BookMarkChart struct {
  526. ChartName string `json:"chartName"`
  527. ChartImage string `json:"chartImage"`
  528. UniqueCode string `json:"uniqueCode"`
  529. ChartInfoId int `json:"chartInfoId"`
  530. }
  531. type BookMarkInterface interface {
  532. GetID() int
  533. GetSourceType() string
  534. }
  535. type BookMarkReport struct {
  536. Type string `json:"type"`
  537. ReportID int `json:"reportId"`
  538. OrgId int `json:"orgId"`
  539. Title string `json:"title"`
  540. Author string `json:"author"`
  541. AuthorInfo []reportDomian.Anthor `json:"authorInfo"`
  542. Source string `json:"source"`
  543. Abstract string `json:"abstract"`
  544. PublishedTime string `json:"publishedTime"`
  545. RiskLevel string `json:"riskLevel"`
  546. PlateName string `json:"-"`
  547. ClassifyId int `json:"-"`
  548. SecondPermission map[int]string `json:"-"`
  549. Permissions map[int]string `json:"-"`
  550. PermissionNames interface {
  551. } `json:"permissionNames"`
  552. Highlight []string `json:"highlight"`
  553. Detail json.RawMessage `json:"detail"`
  554. PdfUrl string `json:"pdfUrl"`
  555. CoverSrc int `json:"coverSrc"`
  556. CoverUrl string `json:"coverUrl"`
  557. Login bool `json:"login"`
  558. RiskLevelStatus string `json:"riskLevelStatus"`
  559. IsFree bool `json:"isFree"`
  560. IsSubscribe bool `json:"isSubscribe"`
  561. SubscribeStatus string `json:"subscribeStatus"`
  562. Price string `json:"price"`
  563. ProductId int `json:"productId"`
  564. IsPackage bool `json:"isPackage"`
  565. Score float64 `json:"score"`
  566. Show bool `json:"-"`
  567. }
  568. func (bk BookMarkReport) GetID() int {
  569. return bk.ReportID
  570. }
  571. func (bk BookMarkReport) GetSourceType() string {
  572. return ReportBookMark
  573. }
  574. func (bk BookMarkChart) GetID() int {
  575. return bk.ChartInfoId
  576. }
  577. func (bk BookMarkChart) GetSourceType() string {
  578. return ChartBookMark
  579. }
  580. // func SearchBookMark(key string, sourceType string, ids []int, pageInfo page.PageInfo, userId int) (list []BookMarkInterface, err error) {
  581. //
  582. // }