local_life.go 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520
  1. package service
  2. import (
  3. "context"
  4. "fmt"
  5. "github.com/issue9/conv"
  6. "github.com/sirupsen/logrus"
  7. "strconv"
  8. "strings"
  9. "youngee_b_api/db"
  10. "youngee_b_api/model/common_model"
  11. "youngee_b_api/model/http_model"
  12. )
  13. var LocalLife *localLife
  14. type localLife struct {
  15. }
  16. func (*localLife) GetFullLocalLifeList(ctx context.Context, pageSize, pageNum int32, supplierId int, condition *common_model.SLocalLifeCondition) (*http_model.FullListData, error) {
  17. // 1. 查询本地生活任务基本信息
  18. fullLocals, total, err := db.GetFullLocalLifeList(ctx, pageSize, pageNum, condition)
  19. if err != nil {
  20. logrus.WithContext(ctx).Errorf("[fullLocals service] call GetFullLocalLifeList error,err:%+v", err)
  21. return nil, err
  22. }
  23. var fullLocalData *http_model.FullListData
  24. fullLocalData = &http_model.FullListData{}
  25. fullLocalData.Total = total
  26. for _, fullLocal := range fullLocals {
  27. var fullLocalPreview *http_model.FullPreview
  28. fullLocalPreview = &http_model.FullPreview{}
  29. fullLocalPreview.LocalId = fullLocal.LocalId
  30. fullLocalPreview.EnterpriseId = fullLocal.EnterpriseId
  31. fullLocalPreview.LocalName = fullLocal.LocalName
  32. fullLocalPreview.TaskStatus = fullLocal.TaskStatus
  33. fullLocalPreview.LocalPlatform = fullLocal.LocalPlatform
  34. fullLocalPreview.TaskForm = fullLocal.TaskForm
  35. fullLocalPreview.LocalType = fullLocal.LocalType
  36. fullLocalPreview.LocalContentType = fullLocal.ContentType
  37. fullLocalPreview.StoreId = fullLocal.StoreId
  38. fullLocalPreview.RecruitDdl = conv.MustString(fullLocal.RecruitDdl)[0:19]
  39. fullLocalData.FullPreview = append(fullLocalData.FullPreview, fullLocalPreview)
  40. }
  41. // 2. 查询本地生活补充信息:门店信息,招募策略
  42. for _, local := range fullLocalData.FullPreview {
  43. // 2.1. 门店信息
  44. storeInfo, productErr := db.FindStoreById(ctx, local.StoreId)
  45. if productErr != nil {
  46. return nil, productErr
  47. }
  48. if storeInfo != nil {
  49. local.StoreId = storeInfo.StoreId
  50. local.StoreName = storeInfo.StoreName
  51. }
  52. // 2.2. 门店图片信息
  53. //fmt.Println("store_id", local.StoreId)
  54. productPhotoInfo, productPhotoErr := db.GetStorePhotoByStoreID(ctx, local.StoreId)
  55. if productPhotoErr != nil {
  56. return nil, productPhotoErr
  57. }
  58. if productPhotoInfo != nil {
  59. for _, photo := range productPhotoInfo {
  60. //fmt.Println(photo)
  61. if photo.Symbol == 1 {
  62. local.ProductPhotoSymbol = 1
  63. local.ProductPhotoUrl = photo.PhotoUrl
  64. local.ProductPhotoUid = photo.PhotoUid
  65. }
  66. }
  67. }
  68. // 2.3. 招募策略信息
  69. recruitStrategyInfo, recruitErr := db.GetRecruitStrategyByProjectId(ctx, local.LocalId)
  70. if recruitErr != nil {
  71. return nil, recruitErr
  72. }
  73. if recruitStrategyInfo != nil {
  74. for _, strategy := range recruitStrategyInfo {
  75. var recruitStrategy *http_model.EasyRecruitStrategy
  76. recruitStrategy = &http_model.EasyRecruitStrategy{}
  77. recruitStrategy.StrategyId = strategy.StrategyID
  78. recruitStrategy.FeeForm = strategy.FeeForm
  79. recruitStrategy.RecruitNumber = strategy.RecruitNumber
  80. local.RecruitStrategy = append(local.RecruitStrategy, recruitStrategy)
  81. }
  82. }
  83. // 2.4. 判断是否加入商单
  84. // fmt.Println(local.LocalId)
  85. sProjectCount, sProjectErr := db.FindSLocalByLocalIdAndSupplierId(ctx, local.LocalId, supplierId)
  86. if sProjectErr != nil {
  87. return nil, sProjectErr
  88. }
  89. if sProjectCount > 0 {
  90. local.AddToListStatus = 1
  91. } else {
  92. local.AddToListStatus = 2
  93. }
  94. }
  95. return fullLocalData, nil
  96. }
  97. // GetSpecialLocalLifeList 商单广场-定向本地生活
  98. func (*localLife) GetSpecialLocalLifeList(ctx context.Context, pageSize, pageNum int32, supplierId int, condition *common_model.SSpecialLocalLifeCondition) (*http_model.SpecialLocalListData, error) {
  99. // 1. 查询本地生活任务基本信息
  100. specialLocals, total, err := db.GetSpecialLocalLifeList(ctx, pageSize, pageNum, supplierId, condition, 1)
  101. if err != nil {
  102. logrus.WithContext(ctx).Errorf("[fullLocals service] call GetFullLocalLifeList error,err:%+v", err)
  103. return nil, err
  104. }
  105. var specialLocalData *http_model.SpecialLocalListData
  106. specialLocalData = &http_model.SpecialLocalListData{}
  107. specialLocalData.Total = total
  108. for _, specialLocal := range specialLocals {
  109. var specialLocalPreview *http_model.SpecialLocalPreview
  110. specialLocalPreview = &http_model.SpecialLocalPreview{}
  111. specialLocalPreview.SLocalId = specialLocal.SLocalId
  112. specialLocalPreview.EnterpriseId = specialLocal.EnterpriseId
  113. specialLocalPreview.LocalId = specialLocal.LocalId
  114. specialLocalPreview.LocalName = specialLocal.LocalName
  115. specialLocalPreview.TaskStatus = specialLocal.TaskStatus
  116. specialLocalPreview.LocalPlatform = specialLocal.LocalPlatform
  117. specialLocalPreview.TaskForm = specialLocal.TaskForm
  118. specialLocalPreview.StoreId = specialLocal.StoreId
  119. specialLocalPreview.LocalType = specialLocal.LocalType
  120. specialLocalPreview.LocalContentType = specialLocal.ContentType
  121. specialLocalPreview.SLocalStatus = specialLocal.SLocalStatus
  122. specialLocalPreview.CreateTime = conv.MustString(specialLocal.CreateTime)[0:19]
  123. if specialLocal.SLocalStatus == 2 {
  124. specialLocalPreview.AddToListStatus = 1
  125. } else {
  126. specialLocalPreview.AddToListStatus = 2
  127. }
  128. specialLocalData.SpecialLocalPreview = append(specialLocalData.SpecialLocalPreview, specialLocalPreview)
  129. }
  130. // 2. 查询本地生活补充信息:门店信息,招募策略
  131. for _, local := range specialLocalData.SpecialLocalPreview {
  132. // 2.1. 门店信息
  133. storeInfo, productErr := db.FindStoreById(ctx, local.StoreId)
  134. if productErr != nil {
  135. return nil, productErr
  136. }
  137. if storeInfo != nil {
  138. local.StoreId = storeInfo.StoreId
  139. local.StoreName = storeInfo.StoreName
  140. }
  141. // 2.2. 门店图片信息
  142. productPhotoInfo, productPhotoErr := db.GetStorePhotoByStoreID(ctx, local.StoreId)
  143. if productPhotoErr != nil {
  144. return nil, productPhotoErr
  145. }
  146. if productPhotoInfo != nil {
  147. for _, photo := range productPhotoInfo {
  148. fmt.Println(photo)
  149. if photo.Symbol == 1 {
  150. local.ProductPhotoSymbol = 1
  151. local.ProductPhotoUrl = photo.PhotoUrl
  152. local.ProductPhotoUid = photo.PhotoUid
  153. }
  154. }
  155. }
  156. // 2.3. 招募策略信息
  157. recruitStrategyInfo, recruitErr := db.GetRecruitStrategyByProjectId(ctx, local.LocalId)
  158. if recruitErr != nil {
  159. return nil, recruitErr
  160. }
  161. if recruitStrategyInfo != nil {
  162. for _, strategy := range recruitStrategyInfo {
  163. var recruitStrategy *http_model.EasyRecruitStrategy
  164. recruitStrategy = &http_model.EasyRecruitStrategy{}
  165. recruitStrategy.StrategyId = strategy.StrategyID
  166. recruitStrategy.FeeForm = strategy.FeeForm
  167. recruitStrategy.RecruitNumber = strategy.RecruitNumber
  168. local.RecruitStrategy = append(local.RecruitStrategy, recruitStrategy)
  169. }
  170. }
  171. // 2.4. 原定向本地生活任务信息
  172. localInfo, localErr := db.GetLocalLifeDetail(ctx, local.LocalId)
  173. if localErr != nil {
  174. return nil, localErr
  175. }
  176. if localInfo != nil {
  177. local.Tools = localInfo.Tools
  178. }
  179. }
  180. return specialLocalData, nil
  181. }
  182. // GetSpecialSLocalLifeList 商单管理-定向本地生活
  183. func (*localLife) GetSpecialSLocalLifeList(ctx context.Context, pageSize, pageNum int32, supplierId int, condition *common_model.SSpecialLocalLifeCondition) (*http_model.SpecialSLocalListData, error) {
  184. // 1. 查询本地生活任务基本信息
  185. specialLocals, total, err := db.GetSpecialLocalLifeList(ctx, pageSize, pageNum, supplierId, condition, 2)
  186. if err != nil {
  187. logrus.WithContext(ctx).Errorf("[fullLocals service] call GetFullLocalLifeList error,err:%+v", err)
  188. return nil, err
  189. }
  190. var specialLocalData *http_model.SpecialSLocalListData
  191. specialLocalData = &http_model.SpecialSLocalListData{}
  192. specialLocalData.Total = total
  193. for _, specialLocal := range specialLocals {
  194. var specialLocalPreview *http_model.SpecialSLocalPreview
  195. specialLocalPreview = &http_model.SpecialSLocalPreview{}
  196. specialLocalPreview.LocalId = specialLocal.LocalId
  197. specialLocalPreview.LocalName = specialLocal.LocalName
  198. specialLocalPreview.TaskStatus = specialLocal.TaskStatus
  199. specialLocalPreview.LocalPlatform = specialLocal.LocalPlatform
  200. specialLocalPreview.TaskForm = specialLocal.TaskForm
  201. specialLocalPreview.LocalType = specialLocal.LocalType
  202. specialLocalPreview.EnterpriseId = specialLocal.EnterpriseId
  203. specialLocalPreview.LocalContentType = specialLocal.ContentType
  204. specialLocalPreview.SLocalStatus = specialLocal.SLocalStatus
  205. if specialLocalPreview.SLocalStatus == 2 {
  206. specialLocalPreview.AgreeTime = conv.MustString(specialLocal.AgreeTime)[0:19]
  207. }
  208. specialLocalData.SpecialSLocalPreview = append(specialLocalData.SpecialSLocalPreview, specialLocalPreview)
  209. }
  210. // 2. 查询本地生活补充信息:门店信息,招募策略
  211. for _, local := range specialLocalData.SpecialSLocalPreview {
  212. // 2.1. 门店信息
  213. storeInfo, productErr := db.FindStoreById(ctx, local.StoreId)
  214. if productErr != nil {
  215. return nil, productErr
  216. }
  217. if storeInfo != nil {
  218. local.StoreId = storeInfo.StoreId
  219. local.StoreName = storeInfo.StoreName
  220. }
  221. // 2.2. 门店图片信息
  222. productPhotoInfo, productPhotoErr := db.GetStorePhotoByStoreID(ctx, local.StoreId)
  223. if productPhotoErr != nil {
  224. return nil, productPhotoErr
  225. }
  226. if productPhotoInfo != nil {
  227. for _, photo := range productPhotoInfo {
  228. fmt.Println(photo)
  229. if photo.Symbol == 1 {
  230. local.ProductPhotoSymbol = 1
  231. local.ProductPhotoUrl = photo.PhotoUrl
  232. local.ProductPhotoUid = photo.PhotoUid
  233. }
  234. }
  235. }
  236. // 2.3. 招募策略信息
  237. recruitStrategyInfo, recruitErr := db.GetRecruitStrategyByProjectId(ctx, local.LocalId)
  238. if recruitErr != nil {
  239. return nil, recruitErr
  240. }
  241. if recruitStrategyInfo != nil {
  242. for _, strategy := range recruitStrategyInfo {
  243. var recruitStrategy *http_model.EasyRecruitStrategy
  244. recruitStrategy = &http_model.EasyRecruitStrategy{}
  245. recruitStrategy.StrategyId = strategy.StrategyID
  246. recruitStrategy.FeeForm = strategy.FeeForm
  247. recruitStrategy.RecruitNumber = strategy.RecruitNumber
  248. local.RecruitStrategy = append(local.RecruitStrategy, recruitStrategy)
  249. }
  250. }
  251. // 2.4. 原定向本地生活任务信息
  252. localInfo, localErr := db.GetLocalLifeDetail(ctx, local.LocalId)
  253. if localErr != nil {
  254. return nil, localErr
  255. }
  256. if localInfo != nil {
  257. local.Tools = localInfo.Tools
  258. }
  259. }
  260. return specialLocalData, nil
  261. }
  262. // ShowLocalLife 商单广场-本地生活详情
  263. func (*localLife) ShowLocalLife(ctx context.Context, req *http_model.ShowLocalRequest) (*http_model.ShowLocalData, error) {
  264. var localInfo *http_model.ShowLocalData
  265. localInfo = &http_model.ShowLocalData{}
  266. // 1. 查询系统信息
  267. localData, localErr := db.GetLocalLifeDetail(ctx, req.LocalId)
  268. if localErr != nil {
  269. return nil, localErr
  270. }
  271. if localData != nil {
  272. localInfo.Donate = localData.Donate
  273. localInfo.LocalId = localData.LocalId
  274. localInfo.LocalName = localData.LocalName
  275. localInfo.LocalPlatform = localData.LocalPlatform
  276. localInfo.TaskStatus = localData.TaskStatus
  277. localInfo.EnterpriseId = localData.EnterpriseId
  278. localInfo.ServiceChargeRate = localData.ServiceChargeRate
  279. localInfo.EstimatedCost = localData.EstimatedCost
  280. localInfo.CreateAt = conv.MustString(localData.CreatedAt)[0:19]
  281. if localData.PassAt != nil {
  282. localInfo.PassAt = conv.MustString(localData.PassAt)[0:19]
  283. }
  284. localInfo.CreatorName = localData.EnterpriseId
  285. // 2. 关联主体
  286. // 2.1. 门店信息
  287. storeInfo, storeErr := db.FindStoreById(ctx, localData.StoreId)
  288. if storeErr != nil {
  289. return nil, storeErr
  290. }
  291. if storeInfo != nil {
  292. localInfo.StoreLocation = storeInfo.StoreLocation
  293. localInfo.StoreId = storeInfo.StoreId
  294. localInfo.StoreName = storeInfo.StoreName
  295. localInfo.StoreCategory = storeInfo.StoreCategory
  296. localInfo.StoreRelatedAt = conv.MustString(localData.StoreRelatedAt)[0:19]
  297. // 2.2. 门店图片信息
  298. storePhotoInfo, storePhotoErr := db.GetStorePhotoByStoreID(ctx, localData.StoreId)
  299. if storePhotoErr != nil {
  300. return nil, storePhotoErr
  301. }
  302. if storePhotoInfo != nil {
  303. for _, photo := range storePhotoInfo {
  304. if photo.Symbol == 1 {
  305. localInfo.StoreMainPhotoSymbol = 1
  306. localInfo.StoreMainPhotoUrl = photo.PhotoUrl
  307. localInfo.StoreMainPhotoUid = photo.PhotoUid
  308. }
  309. }
  310. }
  311. }
  312. // 2.3. 团购信息
  313. // fmt.Println(localData.TeamBuyingId)
  314. teamInfo, teamErr := db.FindTeamById(ctx, localData.TeamBuyingId)
  315. if teamErr != nil {
  316. return nil, teamErr
  317. }
  318. if teamInfo != nil {
  319. localInfo.TeamBuyingId = teamInfo.TeamBuyingId
  320. localInfo.TeamBuyingName = teamInfo.TeamBuyingName
  321. localInfo.TeamBuyingCategory = teamInfo.TeamBuyingCategory
  322. localInfo.TeamBuyingRelatedAt = conv.MustString(localData.TeamBuyingRelatedAt)[0:19]
  323. // 2.4. 团购图片信息
  324. teamPhotoInfo, teamPhotoErr := db.GetTeamPhotoByTeamID(ctx, localData.TeamBuyingId)
  325. if teamPhotoErr != nil {
  326. return nil, teamPhotoErr
  327. }
  328. if teamPhotoInfo != nil {
  329. for _, photo := range teamPhotoInfo {
  330. if photo.Symbol == 1 {
  331. localInfo.TeamMainPhotoSymbol = 1
  332. localInfo.TeamMainPhotoUrl = photo.PhotoUrl
  333. localInfo.TeamMainPhotoUid = photo.PhotoUid
  334. }
  335. }
  336. }
  337. }
  338. // 3. 招募要求
  339. //localInfo.TalentType = localData.TalentType
  340. parts := strings.Split(localData.TalentType, ",")
  341. var result []int
  342. for _, part := range parts {
  343. num, strErr := strconv.Atoi(strings.TrimSpace(part))
  344. if strErr != nil {
  345. return nil, strErr
  346. }
  347. result = append(result, num)
  348. }
  349. // fmt.Println(result)
  350. talentTypeCategory, talentTypeErr := db.GetTalentCategory(ctx, result)
  351. if talentTypeErr != nil {
  352. return nil, talentTypeErr
  353. }
  354. if talentTypeCategory != nil {
  355. categories := make([]string, 0, len(talentTypeCategory))
  356. for _, talentType := range talentTypeCategory {
  357. categories = append(categories, talentType.Category)
  358. }
  359. localInfo.TalentType = strings.Join(categories, ",")
  360. }
  361. localInfo.RecruitDdl = conv.MustString(localData.RecruitDdl)[0:19]
  362. recruitStrategy, recruitErr := db.GetRecruitStrategyByProjectId(ctx, req.LocalId)
  363. if recruitErr != nil {
  364. return nil, recruitErr
  365. }
  366. if recruitStrategy != nil {
  367. for _, strategy := range recruitStrategy {
  368. showStrategy := http_model.ShowSRecruitStrategy{
  369. StrategyID: strategy.StrategyID,
  370. FeeForm: strategy.FeeForm,
  371. FollowersLow: strategy.FollowersLow,
  372. FollowersUp: strategy.FollowersUp,
  373. RecruitNumber: strategy.RecruitNumber,
  374. Offer: strategy.Offer,
  375. }
  376. localInfo.RecruitStrategys = append(localInfo.RecruitStrategys, showStrategy)
  377. }
  378. }
  379. // 4. 执行要求
  380. localInfo.TaskForm = localData.TaskForm
  381. localInfo.ContentType = localData.ContentType
  382. briefInfo, briefErr := db.FindBriefByLocalId(ctx, req.LocalId)
  383. if briefErr != nil {
  384. return nil, briefErr
  385. }
  386. if briefInfo != nil {
  387. localInfo.LocalBrief = briefInfo
  388. }
  389. materialInfo, materialErr := db.FindMaterialByLocalId(ctx, req.LocalId)
  390. if materialErr != nil {
  391. return nil, materialErr
  392. }
  393. if materialInfo != nil {
  394. localInfo.LocalMaterial = materialInfo
  395. }
  396. }
  397. return localInfo, nil
  398. }
  399. // GetStoreInfo 门店信息查找
  400. func (*localLife) GetStoreInfo(ctx context.Context, req *http_model.FindStoreRequest) (*http_model.FindStoreData, error) {
  401. var storeData *http_model.FindStoreData
  402. storeData = &http_model.FindStoreData{}
  403. // 1.1. 门店信息
  404. storeInfo, storeErr := db.FindStoreById(ctx, req.StoreID)
  405. if storeErr != nil {
  406. return nil, storeErr
  407. }
  408. if storeInfo != nil {
  409. storeData.StoreId = storeInfo.StoreId
  410. storeData.StoreName = storeInfo.StoreName
  411. storeData.StoreCategory = storeInfo.StoreCategory
  412. storeData.StoreType = storeInfo.StoreType
  413. storeData.StoreLocation = storeInfo.StoreLocation
  414. storeData.StoreDetail = storeInfo.StoreDetail
  415. storeData.StoreLink = storeInfo.StoreLink
  416. storeData.TeamNum = storeInfo.TeamNum
  417. storeData.BelongEnterpriseId = storeInfo.BelongEnterpriseId
  418. storeData.IsDeleted = storeInfo.IsDeleted
  419. storeData.OperateType = storeInfo.OperateType
  420. storeData.EnterpriseId = storeInfo.EnterpriseId
  421. storeData.SubAccountId = storeInfo.SubAccountId
  422. var Photos *http_model.StorePhoto
  423. Photos = &http_model.StorePhoto{}
  424. // 1.2. 门店图片信息
  425. storePhotoInfo, storePhotoErr := db.GetStorePhotoByStoreID(ctx, req.StoreID)
  426. if storePhotoErr != nil {
  427. return nil, storePhotoErr
  428. }
  429. if storePhotoInfo != nil {
  430. for _, photo := range storePhotoInfo {
  431. Photos.PhotoUrl = photo.PhotoUrl
  432. Photos.PhotoUid = photo.PhotoUid
  433. Photos.Symbol = photo.Symbol
  434. storeData.StorePhotos = append(storeData.StorePhotos, Photos)
  435. }
  436. }
  437. }
  438. return storeData, nil
  439. }
  440. // GetTeamBuyingInfo 团购信息查找
  441. func (*localLife) GetTeamBuyingInfo(ctx context.Context, req *http_model.FindTeamBuyingRequest) (*http_model.FindTeamBuyingData, error) {
  442. var teamBuyingData *http_model.FindTeamBuyingData
  443. teamBuyingData = &http_model.FindTeamBuyingData{}
  444. // 1.1. 门店信息
  445. teamInfo, teamErr := db.FindTeamById(ctx, req.TeamBuyingId)
  446. if teamErr != nil {
  447. return nil, teamErr
  448. }
  449. if teamInfo != nil {
  450. teamBuyingData.TeamBuyingId = teamInfo.TeamBuyingId
  451. teamBuyingData.StoreId = teamInfo.StoreId
  452. teamBuyingData.TeamBuyingCategory = teamInfo.TeamBuyingCategory
  453. teamBuyingData.TeamBuyingName = teamInfo.TeamBuyingName
  454. teamBuyingData.TeamBuyingPrice = teamInfo.TeamBuyingPrice
  455. teamBuyingData.PublicCommission = teamInfo.PublicCommission
  456. teamBuyingData.TeamBuyingDetail = teamInfo.TeamBuyingDetail
  457. teamBuyingData.TeamBuyingLink = teamInfo.TeamBuyingLink
  458. teamBuyingData.IsDeleted = teamInfo.IsDeleted
  459. teamBuyingData.OperateType = teamInfo.OperateType
  460. teamBuyingData.EnterpriseId = teamInfo.EnterpriseId
  461. teamBuyingData.SubAccountId = teamInfo.SubAccountId
  462. var Photos *http_model.TeamBuyingPhoto
  463. Photos = &http_model.TeamBuyingPhoto{}
  464. // 2.4. 团购图片信息
  465. teamPhotoInfo, teamPhotoErr := db.GetTeamPhotoByTeamID(ctx, req.TeamBuyingId)
  466. if teamPhotoErr != nil {
  467. return nil, teamPhotoErr
  468. }
  469. if teamPhotoInfo != nil {
  470. for _, photo := range teamPhotoInfo {
  471. Photos.PhotoUrl = photo.PhotoUrl
  472. Photos.PhotoUid = photo.PhotoUid
  473. Photos.Symbol = photo.Symbol
  474. teamBuyingData.TeamBuyingPhotos = append(teamBuyingData.TeamBuyingPhotos, Photos)
  475. }
  476. }
  477. }
  478. return teamBuyingData, nil
  479. }