|
@@ -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
|
|
|
@@ -123,10 +138,12 @@ func (svr *PgLoginService) PartnerStaticInfo() (interface{}, error) { |
|
@@ -123,10 +138,12 @@ func (svr *PgLoginService) PartnerStaticInfo() (interface{}, error) { |
|
123
|
response := make(map[string]interface{})
|
138
|
response := make(map[string]interface{})
|
|
124
|
response["id"] = protocolx.AdminTypePartner
|
139
|
response["id"] = protocolx.AdminTypePartner
|
|
125
|
response["name"] = protocolx.AdminTypePartnerName
|
140
|
response["name"] = protocolx.AdminTypePartnerName
|
|
|
|
141
|
+
|
|
126
|
if len(svr.PartnerInfo) == 0 {
|
142
|
if len(svr.PartnerInfo) == 0 {
|
|
127
|
response["companys"] = make([]struct{}, 0)
|
143
|
response["companys"] = make([]struct{}, 0)
|
|
128
|
return response, nil
|
144
|
return response, nil
|
|
129
|
}
|
145
|
}
|
|
|
|
146
|
+
|
|
130
|
var (
|
147
|
var (
|
|
131
|
OrderDao, _ = dao.NewOrderBaseDao(svr.transactionContext)
|
148
|
OrderDao, _ = dao.NewOrderBaseDao(svr.transactionContext)
|
|
132
|
BusinessBonusDao, _ = dao.NewBusinessBonusDao(svr.transactionContext)
|
149
|
BusinessBonusDao, _ = dao.NewBusinessBonusDao(svr.transactionContext)
|
|
@@ -137,6 +154,7 @@ func (svr *PgLoginService) PartnerStaticInfo() (interface{}, error) { |
|
@@ -137,6 +154,7 @@ func (svr *PgLoginService) PartnerStaticInfo() (interface{}, error) { |
|
137
|
UsersRepository, _ = repository.NewUsersRepository(svr.transactionContext)
|
154
|
UsersRepository, _ = repository.NewUsersRepository(svr.transactionContext)
|
|
138
|
adminApiGateway = http_gateway.NewHttplibBusinessAdminApiServiceGateway()
|
155
|
adminApiGateway = http_gateway.NewHttplibBusinessAdminApiServiceGateway()
|
|
139
|
)
|
156
|
)
|
|
|
|
157
|
+
|
|
140
|
doGetCompanyIds := func() []int64 {
|
158
|
doGetCompanyIds := func() []int64 {
|
|
141
|
var companies []int64
|
159
|
var companies []int64
|
|
142
|
for i := range svr.PartnerInfo {
|
160
|
for i := range svr.PartnerInfo {
|
|
@@ -144,6 +162,7 @@ func (svr *PgLoginService) PartnerStaticInfo() (interface{}, error) { |
|
@@ -144,6 +162,7 @@ func (svr *PgLoginService) PartnerStaticInfo() (interface{}, error) { |
|
144
|
}
|
162
|
}
|
|
145
|
return companies
|
163
|
return companies
|
|
146
|
}
|
164
|
}
|
|
|
|
165
|
+
|
|
147
|
doGetPartnerIds := func() []int64 {
|
166
|
doGetPartnerIds := func() []int64 {
|
|
148
|
var array []int64
|
167
|
var array []int64
|
|
149
|
for i := range svr.PartnerInfo {
|
168
|
for i := range svr.PartnerInfo {
|
|
@@ -151,17 +170,21 @@ func (svr *PgLoginService) PartnerStaticInfo() (interface{}, error) { |
|
@@ -151,17 +170,21 @@ func (svr *PgLoginService) PartnerStaticInfo() (interface{}, error) { |
|
151
|
}
|
170
|
}
|
|
152
|
return array
|
171
|
return array
|
|
153
|
}
|
172
|
}
|
|
|
|
173
|
+
|
|
154
|
companyList = svr.GetCompanyList(doGetCompanyIds)
|
174
|
companyList = svr.GetCompanyList(doGetCompanyIds)
|
|
155
|
if len(companyList) == 0 {
|
175
|
if len(companyList) == 0 {
|
|
156
|
return response, nil
|
176
|
return response, nil
|
|
157
|
}
|
177
|
}
|
|
|
|
178
|
+
|
|
158
|
totalBonus, e := OrderDao.OrderBonusStatics(domain.OrderBonusQuery{InPartnerIds: doGetPartnerIds(), OrderTypes: domain.UserOrderTypes(domain.Career)})
|
179
|
totalBonus, e := OrderDao.OrderBonusStatics(domain.OrderBonusQuery{InPartnerIds: doGetPartnerIds(), OrderTypes: domain.UserOrderTypes(domain.Career)})
|
|
159
|
if e != nil {
|
180
|
if e != nil {
|
|
160
|
return response, e
|
181
|
return response, e
|
|
161
|
}
|
182
|
}
|
|
|
|
183
|
+
|
|
162
|
if businessBonus, e := BusinessBonusDao.OrderBonusStatics(domain.OrderBonusQuery{InPartnerIds: doGetPartnerIds(), IsDisable: 1}); e == nil {
|
184
|
if businessBonus, e := BusinessBonusDao.OrderBonusStatics(domain.OrderBonusQuery{InPartnerIds: doGetPartnerIds(), IsDisable: 1}); e == nil {
|
|
163
|
totalBonus.Bonus += businessBonus.Bonus
|
185
|
totalBonus.Bonus += businessBonus.Bonus
|
|
164
|
}
|
186
|
}
|
|
|
|
187
|
+
|
|
165
|
_, allPartnerCategory, e = PartnerCategoryInfoRepository.Find(map[string]interface{}{"sortById": domain.ASC})
|
188
|
_, allPartnerCategory, e = PartnerCategoryInfoRepository.Find(map[string]interface{}{"sortById": domain.ASC})
|
|
166
|
var mapPartnerBussinessBonus = make(map[int64]*domain.BusinessBonus)
|
189
|
var mapPartnerBussinessBonus = make(map[int64]*domain.BusinessBonus)
|
|
167
|
if _, bussinessBonus, e := BusinessBonusRepository.Find(map[string]interface{}{"inPartnerIds": doGetPartnerIds(), "isDisable": 1}); e == nil {
|
190
|
if _, bussinessBonus, e := BusinessBonusRepository.Find(map[string]interface{}{"inPartnerIds": doGetPartnerIds(), "isDisable": 1}); e == nil {
|
|
@@ -224,6 +247,7 @@ func (svr *PgLoginService) PartnerStaticInfo() (interface{}, error) { |
|
@@ -224,6 +247,7 @@ func (svr *PgLoginService) PartnerStaticInfo() (interface{}, error) { |
|
224
|
return response, nil
|
247
|
return response, nil
|
|
225
|
}
|
248
|
}
|
|
226
|
|
249
|
|
|
|
|
250
|
+// 高管统计信息
|
|
227
|
func (svr *PgLoginService) ManagerStaticInfo() (interface{}, error) {
|
251
|
func (svr *PgLoginService) ManagerStaticInfo() (interface{}, error) {
|
|
228
|
response := make(map[string]interface{})
|
252
|
response := make(map[string]interface{})
|
|
229
|
response["id"] = protocolx.AdminTypeManager
|
253
|
response["id"] = protocolx.AdminTypeManager
|
|
@@ -392,11 +416,14 @@ func (svr *PgLoginService) RegistryGuest(phone string) error { |
|
@@ -392,11 +416,14 @@ func (svr *PgLoginService) RegistryGuest(phone string) error { |
|
392
|
PartnerInfoService, _ = repository.NewPartnerInfoRepository(svr.transactionContext)
|
416
|
PartnerInfoService, _ = repository.NewPartnerInfoRepository(svr.transactionContext)
|
|
393
|
UsersRepository, _ = repository.NewUsersRepository(svr.transactionContext)
|
417
|
UsersRepository, _ = repository.NewUsersRepository(svr.transactionContext)
|
|
394
|
)
|
418
|
)
|
|
|
|
419
|
+
|
|
395
|
partnerInfo, errPartner := PartnerInfoService.FindOne(map[string]interface{}{"account": phone})
|
420
|
partnerInfo, errPartner := PartnerInfoService.FindOne(map[string]interface{}{"account": phone})
|
|
396
|
user, errUser := UsersRepository.FindOne(map[string]interface{}{"phone": phone})
|
421
|
user, errUser := UsersRepository.FindOne(map[string]interface{}{"phone": phone})
|
|
|
|
422
|
+
|
|
397
|
if partnerInfo != nil || user != nil {
|
423
|
if partnerInfo != nil || user != nil {
|
|
398
|
return nil
|
424
|
return nil
|
|
399
|
}
|
425
|
}
|
|
|
|
426
|
+
|
|
400
|
if errUser != nil && errPartner != nil {
|
427
|
if errUser != nil && errPartner != nil {
|
|
401
|
id := time.Now().Unix()
|
428
|
id := time.Now().Unix()
|
|
402
|
errPartner = svr.transactionContext.PgDd.Insert(&models.PartnerInfo{
|
429
|
errPartner = svr.transactionContext.PgDd.Insert(&models.PartnerInfo{
|