local_life.go 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531
  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.SLocalId = specialLocal.SLocalId
  198. specialLocalPreview.StrategyStatus = specialLocal.StrategyStatus
  199. specialLocalPreview.LocalName = specialLocal.LocalName
  200. specialLocalPreview.TaskStatus = specialLocal.TaskStatus
  201. specialLocalPreview.LocalPlatform = specialLocal.LocalPlatform
  202. specialLocalPreview.TaskForm = specialLocal.TaskForm
  203. specialLocalPreview.LocalType = specialLocal.LocalType
  204. specialLocalPreview.ApplyNum = specialLocal.ApplyNum
  205. specialLocalPreview.RecruitNum = specialLocal.RecruitNum
  206. specialLocalPreview.SettleNum = specialLocal.SettleNum
  207. specialLocalPreview.EnterpriseId = specialLocal.EnterpriseId
  208. specialLocalPreview.LocalContentType = specialLocal.ContentType
  209. specialLocalPreview.SLocalStatus = specialLocal.SLocalStatus
  210. specialLocalPreview.StoreId = specialLocal.StoreId
  211. if specialLocal.OperatorType == 1 {
  212. specialLocalPreview.AddToListOperator = conv.MustString(specialLocal.SupplierId)
  213. } else {
  214. specialLocalPreview.AddToListOperator = conv.MustString(specialLocal.SubAccountId)
  215. }
  216. if specialLocalPreview.SLocalStatus == 2 {
  217. specialLocalPreview.AgreeTime = conv.MustString(specialLocal.AgreeTime)[0:19]
  218. }
  219. specialLocalData.SpecialSLocalPreview = append(specialLocalData.SpecialSLocalPreview, specialLocalPreview)
  220. }
  221. // 2. 查询本地生活补充信息:门店信息,招募策略
  222. for _, local := range specialLocalData.SpecialSLocalPreview {
  223. // 2.1. 门店信息
  224. storeInfo, productErr := db.FindStoreById(ctx, local.StoreId)
  225. if productErr != nil {
  226. return nil, productErr
  227. }
  228. if storeInfo != nil {
  229. local.StoreId = storeInfo.StoreId
  230. local.StoreName = storeInfo.StoreName
  231. }
  232. // 2.2. 门店图片信息
  233. productPhotoInfo, productPhotoErr := db.GetStorePhotoByStoreID(ctx, local.StoreId)
  234. if productPhotoErr != nil {
  235. return nil, productPhotoErr
  236. }
  237. if productPhotoInfo != nil {
  238. for _, photo := range productPhotoInfo {
  239. fmt.Println(photo)
  240. if photo.Symbol == 1 {
  241. local.ProductPhotoSymbol = 1
  242. local.ProductPhotoUrl = photo.PhotoUrl
  243. local.ProductPhotoUid = photo.PhotoUid
  244. }
  245. }
  246. }
  247. // 2.3. 招募策略信息
  248. recruitStrategyInfo, recruitErr := db.GetRecruitStrategyByProjectId(ctx, local.LocalId)
  249. if recruitErr != nil {
  250. return nil, recruitErr
  251. }
  252. if recruitStrategyInfo != nil {
  253. for _, strategy := range recruitStrategyInfo {
  254. var recruitStrategy *http_model.EasyRecruitStrategy
  255. recruitStrategy = &http_model.EasyRecruitStrategy{}
  256. recruitStrategy.StrategyId = strategy.StrategyID
  257. recruitStrategy.FeeForm = strategy.FeeForm
  258. recruitStrategy.RecruitNumber = strategy.RecruitNumber
  259. local.RecruitStrategy = append(local.RecruitStrategy, recruitStrategy)
  260. }
  261. }
  262. // 2.4. 原定向本地生活任务信息
  263. localInfo, localErr := db.GetLocalLifeDetail(ctx, local.LocalId)
  264. if localErr != nil {
  265. return nil, localErr
  266. }
  267. if localInfo != nil {
  268. local.Tools = localInfo.Tools
  269. }
  270. }
  271. return specialLocalData, nil
  272. }
  273. // ShowLocalLife 商单广场-本地生活详情
  274. func (*localLife) ShowLocalLife(ctx context.Context, req *http_model.ShowLocalRequest) (*http_model.ShowLocalData, error) {
  275. var localInfo *http_model.ShowLocalData
  276. localInfo = &http_model.ShowLocalData{}
  277. // 1. 查询系统信息
  278. localData, localErr := db.GetLocalLifeDetail(ctx, req.LocalId)
  279. if localErr != nil {
  280. return nil, localErr
  281. }
  282. if localData != nil {
  283. localInfo.Donate = localData.Donate
  284. localInfo.LocalId = localData.LocalId
  285. localInfo.LocalName = localData.LocalName
  286. localInfo.LocalPlatform = localData.LocalPlatform
  287. localInfo.TaskStatus = localData.TaskStatus
  288. localInfo.EnterpriseId = localData.EnterpriseId
  289. localInfo.ServiceChargeRate = localData.ServiceChargeRate
  290. localInfo.EstimatedCost = localData.EstimatedCost
  291. localInfo.CreateAt = conv.MustString(localData.CreatedAt)[0:19]
  292. if localData.PassAt != nil {
  293. localInfo.PassAt = conv.MustString(localData.PassAt)[0:19]
  294. }
  295. localInfo.CreatorName = localData.EnterpriseId
  296. // 2. 关联主体
  297. // 2.1. 门店信息
  298. storeInfo, storeErr := db.FindStoreById(ctx, localData.StoreId)
  299. if storeErr != nil {
  300. return nil, storeErr
  301. }
  302. if storeInfo != nil {
  303. localInfo.StoreLocation = storeInfo.StoreLocation
  304. localInfo.StoreId = storeInfo.StoreId
  305. localInfo.StoreName = storeInfo.StoreName
  306. localInfo.StoreCategory = storeInfo.StoreCategory
  307. localInfo.StoreRelatedAt = conv.MustString(localData.StoreRelatedAt)[0:19]
  308. // 2.2. 门店图片信息
  309. storePhotoInfo, storePhotoErr := db.GetStorePhotoByStoreID(ctx, localData.StoreId)
  310. if storePhotoErr != nil {
  311. return nil, storePhotoErr
  312. }
  313. if storePhotoInfo != nil {
  314. for _, photo := range storePhotoInfo {
  315. if photo.Symbol == 1 {
  316. localInfo.StoreMainPhotoSymbol = 1
  317. localInfo.StoreMainPhotoUrl = photo.PhotoUrl
  318. localInfo.StoreMainPhotoUid = photo.PhotoUid
  319. }
  320. }
  321. }
  322. }
  323. // 2.3. 团购信息
  324. // fmt.Println(localData.TeamBuyingId)
  325. teamInfo, teamErr := db.FindTeamById(ctx, localData.TeamBuyingId)
  326. if teamErr != nil {
  327. return nil, teamErr
  328. }
  329. if teamInfo != nil {
  330. localInfo.TeamBuyingId = teamInfo.TeamBuyingId
  331. localInfo.TeamBuyingName = teamInfo.TeamBuyingName
  332. localInfo.TeamBuyingCategory = teamInfo.TeamBuyingCategory
  333. localInfo.TeamBuyingRelatedAt = conv.MustString(localData.TeamBuyingRelatedAt)[0:19]
  334. // 2.4. 团购图片信息
  335. teamPhotoInfo, teamPhotoErr := db.GetTeamPhotoByTeamID(ctx, localData.TeamBuyingId)
  336. if teamPhotoErr != nil {
  337. return nil, teamPhotoErr
  338. }
  339. if teamPhotoInfo != nil {
  340. for _, photo := range teamPhotoInfo {
  341. if photo.Symbol == 1 {
  342. localInfo.TeamMainPhotoSymbol = 1
  343. localInfo.TeamMainPhotoUrl = photo.PhotoUrl
  344. localInfo.TeamMainPhotoUid = photo.PhotoUid
  345. }
  346. }
  347. }
  348. }
  349. // 3. 招募要求
  350. //localInfo.TalentType = localData.TalentType
  351. parts := strings.Split(localData.TalentType, ",")
  352. var result []int
  353. for _, part := range parts {
  354. num, strErr := strconv.Atoi(strings.TrimSpace(part))
  355. if strErr != nil {
  356. return nil, strErr
  357. }
  358. result = append(result, num)
  359. }
  360. // fmt.Println(result)
  361. talentTypeCategory, talentTypeErr := db.GetTalentCategory(ctx, result)
  362. if talentTypeErr != nil {
  363. return nil, talentTypeErr
  364. }
  365. if talentTypeCategory != nil {
  366. categories := make([]string, 0, len(talentTypeCategory))
  367. for _, talentType := range talentTypeCategory {
  368. categories = append(categories, talentType.Category)
  369. }
  370. localInfo.TalentType = strings.Join(categories, ",")
  371. }
  372. localInfo.RecruitDdl = conv.MustString(localData.RecruitDdl)[0:19]
  373. recruitStrategy, recruitErr := db.GetRecruitStrategyByProjectId(ctx, req.LocalId)
  374. if recruitErr != nil {
  375. return nil, recruitErr
  376. }
  377. if recruitStrategy != nil {
  378. for _, strategy := range recruitStrategy {
  379. showStrategy := http_model.ShowSRecruitStrategy{
  380. StrategyID: strategy.StrategyID,
  381. FeeForm: strategy.FeeForm,
  382. FollowersLow: strategy.FollowersLow,
  383. FollowersUp: strategy.FollowersUp,
  384. RecruitNumber: strategy.RecruitNumber,
  385. Offer: strategy.Offer,
  386. }
  387. localInfo.RecruitStrategys = append(localInfo.RecruitStrategys, showStrategy)
  388. }
  389. }
  390. // 4. 执行要求
  391. localInfo.TaskForm = localData.TaskForm
  392. localInfo.ContentType = localData.ContentType
  393. briefInfo, briefErr := db.FindBriefByLocalId(ctx, req.LocalId)
  394. if briefErr != nil {
  395. return nil, briefErr
  396. }
  397. if briefInfo != nil {
  398. localInfo.LocalBrief = briefInfo
  399. }
  400. materialInfo, materialErr := db.FindMaterialByLocalId(ctx, req.LocalId)
  401. if materialErr != nil {
  402. return nil, materialErr
  403. }
  404. if materialInfo != nil {
  405. localInfo.LocalMaterial = materialInfo
  406. }
  407. }
  408. return localInfo, nil
  409. }
  410. // GetStoreInfo 门店信息查找
  411. func (*localLife) GetStoreInfo(ctx context.Context, req *http_model.FindStoreRequest) (*http_model.FindStoreData, error) {
  412. var storeData *http_model.FindStoreData
  413. storeData = &http_model.FindStoreData{}
  414. // 1.1. 门店信息
  415. storeInfo, storeErr := db.FindStoreById(ctx, req.StoreID)
  416. if storeErr != nil {
  417. return nil, storeErr
  418. }
  419. if storeInfo != nil {
  420. storeData.StoreId = storeInfo.StoreId
  421. storeData.StoreName = storeInfo.StoreName
  422. storeData.StoreCategory = storeInfo.StoreCategory
  423. storeData.StoreType = storeInfo.StoreType
  424. storeData.StoreLocation = storeInfo.StoreLocation
  425. storeData.StoreDetail = storeInfo.StoreDetail
  426. storeData.StoreLink = storeInfo.StoreLink
  427. storeData.TeamNum = storeInfo.TeamNum
  428. storeData.BelongEnterpriseId = storeInfo.BelongEnterpriseId
  429. storeData.IsDeleted = storeInfo.IsDeleted
  430. storeData.OperateType = storeInfo.OperateType
  431. storeData.EnterpriseId = storeInfo.EnterpriseId
  432. storeData.SubAccountId = storeInfo.SubAccountId
  433. var Photos *http_model.StorePhoto
  434. Photos = &http_model.StorePhoto{}
  435. // 1.2. 门店图片信息
  436. storePhotoInfo, storePhotoErr := db.GetStorePhotoByStoreID(ctx, req.StoreID)
  437. if storePhotoErr != nil {
  438. return nil, storePhotoErr
  439. }
  440. if storePhotoInfo != nil {
  441. for _, photo := range storePhotoInfo {
  442. Photos.PhotoUrl = photo.PhotoUrl
  443. Photos.PhotoUid = photo.PhotoUid
  444. Photos.Symbol = photo.Symbol
  445. storeData.StorePhotos = append(storeData.StorePhotos, Photos)
  446. }
  447. }
  448. }
  449. return storeData, nil
  450. }
  451. // GetTeamBuyingInfo 团购信息查找
  452. func (*localLife) GetTeamBuyingInfo(ctx context.Context, req *http_model.FindTeamBuyingRequest) (*http_model.FindTeamBuyingData, error) {
  453. var teamBuyingData *http_model.FindTeamBuyingData
  454. teamBuyingData = &http_model.FindTeamBuyingData{}
  455. // 1.1. 门店信息
  456. teamInfo, teamErr := db.FindTeamById(ctx, req.TeamBuyingId)
  457. if teamErr != nil {
  458. return nil, teamErr
  459. }
  460. if teamInfo != nil {
  461. teamBuyingData.TeamBuyingId = teamInfo.TeamBuyingId
  462. teamBuyingData.StoreId = teamInfo.StoreId
  463. teamBuyingData.TeamBuyingCategory = teamInfo.TeamBuyingCategory
  464. teamBuyingData.TeamBuyingName = teamInfo.TeamBuyingName
  465. teamBuyingData.TeamBuyingPrice = teamInfo.TeamBuyingPrice
  466. teamBuyingData.PublicCommission = teamInfo.PublicCommission
  467. teamBuyingData.TeamBuyingDetail = teamInfo.TeamBuyingDetail
  468. teamBuyingData.TeamBuyingLink = teamInfo.TeamBuyingLink
  469. teamBuyingData.IsDeleted = teamInfo.IsDeleted
  470. teamBuyingData.OperateType = teamInfo.OperateType
  471. teamBuyingData.EnterpriseId = teamInfo.EnterpriseId
  472. teamBuyingData.SubAccountId = teamInfo.SubAccountId
  473. var Photos *http_model.TeamBuyingPhoto
  474. Photos = &http_model.TeamBuyingPhoto{}
  475. // 2.4. 团购图片信息
  476. teamPhotoInfo, teamPhotoErr := db.GetTeamPhotoByTeamID(ctx, req.TeamBuyingId)
  477. if teamPhotoErr != nil {
  478. return nil, teamPhotoErr
  479. }
  480. if teamPhotoInfo != nil {
  481. for _, photo := range teamPhotoInfo {
  482. Photos.PhotoUrl = photo.PhotoUrl
  483. Photos.PhotoUid = photo.PhotoUid
  484. Photos.Symbol = photo.Symbol
  485. teamBuyingData.TeamBuyingPhotos = append(teamBuyingData.TeamBuyingPhotos, Photos)
  486. }
  487. }
  488. }
  489. return teamBuyingData, nil
  490. }