作者 陈志颖

refactor:增加合伙人编号

@@ -123,10 +123,10 @@ func newQueryOptionV2(request *protocolx.PartnersRequest) map[string]interface{} @@ -123,10 +123,10 @@ func newQueryOptionV2(request *protocolx.PartnersRequest) map[string]interface{}
123 123
124 func newCompany(company *domain.Company, p *domain.PartnerStatics) userx.Company { 124 func newCompany(company *domain.Company, p *domain.PartnerStatics) userx.Company {
125 partnerCompany := userx.Company{ 125 partnerCompany := userx.Company{
126 - Id: company.Id,  
127 - Name: company.Name,  
128 - Phone: company.Phone,  
129 - SerialNo: p.Id, 126 + Id: company.Id,
  127 + Name: company.Name,
  128 + Phone: company.Phone,
  129 + //SerialNo: p.Id,
130 CooperateTime: p.CooperateTime.Unix() * 1000, 130 CooperateTime: p.CooperateTime.Unix() * 1000,
131 MiniProgram: nil, 131 MiniProgram: nil,
132 District: map[string]interface{}{"id": p.RegionInfo.RegionId, "name": p.RegionInfo.RegionName}, 132 District: map[string]interface{}{"id": p.RegionInfo.RegionId, "name": p.RegionInfo.RegionName},
@@ -19,7 +19,7 @@ import ( @@ -19,7 +19,7 @@ import (
19 "strings" 19 "strings"
20 ) 20 )
21 21
22 -//用户信息 22 +//TODO 用户信息返回合伙人编号
23 func UserInfo(header *protocol.RequestHeader, request *protocol.UserInfoRequest) (rsp *protocol.UserInfoResponse, err error) { 23 func UserInfo(header *protocol.RequestHeader, request *protocol.UserInfoRequest) (rsp *protocol.UserInfoResponse, err error) {
24 var ( 24 var (
25 partnerInfo *domain.PartnerInfo 25 partnerInfo *domain.PartnerInfo
@@ -37,6 +37,7 @@ func UserInfo(header *protocol.RequestHeader, request *protocol.UserInfoRequest) @@ -37,6 +37,7 @@ func UserInfo(header *protocol.RequestHeader, request *protocol.UserInfoRequest)
37 defer func() { 37 defer func() {
38 transactionContext.RollbackTransaction() 38 transactionContext.RollbackTransaction()
39 }() 39 }()
  40 +
40 rsp = &protocol.UserInfoResponse{} 41 rsp = &protocol.UserInfoResponse{}
41 42
42 funcPartnerInfo := func() { 43 funcPartnerInfo := func() {
@@ -47,6 +48,7 @@ func UserInfo(header *protocol.RequestHeader, request *protocol.UserInfoRequest) @@ -47,6 +48,7 @@ func UserInfo(header *protocol.RequestHeader, request *protocol.UserInfoRequest)
47 if company, err = CompanyRepository.FindOne(map[string]interface{}{"id": header.CompanyId}); err != nil { 48 if company, err = CompanyRepository.FindOne(map[string]interface{}{"id": header.CompanyId}); err != nil {
48 return 49 return
49 } 50 }
  51 +
50 rsp.User = protocol.User{ 52 rsp.User = protocol.User{
51 Id: partnerInfo.Id, 53 Id: partnerInfo.Id,
52 PartnerName: partnerInfo.PartnerName, 54 PartnerName: partnerInfo.PartnerName,
@@ -231,15 +233,35 @@ func UserInfoV2(header *protocol.RequestHeader, request *protocol.UserInfoReques @@ -231,15 +233,35 @@ func UserInfoV2(header *protocol.RequestHeader, request *protocol.UserInfoReques
231 PartnerName: partnerInfo.PartnerName, 233 PartnerName: partnerInfo.PartnerName,
232 Phone: partnerInfo.Account, 234 Phone: partnerInfo.Account,
233 CooperateCompany: userx.Company{ 235 CooperateCompany: userx.Company{
234 - Id: company.Id,  
235 - Name: company.Name,  
236 - Phone: company.Phone,  
237 - SerialNo: partnerInfo.Id,  
238 - CooperateTime: partnerInfo.CooperateTime.Unix() * 1000,  
239 - MiniProgram: miniProgram,  
240 - District: map[string]interface{}{"id": partnerInfo.RegionInfo.RegionId, "name": partnerInfo.RegionInfo.RegionName}, 236 + Id: company.Id,
  237 + Name: company.Name,
  238 + Phone: company.Phone,
  239 + //SerialNo: partnerInfo.Id,
  240 + CareerSerialNo: "",
  241 + BusinessSerialNo: "",
  242 + DevelopSerialNo: "",
  243 + AppSerialNo: "",
  244 + CooperateTime: partnerInfo.CooperateTime.Unix() * 1000,
  245 + MiniProgram: miniProgram,
  246 + District: map[string]interface{}{"id": partnerInfo.RegionInfo.RegionId, "name": partnerInfo.RegionInfo.RegionName},
241 }, 247 },
242 } 248 }
  249 +
  250 + //TODO 获取合伙人分类
  251 +
  252 + //TODO 获取编号
  253 + for _, partnerCategoryInfo := range partnerInfo.PartnerCategoryInfos {
  254 + if partnerCategoryInfo.Id == 1 {
  255 + u.CooperateCompany.CareerSerialNo = partnerCategoryInfo.Code
  256 + } else if partnerCategoryInfo.Id == 2 {
  257 + u.CooperateCompany.BusinessSerialNo = partnerCategoryInfo.Code
  258 + } else if partnerCategoryInfo.Id == 3 {
  259 + u.CooperateCompany.DevelopSerialNo = partnerCategoryInfo.Code
  260 + } else if partnerCategoryInfo.Id == 4 {
  261 + u.CooperateCompany.AppSerialNo = partnerCategoryInfo.Code
  262 + }
  263 + }
  264 +
243 if len(partnerInfo.Salesman) > 0 { 265 if len(partnerInfo.Salesman) > 0 {
244 u.CooperateCompany.Salesman = map[string]interface{}{"uname": partnerInfo.Salesman[0].Name, "phone": partnerInfo.Salesman[0].Telephone} 266 u.CooperateCompany.Salesman = map[string]interface{}{"uname": partnerInfo.Salesman[0].Name, "phone": partnerInfo.Salesman[0].Telephone}
245 } else { 267 } else {
@@ -2,7 +2,7 @@ package domain @@ -2,7 +2,7 @@ package domain
2 2
3 import "gitlab.fjmaimaimai.com/mmm-go/partner/pkg/infrastructure/utils" 3 import "gitlab.fjmaimaimai.com/mmm-go/partner/pkg/infrastructure/utils"
4 4
5 -//分统计 5 +//分统计
6 type OrderStatics struct { 6 type OrderStatics struct {
7 //1:待支付分红 2:已支付分红 7 //1:待支付分红 2:已支付分红
8 BonusStatus int8 8 BonusStatus int8
@@ -6,6 +6,8 @@ type PartnerCategoryInfo struct { @@ -6,6 +6,8 @@ type PartnerCategoryInfo struct {
6 Id int64 `json:"id"` 6 Id int64 `json:"id"`
7 // 名称 7 // 名称
8 Name string `json:"name"` 8 Name string `json:"name"`
  9 + // 编码
  10 + Code string `json:"code"`
9 } 11 }
10 12
11 type PartnerCategoryInfoRepository interface { 13 type PartnerCategoryInfoRepository interface {
@@ -2,13 +2,7 @@ package domain @@ -2,13 +2,7 @@ package domain
2 2
3 import "time" 3 import "time"
4 4
5 -type PartnerInfoRepository interface {  
6 - Save(dm *PartnerInfo) (*PartnerInfo, error)  
7 - Remove(dm *PartnerInfo) (*PartnerInfo, error)  
8 - FindOne(queryOptions map[string]interface{}) (*PartnerInfo, error)  
9 - Find(queryOptions map[string]interface{}) (int64, []*PartnerInfo, error)  
10 -}  
11 - 5 +// 客户价值
12 type PartnerInfo struct { 6 type PartnerInfo struct {
13 // 合伙人ID 7 // 合伙人ID
14 Id int64 `json:"id"` 8 Id int64 `json:"id"`
@@ -38,6 +32,13 @@ type PartnerInfo struct { @@ -38,6 +32,13 @@ type PartnerInfo struct {
38 PartnerCategoryInfos []*PartnerCategoryInfo `partnerCategoryInfos` 32 PartnerCategoryInfos []*PartnerCategoryInfo `partnerCategoryInfos`
39 } 33 }
40 34
  35 +type PartnerInfoRepository interface {
  36 + Save(dm *PartnerInfo) (*PartnerInfo, error)
  37 + Remove(dm *PartnerInfo) (*PartnerInfo, error)
  38 + FindOne(queryOptions map[string]interface{}) (*PartnerInfo, error)
  39 + Find(queryOptions map[string]interface{}) (int64, []*PartnerInfo, error)
  40 +}
  41 +
41 func (m *PartnerInfo) Identify() interface{} { 42 func (m *PartnerInfo) Identify() interface{} {
42 if m.Id == 0 { 43 if m.Id == 0 {
43 return nil 44 return nil
@@ -7,4 +7,6 @@ type PartnerCategoryInfo struct { @@ -7,4 +7,6 @@ type PartnerCategoryInfo struct {
7 Id int64 7 Id int64
8 // 名称 8 // 名称
9 Name string 9 Name string
  10 + // 编号
  11 + Code string
10 } 12 }
@@ -26,13 +26,15 @@ type User struct { @@ -26,13 +26,15 @@ type User struct {
26 //合作编码 26 //合作编码
27 SerialNo int64 `json:"serialNo"` 27 SerialNo int64 `json:"serialNo"`
28 //合作时间 28 //合作时间
29 - CooperateTime int64 `json:"cooperationTime"`  
30 - Salesman interface{} `json:"salesman"`  
31 - 29 + CooperateTime int64 `json:"cooperationTime"`
  30 + //销售人员
  31 + Salesman interface{} `json:"salesman"`
32 // 网易云信 32 // 网易云信
33 - AccountID int64 `json:"accid"` // 网易云信ID  
34 - ImToken string `json:"imToken"` // 网易云信Token  
35 - CsAccountID string `json:"csAccountID"` // 分配的客服ID 33 + AccountID int64 `json:"accid"`
  34 + //网易云信Token
  35 + ImToken string `json:"imToken"`
  36 + //分配的客服ID
  37 + CsAccountID string `json:"csAccountID"`
36 } 38 }
37 39
38 type Company struct { 40 type Company struct {
@@ -7,11 +7,21 @@ type Company struct { @@ -7,11 +7,21 @@ type Company struct {
7 //合作区域 7 //合作区域
8 District interface{} `json:"district"` 8 District interface{} `json:"district"`
9 //合作编码 9 //合作编码
10 - SerialNo int64 `json:"serialNo"` 10 + //SerialNo int64 `json:"serialNo"`
  11 + //事业合作编号
  12 + CareerSerialNo string `json:"careerSerialNo"`
  13 + //业务合作编号
  14 + BusinessSerialNo string `json:"businessSerialNo"`
  15 + //研发合作编号
  16 + DevelopSerialNo string `json:"developSerialNo"`
  17 + //业务产品应用合作编号
  18 + AppSerialNo string `json:"appSerialNo"`
11 //合作时间 19 //合作时间
12 - CooperateTime int64 `json:"cooperationTime"`  
13 - Salesman interface{} `json:"salesman"`  
14 - MiniProgram interface{} `json:"miniProgram"` 20 + CooperateTime int64 `json:"cooperationTime"`
  21 + //销售人员
  22 + Salesman interface{} `json:"salesman"`
  23 + //小程序
  24 + MiniProgram interface{} `json:"miniProgram"`
15 } 25 }
16 type User struct { 26 type User struct {
17 Id int64 `json:"uid"` 27 Id int64 `json:"uid"`