|
@@ -362,49 +362,42 @@ func computeBonusPercent(totalBonus float64, bonus float64) float64 { |
|
@@ -362,49 +362,42 @@ func computeBonusPercent(totalBonus float64, bonus float64) float64 { |
362
|
|
362
|
|
363
|
/**
|
363
|
/**
|
364
|
* @Author SteveChan
|
364
|
* @Author SteveChan
|
365
|
- * @Description //TODO 注册用户到合伙人
|
365
|
+ * @Description // 注册用户到合伙人
|
366
|
* @Date 13:52 2021/1/13
|
366
|
* @Date 13:52 2021/1/13
|
367
|
* @Param
|
367
|
* @Param
|
368
|
* @return
|
368
|
* @return
|
369
|
**/
|
369
|
**/
|
370
|
-func (svr *PgLoginService) RegistryPartner(phone string, users []*domain.Users) error {
|
370
|
+func (svr *PgLoginService) RegistryUser(phone string) error {
|
371
|
var (
|
371
|
var (
|
372
|
PartnerInfoService, _ = repository.NewPartnerInfoRepository(svr.transactionContext)
|
372
|
PartnerInfoService, _ = repository.NewPartnerInfoRepository(svr.transactionContext)
|
373
|
- //UsersRepository, _ = repository.NewUsersRepository(svr.transactionContext)
|
|
|
374
|
)
|
373
|
)
|
375
|
|
374
|
|
376
|
partnerInfo, errPartner := PartnerInfoService.FindOne(map[string]interface{}{"account": phone})
|
375
|
partnerInfo, errPartner := PartnerInfoService.FindOne(map[string]interface{}{"account": phone})
|
377
|
|
376
|
|
378
|
- //user, errUser := UsersRepository.FindOne(map[string]interface{}{"phone": phone})
|
|
|
379
|
-
|
|
|
380
|
if partnerInfo != nil {
|
377
|
if partnerInfo != nil {
|
381
|
return nil
|
378
|
return nil
|
382
|
}
|
379
|
}
|
383
|
|
380
|
|
384
|
- for _, user := range users {
|
|
|
385
|
- if user.IsSenior == 2 { // 插入合伙人到非高管公司
|
|
|
386
|
- if errPartner != nil {
|
|
|
387
|
- id := time.Now().Unix()
|
|
|
388
|
- errPartner = svr.transactionContext.PgDd.Insert(&models.PartnerInfo{
|
|
|
389
|
- Id: id,
|
|
|
390
|
- CompanyId: user.CompanyId,
|
|
|
391
|
- PartnerName: phone,
|
|
|
392
|
- Account: phone,
|
|
|
393
|
- Password: "7c4a8d09ca3762af61e59520943dc26494f8941b",
|
|
|
394
|
- Status: 1,
|
|
|
395
|
- PartnerCategory: 1,
|
|
|
396
|
- RegionInfo: &domain.RegionInfo{
|
|
|
397
|
- RegionName: "客户区域",
|
|
|
398
|
- RegionId: 0,
|
|
|
399
|
- },
|
|
|
400
|
- CooperateTime: time.Now(),
|
|
|
401
|
- CreateAt: time.Now(),
|
|
|
402
|
- UpdateAt: time.Now(),
|
|
|
403
|
- PartnerCategoryInfos: []*models.PartnerCategoryInfo{&models.PartnerCategoryInfo{Id: 1}},
|
|
|
404
|
- Salesman: []*domain.Salesman{&domain.Salesman{Name: phone, Telephone: phone}},
|
|
|
405
|
- })
|
|
|
406
|
- }
|
|
|
407
|
- }
|
381
|
+ if errPartner != nil {
|
|
|
382
|
+ id := time.Now().Unix()
|
|
|
383
|
+ errPartner = svr.transactionContext.PgDd.Insert(&models.PartnerInfo{
|
|
|
384
|
+ Id: id,
|
|
|
385
|
+ CompanyId: int64(constant.DEFAULT_GUEST_COMPANY),
|
|
|
386
|
+ PartnerName: phone,
|
|
|
387
|
+ Account: phone,
|
|
|
388
|
+ Password: "7c4a8d09ca3762af61e59520943dc26494f8941b",
|
|
|
389
|
+ Status: 1,
|
|
|
390
|
+ PartnerCategory: 1,
|
|
|
391
|
+ RegionInfo: &domain.RegionInfo{
|
|
|
392
|
+ RegionName: "客户区域",
|
|
|
393
|
+ RegionId: 0,
|
|
|
394
|
+ },
|
|
|
395
|
+ CooperateTime: time.Now(),
|
|
|
396
|
+ CreateAt: time.Now(),
|
|
|
397
|
+ UpdateAt: time.Now(),
|
|
|
398
|
+ PartnerCategoryInfos: []*models.PartnerCategoryInfo{&models.PartnerCategoryInfo{Id: 1}},
|
|
|
399
|
+ Salesman: []*domain.Salesman{&domain.Salesman{Name: phone, Telephone: phone}},
|
|
|
400
|
+ })
|
408
|
}
|
401
|
}
|
409
|
|
402
|
|
410
|
return errPartner
|
403
|
return errPartner
|