作者 陈志颖

fix:游客权限修复

... ... @@ -390,7 +390,7 @@ func (svr *PgLoginService) RegistryUser(phone string) error {
)
partnerInfo, errPartner := PartnerInfoService.FindOne(map[string]interface{}{"account": phone, "isNot": constant.DEFAULT_GUEST_COMPANY}) // 合伙人是否存在
guestInfo, _ := PartnerInfoService.FindOne(map[string]interface{}{"account": phone, "companyId": constant.DEFAULT_GUEST_COMPANY}) // 合伙人是否存在
guestInfo, _ := PartnerInfoService.FindOne(map[string]interface{}{"account": phone, "companyId": constant.DEFAULT_GUEST_COMPANY}) // 合伙人是否存在游客公司
user, errUser := UsersRepository.FindOne(map[string]interface{}{"phone": phone, "deleteAtIsNull": true}) // 用户是否存在
senior, errSenior := UsersRepository.FindOne(map[string]interface{}{"phone": phone, "isSenior": 2, "deleteAtIsNull": true}) // 用户是否是高管
... ... @@ -398,11 +398,36 @@ func (svr *PgLoginService) RegistryUser(phone string) error {
fmt.Print(user, "\n")
fmt.Print(senior, "\n")
// 游客公司合伙人存在,更新合伙人转台
if guestInfo != nil {
_, err := svr.transactionContext.PgTx.Model(&models.PartnerInfo{
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}}}).
Where("partner_info.account = ?", phone).
Where("partner_info.company_id = ?", constant.DEFAULT_GUEST_COMPANY).
Update()
if err != nil {
return err
}
}
// 合伙人存在、用户存在、是高管(高管合伙人)
// 合伙人不存在、用户存在、是高管(高管)|| partnerInfo == nil && user != nil && senior != nil
// 合伙人存在、用户存在、非高管(合伙人)
// 游客公司合伙人存在
if partnerInfo != nil && user != nil && senior != nil || partnerInfo != nil && user != nil && senior == nil || guestInfo != nil {
if partnerInfo != nil && user != nil && senior != nil || partnerInfo != nil && user != nil && senior == nil {
return nil
}
... ...