作者 陈志颖

合并分支 'dev' 到 'master'

Dev



查看合并请求 !14
@@ -123,14 +123,32 @@ func newQueryOptionV2(request *protocolx.PartnersRequest) map[string]interface{} @@ -123,14 +123,32 @@ 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,  
130 - CooperateTime: p.CooperateTime.Unix() * 1000,  
131 - MiniProgram: nil,  
132 - District: map[string]interface{}{"id": p.RegionInfo.RegionId, "name": p.RegionInfo.RegionName}, 126 + Id: company.Id,
  127 + Name: company.Name,
  128 + Phone: company.Phone,
  129 + SerialNo: p.Id,
  130 + CareerSerialNo: "",
  131 + BusinessSerialNo: "",
  132 + DevelopSerialNo: "",
  133 + AppSerialNo: "",
  134 + CooperateTime: p.CooperateTime.Unix() * 1000,
  135 + MiniProgram: nil,
  136 + District: map[string]interface{}{"id": p.RegionInfo.RegionId, "name": p.RegionInfo.RegionName},
133 } 137 }
  138 +
  139 + //获取合伙人编号
  140 + for _, partnerCategoryInfo := range p.PartnerCategoryInfos {
  141 + if partnerCategoryInfo.Id == 1 {
  142 + partnerCompany.CareerSerialNo = partnerCategoryInfo.Code
  143 + } else if partnerCategoryInfo.Id == 2 {
  144 + partnerCompany.BusinessSerialNo = partnerCategoryInfo.Code
  145 + } else if partnerCategoryInfo.Id == 3 {
  146 + partnerCompany.DevelopSerialNo = partnerCategoryInfo.Code
  147 + } else if partnerCategoryInfo.Id == 4 {
  148 + partnerCompany.AppSerialNo = partnerCategoryInfo.Code
  149 + }
  150 + }
  151 +
