...
|
...
|
@@ -362,49 +362,42 @@ func computeBonusPercent(totalBonus float64, bonus float64) float64 { |
|
|
|
|
|
/**
|
|
|
* @Author SteveChan
|
|
|
* @Description //TODO 注册用户到合伙人
|
|
|
* @Description // 注册用户到合伙人
|
|
|
* @Date 13:52 2021/1/13
|
|
|
* @Param
|
|
|
* @return
|
|
|
**/
|
|
|
func (svr *PgLoginService) RegistryPartner(phone string, users []*domain.Users) error {
|
|
|
func (svr *PgLoginService) RegistryUser(phone string) error {
|
|
|
var (
|
|
|
PartnerInfoService, _ = repository.NewPartnerInfoRepository(svr.transactionContext)
|
|
|
//UsersRepository, _ = repository.NewUsersRepository(svr.transactionContext)
|
|
|
)
|
|
|
|
|
|
partnerInfo, errPartner := PartnerInfoService.FindOne(map[string]interface{}{"account": phone})
|
|
|
|
|
|
//user, errUser := UsersRepository.FindOne(map[string]interface{}{"phone": phone})
|
|
|
|
|
|
if partnerInfo != nil {
|
|
|
return nil
|
|
|
}
|
|
|
|
|
|
for _, user := range users {
|
|
|
if user.IsSenior == 2 { // 插入合伙人到非高管公司
|
|
|
if errPartner != nil {
|
|
|
id := time.Now().Unix()
|
|
|
errPartner = svr.transactionContext.PgDd.Insert(&models.PartnerInfo{
|
|
|
Id: id,
|
|
|
CompanyId: user.CompanyId,
|
|
|
PartnerName: phone,
|
|
|
Account: phone,
|
|
|
Password: "7c4a8d09ca3762af61e59520943dc26494f8941b",
|
|
|
Status: 1,
|
|
|
PartnerCategory: 1,
|
|
|
RegionInfo: &domain.RegionInfo{
|
|
|
RegionName: "客户区域",
|
|
|
RegionId: 0,
|
|
|
},
|
|
|
CooperateTime: time.Now(),
|
|
|
CreateAt: time.Now(),
|
|
|
UpdateAt: time.Now(),
|
|
|
PartnerCategoryInfos: []*models.PartnerCategoryInfo{&models.PartnerCategoryInfo{Id: 1}},
|
|
|
Salesman: []*domain.Salesman{&domain.Salesman{Name: phone, Telephone: phone}},
|
|
|
})
|
|
|
}
|
|
|
}
|
|
|
if errPartner != nil {
|
|
|
id := time.Now().Unix()
|
|
|
errPartner = svr.transactionContext.PgDd.Insert(&models.PartnerInfo{
|
|
|
Id: id,
|
|
|
CompanyId: int64(constant.DEFAULT_GUEST_COMPANY),
|
|
|
PartnerName: phone,
|
|
|
Account: phone,
|
|
|
Password: "7c4a8d09ca3762af61e59520943dc26494f8941b",
|
|
|
Status: 1,
|
|
|
PartnerCategory: 1,
|
|
|
RegionInfo: &domain.RegionInfo{
|
|
|
RegionName: "客户区域",
|
|
|
RegionId: 0,
|
|
|
},
|
|
|
CooperateTime: time.Now(),
|
|
|
CreateAt: time.Now(),
|
|
|
UpdateAt: time.Now(),
|
|
|
PartnerCategoryInfos: []*models.PartnerCategoryInfo{&models.PartnerCategoryInfo{Id: 1}},
|
|
|
Salesman: []*domain.Salesman{&domain.Salesman{Name: phone, Telephone: phone}},
|
|
|
})
|
|
|
}
|
|
|
|
|
|
return errPartner
|
...
|
...
|
|