user_service.go 20 KB

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