selection_info_service.go 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530
  1. package service
  2. import (
  3. "encoding/json"
  4. "errors"
  5. "github.com/sirupsen/logrus"
  6. "reflect"
  7. "time"
  8. "youngee_b_api/app/dao"
  9. "youngee_b_api/app/entity"
  10. "youngee_b_api/app/util"
  11. "youngee_b_api/app/vo"
  12. )
  13. type SelectionInfoService struct{}
  14. //func (s *SelectionInfoService) GetSelectionInfo(ctx *gin.Context, selectionId string) (*http_model.SelectionDetail, error) {
  15. // selectionDetail := http_model.SelectionDetail{}
  16. // selectionInfo, err := db.GetSelectionById(ctx, selectionId)
  17. //
  18. // if err != nil {
  19. // logrus.WithContext(ctx).Errorf("[selectionDB service] call GetSelectionInfo error,err:%+v", err)
  20. // return nil, err
  21. // }
  22. // selectionBriefInfo, err := db.GetSelectionBriefInfo(ctx, selectionId)
  23. // if err != nil {
  24. // logrus.WithContext(ctx).Errorf("[selectionDB service] call GetSelectionBriefInfo error,err:%+v", err)
  25. // return nil, err
  26. // }
  27. // selectionExampleInfo, err := db.GetSelectionExampleInfo(ctx, selectionId)
  28. // if err != nil {
  29. // logrus.WithContext(ctx).Errorf("[selectionDB service] call GetSelectionExampleInfo error,err:%+v", err)
  30. // return nil, err
  31. // }
  32. // productInfo, err := db.GetProductInfoBySelectionId(ctx, selectionId)
  33. // if err != nil {
  34. // logrus.WithContext(ctx).Errorf("[selectionDB service] call GetProductInfo error,err:%+v", err)
  35. // return nil, err
  36. // }
  37. // productPhotoInfo, err := db.GetProductPhotoInfoBySelectionId(ctx, selectionId)
  38. // if err != nil {
  39. // logrus.WithContext(ctx).Errorf("[selectionDB service] call GetProductPhotoInfo error,err:%+v", err)
  40. // return nil, err
  41. // }
  42. // selectionDetail.SelectionBrief = selectionBriefInfo
  43. // selectionDetail.SelectionInfo = selectionInfo
  44. // selectionDetail.SelectionExample = selectionExampleInfo
  45. // selectionDetail.ProductInfo = productInfo
  46. // selectionDetail.ProductPhotoInfo = productPhotoInfo
  47. // return &selectionDetail, nil
  48. //}
  49. // 创建带货任务
  50. func (s SelectionInfoService) CreateSelectionInfo(param *vo.SelectionInfoCreateParam) (*string, error) {
  51. // a) 生成选品id
  52. selectionId := util.GetSelectionID()
  53. // b) 查找关联商品信息
  54. product, err := dao.ProductDAO{}.GetProductByID(param.ProductId)
  55. if err != nil {
  56. return nil, err
  57. }
  58. if product == nil {
  59. return nil, errors.New("未找到关联商品")
  60. }
  61. productPhotos, err := dao.ProductPhotoDAO{}.GetProductPhotoByProductID(param.ProductId)
  62. productInfoToJson, _ := json.Marshal(product)
  63. productPhotosToJson, _ := json.Marshal(productPhotos)
  64. // c) 选品名称
  65. //selectionName := product.ProductName
  66. // d)创建选品
  67. // 获取定时任务配置
  68. infoAutoTask := entity.InfoAutoTask{}
  69. infoAutoTask = dao.InfoAutoTaskDao{}.GetAutoTaskLast(param.EnterpriseId)
  70. t := time.Now()
  71. newSelection := entity.SelectionInfo{
  72. SelectionStatus: 1,
  73. SelectionID: selectionId,
  74. ProductID: param.ProductId,
  75. EnterpriseID: param.EnterpriseId,
  76. SubAccountId: param.SubAccountId,
  77. Platform: param.Platform,
  78. ProductSnap: string(productInfoToJson),
  79. ProductPhotoSnap: string(productPhotosToJson),
  80. CreatedAt: t,
  81. UpdatedAt: t,
  82. AutoTaskID: infoAutoTask.AutoTaskID,
  83. }
  84. err = dao.SelectionInfoDAO{}.CreateSelectionInfo(newSelection)
  85. if err != nil {
  86. return nil, err
  87. }
  88. return &selectionId, nil
  89. }
  90. // 更新带货任务(样品奖励、补充信息)
  91. func (s SelectionInfoService) UpdateSelectionInfo(selectionUpdateParam *vo.SelectionInfoUpdateParam) (*string, error) {
  92. // 1. 检查该企业id和商品id有无选品
  93. selectionID := selectionUpdateParam.SelectionID
  94. selectionInfo, err := dao.SelectionInfoDAO{}.GetSelectionInfoById(selectionID)
  95. if err != nil {
  96. return nil, err
  97. }
  98. if selectionInfo == nil {
  99. return nil, errors.New("选品不存在")
  100. }
  101. // 2. 数据准备
  102. // a) 查找关联商品信息
  103. product, err := dao.ProductDAO{}.GetProductByID(selectionInfo.ProductID)
  104. if err != nil {
  105. return nil, err
  106. }
  107. productPhotos, err := dao.ProductPhotoDAO{}.GetProductPhotoByProductID(selectionInfo.ProductID)
  108. productInfoToJson, _ := json.Marshal(product)
  109. productPhotosToJson, _ := json.Marshal(productPhotos)
  110. // d) 任务截止时间
  111. taskDdl := time.Time{} //赋零值
  112. taskDdl, _ = time.ParseInLocation("2006-01-02 15:04:05", selectionUpdateParam.TaskDdl, time.Local)
  113. // f) 更新选品状态
  114. if selectionUpdateParam.SelectionStatus != 2 && selectionUpdateParam.SelectionStatus != 7 {
  115. selectionUpdateParam.SelectionStatus = 1
  116. }
  117. t := time.Now()
  118. var sampleMode, taskMode int64
  119. if len(selectionUpdateParam.FreeStrategys) > 0 {
  120. sampleMode = 1
  121. } else {
  122. sampleMode = 3
  123. }
  124. if len(selectionUpdateParam.RewardStrategys) > 0 {
  125. taskMode = 1
  126. } else {
  127. taskMode = 2
  128. }
  129. updateSelection := entity.SelectionInfo{
  130. SelectionID: selectionUpdateParam.SelectionID,
  131. SelectionStatus: selectionUpdateParam.SelectionStatus,
  132. SelectionName: selectionUpdateParam.SelectionName,
  133. EnterpriseID: selectionUpdateParam.EnterpriseId,
  134. SubAccountId: selectionUpdateParam.SubAccountId,
  135. ProductID: selectionUpdateParam.ProductId,
  136. ProductUrl: selectionUpdateParam.ProductUrl,
  137. TaskMode: taskMode,
  138. SampleMode: sampleMode,
  139. SampleNum: selectionUpdateParam.SampleNum,
  140. RemainNum: selectionUpdateParam.SampleNum,
  141. CommissionRate: selectionUpdateParam.CommissionRate,
  142. TaskReward: selectionUpdateParam.TaskReward,
  143. SettlementAmount: selectionUpdateParam.SettlementAmount,
  144. EstimatedCost: selectionInfo.EstimatedCost,
  145. SampleCondition: selectionUpdateParam.SampleCondition,
  146. RewardCondition: selectionUpdateParam.RewardCondition,
  147. TaskDdl: taskDdl,
  148. Detail: selectionUpdateParam.Detail,
  149. ProductSnap: string(productInfoToJson),
  150. ProductPhotoSnap: string(productPhotosToJson),
  151. CreatedAt: selectionInfo.CreatedAt,
  152. UpdatedAt: t,
  153. }
  154. if selectionUpdateParam.SelectionStatus == 2 {
  155. updateSelection.SubmitAt = t
  156. }
  157. if selectionUpdateParam.Status == 1 {
  158. updateSelection.Status = 1
  159. }
  160. // 合并传入参数和数据表中原记录,若传入参数字段值为空,则将字段赋值为原记录中值
  161. result := util.MergeStructValue(&updateSelection, selectionInfo)
  162. // 利用反射机制将interface类型转换为结构体类型
  163. v := reflect.ValueOf(&result).Elem()
  164. if v.Kind() == reflect.Struct {
  165. updateSelection = v.Interface().(entity.SelectionInfo)
  166. //fmt.Println(p)
  167. }
  168. // c) 计算预估成本(如果有)
  169. /*
  170. var estimatedCost float64
  171. if conv.MustInt(updateSelection.TaskMode, 0) == 1 {
  172. estimatedCost = conv.MustFloat64(updateSelection.TaskReward, 0) * conv.MustFloat64(updateSelection.SampleNum, 0)
  173. }
  174. estimatedCostToString, _ := conv.String(estimatedCost)
  175. updateSelection.EstimatedCost = estimatedCostToString
  176. */
  177. // 3. 更新选品
  178. err = dao.SelectionInfoDAO{}.UpdateSelectionInfo(updateSelection)
  179. if err != nil {
  180. return nil, err
  181. }
  182. // 4. 更新选品brief和示例(带货任务补充信息)
  183. if selectionUpdateParam.SecBrief != nil {
  184. // 删除已有brief
  185. err = dao.SecBriefDao{}.DeleteSecBriefBySelectionId(selectionInfo.SelectionID)
  186. if err != nil {
  187. return nil, err
  188. }
  189. // 插入新的brief
  190. for _, v := range selectionUpdateParam.SecBrief {
  191. brief := entity.SecBrief{
  192. SelectionID: selectionInfo.SelectionID,
  193. FileUid: v.FileUid,
  194. FileName: v.Name,
  195. FileUrl: v.FileUrl,
  196. CreatedAt: time.Now(),
  197. }
  198. err = dao.SecBriefDao{}.CreateSecBrief(brief)
  199. if err != nil {
  200. return nil, err
  201. }
  202. }
  203. }
  204. if selectionUpdateParam.SecMaterial != nil {
  205. // 删除已有示例
  206. err = dao.SecMaterialDao{}.DeleteSecMaterialBySelectionId(selectionInfo.SelectionID)
  207. if err != nil {
  208. return nil, err
  209. }
  210. // 插入新的示例
  211. for _, v := range selectionUpdateParam.SecMaterial {
  212. secMaterial := entity.SecMaterial{
  213. SelectionID: selectionInfo.SelectionID,
  214. FileUid: v.FileUid,
  215. FileName: v.Name,
  216. FileUrl: v.FileUrl,
  217. CreatedAt: time.Now(),
  218. }
  219. err = dao.SecMaterialDao{}.CreateSecMaterial(secMaterial)
  220. if err != nil {
  221. return nil, err
  222. }
  223. }
  224. }
  225. println("更新带货任务的免费领样策略")
  226. // 更新带货任务的免费领样策略
  227. if selectionUpdateParam.FreeStrategys != nil {
  228. // 1. 删除已有的免费领样策略
  229. err = dao.FreeStrategyDao{}.DeleteFreeStrategyBySelectionId(selectionUpdateParam.SelectionID)
  230. if err != nil {
  231. return nil, err
  232. }
  233. // 2. 接收并创建新的免费领样策略
  234. if sampleMode == 1 {
  235. var frees []entity.FreeStrategy
  236. for _, v := range selectionUpdateParam.FreeStrategys {
  237. free := entity.FreeStrategy{
  238. SelectionId: selectionInfo.SelectionID,
  239. StrategyId: v.StrategyId,
  240. FansNum: v.FansNum,
  241. SaleNum: v.SaleNum,
  242. StrategyStatus: 1,
  243. EnrollNum: 0,
  244. ChooseNum: 0,
  245. }
  246. frees = append(frees, free)
  247. }
  248. err = dao.FreeStrategyDao{}.CreateFreeStrategy(frees)
  249. if err != nil {
  250. return nil, err
  251. }
  252. }
  253. }
  254. println("更新带货任务的悬赏策略")
  255. // 更新带货任务的悬赏策略
  256. if selectionUpdateParam.RewardStrategys != nil {
  257. // 1. 删除已有的悬赏策略
  258. err = dao.RewardStrategyDao{}.DeleteRewardStrategyBySelectionId(selectionUpdateParam.SelectionID)
  259. if err != nil {
  260. return nil, err
  261. }
  262. if taskMode == 1 {
  263. var rewards []entity.RewardStrategy
  264. for _, v := range selectionUpdateParam.RewardStrategys {
  265. reward := entity.RewardStrategy{
  266. SelectionId: selectionInfo.SelectionID,
  267. Reward: v.Reward,
  268. SaleActual: v.SaleActual,
  269. PerReward: v.PerReward,
  270. StrategyStatus: 1,
  271. }
  272. rewards = append(rewards, reward)
  273. }
  274. err = dao.RewardStrategyDao{}.CreateRewardStrategy(rewards)
  275. if err != nil {
  276. return nil, err
  277. }
  278. }
  279. }
  280. return &updateSelection.SelectionID, nil
  281. }
  282. // 电商带货任务预览
  283. func (s SelectionInfoService) GetSelectionDetail(selectionId string) (*vo.ReSelectionDetail, error) {
  284. reSelectionDetail := vo.ReSelectionDetail{}
  285. selection, err := dao.SelectionInfoDAO{}.GetSelectionInfoById(selectionId)
  286. if err != nil {
  287. logrus.Errorf("[selectionInfoDB service] call GetSelection error,err:%+v", err)
  288. return nil, err
  289. }
  290. // 系统信息
  291. reSelectionDetail.SelectionId = selectionId
  292. reSelectionDetail.SelectionStatus = selection.SelectionStatus
  293. reSelectionDetail.SelectionPlatform = selection.Platform
  294. reSelectionDetail.CreatedAt = selection.CreatedAt.Format("2006-01-02 15:04:05")
  295. reSelectionDetail.SubmitAt = selection.SubmitAt.Format("2006-01-02 15:04:05")
  296. var creatorName, phone string
  297. var rewardSum float64
  298. if selection.SubAccountId == 0 {
  299. enterprise, err := dao.EnterpriseDao{}.GetEnterprise(selection.EnterpriseID)
  300. if err == nil && enterprise != nil {
  301. creatorName = enterprise.BusinessName
  302. phone, err = dao.UserDao{}.GetPhoneByUserId(enterprise.UserId)
  303. }
  304. } else {
  305. subAccount, err := dao.SubAccountDao{}.GetSubAccount(selection.SubAccountId)
  306. if err == nil && subAccount != nil {
  307. creatorName = subAccount.SubAccountName
  308. phone, err = dao.UserDao{}.GetPhoneByUserId(subAccount.UserId)
  309. }
  310. }
  311. reSelectionDetail.CreatorName = creatorName
  312. reSelectionDetail.Phone = phone
  313. // 关联商品
  314. var reProduct vo.ReTaskProduct
  315. product, err := dao.ProductDAO{}.GetProductByID(selection.ProductID)
  316. if err == nil {
  317. photoUrl, e := dao.ProductPhotoDAO{}.GetMainPhotoByProductID(product.ProductID)
  318. if e != nil {
  319. photoUrl = ""
  320. }
  321. reProduct = vo.ReTaskProduct{
  322. ProductID: product.ProductID,
  323. ProductName: product.ProductName,
  324. ProductType: product.ProductType,
  325. ProductCategory: product.ProductCategory,
  326. ProductPrice: product.ProductPrice,
  327. ProductDetail: product.ProductDetail,
  328. CreatedAt: product.CreatedAt.Format("2006-01-02 15:04:05"),
  329. PhotoUrl: photoUrl,
  330. }
  331. }
  332. reSelectionDetail.ProductInfo = &reProduct
  333. // 样品奖励
  334. reSelectionDetail.TaskDdl = selection.TaskDdl.Format("2006-01-02 15:04:05")
  335. reSelectionDetail.SampleNum = selection.SampleNum
  336. var freeStrategyPreviews []*vo.FreeStrategyPreview // 领样策略
  337. freeStrategys, err := dao.FreeStrategyDao{}.GetFreeStrategyBySelectionId(selectionId)
  338. if err != nil {
  339. logrus.Errorf("[selectionInfoDB service] call GetFreeStrategy error,err:%+v", err)
  340. return nil, err
  341. }
  342. for _, freeStrategy := range freeStrategys {
  343. freeStrategyPreview := &vo.FreeStrategyPreview{
  344. StrategyId: freeStrategy.StrategyId,
  345. FansNum: freeStrategy.FansNum,
  346. SaleNum: freeStrategy.SaleNum,
  347. StrategyStatus: freeStrategy.StrategyStatus,
  348. }
  349. freeStrategyPreviews = append(freeStrategyPreviews, freeStrategyPreview)
  350. }
  351. reSelectionDetail.FreeStrategys = freeStrategyPreviews
  352. var rewardStrategyPreviews []*vo.RewardStrategyPreview // 悬赏策略
  353. rewardStrategys, err := dao.RewardStrategyDao{}.GetRewardStrategyBySelectionId(selectionId)
  354. if err != nil {
  355. logrus.Errorf("[selectionInfoDB service] call GetRewardStrategy error,err:%+v", err)
  356. return nil, err
  357. }
  358. for _, rewardStrategy := range rewardStrategys {
  359. rewardStrategyPreview := &vo.RewardStrategyPreview{
  360. Reward: rewardStrategy.Reward,
  361. SaleActual: rewardStrategy.SaleActual,
  362. PerReward: rewardStrategy.PerReward,
  363. StrategyStatus: rewardStrategy.StrategyStatus,
  364. }
  365. rewardStrategyPreviews = append(rewardStrategyPreviews, rewardStrategyPreview)
  366. }
  367. reSelectionDetail.FreeStrategys = freeStrategyPreviews
  368. reSelectionDetail.RewardStrategys = rewardStrategyPreviews
  369. for _, rewardStrategy := range rewardStrategys {
  370. rewardSum += rewardStrategy.Reward
  371. }
  372. reSelectionDetail.RewardSum = rewardSum
  373. // 补充信息
  374. selectionBriefInfos, err := dao.SecBriefDao{}.GetSelectionBriefInfo(selectionId)
  375. if err != nil {
  376. logrus.Errorf("[selectionInfoDB service] call GetSelectionBriefInfo error,err:%+v", err)
  377. return nil, err
  378. }
  379. selectionMaterials, err := dao.SecMaterialDao{}.GetSelectionMaterialInfo(selectionId)
  380. if err != nil {
  381. logrus.Errorf("[selectionInfoDB service] call GetSelectionMaterialInfo error,err:%+v", err)
  382. return nil, err
  383. }
  384. reSelectionDetail.SelectionBriefs = selectionBriefInfos
  385. reSelectionDetail.SelectionMaterials = selectionMaterials
  386. return &reSelectionDetail, nil
  387. }
  388. // 电商带货提交审核
  389. func (s SelectionInfoService) SelectionToReview(selectionUpdateParam *vo.SelectionInfoUpdateParam) (*string, error) {
  390. selectionId := selectionUpdateParam.SelectionID
  391. t := time.Now()
  392. updateSelection := entity.SelectionInfo{
  393. SelectionID: selectionId,
  394. SelectionStatus: 2,
  395. UpdatedAt: t,
  396. }
  397. err := dao.SelectionInfoDAO{}.UpdateSelectionInfo(updateSelection)
  398. if err != nil {
  399. return nil, err
  400. }
  401. return &selectionId, nil
  402. }
  403. // 电商带货任务列表
  404. func (s SelectionInfoService) GetSelectionTaskList(param *vo.SelectionSearchParam) (vo.ResultVO, error) {
  405. if param.Page == 0 {
  406. param.Page = 1
  407. }
  408. if param.PageSize == 0 {
  409. param.PageSize = 10
  410. }
  411. var result vo.ResultVO
  412. reSelectionTaskPreviews, total, err := (&dao.SelectionInfoDAO{}).GetSelectionPreviews(param)
  413. if err != nil {
  414. return result, err
  415. }
  416. for i := range reSelectionTaskPreviews {
  417. var creatorName string
  418. var productName string
  419. var productPrice float64
  420. var mainImage string
  421. var reward float64
  422. if reSelectionTaskPreviews[i].SubAccountId == 0 {
  423. enterprise, err := dao.EnterpriseDao{}.GetEnterprise(reSelectionTaskPreviews[i].EnterpriseId)
  424. if err == nil && enterprise != nil {
  425. creatorName = enterprise.BusinessName
  426. }
  427. } else {
  428. subAccount, err := dao.SubAccountDao{}.GetSubAccount(reSelectionTaskPreviews[i].SubAccountId)
  429. if err == nil && subAccount != nil {
  430. creatorName = subAccount.SubAccountName
  431. }
  432. }
  433. product, err := dao.ProductDAO{}.GetProductByID(reSelectionTaskPreviews[i].ProductId)
  434. if err == nil && product != nil {
  435. productName = product.ProductName
  436. productPrice = product.ProductPrice
  437. }
  438. mainImage, err = dao.ProductPhotoDAO{}.GetMainPhotoByProductID(reSelectionTaskPreviews[i].ProductId)
  439. rewardStrategys, err := dao.RewardStrategyDao{}.GetRewardStrategyBySelectionId(reSelectionTaskPreviews[i].SelectionId)
  440. for _, rewardStrategy := range rewardStrategys {
  441. reward += rewardStrategy.Reward
  442. }
  443. reSelectionTaskPreviews[i].CreatorName = creatorName
  444. reSelectionTaskPreviews[i].ProductName = productName
  445. reSelectionTaskPreviews[i].ProductPrice = productPrice
  446. reSelectionTaskPreviews[i].MainImage = mainImage
  447. reSelectionTaskPreviews[i].Reward = reward
  448. }
  449. result = vo.ResultVO{
  450. Page: param.Page,
  451. PageSize: param.PageSize,
  452. Total: total,
  453. Data: reSelectionTaskPreviews,
  454. }
  455. return result, nil
  456. }
  457. // 删除带货任务
  458. func (s SelectionInfoService) DeleteSelection(selectionId string) (*string, error) {
  459. res, err := dao.SelectionInfoDAO{}.DeleteSelection(selectionId)
  460. if err != nil {
  461. logrus.Errorf("[projectDB service] call DeleteSelection error,err:%+v", err)
  462. return res, err
  463. }
  464. return res, nil
  465. }
  466. // 草稿箱——电商带货
  467. func (s SelectionInfoService) GetSelectionDraftList(param *vo.SelectionDraftParam) (vo.ResultVO, error) {
  468. if param.Page == 0 {
  469. param.Page = 1
  470. }
  471. if param.PageSize == 0 {
  472. param.PageSize = 10
  473. }
  474. var result vo.ResultVO
  475. reSelectionTaskPreviews, total, err := (&dao.SelectionInfoDAO{}).GetSelectionDraftList(param)
  476. if err != nil {
  477. return result, err
  478. }
  479. for i := range reSelectionTaskPreviews {
  480. var creatorName string
  481. var productName string
  482. var productPrice float64
  483. var mainImage string
  484. if reSelectionTaskPreviews[i].SubAccountId == 0 {
  485. enterprise, err := dao.EnterpriseDao{}.GetEnterprise(reSelectionTaskPreviews[i].EnterpriseId)
  486. if err == nil && enterprise != nil {
  487. creatorName = enterprise.BusinessName
  488. }
  489. } else {
  490. subAccount, err := dao.SubAccountDao{}.GetSubAccount(reSelectionTaskPreviews[i].SubAccountId)
  491. if err == nil && subAccount != nil {
  492. creatorName = subAccount.SubAccountName
  493. }
  494. }
  495. product, err := dao.ProductDAO{}.GetProductByID(reSelectionTaskPreviews[i].ProductId)
  496. if err == nil && product != nil {
  497. productName = product.ProductName
  498. productPrice = product.ProductPrice
  499. }
  500. mainImage, err = dao.ProductPhotoDAO{}.GetMainPhotoByProductID(reSelectionTaskPreviews[i].ProductId)
  501. reSelectionTaskPreviews[i].CreatorName = creatorName
  502. reSelectionTaskPreviews[i].ProductName = productName
  503. reSelectionTaskPreviews[i].ProductPrice = productPrice
  504. reSelectionTaskPreviews[i].MainImage = mainImage
  505. }
  506. result = vo.ResultVO{
  507. Page: param.Page,
  508. PageSize: param.PageSize,
  509. Total: total,
  510. Data: reSelectionTaskPreviews,
  511. }
  512. return result, nil
  513. }