作者 陈志颖

test:测试普通用户

... ... @@ -380,11 +380,19 @@ func CompaniesLogin(header *protocol.RequestHeader, request *protocolx.CenterCom
transactionContext.RollbackTransaction()
}()
// 通过短信验证码登录的游客或者普通用户,注册一个账号到配置的公司去(ios审核使用)
if request.GrantType == protocol.LoginBySmsCode || request.GrantType == protocol.LoginByPassword {
e := loginSvr.RegistryGuest(request.Phone)
if e != nil {
log.Error(e)
// 通过短信验证码登录的游客,注册一个账号到配置的公司去(ios审核使用)
if request.GrantType == protocol.LoginBySmsCode {
guestErr := loginSvr.RegistryGuest(request.Phone)
if guestErr != nil {
log.Error(guestErr)
}
}
// 通过密码登录的普通用户,注册一个账号到配置的公司去
if request.GrantType == protocol.LoginByPassword {
userErr := loginSvr.RegistryUser(request.Phone)
if userErr != nil {
log.Error(userErr)
}
}
... ...
... ... @@ -362,32 +362,27 @@ 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,
CompanyId: int64(constant.DEFAULT_GUEST_COMPANY),
PartnerName: phone,
Account: phone,
Password: "7c4a8d09ca3762af61e59520943dc26494f8941b",
... ... @@ -404,8 +399,6 @@ func (svr *PgLoginService) RegistryPartner(phone string, users []*domain.Users)
Salesman: []*domain.Salesman{&domain.Salesman{Name: phone, Telephone: phone}},
})
}
}
}
return errPartner
}
... ...
... ... @@ -55,6 +55,7 @@ func (repository *UsersRepository) FindOne(queryOptions map[string]interface{})
query.SetWhere("phone = ?", "phone")
query.SetWhere("company_id = ?", "companyId")
query.SetWhere(`delete_at is null`, "deleteAtIsNull")
if err := query.First(); err != nil {
return nil, fmt.Errorf("query row not found")
}
... ...