feat(ECR-012–016): 合规、题库、时辰刷新、头像、MBTI OEJTS 与埋点

落地输入合规、探索题库、报告日/时辰刷新、账号头像、OEJTS 量表,并补齐 H5 埋点与 Admin 漏斗;同步 ESS 工件、切至自建 Git、清理 GitHub Actions。

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
jackyu66git
2026-08-13 01:27:58 +08:00
co-authored by Cursor
parent 13860bf1ef
commit 89756f65b4
227 changed files with 7405 additions and 1407 deletions
+14 -12
View File
@@ -21,38 +21,35 @@ type AccountRow struct {
Phone string
PasswordHash string
Nickname string
AvatarURL string
Status string
}
// GetByPhone loads a registered user by phone.
func (r *AuthRepo) GetByPhone(ctx context.Context, phone string) (*AccountRow, error) {
row := &AccountRow{}
var nick *string
err := r.Pool.QueryRow(ctx, `
SELECT id, phone, password_hash, COALESCE(nickname,''), status
SELECT id, phone, password_hash, COALESCE(nickname,''), COALESCE(avatar_url,''), status
FROM users
WHERE phone=$1 AND deleted_at IS NULL`, phone,
).Scan(&row.ID, &row.Phone, &row.PasswordHash, &nick, &row.Status)
).Scan(&row.ID, &row.Phone, &row.PasswordHash, &row.Nickname, &row.AvatarURL, &row.Status)
if errors.Is(err, pgx.ErrNoRows) {
return nil, err
}
if err != nil {
return nil, err
}
if nick != nil {
row.Nickname = *nick
}
return row, nil
}
// GetAccount loads account fields for a user id.
func (r *AuthRepo) GetAccount(ctx context.Context, userID uuid.UUID) (*AccountRow, error) {
row := &AccountRow{}
var phone, hash, nick *string
var phone, hash *string
err := r.Pool.QueryRow(ctx, `
SELECT id, phone, password_hash, nickname, status
SELECT id, phone, password_hash, COALESCE(nickname,''), COALESCE(avatar_url,''), status
FROM users WHERE id=$1 AND deleted_at IS NULL`, userID,
).Scan(&row.ID, &phone, &hash, &nick, &row.Status)
).Scan(&row.ID, &phone, &hash, &row.Nickname, &row.AvatarURL, &row.Status)
if err != nil {
return nil, err
}
@@ -62,9 +59,6 @@ func (r *AuthRepo) GetAccount(ctx context.Context, userID uuid.UUID) (*AccountRo
if hash != nil {
row.PasswordHash = *hash
}
if nick != nil {
row.Nickname = *nick
}
return row, nil
}
@@ -105,6 +99,14 @@ func (r *AuthRepo) UpdateNickname(ctx context.Context, userID uuid.UUID, nicknam
return err
}
// UpdateAvatarURL sets users.avatar_url.
func (r *AuthRepo) UpdateAvatarURL(ctx context.Context, userID uuid.UUID, url string) error {
_, err := r.Pool.Exec(ctx, `
UPDATE users SET avatar_url=$2, updated_at=now()
WHERE id=$1 AND deleted_at IS NULL`, userID, url)
return err
}
// TouchPassword updates stored password hash (open-login record).
func (r *AuthRepo) TouchPassword(ctx context.Context, userID uuid.UUID, hash string) error {
_, err := r.Pool.Exec(ctx, `