|
@@ -39,14 +39,14 @@ func (*cooperate) GetEnterpriseInfoBySupplierId(ctx context.Context, request *ht
|
|
|
cooperateData.SOperatorType = c.SOperatorType
|
|
|
cooperateData.BOperator = c.BOperator
|
|
|
cooperateData.BOperatorType = c.BOperatorType
|
|
|
- if cooperateData.CreateTime != "" {
|
|
|
- cooperateData.CreateTime = conv.MustString(c.CreateTime, "")
|
|
|
+ if c.CreateTime != nil {
|
|
|
+ cooperateData.CreateTime = conv.MustString(c.CreateTime, "")[0:19]
|
|
|
}
|
|
|
- if cooperateData.AgreeTime != "" {
|
|
|
- cooperateData.AgreeTime = conv.MustString(c.AgreeTime, "")
|
|
|
+ if c.AgreeTime != nil {
|
|
|
+ cooperateData.AgreeTime = conv.MustString(c.AgreeTime, "")[0:19]
|
|
|
}
|
|
|
- if cooperateData.RejectTime != "" {
|
|
|
- cooperateData.RejectTime = conv.MustString(c.RejectTime, "")
|
|
|
+ if c.RejectTime != nil {
|
|
|
+ cooperateData.RejectTime = conv.MustString(c.RejectTime, "")[0:19]
|
|
|
}
|
|
|
|
|
|
// 1.2. 商家信息
|
|
@@ -57,7 +57,17 @@ func (*cooperate) GetEnterpriseInfoBySupplierId(ctx context.Context, request *ht
|
|
|
if enterpriseInfo != nil {
|
|
|
cooperateData.EnterprisePhone = enterpriseInfo.Phone
|
|
|
cooperateData.EnterpriseAuth = enterpriseInfo.AuthStatus
|
|
|
+ cooperateData.EnterpriseAvatar = enterpriseInfo.Avatar
|
|
|
+ cooperateData.EnterpriseName = enterpriseInfo.EnterpriseName
|
|
|
+ cooperateData.BOperatorName = enterpriseInfo.EnterpriseID
|
|
|
+ cooperateData.WechatNumber = enterpriseInfo.WechatNumber
|
|
|
+ cooperateData.WechatQrCode = enterpriseInfo.WechatQrCode
|
|
|
+ cooperateData.CompanyName = enterpriseInfo.BusinessName
|
|
|
}
|
|
|
+
|
|
|
+ // 1.3. 服务商信息
|
|
|
+ cooperateData.SOperatorName = conv.MustString(c.SupplierId)
|
|
|
+
|
|
|
enterpriseListData.EnterpriseListInfo = append(enterpriseListData.EnterpriseListInfo, cooperateData)
|
|
|
}
|
|
|
|
|
@@ -97,8 +107,8 @@ func (*cooperate) CreateCooperate(ctx context.Context, enterpriseId string, supp
|
|
|
}
|
|
|
|
|
|
// AgreeEnterpriseCooperate 同意商家合作邀约请求
|
|
|
-func (*cooperate) AgreeEnterpriseCooperate(ctx context.Context, cooperateId int) error {
|
|
|
- err := db.UpdateCooperateInfo(ctx, cooperateId, 2)
|
|
|
+func (*cooperate) AgreeEnterpriseCooperate(ctx context.Context, req *http_model.AgreeCooperateRequest) error {
|
|
|
+ err := db.UpdateCooperateInfo(ctx, req.CooperateId, 2, req.SupplierId, req.SubAccountId)
|
|
|
if err != nil {
|
|
|
return err
|
|
|
}
|
|
@@ -106,10 +116,33 @@ func (*cooperate) AgreeEnterpriseCooperate(ctx context.Context, cooperateId int)
|
|
|
}
|
|
|
|
|
|
// RejectEnterpriseCooperate 拒绝商家合作邀约请求
|
|
|
-func (*cooperate) RejectEnterpriseCooperate(ctx context.Context, cooperateId int) error {
|
|
|
- err := db.UpdateCooperateInfo(ctx, cooperateId, 3)
|
|
|
+func (*cooperate) RejectEnterpriseCooperate(ctx context.Context, req *http_model.RejectCooperateRequest) error {
|
|
|
+ err := db.UpdateCooperateInfo(ctx, req.CooperateId, 3, req.SupplierId, req.SubAccountId)
|
|
|
if err != nil {
|
|
|
return err
|
|
|
}
|
|
|
return nil
|
|
|
}
|
|
|
+
|
|
|
+// CooperateCount 合作列表数统计
|
|
|
+func (*cooperate) CooperateCount(ctx context.Context, req *http_model.CooperateCountRequest) (*http_model.CooperateCountData, error) {
|
|
|
+
|
|
|
+ var cooperateCount *http_model.CooperateCountData
|
|
|
+ cooperateCount = &http_model.CooperateCountData{}
|
|
|
+ status1, status1Err := db.CountCooperateBySupplierId(ctx, req.SupplierId, 1)
|
|
|
+ if status1Err != nil {
|
|
|
+ return nil, status1Err
|
|
|
+ }
|
|
|
+ cooperateCount.Status1 = status1
|
|
|
+ status2, status2Err := db.CountCooperateBySupplierId(ctx, req.SupplierId, 2)
|
|
|
+ if status2Err != nil {
|
|
|
+ return nil, status2Err
|
|
|
+ }
|
|
|
+ cooperateCount.Status2 = status2
|
|
|
+ status3, status3Err := db.CountCooperateBySupplierId(ctx, req.SupplierId, 3)
|
|
|
+ if status3Err != nil {
|
|
|
+ return nil, status3Err
|
|
|
+ }
|
|
|
+ cooperateCount.Status3 = status3
|
|
|
+ return cooperateCount, nil
|
|
|
+}
|