# UserAccountService
> 用户账户服务

---

## countUserAccounts
> 计算账户数量

- 角色：`admin`
- HTTP：`POST https://backend.dooki.cloud/UserAccountService/countUserAccounts`
- RPC：`rpc countUserAccounts(CountUserAccountsRequest) returns (RPCCountResponse);`

**请求对象 (`CountUserAccountsRequest`)**

```json
{
  "keyword": "string // 关键词"
}
```

**响应对象 (`RPCCountResponse`)**

```json
{
  "count": "int64 // 数量"
}
```

**调用示例**

```bash
curl -X POST "https://backend.dooki.cloud/UserAccountService/countUserAccounts" \
  -H "Content-Type: application/json" \
  -H "X-Edge-Access-Token: <YOUR_TOKEN>" \
  -d '{
    ...
  }'
```

---

## findEnabledUserAccount
> 查找单个账户

- 角色：`admin`, `user`
- HTTP：`POST https://backend.dooki.cloud/UserAccountService/findEnabledUserAccount`
- RPC：`rpc findEnabledUserAccount(FindEnabledUserAccountRequest) returns (FindEnabledUserAccountResponse);`

**请求对象 (`FindEnabledUserAccountRequest`)**

```json
{
  "userAccountId": "int64 // 用户账户ID"
}
```

**响应对象 (`FindEnabledUserAccountResponse`)**

```json
{
  "userAccount": "UserAccount // 用户账户"
}
```

**调用示例**

```bash
curl -X POST "https://backend.dooki.cloud/UserAccountService/findEnabledUserAccount" \
  -H "Content-Type: application/json" \
  -H "X-Edge-Access-Token: <YOUR_TOKEN>" \
  -d '{
    ...
  }'
```

---

## findEnabledUserAccountWithUserId
> 根据用户ID查找单个账户

- 角色：`admin`, `user`
- HTTP：`POST https://backend.dooki.cloud/UserAccountService/findEnabledUserAccountWithUserId`
- RPC：`rpc findEnabledUserAccountWithUserId(FindEnabledUserAccountWithUserIdRequest) returns (FindEnabledUserAccountWithUserIdResponse);`

**请求对象 (`FindEnabledUserAccountWithUserIdRequest`)**

```json
{
  "userId": "int64 // 用户ID"
}
```

**响应对象 (`FindEnabledUserAccountWithUserIdResponse`)**

```json
{
  "userAccount": "UserAccount // 用户账户"
}
```

**调用示例**

```bash
curl -X POST "https://backend.dooki.cloud/UserAccountService/findEnabledUserAccountWithUserId" \
  -H "Content-Type: application/json" \
  -H "X-Edge-Access-Token: <YOUR_TOKEN>" \
  -d '{
    ...
  }'
```

---

## listUserAccounts
> 列出单页账户

- 角色：`admin`
- HTTP：`POST https://backend.dooki.cloud/UserAccountService/listUserAccounts`
- RPC：`rpc listUserAccounts(ListUserAccountsRequest) returns (ListUserAccountsResponse);`

**请求对象 (`ListUserAccountsRequest`)**

```json
{
  "keyword": "string // 关键词",
  "offset": "int64 // 读取位置",
  "size": "int64 // 数量，通常不能小于0"
}
```

**响应对象 (`ListUserAccountsResponse`)**

```json
{
  "userAccounts": "[]UserAccount // 用户账户列表"
}
```

**调用示例**

```bash
curl -X POST "https://backend.dooki.cloud/UserAccountService/listUserAccounts" \
  -H "Content-Type: application/json" \
  -H "X-Edge-Access-Token: <YOUR_TOKEN>" \
  -d '{
    ...
  }'
```

---

## updateUserAccount
> 修改用户账户

- 角色：`admin`
- HTTP：`POST https://backend.dooki.cloud/UserAccountService/updateUserAccount`
- RPC：`rpc updateUserAccount(UpdateUserAccountRequest) returns (RPCSuccess);`

**请求对象 (`UpdateUserAccountRequest`)**

```json
{
  "userAccountId": "int64 // 用户账户ID（非用户ID）",
  "delta": "double // 操作的数值，正值表示增加，负值表示减少",
  "eventType": "string // 事件类型：charge, award, buyPlan, payBill, refund, withdraw, buyNSPlan, buyTrafficPackage, buyAntiDDoSPackage, renewAntiDDoSPackage",
  "description": "string // 描述",
  "paramsJSON": "bytes // 相关参数"
}
```

**响应对象 (`RPCSuccess`)**

```json
{}
```

**调用示例**

```bash
curl -X POST "https://backend.dooki.cloud/UserAccountService/updateUserAccount" \
  -H "Content-Type: application/json" \
  -H "X-Edge-Access-Token: <YOUR_TOKEN>" \
  -d '{
    ...
  }'
```

---
