|
@@ -32,9 +32,24 @@ func (svr *PgLoginService) Init(phone string) (err error) { |
|
@@ -32,9 +32,24 @@ func (svr *PgLoginService) Init(phone string) (err error) { |
32
|
PartnerInfoService, _ = repository.NewPartnerInfoRepository(svr.transactionContext)
|
32
|
PartnerInfoService, _ = repository.NewPartnerInfoRepository(svr.transactionContext)
|
33
|
UsersRepository, _ = repository.NewUsersRepository(svr.transactionContext)
|
33
|
UsersRepository, _ = repository.NewUsersRepository(svr.transactionContext)
|
34
|
)
|
34
|
)
|
|
|
35
|
+
|
35
|
svr.Phone = phone
|
36
|
svr.Phone = phone
|
|
|
37
|
+
|
36
|
_, svr.PartnerInfo, err = PartnerInfoService.Find(map[string]interface{}{"account": phone, "status": 1, "sortByCreateTime": "ASC"})
|
38
|
_, svr.PartnerInfo, err = PartnerInfoService.Find(map[string]interface{}{"account": phone, "status": 1, "sortByCreateTime": "ASC"})
|
37
|
_, svr.Users, err = UsersRepository.Find(map[string]interface{}{"phone": phone, "status": 1, "sortByCreateTime": "ASC", "deleteAtIsNull": true})
|
39
|
_, svr.Users, err = UsersRepository.Find(map[string]interface{}{"phone": phone, "status": 1, "sortByCreateTime": "ASC", "deleteAtIsNull": true})
|
|
|
40
|
+
|
|
|
41
|
+ return nil
|
|
|
42
|
+}
|
|
|
43
|
+
|
|
|
44
|
+func (svr *PgLoginService) InitSenior(phone string) (err error) {
|
|
|
45
|
+ var (
|
|
|
46
|
+ UsersRepository, _ = repository.NewUsersRepository(svr.transactionContext)
|
|
|
47
|
+ )
|
|
|
48
|
+
|
|
|
49
|
+ svr.Phone = phone
|
|
|
50
|
+
|
|
|
51
|
+ _, svr.Users, err = UsersRepository.Find(map[string]interface{}{"phone": phone, "status": 1, "sortByCreateTime": "ASC", "deleteAtIsNull": true, "isSenior": 1})
|
|
|
52
|
+
|
38
|
return nil
|
53
|
return nil
|
39
|
}
|
54
|
}
|
40
|
|
55
|
|
|
@@ -73,10 +88,12 @@ func (svr *PgLoginService) PartnerStaticInfo() (interface{}, error) { |
|
@@ -73,10 +88,12 @@ func (svr *PgLoginService) PartnerStaticInfo() (interface{}, error) { |
73
|
response := make(map[string]interface{})
|
88
|
response := make(map[string]interface{})
|
74
|
response["id"] = protocolx.AdminTypePartner
|
89
|
response["id"] = protocolx.AdminTypePartner
|
75
|
response["name"] = protocolx.AdminTypePartnerName
|
90
|
response["name"] = protocolx.AdminTypePartnerName
|
|
|
91
|
+
|
76
|
if len(svr.PartnerInfo) == 0 {
|
92
|
if len(svr.PartnerInfo) == 0 {
|
77
|
response["companys"] = make([]struct{}, 0)
|
93
|
response["companys"] = make([]struct{}, 0)
|
78
|
return response, nil
|
94
|
return response, nil
|
79
|
}
|
95
|
}
|
|
|
96
|
+
|
80
|
var (
|
97
|
var (
|
81
|
OrderDao, _ = dao.NewOrderBaseDao(svr.transactionContext)
|
98
|
OrderDao, _ = dao.NewOrderBaseDao(svr.transactionContext)
|
82
|
BusinessBonusDao, _ = dao.NewBusinessBonusDao(svr.transactionContext)
|
99
|
BusinessBonusDao, _ = dao.NewBusinessBonusDao(svr.transactionContext)
|
|
@@ -87,6 +104,7 @@ func (svr *PgLoginService) PartnerStaticInfo() (interface{}, error) { |
|
@@ -87,6 +104,7 @@ func (svr *PgLoginService) PartnerStaticInfo() (interface{}, error) { |
87
|
UsersRepository, _ = repository.NewUsersRepository(svr.transactionContext)
|
104
|
UsersRepository, _ = repository.NewUsersRepository(svr.transactionContext)
|
88
|
adminApiGateway = http_gateway.NewHttplibBusinessAdminApiServiceGateway()
|
105
|
adminApiGateway = http_gateway.NewHttplibBusinessAdminApiServiceGateway()
|
89
|
)
|
106
|
)
|
|
|
107
|
+
|
90
|
doGetCompanyIds := func() []int64 {
|
108
|
doGetCompanyIds := func() []int64 {
|
91
|
var companies []int64
|
109
|
var companies []int64
|
92
|
for i := range svr.PartnerInfo {
|
110
|
for i := range svr.PartnerInfo {
|
|
@@ -94,6 +112,7 @@ func (svr *PgLoginService) PartnerStaticInfo() (interface{}, error) { |
|
@@ -94,6 +112,7 @@ func (svr *PgLoginService) PartnerStaticInfo() (interface{}, error) { |
94
|
}
|
112
|
}
|
95
|
return companies
|
113
|
return companies
|
96
|
}
|
114
|
}
|
|
|
115
|
+
|
97
|
doGetPartnerIds := func() []int64 {
|
116
|
doGetPartnerIds := func() []int64 {
|
98
|
var array []int64
|
117
|
var array []int64
|
99
|
for i := range svr.PartnerInfo {
|
118
|
for i := range svr.PartnerInfo {
|
|
@@ -101,17 +120,21 @@ func (svr *PgLoginService) PartnerStaticInfo() (interface{}, error) { |
|
@@ -101,17 +120,21 @@ func (svr *PgLoginService) PartnerStaticInfo() (interface{}, error) { |
101
|
}
|
120
|
}
|
102
|
return array
|
121
|
return array
|
103
|
}
|
122
|
}
|
|
|
123
|
+
|
104
|
companyList = svr.GetCompanyList(doGetCompanyIds)
|
124
|
companyList = svr.GetCompanyList(doGetCompanyIds)
|
105
|
if len(companyList) == 0 {
|
125
|
if len(companyList) == 0 {
|
106
|
return response, nil
|
126
|
return response, nil
|
107
|
}
|
127
|
}
|
|
|
128
|
+
|
108
|
totalBonus, e := OrderDao.OrderBonusStatics(domain.OrderBonusQuery{InPartnerIds: doGetPartnerIds(), OrderTypes: domain.UserOrderTypes(domain.Career)})
|
129
|
totalBonus, e := OrderDao.OrderBonusStatics(domain.OrderBonusQuery{InPartnerIds: doGetPartnerIds(), OrderTypes: domain.UserOrderTypes(domain.Career)})
|
109
|
if e != nil {
|
130
|
if e != nil {
|
110
|
return response, e
|
131
|
return response, e
|
111
|
}
|
132
|
}
|
|
|
133
|
+
|
112
|
if businessBonus, e := BusinessBonusDao.OrderBonusStatics(domain.OrderBonusQuery{InPartnerIds: doGetPartnerIds(), IsDisable: 1}); e == nil {
|
134
|
if businessBonus, e := BusinessBonusDao.OrderBonusStatics(domain.OrderBonusQuery{InPartnerIds: doGetPartnerIds(), IsDisable: 1}); e == nil {
|
113
|
totalBonus.Bonus += businessBonus.Bonus
|
135
|
totalBonus.Bonus += businessBonus.Bonus
|
114
|
}
|
136
|
}
|
|
|
137
|
+
|
115
|
_, allPartnerCategory, e = PartnerCategoryInfoRepository.Find(map[string]interface{}{"sortById": domain.ASC})
|
138
|
_, allPartnerCategory, e = PartnerCategoryInfoRepository.Find(map[string]interface{}{"sortById": domain.ASC})
|
116
|
var mapPartnerBussinessBonus = make(map[int64]*domain.BusinessBonus)
|
139
|
var mapPartnerBussinessBonus = make(map[int64]*domain.BusinessBonus)
|
117
|
if _, bussinessBonus, e := BusinessBonusRepository.Find(map[string]interface{}{"inPartnerIds": doGetPartnerIds(), "isDisable": 1}); e == nil {
|
140
|
if _, bussinessBonus, e := BusinessBonusRepository.Find(map[string]interface{}{"inPartnerIds": doGetPartnerIds(), "isDisable": 1}); e == nil {
|
|
@@ -173,6 +196,8 @@ func (svr *PgLoginService) PartnerStaticInfo() (interface{}, error) { |
|
@@ -173,6 +196,8 @@ func (svr *PgLoginService) PartnerStaticInfo() (interface{}, error) { |
173
|
response["companys"] = companys
|
196
|
response["companys"] = companys
|
174
|
return response, nil
|
197
|
return response, nil
|
175
|
}
|
198
|
}
|
|
|
199
|
+
|
|
|
200
|
+// 高管统计信息
|
176
|
func (svr *PgLoginService) ManagerStaticInfo() (interface{}, error) {
|
201
|
func (svr *PgLoginService) ManagerStaticInfo() (interface{}, error) {
|
177
|
response := make(map[string]interface{})
|
202
|
response := make(map[string]interface{})
|
178
|
response["id"] = protocolx.AdminTypeManager
|
203
|
response["id"] = protocolx.AdminTypeManager
|
|
@@ -290,11 +315,14 @@ func (svr *PgLoginService) RegistryGuest(phone string) error { |
|
@@ -290,11 +315,14 @@ func (svr *PgLoginService) RegistryGuest(phone string) error { |
290
|
PartnerInfoService, _ = repository.NewPartnerInfoRepository(svr.transactionContext)
|
315
|
PartnerInfoService, _ = repository.NewPartnerInfoRepository(svr.transactionContext)
|
291
|
UsersRepository, _ = repository.NewUsersRepository(svr.transactionContext)
|
316
|
UsersRepository, _ = repository.NewUsersRepository(svr.transactionContext)
|
292
|
)
|
317
|
)
|
|
|
318
|
+
|
293
|
partnerInfo, errPartner := PartnerInfoService.FindOne(map[string]interface{}{"account": phone})
|
319
|
partnerInfo, errPartner := PartnerInfoService.FindOne(map[string]interface{}{"account": phone})
|
294
|
user, errUser := UsersRepository.FindOne(map[string]interface{}{"phone": phone})
|
320
|
user, errUser := UsersRepository.FindOne(map[string]interface{}{"phone": phone})
|
|
|
321
|
+
|
295
|
if partnerInfo != nil || user != nil {
|
322
|
if partnerInfo != nil || user != nil {
|
296
|
return nil
|
323
|
return nil
|
297
|
}
|
324
|
}
|
|
|
325
|
+
|
298
|
if errUser != nil && errPartner != nil {
|
326
|
if errUser != nil && errPartner != nil {
|
299
|
id := time.Now().Unix()
|
327
|
id := time.Now().Unix()
|
300
|
errPartner = svr.transactionContext.PgDd.Insert(&models.PartnerInfo{
|
328
|
errPartner = svr.transactionContext.PgDd.Insert(&models.PartnerInfo{
|