feat: add tenant admin invite management, ledger overview, order details, and order management features

- Implemented Invite management with creation, searching, and disabling functionalities.
- Added Ledger overview for financial transactions with filtering options.
- Developed Order Detail view for individual order insights and refund capabilities.
- Created Orders management page with search, reset, and pagination features.
- Enhanced user experience with toast notifications for actions and error handling.
This commit is contained in:
2025-12-24 19:41:44 +08:00
parent 1d0b38bbb7
commit 87f569cc6a
27 changed files with 3652 additions and 151 deletions

View File

@@ -42,7 +42,7 @@ const docTemplate = `{
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/dto.LoginForm"
"$ref": "#/definitions/quyun_v2_app_http_super_dto.LoginForm"
}
}
],
@@ -50,7 +50,7 @@ const docTemplate = `{
"200": {
"description": "成功",
"schema": {
"$ref": "#/definitions/dto.LoginResponse"
"$ref": "#/definitions/quyun_v2_app_http_super_dto.LoginResponse"
}
}
}
@@ -71,7 +71,7 @@ const docTemplate = `{
"200": {
"description": "成功",
"schema": {
"$ref": "#/definitions/dto.LoginResponse"
"$ref": "#/definitions/quyun_v2_app_http_super_dto.LoginResponse"
}
}
}
@@ -1429,6 +1429,140 @@ const docTemplate = `{
}
},
"/t/{tenantCode}/v1/admin/contents": {
"get": {
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"Tenant"
],
"summary": "内容列表(租户管理)",
"parameters": [
{
"type": "string",
"description": "Tenant Code",
"name": "tenantCode",
"in": "path",
"required": true
},
{
"type": "string",
"description": "Asc specifies comma-separated field names to sort ascending by.",
"name": "asc",
"in": "query"
},
{
"type": "string",
"name": "created_at_from",
"in": "query"
},
{
"type": "string",
"name": "created_at_to",
"in": "query"
},
{
"type": "string",
"description": "Desc specifies comma-separated field names to sort descending by.",
"name": "desc",
"in": "query"
},
{
"type": "integer",
"name": "id",
"in": "query"
},
{
"type": "string",
"name": "keyword",
"in": "query"
},
{
"type": "integer",
"description": "Limit is page size; only values in {10,20,50,100} are accepted (otherwise defaults to 10).",
"name": "limit",
"in": "query"
},
{
"type": "integer",
"description": "Page is 1-based page index; values \u003c= 0 are normalized to 1.",
"name": "page",
"in": "query"
},
{
"type": "string",
"name": "published_at_from",
"in": "query"
},
{
"type": "string",
"name": "published_at_to",
"in": "query"
},
{
"enum": [
"draft",
"reviewing",
"published",
"unpublished",
"blocked"
],
"type": "string",
"x-enum-varnames": [
"ContentStatusDraft",
"ContentStatusReviewing",
"ContentStatusPublished",
"ContentStatusUnpublished",
"ContentStatusBlocked"
],
"name": "status",
"in": "query"
},
{
"type": "integer",
"name": "user_id",
"in": "query"
},
{
"enum": [
"public",
"tenant_only",
"private"
],
"type": "string",
"x-enum-varnames": [
"ContentVisibilityPublic",
"ContentVisibilityTenantOnly",
"ContentVisibilityPrivate"
],
"name": "visibility",
"in": "query"
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"allOf": [
{
"$ref": "#/definitions/requests.Pager"
},
{
"type": "object",
"properties": {
"items": {
"$ref": "#/definitions/dto.AdminContentItem"
}
}
}
]
}
}
}
},
"post": {
"consumes": [
"application/json"
@@ -3295,7 +3429,7 @@ const docTemplate = `{
"200": {
"description": "OK",
"schema": {
"$ref": "#/definitions/dto.MeResponse"
"$ref": "#/definitions/quyun_v2_app_http_tenant_dto.MeResponse"
}
}
}
@@ -3717,6 +3851,108 @@ const docTemplate = `{
}
}
}
},
"/v1/auth/login": {
"post": {
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"Web"
],
"summary": "用户登录",
"parameters": [
{
"description": "form",
"name": "form",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/quyun_v2_app_http_web_dto.LoginForm"
}
}
],
"responses": {
"200": {
"description": "成功",
"schema": {
"$ref": "#/definitions/quyun_v2_app_http_web_dto.LoginResponse"
}
}
}
}
},
"/v1/auth/token": {
"get": {
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"Web"
],
"summary": "刷新 Token",
"responses": {
"200": {
"description": "成功",
"schema": {
"$ref": "#/definitions/quyun_v2_app_http_web_dto.LoginResponse"
}
}
}
}
},
"/v1/me": {
"get": {
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"Web"
],
"summary": "当前用户信息",
"responses": {
"200": {
"description": "成功",
"schema": {
"$ref": "#/definitions/quyun_v2_app_http_web_dto.MeResponse"
}
}
}
}
},
"/v1/me/tenants": {
"get": {
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"Web"
],
"summary": "我的租户列表",
"responses": {
"200": {
"description": "成功",
"schema": {
"type": "array",
"items": {
"$ref": "#/definitions/dto.MyTenantItem"
}
}
}
}
}
}
},
"definitions": {
@@ -3958,6 +4194,46 @@ const docTemplate = `{
"UserStatusBanned"
]
},
"dto.AdminContentItem": {
"type": "object",
"properties": {
"content": {
"$ref": "#/definitions/models.Content"
},
"owner": {
"$ref": "#/definitions/dto.AdminContentOwnerLite"
},
"price": {
"$ref": "#/definitions/models.ContentPrice"
},
"status_description": {
"type": "string"
},
"visibility_description": {
"type": "string"
}
}
},
"dto.AdminContentOwnerLite": {
"type": "object",
"properties": {
"id": {
"type": "integer"
},
"roles": {
"type": "array",
"items": {
"$ref": "#/definitions/consts.Role"
}
},
"status": {
"$ref": "#/definitions/consts.UserStatus"
},
"username": {
"type": "string"
}
}
},
"dto.AdminLedgerItem": {
"type": "object",
"properties": {
@@ -4435,25 +4711,6 @@ const docTemplate = `{
}
}
},
"dto.LoginForm": {
"type": "object",
"properties": {
"password": {
"type": "string"
},
"username": {
"type": "string"
}
}
},
"dto.LoginResponse": {
"type": "object",
"properties": {
"token": {
"type": "string"
}
}
},
"dto.MeBalanceResponse": {
"type": "object",
"properties": {
@@ -4479,35 +4736,6 @@ const docTemplate = `{
}
}
},
"dto.MeResponse": {
"type": "object",
"properties": {
"tenant": {
"description": "Tenant is the resolved tenant by ` + "`" + `tenantCode` + "`" + `.",
"allOf": [
{
"$ref": "#/definitions/models.Tenant"
}
]
},
"tenant_user": {
"description": "TenantUser is the membership record of the authenticated user within the tenant.",
"allOf": [
{
"$ref": "#/definitions/models.TenantUser"
}
]
},
"user": {
"description": "User is the authenticated user derived from JWT ` + "`" + `user_id` + "`" + `.",
"allOf": [
{
"$ref": "#/definitions/models.User"
}
]
}
}
},
"dto.MyLedgerItem": {
"type": "object",
"properties": {
@@ -4525,6 +4753,58 @@ const docTemplate = `{
}
}
},
"dto.MyTenantItem": {
"type": "object",
"properties": {
"is_owner": {
"description": "IsOwner 是否为租户Ownertenants.user_id == 当前用户)。\n说明Owner 通常也在 tenant_users 里具备 tenant_admin 角色,但此字段更直观。",
"type": "boolean"
},
"joined_at": {
"description": "JoinedAt 加入租户时间tenant_users.created_at。",
"type": "string"
},
"member_roles": {
"description": "MemberRoles 当前用户在该租户下的角色tenant_admin/member 等)。",
"type": "array",
"items": {
"$ref": "#/definitions/consts.TenantUserRole"
}
},
"member_status": {
"description": "MemberStatus 当前用户在该租户下的成员状态。",
"allOf": [
{
"$ref": "#/definitions/consts.UserStatus"
}
]
},
"tenant_code": {
"description": "TenantCode 租户Code路由使用/t/:tenantCode/...)。",
"type": "string"
},
"tenant_id": {
"description": "TenantID 租户ID数值型主键。",
"type": "integer"
},
"tenant_name": {
"description": "TenantName 租户名称。",
"type": "string"
},
"tenant_status": {
"description": "TenantStatus 租户状态pending/verified/expired 等)。",
"allOf": [
{
"$ref": "#/definitions/consts.TenantStatus"
}
]
},
"tenant_status_description": {
"description": "TenantStatusDescription 租户状态描述(便于前端展示)。",
"type": "string"
}
}
},
"dto.OrderBuyerLite": {
"type": "object",
"properties": {
@@ -5899,6 +6179,116 @@ const docTemplate = `{
}
}
},
"quyun_v2_app_http_super_dto.LoginForm": {
"type": "object",
"properties": {
"password": {
"type": "string"
},
"username": {
"type": "string"
}
}
},
"quyun_v2_app_http_super_dto.LoginResponse": {
"type": "object",
"properties": {
"token": {
"type": "string"
}
}
},
"quyun_v2_app_http_tenant_dto.MeResponse": {
"type": "object",
"properties": {
"tenant": {
"description": "Tenant is the resolved tenant by ` + "`" + `tenantCode` + "`" + `.",
"allOf": [
{
"$ref": "#/definitions/models.Tenant"
}
]
},
"tenant_user": {
"description": "TenantUser is the membership record of the authenticated user within the tenant.",
"allOf": [
{
"$ref": "#/definitions/models.TenantUser"
}
]
},
"user": {
"description": "User is the authenticated user derived from JWT ` + "`" + `user_id` + "`" + `.",
"allOf": [
{
"$ref": "#/definitions/models.User"
}
]
}
}
},
"quyun_v2_app_http_web_dto.LoginForm": {
"type": "object",
"properties": {
"password": {
"description": "Password 明文密码;后端会与 users.password 的 bcrypt hash 做比对。",
"type": "string"
},
"username": {
"description": "Username 用户名;必须与数据库 users.username 精确匹配。",
"type": "string"
}
}
},
"quyun_v2_app_http_web_dto.LoginResponse": {
"type": "object",
"properties": {
"token": {
"description": "Token JWT 访问令牌;前端应以 ` + "`" + `Authorization: Bearer \u003ctoken\u003e` + "`" + ` 方式携带。",
"type": "string"
}
}
},
"quyun_v2_app_http_web_dto.MeResponse": {
"type": "object",
"properties": {
"created_at": {
"description": "CreatedAt 用户创建时间。",
"type": "string"
},
"id": {
"description": "ID 用户ID全局唯一。",
"type": "integer"
},
"roles": {
"description": "Roles 用户全局角色数组(如 user/super_admin 等)。",
"type": "array",
"items": {
"$ref": "#/definitions/consts.Role"
}
},
"status": {
"description": "Status 用户状态active/verified/banned 等)。",
"allOf": [
{
"$ref": "#/definitions/consts.UserStatus"
}
]
},
"status_description": {
"description": "StatusDescription 用户状态描述(便于前端展示)。",
"type": "string"
},
"updated_at": {
"description": "UpdatedAt 用户更新时间。",
"type": "string"
},
"username": {
"description": "Username 用户名。",
"type": "string"
}
}
},
"requests.KV": {
"type": "object",
"properties": {