134 if len(p.Salesman) > 0 { 152 if len(p.Salesman) > 0 {
135 partnerCompany.Salesman = map[string]interface{}{"uname": p.Salesman[0].Name, "phone": p.Salesman[0].Telephone} 153 partnerCompany.Salesman = map[string]interface{}{"uname": p.Salesman[0].Name, "phone": p.Salesman[0].Telephone}
136 } else { 154 } else {
@@ -19,7 +19,6 @@ import ( @@ -19,7 +19,6 @@ import (
19 "strings" 19 "strings"
20 ) 20 )
21 21
22 -//用户信息  
23 func UserInfo(header *protocol.RequestHeader, request *protocol.UserInfoRequest) (rsp *protocol.UserInfoResponse, err error) { 22 func UserInfo(header *protocol.RequestHeader, request *protocol.UserInfoRequest) (rsp *protocol.UserInfoResponse, err error) {
24 var ( 23 var (
25 partnerInfo *domain.PartnerInfo 24 partnerInfo *domain.PartnerInfo
@@ -37,6 +36,7 @@ func UserInfo(header *protocol.RequestHeader, request *protocol.UserInfoRequest) @@ -37,6 +36,7 @@ func UserInfo(header *protocol.RequestHeader, request *protocol.UserInfoRequest)
37 defer func() { 36 defer func() {
38 transactionContext.RollbackTransaction() 37 transactionContext.RollbackTransaction()
39 }() 38 }()
  39 +
40 rsp = &protocol.UserInfoResponse{} 40 rsp = &protocol.UserInfoResponse{}
41 41
42 funcPartnerInfo := func() { 42 funcPartnerInfo := func() {
@@ -47,6 +47,7 @@ func UserInfo(header *protocol.RequestHeader, request *protocol.UserInfoRequest) @@ -47,6 +47,7 @@ func UserInfo(header *protocol.RequestHeader, request *protocol.UserInfoRequest)
47 if company, err = CompanyRepository.FindOne(map[string]interface{}{"id": header.CompanyId}); err != nil { 47 if company, err = CompanyRepository.FindOne(map[string]interface{}{"id": header.CompanyId}); err != nil {
48 return 48 return
49 } 49 }
  50 +
50 rsp.User = protocol.User{ 51 rsp.User = protocol.User{
51 Id: partnerInfo.Id, 52 Id: partnerInfo.Id,
52 PartnerName: partnerInfo.PartnerName, 53 PartnerName: partnerInfo.PartnerName,
@@ -204,6 +205,7 @@ func UserInfoV2(header *protocol.RequestHeader, request *protocol.UserInfoReques @@ -204,6 +205,7 @@ func UserInfoV2(header *protocol.RequestHeader, request *protocol.UserInfoReques
204 }() 205 }()
205 rsp = &protocol.UserInfoResponse{} 206 rsp = &protocol.UserInfoResponse{}
206 rspMap := make(map[string]interface{}) 207 rspMap := make(map[string]interface{})
  208 +
207 funcPartnerInfo := func() { 209 funcPartnerInfo := func() {
208 if partnerInfo, err = PartnerInfoService.FindOne(map[string]interface{}{"id": header.UserId}); err != nil { 210 if partnerInfo, err = PartnerInfoService.FindOne(map[string]interface{}{"id": header.UserId}); err != nil {
209 err = protocol.NewErrWithMessage(502, err) //账号不存在 211 err = protocol.NewErrWithMessage(502, err) //账号不存在
@@ -231,15 +233,33 @@ func UserInfoV2(header *protocol.RequestHeader, request *protocol.UserInfoReques @@ -231,15 +233,33 @@ 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 + // 获取编号
  251 + for _, partnerCategoryInfo := range partnerInfo.PartnerCategoryInfos {
  252 + if partnerCategoryInfo.Id == 1 {
  253 + u.CooperateCompany.CareerSerialNo = partnerCategoryInfo.Code
  254 + } else if partnerCategoryInfo.Id == 2 {
  255 + u.CooperateCompany.BusinessSerialNo = partnerCategoryInfo.Code
  256 + } else if partnerCategoryInfo.Id == 3 {
  257 + u.CooperateCompany.DevelopSerialNo = partnerCategoryInfo.Code
  258 + } else if partnerCategoryInfo.Id == 4 {
  259 + u.CooperateCompany.AppSerialNo = partnerCategoryInfo.Code
  260 + }
  261 + }
  262 +
243 if len(partnerInfo.Salesman) > 0 { 263 if len(partnerInfo.Salesman) > 0 {
244 u.CooperateCompany.Salesman = map[string]interface{}{"uname": partnerInfo.Salesman[0].Name, "phone": partnerInfo.Salesman[0].Telephone} 264 u.CooperateCompany.Salesman = map[string]interface{}{"uname": partnerInfo.Salesman[0].Name, "phone": partnerInfo.Salesman[0].Telephone}
245 } else { 265 } else {
@@ -248,6 +268,7 @@ func UserInfoV2(header *protocol.RequestHeader, request *protocol.UserInfoReques @@ -248,6 +268,7 @@ func UserInfoV2(header *protocol.RequestHeader, request *protocol.UserInfoReques
248 rspMap["user"] = u 268 rspMap["user"] = u
249 rsp = rspMap 269 rsp = rspMap
250 } 270 }
  271 +
251 funcManagerInfo := func() { 272 funcManagerInfo := func() {
252 if user, err = UsersRepository.FindOne(map[string]interface{}{"id": header.UserId}); err != nil { 273 if user, err = UsersRepository.FindOne(map[string]interface{}{"id": header.UserId}); err != nil {
253 err = protocol.NewErrWithMessage(502, err) //账号不存在 274 err = protocol.NewErrWithMessage(502, err) //账号不存在
@@ -269,6 +290,7 @@ func UserInfoV2(header *protocol.RequestHeader, request *protocol.UserInfoReques @@ -269,6 +290,7 @@ func UserInfoV2(header *protocol.RequestHeader, request *protocol.UserInfoReques
269 } 290 }
270 rsp = rspMap 291 rsp = rspMap
271 } 292 }
  293 +
272 switch header.AdminType { 294 switch header.AdminType {
273 case int(protocolx.AdminTypePartner): 295 case int(protocolx.AdminTypePartner):
274 funcPartnerInfo() 296 funcPartnerInfo()
@@ -11,10 +11,10 @@ var LOG_LEVEL = "debug" @@ -11,10 +11,10 @@ var LOG_LEVEL = "debug"
11 var LOG_File = "app.log" 11 var LOG_File = "app.log"
12 12
13 var MMM_SMS_SERVICE_HOST = "https://sms.fjmaimaimai.com:9897" 13 var MMM_SMS_SERVICE_HOST = "https://sms.fjmaimaimai.com:9897"
14 -var UCENTER_SERVICE_HOST = "https://suplus-ucenter-dev.fjmaimaimai.com" 14 +var UCENTER_SERVICE_HOST = "https://suplus-ucenter-test.fjmaimaimai.com"
15 var UCENTER_APP_KEY = "0c2c2a23dfc64ae230f5c54ab243ab52" 15 var UCENTER_APP_KEY = "0c2c2a23dfc64ae230f5c54ab243ab52"
16 16
17 -var BUSINESS_ADMIN_SERVICE_HOST = "http://suplus-business-admin-dev.fjmaimaimai.com" 17 +var BUSINESS_ADMIN_SERVICE_HOST = "http://suplus-business-admin-test.fjmaimaimai.com"
18 var BUSINESS_ADMIN_PLATFORM_ID = "25" //合伙人模块 18 var BUSINESS_ADMIN_PLATFORM_ID = "25" //合伙人模块
19 19
20 var DEFAULT_GUEST_COMPANY int = 10011 20 var DEFAULT_GUEST_COMPANY int = 10011
@@ -2,11 +2,11 @@ package constant @@ -2,11 +2,11 @@ package constant
2 2
3 import "os" 3 import "os"
4 4
5 -var POSTGRESQL_DB_NAME = "partner_dev" //partner_test/partner_dev  
6 -var POSTGRESQL_USER = "postgres" //postgres  
7 -var POSTGRESQL_PASSWORD = "eagle1010" //pgsql@123/1993618jack  
8 -var POSTGRESQL_HOST = "114.55.200.59" //127.0.0.1/114.55.200.59  
9 -var POSTGRESQL_PORT = "31543" //5432/31543 5 +var POSTGRESQL_DB_NAME = "partner_test" //partner_test/partner_dev
  6 +var POSTGRESQL_USER = "postgres" //postgres
  7 +var POSTGRESQL_PASSWORD = "eagle1010" //pgsql@123/1993618jack
  8 +var POSTGRESQL_HOST = "114.55.200.59" //127.0.0.1/114.55.200.59
  9 +var POSTGRESQL_PORT = "31543" //5432/31543
10 var DISABLE_CREATE_TABLE = true 10 var DISABLE_CREATE_TABLE = true
11 var DISABLE_SQL_GENERATE_PRINT = false 11 var DISABLE_SQL_GENERATE_PRINT = false
12 12
@@ -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"`
@@ -36,6 +30,15 @@ type PartnerInfo struct { @@ -36,6 +30,15 @@ type PartnerInfo struct {
36 Salesman []*Salesman `json:"salesman"` 30 Salesman []*Salesman `json:"salesman"`
37 //合伙人分类信息 31 //合伙人分类信息
38 PartnerCategoryInfos []*PartnerCategoryInfo `partnerCategoryInfos` 32 PartnerCategoryInfos []*PartnerCategoryInfo `partnerCategoryInfos`
  33 + //备注
  34 + Remark string `json:"remark"`
  35 +}
  36 +
  37 +type PartnerInfoRepository interface {
  38 + Save(dm *PartnerInfo) (*PartnerInfo, error)
  39 + Remove(dm *PartnerInfo) (*PartnerInfo, error)
  40 + FindOne(queryOptions map[string]interface{}) (*PartnerInfo, error)
  41 + Find(queryOptions map[string]interface{}) (int64, []*PartnerInfo, error)
39 } 42 }
40 43
41 func (m *PartnerInfo) Identify() interface{} { 44 func (m *PartnerInfo) Identify() interface{} {
@@ -97,7 +97,7 @@ func (dao *PartnerInfoDao) Partners(partnerIds []int64, queryOptions map[string] @@ -97,7 +97,7 @@ func (dao *PartnerInfoDao) Partners(partnerIds []int64, queryOptions map[string]
97 filterPartners.WriteString(fmt.Sprintf(" and cooperate_time<to_timestamp(%v)", endTime)) 97 filterPartners.WriteString(fmt.Sprintf(" and cooperate_time<to_timestamp(%v)", endTime))
98 } 98 }
99 if keyword, ok := queryOptions["keyword"]; ok && keyword.(string) != "" { 99 if keyword, ok := queryOptions["keyword"]; ok && keyword.(string) != "" {
100 - filterPartners.WriteString(fmt.Sprintf(` and partner_name LIKE '%v'`, fmt.Sprintf("%%%s%%", "%%" + keyword.(string) + "%"))) 100 + filterPartners.WriteString(fmt.Sprintf(` and partner_name LIKE '%v'`, fmt.Sprintf("%%%s%%", "%%"+keyword.(string)+"%")))
101 } 101 }
102 102
103 sql.WriteString(fmt.Sprintf(` 103 sql.WriteString(fmt.Sprintf(`
@@ -22,7 +22,6 @@ type PartnerInfo struct { @@ -22,7 +22,6 @@ type PartnerInfo struct {
22 Status int `pg:",notnull,default:1"` 22 Status int `pg:",notnull,default:1"`
23 // 合伙类别 (1.研发合伙人 2.业务合伙人 3.事业) 23 // 合伙类别 (1.研发合伙人 2.业务合伙人 3.事业)
24 PartnerCategory int `pg:",notnull,default:1"` 24 PartnerCategory int `pg:",notnull,default:1"`
25 -  
26 //所属区域信息 25 //所属区域信息
27 RegionInfo *domain.RegionInfo 26 RegionInfo *domain.RegionInfo
28 //合作时间 27 //合作时间
@@ -31,9 +30,10 @@ type PartnerInfo struct { @@ -31,9 +30,10 @@ type PartnerInfo struct {
31 CreateAt time.Time 30 CreateAt time.Time
32 //更新时间 31 //更新时间
33 UpdateAt time.Time 32 UpdateAt time.Time
34 -  
35 //关联业务员 33 //关联业务员
36 Salesman []*domain.Salesman 34 Salesman []*domain.Salesman
37 //合伙人分类信息 35 //合伙人分类信息
38 PartnerCategoryInfos []*PartnerCategoryInfo 36 PartnerCategoryInfos []*PartnerCategoryInfo
  37 + //备注
  38 + Remark string
39 } 39 }
@@ -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 {
@@ -8,10 +8,20 @@ type Company struct { @@ -8,10 +8,20 @@ type Company struct {
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"`