作者 陈志颖

合并分支 'dev' 到 'master'

Dev



查看合并请求 !14
... ... @@ -123,14 +123,32 @@ 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,
CooperateTime: p.CooperateTime.Unix() * 1000,
MiniProgram: nil,
District: map[string]interface{}{"id": p.RegionInfo.RegionId, "name": p.RegionInfo.RegionName},
Id: company.Id,
Name: company.Name,
Phone: company.Phone,
SerialNo: p.Id,
CareerSerialNo: "",
BusinessSerialNo: "",
DevelopSerialNo: "",
AppSerialNo: "",
CooperateTime: p.CooperateTime.Unix() * 1000,
MiniProgram: nil,
District: map[string]interface{}{"id": p.RegionInfo.RegionId, "name": p.RegionInfo.RegionName},
}
//获取合伙人编号
for _, partnerCategoryInfo := range p.PartnerCategoryInfos {
if partnerCategoryInfo.Id == 1 {
partnerCompany.CareerSerialNo = partnerCategoryInfo.Code
} else if partnerCategoryInfo.Id == 2 {
partnerCompany.BusinessSerialNo = partnerCategoryInfo.Code
} else if partnerCategoryInfo.Id == 3 {
partnerCompany.DevelopSerialNo = partnerCategoryInfo.Code
} else if partnerCategoryInfo.Id == 4 {
partnerCompany.AppSerialNo = partnerCategoryInfo.Code
}
}
if len(p.Salesman) > 0 {
partnerCompany.Salesman = map[string]interface{}{"uname": p.Salesman[0].Name, "phone": p.Salesman[0].Telephone}
} else {
... ...
... ... @@ -19,7 +19,6 @@ import (
"strings"
)
//用户信息
func UserInfo(header *protocol.RequestHeader, request *protocol.UserInfoRequest) (rsp *protocol.UserInfoResponse, err error) {
var (
partnerInfo *domain.PartnerInfo
... ... @@ -37,6 +36,7 @@ func UserInfo(header *protocol.RequestHeader, request *protocol.UserInfoRequest)
defer func() {
transactionContext.RollbackTransaction()
}()
rsp = &protocol.UserInfoResponse{}
funcPartnerInfo := func() {
... ... @@ -47,6 +47,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,
... ... @@ -204,6 +205,7 @@ func UserInfoV2(header *protocol.RequestHeader, request *protocol.UserInfoReques
}()
rsp = &protocol.UserInfoResponse{}
rspMap := make(map[string]interface{})
funcPartnerInfo := func() {
if partnerInfo, err = PartnerInfoService.FindOne(map[string]interface{}{"id": header.UserId}); err != nil {
err = protocol.NewErrWithMessage(502, err) //账号不存在
... ... @@ -231,15 +233,33 @@ 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},
},
}
// 获取编号
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 {
... ... @@ -248,6 +268,7 @@ func UserInfoV2(header *protocol.RequestHeader, request *protocol.UserInfoReques
rspMap["user"] = u
rsp = rspMap
}
funcManagerInfo := func() {
if user, err = UsersRepository.FindOne(map[string]interface{}{"id": header.UserId}); err != nil {
err = protocol.NewErrWithMessage(502, err) //账号不存在
... ... @@ -269,6 +290,7 @@ func UserInfoV2(header *protocol.RequestHeader, request *protocol.UserInfoReques
}
rsp = rspMap
}
switch header.AdminType {
case int(protocolx.AdminTypePartner):
funcPartnerInfo()
... ...
... ... @@ -11,10 +11,10 @@ var LOG_LEVEL = "debug"
var LOG_File = "app.log"
var MMM_SMS_SERVICE_HOST = "https://sms.fjmaimaimai.com:9897"
var UCENTER_SERVICE_HOST = "https://suplus-ucenter-dev.fjmaimaimai.com"
var UCENTER_SERVICE_HOST = "https://suplus-ucenter-test.fjmaimaimai.com"
var UCENTER_APP_KEY = "0c2c2a23dfc64ae230f5c54ab243ab52"
var BUSINESS_ADMIN_SERVICE_HOST = "http://suplus-business-admin-dev.fjmaimaimai.com"
var BUSINESS_ADMIN_SERVICE_HOST = "http://suplus-business-admin-test.fjmaimaimai.com"
var BUSINESS_ADMIN_PLATFORM_ID = "25" //合伙人模块
var DEFAULT_GUEST_COMPANY int = 10011
... ...
... ... @@ -2,11 +2,11 @@ package constant
import "os"
var POSTGRESQL_DB_NAME = "partner_dev" //partner_test/partner_dev
var POSTGRESQL_USER = "postgres" //postgres
var POSTGRESQL_PASSWORD = "eagle1010" //pgsql@123/1993618jack
var POSTGRESQL_HOST = "114.55.200.59" //127.0.0.1/114.55.200.59
var POSTGRESQL_PORT = "31543" //5432/31543
var POSTGRESQL_DB_NAME = "partner_test" //partner_test/partner_dev
var POSTGRESQL_USER = "postgres" //postgres
var POSTGRESQL_PASSWORD = "eagle1010" //pgsql@123/1993618jack
var POSTGRESQL_HOST = "114.55.200.59" //127.0.0.1/114.55.200.59
var POSTGRESQL_PORT = "31543" //5432/31543
var DISABLE_CREATE_TABLE = true
var DISABLE_SQL_GENERATE_PRINT = false
... ...
... ... @@ -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"`
... ... @@ -36,6 +30,15 @@ type PartnerInfo struct {
Salesman []*Salesman `json:"salesman"`
//合伙人分类信息
PartnerCategoryInfos []*PartnerCategoryInfo `partnerCategoryInfos`
//备注
Remark string `json:"remark"`
}
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{} {
... ...
... ... @@ -97,7 +97,7 @@ func (dao *PartnerInfoDao) Partners(partnerIds []int64, queryOptions map[string]
filterPartners.WriteString(fmt.Sprintf(" and cooperate_time<to_timestamp(%v)", endTime))
}
if keyword, ok := queryOptions["keyword"]; ok && keyword.(string) != "" {
filterPartners.WriteString(fmt.Sprintf(` and partner_name LIKE '%v'`, fmt.Sprintf("%%%s%%", "%%" + keyword.(string) + "%")))
filterPartners.WriteString(fmt.Sprintf(` and partner_name LIKE '%v'`, fmt.Sprintf("%%%s%%", "%%"+keyword.(string)+"%")))
}
sql.WriteString(fmt.Sprintf(`
... ...
... ... @@ -22,7 +22,6 @@ type PartnerInfo struct {
Status int `pg:",notnull,default:1"`
// 合伙类别 (1.研发合伙人 2.业务合伙人 3.事业)
PartnerCategory int `pg:",notnull,default:1"`
//所属区域信息
RegionInfo *domain.RegionInfo
//合作时间
... ... @@ -31,9 +30,10 @@ type PartnerInfo struct {
CreateAt time.Time
//更新时间
UpdateAt time.Time
//关联业务员
Salesman []*domain.Salesman
//合伙人分类信息
PartnerCategoryInfos []*PartnerCategoryInfo
//备注
Remark string
}
... ...
... ... @@ -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 {
... ...
... ... @@ -8,10 +8,20 @@ type Company struct {
District interface{} `json:"district"`
//合作编码
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"`
... ...