Xingyu Xian 2 сар өмнө
parent
commit
cf6205ab1d

+ 1 - 1
handler/full_s_local_list.go

@@ -41,7 +41,7 @@ func (h *FullSLocalListHandler) getResponse() interface{} {
 func (h *FullSLocalListHandler) run() {
 	// enterpriseID := middleware.GetSessionAuth(h.ctx).EnterpriseID
 	condition := pack.HttpFullSLocalLifeListRequestToCondition(h.req)
-	data, err := service.LocalLife.GetFullSLocalLifeList(h.ctx, h.req.PageSize, h.req.PageNum, h.req.SupplierId, condition)
+	data, err := service.SLcoalLife.GetFullSLocalLifeList(h.ctx, h.req.PageSize, h.req.PageNum, h.req.SupplierId, condition)
 	if err != nil {
 		logrus.WithContext(h.ctx).Errorf("[FullListHandler] error GetFullProjectList, err:%+v", err)
 		util.HandlerPackErrorResp(h.resp, consts.ErrorInternal, consts.DefaultToast)

+ 0 - 23
handler/project_taskList.go

@@ -1,8 +1,6 @@
 package handler
 
 import (
-	"errors"
-	"fmt"
 	"youngee_b_api/consts"
 	"youngee_b_api/model/http_model"
 	"youngee_b_api/pack"
@@ -10,7 +8,6 @@ import (
 	"youngee_b_api/util"
 
 	"github.com/gin-gonic/gin"
-	"github.com/issue9/conv"
 	"github.com/sirupsen/logrus"
 )
 
@@ -53,25 +50,5 @@ func (h *ProjectTaskListHandler) run() {
 	h.resp.Data = data
 }
 func (h *ProjectTaskListHandler) checkParam() error {
-	var errs []error
-	if h.req.PageNum < 0 || h.req.PageSize <= 0 {
-		errs = append(errs, errors.New("page param error"))
-	}
-	h.req.PageNum--
-	h.req.ProjectId = util.IsNull(h.req.ProjectId)
-	if _, err := conv.Int64(h.req.ProjectId); err != nil {
-		errs = append(errs, err)
-	}
-	h.req.StrategyId = util.IsNull(h.req.StrategyId)
-	if _, err := conv.Int64(h.req.StrategyId); err != nil {
-		errs = append(errs, err)
-	}
-	h.req.TaskStatus = util.IsNull(h.req.TaskStatus)
-	if _, err := conv.Int64(h.req.TaskStatus); err != nil {
-		errs = append(errs, err)
-	}
-	if len(errs) != 0 {
-		return fmt.Errorf("check param errs:%+v", errs)
-	}
 	return nil
 }

+ 1 - 1
model/gorm_model/enterprise.go

@@ -18,7 +18,7 @@ type Enterprise struct {
 	CreatedAt        time.Time `gorm:"column:created_at"`        // 创建时间
 	UpdatedAt        time.Time `gorm:"column:updated_at"`        // 更新时间
 	Phone            string    `gorm:"column:phone"`             // 手机号
-
+	AuthStatus       int       `gorm:"column:auth_status"`       // 商家认证状态,0未认证,1已认证
 }
 
 func (m *Enterprise) TableName() string {

+ 21 - 4
model/http_model/enterprise_supplier_cooperate.go

@@ -1,7 +1,5 @@
 package http_model
 
-import "youngee_b_api/model/gorm_model"
-
 type EnterpriseListRequest struct {
 	PageSize        int64 `json:"page_size"`
 	PageNum         int64 `json:"page_num"`
@@ -10,8 +8,27 @@ type EnterpriseListRequest struct {
 }
 
 type EnterpriseListData struct {
-	EnterpriseListInfo []*gorm_model.EnterpriseSupplierCooperate `json:"enterprise_list_info"`
-	Total              int64                                     `json:"total"`
+	EnterpriseListInfo []*EnterpriseSupplierCooperateData `json:"enterprise_list_info"`
+	Total              int64                              `json:"total"`
+}
+
+type EnterpriseSupplierCooperateData struct {
+	CooperateId        int    `json:"cooperate_id"`         // 合作表主键ID
+	EnterpriseId       string `json:"enterprise_id"`        // 商家ID
+	EnterprisePhone    string `json:"enterprise_phone"`     // 商家手机号
+	EnterpriseAuth     int    `json:"enterprise_auth"`      // 商家认证状态,0未认证,1已认证
+	SupplierId         int    `json:"supplier_id"`          // 服务商ID
+	CooperateNum       int    `json:"cooperate_num"`        // 受邀合作次数
+	UploadTalentNum    int    `json:"upload_talent_num"`    // 提报达人数量
+	CooperateTalentNum int    `json:"cooperate_talent_num"` // 合作达人人数
+	SOperator          int    `json:"s_operator"`           // 服务商同意/拒绝邀约操作人
+	SOperatorType      int    `json:"s_operator_type"`      // 服务商操作人类型:1主账号,2子账号
+	BOperator          string `json:"b_operator"`           // 商家发起入库邀约人
+	BOperatorType      int    `json:"b_operator_type"`      // 商家发起入库邀约人类型:1主账号,2子账号
+	CooperateStatus    int    `json:"cooperate_status"`     // 邀约状态:1待同意,2已同意,3已拒绝
+	CreateTime         string `json:"create_time"`          // 合作邀约时间
+	AgreeTime          string `json:"agree_time"`           // 同意邀约时间
+	RejectTime         string `json:"reject_time"`          // 拒绝邀约时间
 }
 
 func NewEnterpriseListRequest() *EnterpriseListRequest {

+ 33 - 3
service/cooperate.go

@@ -2,6 +2,7 @@ package service
 
 import (
 	"context"
+	"github.com/issue9/conv"
 	"time"
 	"youngee_b_api/db"
 	"youngee_b_api/model/gorm_model"
@@ -15,15 +16,44 @@ type cooperate struct {
 
 // GetEnterpriseInfoBySupplierId 通过supplierId和合作状态筛选合作商家信息
 func (*cooperate) GetEnterpriseInfoBySupplierId(ctx context.Context, request *http_model.EnterpriseListRequest) (*http_model.EnterpriseListData, error) {
+	var enterpriseListData *http_model.EnterpriseListData
+	enterpriseListData = &http_model.EnterpriseListData{}
+
+	// 1. 根据服务商ID和合作状态查找信息
 	enterpriseListInfo, total, enterpriseListInfoErr := db.GetCooperateInfoByIds(ctx, request.SupplierId, request.CooperateStatus, request.PageSize, request.PageNum)
 	if enterpriseListInfoErr != nil {
 		return nil, enterpriseListInfoErr
 	}
-	var enterpriseListData *http_model.EnterpriseListData
-	enterpriseListData = &http_model.EnterpriseListData{}
 	if enterpriseListInfo != nil {
-		enterpriseListData.EnterpriseListInfo = enterpriseListInfo
 		enterpriseListData.Total = total
+		for _, c := range enterpriseListInfo {
+			var cooperateData *http_model.EnterpriseSupplierCooperateData
+			cooperateData = &http_model.EnterpriseSupplierCooperateData{}
+			cooperateData.CooperateId = c.CooperateId
+			cooperateData.CooperateStatus = c.CooperateStatus
+			cooperateData.CooperateNum = c.CooperateNum
+			cooperateData.SupplierId = c.SupplierId
+			cooperateData.UploadTalentNum = c.UploadTalentNum
+			cooperateData.CooperateTalentNum = c.CooperateTalentNum
+			cooperateData.SOperator = c.SOperator
+			cooperateData.SOperatorType = c.SOperatorType
+			cooperateData.BOperator = c.BOperator
+			cooperateData.BOperatorType = c.BOperatorType
+			cooperateData.CreateTime = conv.MustString(c.CreateTime)
+			cooperateData.AgreeTime = conv.MustString(c.AgreeTime)
+			cooperateData.RejectTime = conv.MustString(c.RejectTime)
+			// 1.2. 商家信息
+			enterpriseInfo, enterpriseErr := db.GetEnterpriseByEnterpriseID(ctx, c.EnterpriseId)
+			if enterpriseErr != nil {
+				return nil, enterpriseErr
+			}
+			if enterpriseInfo != nil {
+				cooperateData.EnterprisePhone = enterpriseInfo.Phone
+				cooperateData.EnterpriseAuth = enterpriseInfo.AuthStatus
+			}
+			enterpriseListData.EnterpriseListInfo = append(enterpriseListData.EnterpriseListInfo, cooperateData)
+		}
+
 	}
 	return enterpriseListData, nil
 }

+ 0 - 66
service/local_life.go

@@ -3,7 +3,6 @@ package service
 import (
 	"context"
 	"fmt"
-	"github.com/issue9/conv"
 	"github.com/sirupsen/logrus"
 	"youngee_b_api/db"
 	"youngee_b_api/model/common_model"
@@ -97,68 +96,3 @@ func (*localLife) GetFullLocalLifeList(ctx context.Context, pageSize, pageNum in
 	}
 	return fullLocalData, nil
 }
-
-func (*localLife) GetFullSLocalLifeList(ctx context.Context, pageSize, pageNum int32, supplierId int, condition *common_model.SLocalLifeCondition) (*http_model.FullSLocalListData, error) {
-
-	// 1. 查询本地生活任务基本信息
-	fullLocals, total, err := db.GetFullSLocalLifeList(ctx, pageSize, pageNum, condition)
-	if err != nil {
-		logrus.WithContext(ctx).Errorf("[fullLocals service] call GetFullSLocalLifeList error,err:%+v", err)
-		return nil, err
-	}
-	var fullLocalData *http_model.FullSLocalListData
-	fullLocalData = &http_model.FullSLocalListData{}
-	fullLocalData.Total = total
-	for _, fullLocal := range fullLocals {
-		var fullLocalPreview *http_model.FullSLocalPreview
-		fullLocalPreview = &http_model.FullSLocalPreview{}
-		fullLocalPreview.LocalId = fullLocal.LocalId
-		fullLocalPreview.TaskStatus = fullLocal.TaskStatus
-		fullLocalPreview.LocalPlatform = fullLocal.LocalPlatform
-		fullLocalPreview.TaskForm = fullLocal.TaskForm
-		fullLocalPreview.LocalType = fullLocal.LocalType
-		fullLocalPreview.LocalContentType = fullLocal.ContentType
-		fullLocalPreview.SupplierId = supplierId
-		fullLocalPreview.SubAccountId = fullLocal.SubAccountId
-		fullLocalPreview.OperatorType = fullLocal.OperatorType
-		fullLocalPreview.CreateTime = conv.MustString(fullLocal.CreateTime)
-		fullLocalPreview.ServiceCharge = fullLocal.ServiceCharge
-		fullLocalPreview.ServiceChargeActual = fullLocal.ServiceChargeActual
-		fullLocalPreview.ApplyNum = fullLocal.ApplyNum
-		fullLocalPreview.RecruitNum = fullLocal.RecruitNum
-		fullLocalPreview.SettleNum = fullLocal.SettleNum
-		fullLocalData.FullSLocalPreview = append(fullLocalData.FullSLocalPreview, fullLocalPreview)
-	}
-
-	// 2. 查询本地生活补充信息:门店信息,招募策略
-	for _, local := range fullLocalData.FullSLocalPreview {
-
-		// 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
-				}
-			}
-		}
-
-	}
-	return fullLocalData, nil
-}

+ 68 - 1
service/s_local_life.go

@@ -2,8 +2,11 @@ package service
 
 import (
 	"context"
+	"fmt"
 	"github.com/issue9/conv"
+	"github.com/sirupsen/logrus"
 	"youngee_b_api/db"
+	"youngee_b_api/model/common_model"
 	"youngee_b_api/model/gorm_model"
 	"youngee_b_api/model/http_model"
 )
@@ -164,8 +167,72 @@ func (*sLocalLife) ShowSLocalLife(ctx context.Context, req *http_model.ShowSLoca
 		if materialInfo != nil {
 			sLocalInfo.LocalMaterial = materialInfo
 		}
-
 	}
 
 	return sLocalInfo, nil
 }
+
+func (*sLocalLife) GetFullSLocalLifeList(ctx context.Context, pageSize, pageNum int32, supplierId int, condition *common_model.SLocalLifeCondition) (*http_model.FullSLocalListData, error) {
+
+	// 1. 查询本地生活任务基本信息
+	fullLocals, total, err := db.GetFullSLocalLifeList(ctx, pageSize, pageNum, condition)
+	if err != nil {
+		logrus.WithContext(ctx).Errorf("[fullLocals service] call GetFullSLocalLifeList error,err:%+v", err)
+		return nil, err
+	}
+	var fullLocalData *http_model.FullSLocalListData
+	fullLocalData = &http_model.FullSLocalListData{}
+	fullLocalData.Total = total
+	for _, fullLocal := range fullLocals {
+		var fullLocalPreview *http_model.FullSLocalPreview
+		fullLocalPreview = &http_model.FullSLocalPreview{}
+		fullLocalPreview.LocalId = fullLocal.LocalId
+		fullLocalPreview.TaskStatus = fullLocal.TaskStatus
+		fullLocalPreview.LocalPlatform = fullLocal.LocalPlatform
+		fullLocalPreview.TaskForm = fullLocal.TaskForm
+		fullLocalPreview.LocalType = fullLocal.LocalType
+		fullLocalPreview.LocalContentType = fullLocal.ContentType
+		fullLocalPreview.SupplierId = supplierId
+		fullLocalPreview.SubAccountId = fullLocal.SubAccountId
+		fullLocalPreview.OperatorType = fullLocal.OperatorType
+		fullLocalPreview.CreateTime = conv.MustString(fullLocal.CreateTime)
+		fullLocalPreview.ServiceCharge = fullLocal.ServiceCharge
+		fullLocalPreview.ServiceChargeActual = fullLocal.ServiceChargeActual
+		fullLocalPreview.ApplyNum = fullLocal.ApplyNum
+		fullLocalPreview.RecruitNum = fullLocal.RecruitNum
+		fullLocalPreview.SettleNum = fullLocal.SettleNum
+		fullLocalData.FullSLocalPreview = append(fullLocalData.FullSLocalPreview, fullLocalPreview)
+	}
+
+	// 2. 查询本地生活补充信息:门店信息,招募策略
+	for _, local := range fullLocalData.FullSLocalPreview {
+
+		// 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
+				}
+			}
+		}
+
+	}
+	return fullLocalData, nil
+}