作者 yangfu

manager login

... ... @@ -8,8 +8,6 @@ import (
_ "gitlab.fjmaimaimai.com/mmm-go/partner/pkg/infrastructure/pg"
_ "gitlab.fjmaimaimai.com/mmm-go/partner/pkg/infrastructure/redis"
"gitlab.fjmaimaimai.com/mmm-go/partner/pkg/log"
"gitlab.fjmaimaimai.com/mmm-go/partner/pkg/port/sarama"
//"gitlab.fjmaimaimai.com/mmm-go/partner/pkg/port/ginsvr"
_ "gitlab.fjmaimaimai.com/mmm-go/partner/pkg/port/appsvr"
)
... ... @@ -26,7 +24,7 @@ func main() {
event.InitEventCenter()
//启动kafaka消息订阅
go sarama.Run()
//go sarama.Run()
beego.Run()
}
... ...
... ... @@ -365,7 +365,7 @@ func CompaniesLogin(header *protocol.RequestHeader, request *protocolx.CenterCom
transactionContext.RollbackTransaction()
}()
// 通过短信验证码登录的游客,注册一个账号到配置的公司去(ios审核使用)
if request.GrantType == protocol.LoginBySmsCode {
if request.GrantType == protocol.LoginBySmsCode || request.GrantType == protocol.LoginByPassword {
e := loginSvr.RegistryGuest(request.Phone)
if e != nil {
log.Error(e)
... ...
... ... @@ -46,6 +46,8 @@ type Users struct {
AccessPartners []*PartnerInfo
// 1普通用户 2主管理员
AdminType int8 `json:"adminType"`
//是否是高管
IsSenior int64 `json:"is_senior"`
}
func (Users *Users) AccessPartnerIds() []int64 {
... ...
... ... @@ -34,7 +34,7 @@ func (svr *PgLoginService) Init(phone string) (err error) {
)
svr.Phone = phone
_, svr.PartnerInfo, err = PartnerInfoService.Find(map[string]interface{}{"account": phone, "status": 1, "sortByCreateTime": "ASC"})
_, svr.Users, err = UsersRepository.Find(map[string]interface{}{"phone": phone, "status": 1, "sortByCreateTime": "ASC", "deleteAtIsNull": true})
_, svr.Users, err = UsersRepository.Find(map[string]interface{}{"phone": phone, "status": 1, "sortByCreateTime": "ASC", "deleteAtIsNull": true, "isSenior": 1})
return nil
}
... ... @@ -291,7 +291,7 @@ func (svr *PgLoginService) RegistryGuest(phone string) error {
UsersRepository, _ = repository.NewUsersRepository(svr.transactionContext)
)
partnerInfo, errPartner := PartnerInfoService.FindOne(map[string]interface{}{"account": phone})
user, errUser := UsersRepository.FindOne(map[string]interface{}{"phone": phone})
user, errUser := UsersRepository.FindOne(map[string]interface{}{"phone": phone, "isSenior": 1})
if partnerInfo != nil || user != nil {
return nil
}
... ...
... ... @@ -50,4 +50,6 @@ type Users struct {
AccessPartners []*domain.PartnerInfo
// 1普通用户 2主管理员
AdminType int8
// 是否是高管 1 是2 否
IsSenior int64
}
... ...
... ... @@ -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")
query.SetWhere("is_senior = ?", "isSenior")
if err := query.First(); err != nil {
return nil, fmt.Errorf("query row not found")
}
... ... @@ -81,6 +82,7 @@ func (repository *UsersRepository) Find(queryOptions map[string]interface{}) (in
query.Where("company_id in (?)", pg.In(v))
}
query.SetWhere("admin_type=?", "adminType")
query.SetWhere("is_senior = ?", "isSenior")
var err error
if query.AffectRow, err = query.SelectAndCount(); err != nil {
return 0, Userss, err
... ...