fix: remove tenant dependency from member login

This commit is contained in:
richjohnrambo
2026-10-19 01:03:31 +08:00
parent 804318e5f5
commit 2e47dd3935
13 changed files with 51 additions and 38 deletions
+4 -4
View File
@@ -95,11 +95,11 @@ func (s *Store) RegisterAccount(ctx context.Context, input AccountRegistration)
InviteCode: input.InviteCode, MemberStatus: memberStatusActive, MemberCategory: memberCategoryReal}, nil
}
func (s *Store) AccountByMobile(ctx context.Context, tenantID int64, mobile string) (*Account, error) {
func (s *Store) AccountByMobile(ctx context.Context, mobile string) (*Account, error) {
if s == nil || s.db == nil {
return nil, errors.New("store is unavailable")
}
return accountByMobile(ctx, s.db, tenantID, mobile)
return accountByMobile(ctx, s.db, mobile)
}
func (s *Store) RecordLogin(ctx context.Context, tenantID, memberID int64) error {
@@ -112,11 +112,11 @@ type queryer interface {
GetContext(context.Context, any, string, ...any) error
}
func accountByMobile(ctx context.Context, db queryer, tenantID int64, mobile string) (*Account, error) {
func accountByMobile(ctx context.Context, db queryer, mobile string) (*Account, error) {
var row Account
err := db.GetContext(ctx, &row, `SELECT tenant_id, id AS member_id, member_no, username, mobile,
password_hash, invite_code, member_status, risk_status AS member_category
FROM hg_app_member WHERE tenant_id=? AND mobile=? AND deleted_at IS NULL LIMIT 1`, tenantID, mobile)
FROM hg_app_member WHERE mobile=? AND deleted_at IS NULL LIMIT 1`, mobile)
if errors.Is(err, sql.ErrNoRows) {
return nil, ErrInvalidCredentials
}