|
@@ -106,10 +106,10 @@ func (*localLife) GetFullLocalLifeList(ctx context.Context, pageSize, pageNum in
|
|
|
}
|
|
|
|
|
|
// GetSpecialLocalLifeList 商单广场-定向本地生活
|
|
|
-func (*localLife) GetSpecialLocalLifeList(ctx context.Context, pageSize, pageNum int32, condition *common_model.SSpecialLocalLifeCondition) (*http_model.SpecialLocalListData, error) {
|
|
|
+func (*localLife) GetSpecialLocalLifeList(ctx context.Context, pageSize, pageNum int32, supplierId int, condition *common_model.SSpecialLocalLifeCondition) (*http_model.SpecialLocalListData, error) {
|
|
|
|
|
|
// 1. 查询本地生活任务基本信息
|
|
|
- specialLocals, total, err := db.GetSpecialLocalLifeList(ctx, pageSize, pageNum, condition)
|
|
|
+ specialLocals, total, err := db.GetSpecialLocalLifeList(ctx, pageSize, pageNum, supplierId, condition, 1)
|
|
|
if err != nil {
|
|
|
logrus.WithContext(ctx).Errorf("[fullLocals service] call GetFullLocalLifeList error,err:%+v", err)
|
|
|
return nil, err
|
|
@@ -184,7 +184,89 @@ func (*localLife) GetSpecialLocalLifeList(ctx context.Context, pageSize, pageNum
|
|
|
if localInfo != nil {
|
|
|
local.Tools = localInfo.Tools
|
|
|
}
|
|
|
+ }
|
|
|
+ return specialLocalData, nil
|
|
|
+}
|
|
|
|
|
|
+// GetSpecialSLocalLifeList 商单管理-定向本地生活
|
|
|
+func (*localLife) GetSpecialSLocalLifeList(ctx context.Context, pageSize, pageNum int32, supplierId int, condition *common_model.SSpecialLocalLifeCondition) (*http_model.SpecialSLocalListData, error) {
|
|
|
+
|
|
|
+ // 1. 查询本地生活任务基本信息
|
|
|
+ specialLocals, total, err := db.GetSpecialLocalLifeList(ctx, pageSize, pageNum, supplierId, condition, 2)
|
|
|
+ if err != nil {
|
|
|
+ logrus.WithContext(ctx).Errorf("[fullLocals service] call GetFullLocalLifeList error,err:%+v", err)
|
|
|
+ return nil, err
|
|
|
+ }
|
|
|
+ var specialLocalData *http_model.SpecialSLocalListData
|
|
|
+ specialLocalData = &http_model.SpecialSLocalListData{}
|
|
|
+ specialLocalData.Total = total
|
|
|
+ for _, specialLocal := range specialLocals {
|
|
|
+ var specialLocalPreview *http_model.SpecialSLocalPreview
|
|
|
+ specialLocalPreview = &http_model.SpecialSLocalPreview{}
|
|
|
+ specialLocalPreview.LocalId = specialLocal.LocalId
|
|
|
+ specialLocalPreview.LocalName = specialLocal.LocalName
|
|
|
+ specialLocalPreview.TaskStatus = specialLocal.TaskStatus
|
|
|
+ specialLocalPreview.LocalPlatform = specialLocal.LocalPlatform
|
|
|
+ specialLocalPreview.TaskForm = specialLocal.TaskForm
|
|
|
+ specialLocalPreview.LocalType = specialLocal.LocalType
|
|
|
+ specialLocalPreview.LocalContentType = specialLocal.ContentType
|
|
|
+ specialLocalPreview.SLocalStatus = specialLocal.SLocalStatus
|
|
|
+ specialLocalData.SpecialSLocalPreview = append(specialLocalData.SpecialSLocalPreview, specialLocalPreview)
|
|
|
+ }
|
|
|
+
|
|
|
+ // 2. 查询本地生活补充信息:门店信息,招募策略
|
|
|
+ for _, local := range specialLocalData.SpecialSLocalPreview {
|
|
|
+
|
|
|
+ // 2.1. 门店信息
|
|
|
+ storeInfo, productErr := db.FindStoreById(ctx, local.StoreId)
|
|
|
+ if productErr != nil {
|
|
|
+ return nil, productErr
|
|
|
+ }
|
|
|
+ if storeInfo != nil {
|
|
|
+ local.StoreId = storeInfo.StoreId
|
|
|
+ local.StoreName = storeInfo.StoreName
|
|
|
+ }
|
|
|
+
|
|
|
+ // 2.2. 门店图片信息
|
|
|
+ productPhotoInfo, productPhotoErr := db.GetStorePhotoByStoreID(ctx, local.StoreId)
|
|
|
+ if productPhotoErr != nil {
|
|
|
+ return nil, productPhotoErr
|
|
|
+ }
|
|
|
+ if productPhotoInfo != nil {
|
|
|
+ for _, photo := range productPhotoInfo {
|
|
|
+ fmt.Println(photo)
|
|
|
+ if photo.Symbol == 1 {
|
|
|
+ local.ProductPhotoSymbol = 1
|
|
|
+ local.ProductPhotoUrl = photo.PhotoUrl
|
|
|
+ local.ProductPhotoUid = photo.PhotoUid
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ // 2.3. 招募策略信息
|
|
|
+ recruitStrategyInfo, recruitErr := db.GetRecruitStrategyByProjectId(ctx, local.LocalId)
|
|
|
+ if recruitErr != nil {
|
|
|
+ return nil, recruitErr
|
|
|
+ }
|
|
|
+ if recruitStrategyInfo != nil {
|
|
|
+ for _, strategy := range recruitStrategyInfo {
|
|
|
+ var recruitStrategy *http_model.EasyRecruitStrategy
|
|
|
+ recruitStrategy = &http_model.EasyRecruitStrategy{}
|
|
|
+ recruitStrategy.StrategyId = strategy.StrategyID
|
|
|
+ recruitStrategy.FeeForm = strategy.FeeForm
|
|
|
+ recruitStrategy.RecruitNumber = strategy.RecruitNumber
|
|
|
+ local.RecruitStrategy = append(local.RecruitStrategy, recruitStrategy)
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ // 2.4. 原定向本地生活任务信息
|
|
|
+ localInfo, localErr := db.GetLocalLifeDetail(ctx, local.LocalId)
|
|
|
+ if localErr != nil {
|
|
|
+ return nil, localErr
|
|
|
+ }
|
|
|
+ if localInfo != nil {
|
|
|
+ local.Tools = localInfo.Tools
|
|
|
+ }
|
|
|
}
|
|
|
return specialLocalData, nil
|
|
|
}
|