|
@@ -2,6 +2,7 @@ package service
|
|
|
|
|
|
import (
|
|
import (
|
|
"context"
|
|
"context"
|
|
|
|
+ "github.com/issue9/conv"
|
|
"time"
|
|
"time"
|
|
"youngee_b_api/db"
|
|
"youngee_b_api/db"
|
|
"youngee_b_api/model/gorm_model"
|
|
"youngee_b_api/model/gorm_model"
|
|
@@ -15,15 +16,44 @@ type cooperate struct {
|
|
|
|
|
|
// GetEnterpriseInfoBySupplierId 通过supplierId和合作状态筛选合作商家信息
|
|
// GetEnterpriseInfoBySupplierId 通过supplierId和合作状态筛选合作商家信息
|
|
func (*cooperate) GetEnterpriseInfoBySupplierId(ctx context.Context, request *http_model.EnterpriseListRequest) (*http_model.EnterpriseListData, error) {
|
|
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)
|
|
enterpriseListInfo, total, enterpriseListInfoErr := db.GetCooperateInfoByIds(ctx, request.SupplierId, request.CooperateStatus, request.PageSize, request.PageNum)
|
|
if enterpriseListInfoErr != nil {
|
|
if enterpriseListInfoErr != nil {
|
|
return nil, enterpriseListInfoErr
|
|
return nil, enterpriseListInfoErr
|
|
}
|
|
}
|
|
- var enterpriseListData *http_model.EnterpriseListData
|
|
|
|
- enterpriseListData = &http_model.EnterpriseListData{}
|
|
|
|
if enterpriseListInfo != nil {
|
|
if enterpriseListInfo != nil {
|
|
- enterpriseListData.EnterpriseListInfo = enterpriseListInfo
|
|
|
|
enterpriseListData.Total = total
|
|
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
|
|
return enterpriseListData, nil
|
|
}
|
|
}
|