feat: Add owner account management feature with a new frontend list component and backend API/database integration.
This commit is contained in:
@@ -237,6 +237,36 @@ func (d *DB) ClearTeamOwners() error {
|
||||
return err
|
||||
}
|
||||
|
||||
// GetOwnersWithoutAccountID 获取缺少 account_id 的 owners
|
||||
func (d *DB) GetOwnersWithoutAccountID() ([]TeamOwner, error) {
|
||||
rows, err := d.db.Query(`
|
||||
SELECT id, email, password, token, account_id, status, created_at
|
||||
FROM team_owners WHERE account_id = '' OR account_id IS NULL
|
||||
ORDER BY created_at DESC
|
||||
`)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
defer rows.Close()
|
||||
|
||||
var owners []TeamOwner
|
||||
for rows.Next() {
|
||||
var owner TeamOwner
|
||||
err := rows.Scan(&owner.ID, &owner.Email, &owner.Password, &owner.Token, &owner.AccountID, &owner.Status, &owner.CreatedAt)
|
||||
if err != nil {
|
||||
continue
|
||||
}
|
||||
owners = append(owners, owner)
|
||||
}
|
||||
return owners, nil
|
||||
}
|
||||
|
||||
// UpdateOwnerAccountID 更新 owner 的 account_id
|
||||
func (d *DB) UpdateOwnerAccountID(id int64, accountID string) error {
|
||||
_, err := d.db.Exec("UPDATE team_owners SET account_id = ? WHERE id = ?", accountID, id)
|
||||
return err
|
||||
}
|
||||
|
||||
// GetOwnerStats 获取统计
|
||||
func (d *DB) GetOwnerStats() map[string]int {
|
||||
stats := map[string]int{
|
||||
|
||||
Reference in New Issue
Block a user