作者 陈志颖

refactor:增加合伙人编号

... ... @@ -123,10 +123,10 @@ func newQueryOptionV2(request *protocolx.PartnersRequest) map[string]interface{}
func newCompany(company *domain.Company, p *domain.PartnerStatics) userx.Company {
partnerCompany := userx.Company{
Id: company.Id,
Name: company.Name,
Phone: company.Phone,
SerialNo: p.Id,
Id: company.Id,
Name: company.Name,
Phone: company.Phone,
//SerialNo: p.Id,
CooperateTime: p.CooperateTime.Unix() * 1000,
MiniProgram: nil,
District: map[string]interface{}{"id": p.RegionInfo.RegionId, "name": p.RegionInfo.RegionName},
... ...
... ... @@ -19,7 +19,7 @@ import (
"strings"
)
//用户信息
//TODO 用户信息返回合伙人编号
func UserInfo(header *protocol.RequestHeader, request *protocol.UserInfoRequest) (rsp *protocol.UserInfoResponse, err error) {
var (
partnerInfo *domain.PartnerInfo
... ... @@ -37,6 +37,7 @@ func UserInfo(header *protocol.RequestHeader, request *protocol.UserInfoRequest)
defer func() {
transactionContext.RollbackTransaction()
}()
rsp = &protocol.UserInfoResponse{}
funcPartnerInfo := func() {
... ... @@ -47,6 +48,7 @@ func UserInfo(header *protocol.RequestHeader, request *protocol.UserInfoRequest)
if company, err = CompanyRepository.FindOne(map[string]interface{}{"id": header.CompanyId}); err != nil {
return
}
rsp.User = protocol.User{
Id: partnerInfo.Id,
PartnerName: partnerInfo.PartnerName,
... ... @@ -231,15 +233,35 @@ func UserInfoV2(header *protocol.RequestHeader, request *protocol.UserInfoReques
PartnerName: partnerInfo.PartnerName,
Phone: partnerInfo.Account,
CooperateCompany: userx.Company{
Id: company.Id,
Name: company.Name,
Phone: company.Phone,
SerialNo: partnerInfo.Id,
CooperateTime: partnerInfo.CooperateTime.Unix() * 1000,
MiniProgram: miniProgram,
District: map[string]interface{}{"id": partnerInfo.RegionInfo.RegionId, "name": partnerInfo.RegionInfo.RegionName},
Id: company.Id,
Name: company.Name,
Phone: company.Phone,
//SerialNo: partnerInfo.Id,
CareerSerialNo: "",
BusinessSerialNo: "",
DevelopSerialNo: "",
AppSerialNo: "",
CooperateTime: partnerInfo.CooperateTime.Unix() * 1000,
MiniProgram: miniProgram,
District: map[string]interface{}{"id": partnerInfo.RegionInfo.RegionId, "name": partnerInfo.RegionInfo.RegionName},
},
}
//TODO 获取合伙人分类
//TODO 获取编号
for _, partnerCategoryInfo := range partnerInfo.PartnerCategoryInfos {
if partnerCategoryInfo.Id == 1 {
u.CooperateCompany.CareerSerialNo = partnerCategoryInfo.Code
} else if partnerCategoryInfo.Id == 2 {
u.CooperateCompany.BusinessSerialNo = partnerCategoryInfo.Code
} else if partnerCategoryInfo.Id == 3 {
u.CooperateCompany.DevelopSerialNo = partnerCategoryInfo.Code
} else if partnerCategoryInfo.Id == 4 {
u.CooperateCompany.AppSerialNo = partnerCategoryInfo.Code
}
}
if len(partnerInfo.Salesman) > 0 {
u.CooperateCompany.Salesman = map[string]interface{}{"uname": partnerInfo.Salesman[0].Name, "phone": partnerInfo.Salesman[0].Telephone}
} else {
... ...
... ... @@ -2,7 +2,7 @@ package domain
import "gitlab.fjmaimaimai.com/mmm-go/partner/pkg/infrastructure/utils"
//分统计
//分统计
type OrderStatics struct {
//1:待支付分红 2:已支付分红
BonusStatus int8
... ...
... ... @@ -6,6 +6,8 @@ type PartnerCategoryInfo struct {
Id int64 `json:"id"`
// 名称
Name string `json:"name"`
// 编码
Code string `json:"code"`
}
type PartnerCategoryInfoRepository interface {
... ...
... ... @@ -2,13 +2,7 @@ package domain
import "time"
type PartnerInfoRepository interface {
Save(dm *PartnerInfo) (*PartnerInfo, error)
Remove(dm *PartnerInfo) (*PartnerInfo, error)
FindOne(queryOptions map[string]interface{}) (*PartnerInfo, error)
Find(queryOptions map[string]interface{}) (int64, []*PartnerInfo, error)
}
// 客户价值
type PartnerInfo struct {
// 合伙人ID
Id int64 `json:"id"`
... ... @@ -38,6 +32,13 @@ type PartnerInfo struct {
PartnerCategoryInfos []*PartnerCategoryInfo `partnerCategoryInfos`
}
type PartnerInfoRepository interface {
Save(dm *PartnerInfo) (*PartnerInfo, error)
Remove(dm *PartnerInfo) (*PartnerInfo, error)
FindOne(queryOptions map[string]interface{}) (*PartnerInfo, error)
Find(queryOptions map[string]interface{}) (int64, []*PartnerInfo, error)
}
func (m *PartnerInfo) Identify() interface{} {
if m.Id == 0 {
return nil
... ...
... ... @@ -7,4 +7,6 @@ type PartnerCategoryInfo struct {
Id int64
// 名称
Name string
// 编号
Code string
}
... ...
... ... @@ -26,13 +26,15 @@ type User struct {
//合作编码
SerialNo int64 `json:"serialNo"`
//合作时间
CooperateTime int64 `json:"cooperationTime"`
Salesman interface{} `json:"salesman"`
CooperateTime int64 `json:"cooperationTime"`
//销售人员
Salesman interface{} `json:"salesman"`
// 网易云信
AccountID int64 `json:"accid"` // 网易云信ID
ImToken string `json:"imToken"` // 网易云信Token
CsAccountID string `json:"csAccountID"` // 分配的客服ID
AccountID int64 `json:"accid"`
//网易云信Token
ImToken string `json:"imToken"`
//分配的客服ID
CsAccountID string `json:"csAccountID"`
}
type Company struct {
... ...
... ... @@ -7,11 +7,21 @@ type Company struct {
//合作区域
District interface{} `json:"district"`
//合作编码
SerialNo int64 `json:"serialNo"`
//SerialNo int64 `json:"serialNo"`
//事业合作编号
CareerSerialNo string `json:"careerSerialNo"`
//业务合作编号
BusinessSerialNo string `json:"businessSerialNo"`
//研发合作编号
DevelopSerialNo string `json:"developSerialNo"`
//业务产品应用合作编号
AppSerialNo string `json:"appSerialNo"`
//合作时间
CooperateTime int64 `json:"cooperationTime"`
Salesman interface{} `json:"salesman"`
MiniProgram interface{} `json:"miniProgram"`
CooperateTime int64 `json:"cooperationTime"`
//销售人员
Salesman interface{} `json:"salesman"`
//小程序
MiniProgram interface{} `json:"miniProgram"`
}
type User struct {
Id int64 `json:"uid"`
... ...