初始化
Some checks failed
Build docker and publish / prepare (push) Has been cancelled
Build docker and publish / build (map[dockerfile:deploy/Dockerfile.admin image_name:ppanel-admin name:admin]) (push) Has been cancelled
Build docker and publish / build (map[dockerfile:deploy/Dockerfile.api image_name:ppanel-api name:api]) (push) Has been cancelled
Build docker and publish / build (map[dockerfile:deploy/Dockerfile.node image_name:ppanel-node name:node]) (push) Has been cancelled
Build docker and publish / build (map[dockerfile:deploy/Dockerfile.queue image_name:ppanel-queue name:queue]) (push) Has been cancelled
Build docker and publish / build (map[dockerfile:deploy/Dockerfile.scheduler image_name:ppanel-scheduler name:scheduler]) (push) Has been cancelled
Build docker and publish / deploy (push) Has been cancelled
Build docker and publish / notify (push) Has been cancelled
Some checks failed
Build docker and publish / prepare (push) Has been cancelled
Build docker and publish / build (map[dockerfile:deploy/Dockerfile.admin image_name:ppanel-admin name:admin]) (push) Has been cancelled
Build docker and publish / build (map[dockerfile:deploy/Dockerfile.api image_name:ppanel-api name:api]) (push) Has been cancelled
Build docker and publish / build (map[dockerfile:deploy/Dockerfile.node image_name:ppanel-node name:node]) (push) Has been cancelled
Build docker and publish / build (map[dockerfile:deploy/Dockerfile.queue image_name:ppanel-queue name:queue]) (push) Has been cancelled
Build docker and publish / build (map[dockerfile:deploy/Dockerfile.scheduler image_name:ppanel-scheduler name:scheduler]) (push) Has been cancelled
Build docker and publish / deploy (push) Has been cancelled
Build docker and publish / notify (push) Has been cancelled
This commit is contained in:
commit
9dacd85a89
226
.gitea/workflows/deploy.yml
Normal file
226
.gitea/workflows/deploy.yml
Normal file
@ -0,0 +1,226 @@
|
|||||||
|
name: Build docker and publish
|
||||||
|
run-name: zero-ppanel Docker构建和部署
|
||||||
|
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
branches:
|
||||||
|
- main
|
||||||
|
- dev
|
||||||
|
pull_request:
|
||||||
|
branches:
|
||||||
|
- main
|
||||||
|
- dev
|
||||||
|
|
||||||
|
env:
|
||||||
|
REPO: ${{ vars.REPO || 'registry.kxsw.us/vpn-server' }}
|
||||||
|
SSH_HOST: ${{ github.ref_name == 'main' && vars.SSH_HOST || vars.DEV_SSH_HOST }}
|
||||||
|
SSH_PORT: ${{ vars.SSH_PORT }}
|
||||||
|
SSH_USER: ${{ vars.SSH_USER }}
|
||||||
|
SSH_PASSWORD: ${{ github.ref_name == 'main' && vars.SSH_PASSWORD || vars.DEV_SSH_PASSWORD }}
|
||||||
|
TG_BOT_TOKEN: ${{ secrets.TG_BOT_TOKEN }}
|
||||||
|
TG_CHAT_ID: ${{ secrets.TG_CHAT_ID }}
|
||||||
|
VERSION: ${{ github.sha }}
|
||||||
|
BUILDTIME: ${{ github.event.head_commit.timestamp }}
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
# ============================================================
|
||||||
|
# Job 1: 设置环境变量,供后续 jobs 共享
|
||||||
|
# ============================================================
|
||||||
|
prepare:
|
||||||
|
runs-on: ario-server
|
||||||
|
outputs:
|
||||||
|
docker_tag: ${{ steps.vars.outputs.docker_tag }}
|
||||||
|
container_suffix: ${{ steps.vars.outputs.container_suffix }}
|
||||||
|
deploy_path: ${{ steps.vars.outputs.deploy_path }}
|
||||||
|
steps:
|
||||||
|
- name: ⚙️ 计算部署变量
|
||||||
|
id: vars
|
||||||
|
run: |
|
||||||
|
case "${{ github.ref_name }}" in
|
||||||
|
main)
|
||||||
|
echo "docker_tag=latest" >> $GITHUB_OUTPUT
|
||||||
|
echo "container_suffix=" >> $GITHUB_OUTPUT
|
||||||
|
echo "deploy_path=/root/bindbox" >> $GITHUB_OUTPUT
|
||||||
|
;;
|
||||||
|
dev)
|
||||||
|
echo "docker_tag=dev" >> $GITHUB_OUTPUT
|
||||||
|
echo "container_suffix=-dev" >> $GITHUB_OUTPUT
|
||||||
|
echo "deploy_path=/root/bindbox-dev" >> $GITHUB_OUTPUT
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
echo "docker_tag=${{ github.ref_name }}" >> $GITHUB_OUTPUT
|
||||||
|
echo "container_suffix=-${{ github.ref_name }}" >> $GITHUB_OUTPUT
|
||||||
|
echo "deploy_path=/root/vpn_server_other" >> $GITHUB_OUTPUT
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
|
||||||
|
# ============================================================
|
||||||
|
# Job 2: 并行矩阵构建 5 个服务镜像
|
||||||
|
# ============================================================
|
||||||
|
build:
|
||||||
|
runs-on: ario-server
|
||||||
|
needs: prepare
|
||||||
|
strategy:
|
||||||
|
fail-fast: false
|
||||||
|
matrix:
|
||||||
|
service:
|
||||||
|
- name: api
|
||||||
|
dockerfile: deploy/Dockerfile.api
|
||||||
|
image_name: ppanel-api
|
||||||
|
- name: admin
|
||||||
|
dockerfile: deploy/Dockerfile.admin
|
||||||
|
image_name: ppanel-admin
|
||||||
|
- name: node
|
||||||
|
dockerfile: deploy/Dockerfile.node
|
||||||
|
image_name: ppanel-node
|
||||||
|
- name: queue
|
||||||
|
dockerfile: deploy/Dockerfile.queue
|
||||||
|
image_name: ppanel-queue
|
||||||
|
- name: scheduler
|
||||||
|
dockerfile: deploy/Dockerfile.scheduler
|
||||||
|
image_name: ppanel-scheduler
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- name: 📥 下载代码
|
||||||
|
uses: actions/checkout@v4
|
||||||
|
|
||||||
|
- name: 🔧 安装 Docker CLI
|
||||||
|
run: |
|
||||||
|
set -e
|
||||||
|
export DEBIAN_FRONTEND=noninteractive
|
||||||
|
|
||||||
|
# 等待 apt 锁释放
|
||||||
|
for i in $(seq 1 60); do
|
||||||
|
if ! fuser /var/lib/dpkg/lock-frontend >/dev/null 2>&1; then break; fi
|
||||||
|
echo "等待 apt 锁... ($i/60)"; sleep 5
|
||||||
|
done
|
||||||
|
|
||||||
|
apt-get update -y -o Dpkg::Lock::Timeout=300
|
||||||
|
apt-get install -y -o Dpkg::Lock::Timeout=300 ca-certificates curl gnupg
|
||||||
|
|
||||||
|
# 安装 Docker 官方 CLI (API >= 1.44)
|
||||||
|
install -m 0755 -d /etc/apt/keyrings
|
||||||
|
curl -fsSL https://download.docker.com/linux/debian/gpg \
|
||||||
|
| gpg --dearmor -o /etc/apt/keyrings/docker.gpg
|
||||||
|
echo "deb [arch=amd64 signed-by=/etc/apt/keyrings/docker.gpg] \
|
||||||
|
https://download.docker.com/linux/debian \
|
||||||
|
$(. /etc/os-release && echo "$VERSION_CODENAME") stable" \
|
||||||
|
> /etc/apt/sources.list.d/docker.list
|
||||||
|
apt-get update -y -o Dpkg::Lock::Timeout=300
|
||||||
|
apt-get install -y -o Dpkg::Lock::Timeout=300 docker-ce-cli docker-buildx-plugin
|
||||||
|
|
||||||
|
echo "Docker CLI 版本: $(docker --version)"
|
||||||
|
echo "API 版本: $(docker version --format '{{.Client.APIVersion}}')"
|
||||||
|
|
||||||
|
- name: 📤 构建并推送 ${{ matrix.service.name }}
|
||||||
|
run: |
|
||||||
|
DOCKER_TAG="${{ needs.prepare.outputs.docker_tag }}"
|
||||||
|
IMAGE_BASE="${{ env.REPO }}/${{ matrix.service.image_name }}"
|
||||||
|
|
||||||
|
echo "构建服务: ${{ matrix.service.name }}"
|
||||||
|
echo "镜像: ${IMAGE_BASE}"
|
||||||
|
echo "标签: ${DOCKER_TAG} | ${{ env.VERSION }}"
|
||||||
|
|
||||||
|
docker build \
|
||||||
|
-f ${{ matrix.service.dockerfile }} \
|
||||||
|
--platform linux/amd64 \
|
||||||
|
--build-arg VERSION=${{ env.VERSION }} \
|
||||||
|
--build-arg BUILDTIME=${{ env.BUILDTIME }} \
|
||||||
|
-t ${IMAGE_BASE}:${{ env.VERSION }} \
|
||||||
|
-t ${IMAGE_BASE}:${DOCKER_TAG} \
|
||||||
|
.
|
||||||
|
|
||||||
|
docker push ${IMAGE_BASE}:${{ env.VERSION }}
|
||||||
|
docker push ${IMAGE_BASE}:${DOCKER_TAG}
|
||||||
|
|
||||||
|
echo "✅ ${{ matrix.service.name }} 镜像推送完成"
|
||||||
|
|
||||||
|
# ============================================================
|
||||||
|
# Job 3: 部署到服务器
|
||||||
|
# ============================================================
|
||||||
|
deploy:
|
||||||
|
runs-on: ario-server
|
||||||
|
needs: [prepare, build]
|
||||||
|
# PR 不触发部署,只有直接推送才部署
|
||||||
|
if: github.event_name == 'push'
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- name: 📥 下载代码 (获取 docker-compose.cloud.yml)
|
||||||
|
uses: actions/checkout@v4
|
||||||
|
|
||||||
|
- name: 📂 传输 docker-compose.cloud.yml
|
||||||
|
uses: appleboy/scp-action@v0.1.7
|
||||||
|
with:
|
||||||
|
host: ${{ env.SSH_HOST }}
|
||||||
|
username: ${{ env.SSH_USER }}
|
||||||
|
password: ${{ env.SSH_PASSWORD }}
|
||||||
|
port: ${{ env.SSH_PORT }}
|
||||||
|
source: "deploy/docker-compose.cloud.yml"
|
||||||
|
target: "${{ needs.prepare.outputs.deploy_path }}/"
|
||||||
|
strip_components: 1
|
||||||
|
|
||||||
|
- name: 🚀 部署服务
|
||||||
|
uses: appleboy/ssh-action@v1.0.3
|
||||||
|
with:
|
||||||
|
host: ${{ env.SSH_HOST }}
|
||||||
|
username: ${{ env.SSH_USER }}
|
||||||
|
password: ${{ env.SSH_PASSWORD }}
|
||||||
|
port: ${{ env.SSH_PORT }}
|
||||||
|
timeout: 300s
|
||||||
|
command_timeout: 600s
|
||||||
|
script: |
|
||||||
|
set -e
|
||||||
|
DEPLOY_PATH="${{ needs.prepare.outputs.deploy_path }}"
|
||||||
|
DOCKER_TAG="${{ needs.prepare.outputs.docker_tag }}"
|
||||||
|
REPO="${{ env.REPO }}"
|
||||||
|
|
||||||
|
echo "部署目录: ${DEPLOY_PATH}"
|
||||||
|
echo "镜像标签: ${DOCKER_TAG}"
|
||||||
|
|
||||||
|
cd ${DEPLOY_PATH}
|
||||||
|
|
||||||
|
# 写入环境变量供 docker-compose 使用
|
||||||
|
cat > .env <<EOF
|
||||||
|
PPANEL_TAG=${DOCKER_TAG}
|
||||||
|
PPANEL_REPO=${REPO}
|
||||||
|
EOF
|
||||||
|
|
||||||
|
# 拉取所有服务的最新镜像
|
||||||
|
docker-compose -f docker-compose.cloud.yml pull
|
||||||
|
|
||||||
|
# 滚动更新所有 ppanel 服务
|
||||||
|
docker-compose -f docker-compose.cloud.yml up -d \
|
||||||
|
ppanel-api ppanel-admin ppanel-node ppanel-queue ppanel-scheduler
|
||||||
|
|
||||||
|
# 清理旧镜像
|
||||||
|
docker image prune -f || true
|
||||||
|
|
||||||
|
echo "✅ 部署完成,当前运行容器:"
|
||||||
|
docker-compose -f docker-compose.cloud.yml ps
|
||||||
|
|
||||||
|
# ============================================================
|
||||||
|
# Job 4: 通知
|
||||||
|
# ============================================================
|
||||||
|
notify:
|
||||||
|
runs-on: ario-server
|
||||||
|
needs: [prepare, build, deploy]
|
||||||
|
if: always() && github.event_name == 'push'
|
||||||
|
steps:
|
||||||
|
- name: 📱 发送 Telegram 通知
|
||||||
|
uses: appleboy/telegram-action@master
|
||||||
|
with:
|
||||||
|
token: ${{ env.TG_BOT_TOKEN }}
|
||||||
|
to: ${{ env.TG_CHAT_ID }}
|
||||||
|
message: |
|
||||||
|
${{ (needs.build.result == 'success' && needs.deploy.result == 'success') && '✅ 部署成功!' || '❌ 部署失败!' }}
|
||||||
|
|
||||||
|
📦 项目: zero-ppanel
|
||||||
|
🌿 分支: ${{ github.ref_name }}
|
||||||
|
🏷️ 标签: ${{ needs.prepare.outputs.docker_tag }}
|
||||||
|
📝 提交: `${{ github.sha }}`
|
||||||
|
👤 提交者: ${{ github.actor }}
|
||||||
|
🕐 时间: ${{ github.event.head_commit.timestamp }}
|
||||||
|
|
||||||
|
构建: ${{ needs.build.result }} | 部署: ${{ needs.deploy.result }}
|
||||||
|
${{ (needs.build.result != 'success' || needs.deploy.result != 'success') && '⚠️ 请检查 Actions 日志获取详细信息' || '' }}
|
||||||
|
parse_mode: Markdown
|
||||||
36
.gitignore
vendored
Normal file
36
.gitignore
vendored
Normal file
@ -0,0 +1,36 @@
|
|||||||
|
# Binaries
|
||||||
|
bin/
|
||||||
|
*.exe
|
||||||
|
*.exe~
|
||||||
|
*.dll
|
||||||
|
*.so
|
||||||
|
*.dylib
|
||||||
|
|
||||||
|
# Logs
|
||||||
|
logs/
|
||||||
|
*.log
|
||||||
|
*.pid
|
||||||
|
|
||||||
|
# Local config overrides
|
||||||
|
etc/*.local.yaml
|
||||||
|
apps/*/etc/*.local.yaml
|
||||||
|
|
||||||
|
# IDE
|
||||||
|
.idea/
|
||||||
|
.vscode/
|
||||||
|
*.swp
|
||||||
|
*.swo
|
||||||
|
|
||||||
|
# OS
|
||||||
|
.DS_Store
|
||||||
|
Thumbs.db
|
||||||
|
|
||||||
|
# Go
|
||||||
|
vendor/
|
||||||
|
|
||||||
|
# Temp
|
||||||
|
tmp/
|
||||||
|
|
||||||
|
# Claude
|
||||||
|
CLAUDE.md
|
||||||
|
.claude/
|
||||||
83
Makefile
Normal file
83
Makefile
Normal file
@ -0,0 +1,83 @@
|
|||||||
|
.PHONY: build-all build-api build-admin build-node build-queue build-scheduler build-rpc-core \
|
||||||
|
gen-api gen-model docker-up docker-down docker-env-up docker-env-down lint clean \
|
||||||
|
run-api run-admin run-node run-queue run-scheduler run-rpc-core
|
||||||
|
|
||||||
|
# Environment: dev | test | prod (default: dev)
|
||||||
|
ENV ?= dev
|
||||||
|
|
||||||
|
# Build targets
|
||||||
|
build-all: build-api build-admin build-node build-queue build-scheduler build-rpc-core
|
||||||
|
|
||||||
|
build-api:
|
||||||
|
CGO_ENABLED=0 go build -trimpath -o bin/ppanel-api ./apps/api/ppanel.go
|
||||||
|
|
||||||
|
build-admin:
|
||||||
|
CGO_ENABLED=0 go build -trimpath -o bin/ppanel-admin ./apps/admin/ppaneladmin.go
|
||||||
|
|
||||||
|
build-node:
|
||||||
|
CGO_ENABLED=0 go build -trimpath -o bin/ppanel-node ./apps/node/ppanelnode.go
|
||||||
|
|
||||||
|
build-queue:
|
||||||
|
CGO_ENABLED=0 go build -trimpath -o bin/ppanel-queue ./apps/queue/queue.go
|
||||||
|
|
||||||
|
build-scheduler:
|
||||||
|
CGO_ENABLED=0 go build -trimpath -o bin/ppanel-scheduler ./apps/scheduler/scheduler.go
|
||||||
|
|
||||||
|
build-rpc-core:
|
||||||
|
CGO_ENABLED=0 go build -trimpath -o bin/ppanel-rpc-core ./apps/rpc/core/core.go
|
||||||
|
|
||||||
|
# Run with environment config
|
||||||
|
run-api:
|
||||||
|
go run apps/api/ppanel.go -f apps/api/etc/api-$(ENV).yaml
|
||||||
|
|
||||||
|
run-admin:
|
||||||
|
go run apps/admin/ppaneladmin.go -f apps/admin/etc/admin-$(ENV).yaml
|
||||||
|
|
||||||
|
run-node:
|
||||||
|
go run apps/node/ppanelnode.go -f apps/node/etc/node-$(ENV).yaml
|
||||||
|
|
||||||
|
run-queue:
|
||||||
|
go run apps/queue/queue.go -f apps/queue/etc/queue-$(ENV).yaml
|
||||||
|
|
||||||
|
run-scheduler:
|
||||||
|
go run apps/scheduler/scheduler.go -f apps/scheduler/etc/scheduler-$(ENV).yaml
|
||||||
|
|
||||||
|
run-rpc-core:
|
||||||
|
go run apps/rpc/core/core.go -f apps/rpc/core/etc/core-$(ENV).yaml
|
||||||
|
|
||||||
|
# Code generation
|
||||||
|
gen-api:
|
||||||
|
cd apps/api && goctl api go -api api.api -dir . -style goZero
|
||||||
|
cd apps/admin && goctl api go -api admin.api -dir . -style goZero
|
||||||
|
cd apps/node && goctl api go -api node.api -dir . -style goZero
|
||||||
|
# fix: admin routes.go 中 server 包名与参数名 server(*rest.Server) 冲突
|
||||||
|
# 1. 若 goctl 生成了 server import 但没加别名,加上别名
|
||||||
|
sed -i '' 's|"github.com/zero-ppanel/zero-ppanel/apps/admin/internal/handler/server"|serverhandler "github.com/zero-ppanel/zero-ppanel/apps/admin/internal/handler/server"|g' apps/admin/internal/handler/routes.go
|
||||||
|
# 2. 若 goctl 漏掉了 server import,补进去
|
||||||
|
grep -q 'handler/server' apps/admin/internal/handler/routes.go || sed -i '' 's|"github.com/zero-ppanel/zero-ppanel/apps/admin/internal/svc"|serverhandler "github.com/zero-ppanel/zero-ppanel/apps/admin/internal/handler/server"\n\t"github.com/zero-ppanel/zero-ppanel/apps/admin/internal/svc"|' apps/admin/internal/handler/routes.go
|
||||||
|
# 3. 替换调用处
|
||||||
|
sed -i '' 's/Handler: server\./Handler: serverhandler./g' apps/admin/internal/handler/routes.go
|
||||||
|
|
||||||
|
gen-model:
|
||||||
|
@echo "Usage: make gen-model TABLE=user DIR=apps/api/internal/model/user"
|
||||||
|
goctl model mysql ddl -src sql/001_init.up.sql -dir $(DIR) -table $(TABLE) -c
|
||||||
|
|
||||||
|
# Docker
|
||||||
|
docker-up:
|
||||||
|
cd deploy && docker-compose up -d
|
||||||
|
|
||||||
|
docker-down:
|
||||||
|
cd deploy && docker-compose down
|
||||||
|
|
||||||
|
docker-env-up:
|
||||||
|
cd deploy && docker-compose -f docker-compose-env.yml up -d
|
||||||
|
|
||||||
|
docker-env-down:
|
||||||
|
cd deploy && docker-compose -f docker-compose-env.yml down
|
||||||
|
|
||||||
|
# Quality
|
||||||
|
lint:
|
||||||
|
golangci-lint run ./...
|
||||||
|
|
||||||
|
clean:
|
||||||
|
rm -rf bin/
|
||||||
22
apps/admin/admin.api
Normal file
22
apps/admin/admin.api
Normal file
@ -0,0 +1,22 @@
|
|||||||
|
syntax = "v1"
|
||||||
|
|
||||||
|
info (
|
||||||
|
title: "PPanel Admin"
|
||||||
|
desc: "管理后台 BFF 服务"
|
||||||
|
author: "ppanel"
|
||||||
|
version: "1.0"
|
||||||
|
)
|
||||||
|
|
||||||
|
import (
|
||||||
|
"desc/types.api"
|
||||||
|
"desc/common.api"
|
||||||
|
"desc/system.api"
|
||||||
|
"desc/console.api"
|
||||||
|
"desc/user.api"
|
||||||
|
"desc/server.api"
|
||||||
|
"desc/subscribe.api"
|
||||||
|
"desc/order.api"
|
||||||
|
"desc/announcement.api"
|
||||||
|
"desc/ticket.api"
|
||||||
|
)
|
||||||
|
|
||||||
45
apps/admin/desc/announcement.api
Normal file
45
apps/admin/desc/announcement.api
Normal file
@ -0,0 +1,45 @@
|
|||||||
|
syntax = "v1"
|
||||||
|
|
||||||
|
info (
|
||||||
|
title: "公告管理"
|
||||||
|
)
|
||||||
|
|
||||||
|
type (
|
||||||
|
CreateAnnouncementReq {
|
||||||
|
Title string `json:"title"`
|
||||||
|
Content string `json:"content"`
|
||||||
|
}
|
||||||
|
|
||||||
|
AdminAnnouncementResp {
|
||||||
|
Id int64 `json:"id"`
|
||||||
|
Title string `json:"title"`
|
||||||
|
Content string `json:"content"`
|
||||||
|
CreatedAt string `json:"created_at"`
|
||||||
|
}
|
||||||
|
|
||||||
|
UpdateAnnouncementReq {
|
||||||
|
Id int64 `path:"id"`
|
||||||
|
Title string `json:"title"`
|
||||||
|
Content string `json:"content"`
|
||||||
|
}
|
||||||
|
|
||||||
|
DeleteAnnouncementReq {
|
||||||
|
Id int64 `path:"id"`
|
||||||
|
}
|
||||||
|
)
|
||||||
|
|
||||||
|
@server (
|
||||||
|
prefix: /api/v1/admin/announcement
|
||||||
|
group: announcement
|
||||||
|
jwt: JwtAuth
|
||||||
|
)
|
||||||
|
service ppaneladmin {
|
||||||
|
@handler CreateAnnouncementHandler
|
||||||
|
post /create (CreateAnnouncementReq) returns (AdminAnnouncementResp)
|
||||||
|
|
||||||
|
@handler UpdateAnnouncementHandler
|
||||||
|
put /:id (UpdateAnnouncementReq)
|
||||||
|
|
||||||
|
@handler DeleteAnnouncementHandler
|
||||||
|
delete /:id (DeleteAnnouncementReq)
|
||||||
|
}
|
||||||
14
apps/admin/desc/common.api
Normal file
14
apps/admin/desc/common.api
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
syntax = "v1"
|
||||||
|
|
||||||
|
info (
|
||||||
|
title: "管理后台公共接口"
|
||||||
|
)
|
||||||
|
|
||||||
|
@server (
|
||||||
|
prefix: /api/v1/admin
|
||||||
|
group: common
|
||||||
|
)
|
||||||
|
service ppaneladmin {
|
||||||
|
@handler HealthHandler
|
||||||
|
get /health returns (HealthResp)
|
||||||
|
}
|
||||||
28
apps/admin/desc/console.api
Normal file
28
apps/admin/desc/console.api
Normal file
@ -0,0 +1,28 @@
|
|||||||
|
syntax = "v1"
|
||||||
|
|
||||||
|
info (
|
||||||
|
title: "控制台"
|
||||||
|
)
|
||||||
|
|
||||||
|
type (
|
||||||
|
ConsoleStatsResp {
|
||||||
|
TotalUsers int64 `json:"total_users"`
|
||||||
|
TotalOrders int64 `json:"total_orders"`
|
||||||
|
TotalRevenue int64 `json:"total_revenue"`
|
||||||
|
TodayNewUsers int64 `json:"today_new_users"`
|
||||||
|
TodayOrders int64 `json:"today_orders"`
|
||||||
|
TodayRevenue int64 `json:"today_revenue"`
|
||||||
|
OnlineNodes int64 `json:"online_nodes"`
|
||||||
|
TotalNodes int64 `json:"total_nodes"`
|
||||||
|
}
|
||||||
|
)
|
||||||
|
|
||||||
|
@server (
|
||||||
|
prefix: /api/v1/admin/console
|
||||||
|
group: console
|
||||||
|
jwt: JwtAuth
|
||||||
|
)
|
||||||
|
service ppaneladmin {
|
||||||
|
@handler GetConsoleStatsHandler
|
||||||
|
get /stats returns (ConsoleStatsResp)
|
||||||
|
}
|
||||||
45
apps/admin/desc/order.api
Normal file
45
apps/admin/desc/order.api
Normal file
@ -0,0 +1,45 @@
|
|||||||
|
syntax = "v1"
|
||||||
|
|
||||||
|
info (
|
||||||
|
title: "订单管理"
|
||||||
|
)
|
||||||
|
|
||||||
|
type (
|
||||||
|
AdminOrderListReq {
|
||||||
|
Page int `form:"page,default=1"`
|
||||||
|
PageSize int `form:"page_size,default=20"`
|
||||||
|
Status int `form:"status,optional"`
|
||||||
|
}
|
||||||
|
|
||||||
|
AdminOrderResp {
|
||||||
|
Id int64 `json:"id"`
|
||||||
|
OrderNo string `json:"order_no"`
|
||||||
|
UserId int64 `json:"user_id"`
|
||||||
|
Amount int64 `json:"amount"`
|
||||||
|
Status int `json:"status"`
|
||||||
|
CreatedAt string `json:"created_at"`
|
||||||
|
}
|
||||||
|
|
||||||
|
AdminOrderListResp {
|
||||||
|
Total int64 `json:"total"`
|
||||||
|
List []AdminOrderResp `json:"list"`
|
||||||
|
}
|
||||||
|
|
||||||
|
UpdateOrderStatusReq {
|
||||||
|
OrderNo string `path:"order_no"`
|
||||||
|
Status int `json:"status"`
|
||||||
|
}
|
||||||
|
)
|
||||||
|
|
||||||
|
@server (
|
||||||
|
prefix: /api/v1/admin/order
|
||||||
|
group: order
|
||||||
|
jwt: JwtAuth
|
||||||
|
)
|
||||||
|
service ppaneladmin {
|
||||||
|
@handler GetOrderListHandler
|
||||||
|
get /list (AdminOrderListReq) returns (AdminOrderListResp)
|
||||||
|
|
||||||
|
@handler UpdateOrderStatusHandler
|
||||||
|
put /:order_no/status (UpdateOrderStatusReq)
|
||||||
|
}
|
||||||
64
apps/admin/desc/server.api
Normal file
64
apps/admin/desc/server.api
Normal file
@ -0,0 +1,64 @@
|
|||||||
|
syntax = "v1"
|
||||||
|
|
||||||
|
info (
|
||||||
|
title: "服务器管理"
|
||||||
|
)
|
||||||
|
|
||||||
|
type (
|
||||||
|
ServerListReq {
|
||||||
|
Page int `form:"page,default=1"`
|
||||||
|
PageSize int `form:"page_size,default=20"`
|
||||||
|
}
|
||||||
|
|
||||||
|
ServerResp {
|
||||||
|
Id int64 `json:"id"`
|
||||||
|
Name string `json:"name"`
|
||||||
|
Address string `json:"address"`
|
||||||
|
Port int `json:"port"`
|
||||||
|
Protocol string `json:"protocol"`
|
||||||
|
Enable bool `json:"enable"`
|
||||||
|
}
|
||||||
|
|
||||||
|
ServerListResp {
|
||||||
|
Total int64 `json:"total"`
|
||||||
|
List []ServerResp `json:"list"`
|
||||||
|
}
|
||||||
|
|
||||||
|
CreateServerReq {
|
||||||
|
Name string `json:"name"`
|
||||||
|
Address string `json:"address"`
|
||||||
|
Port int `json:"port"`
|
||||||
|
Protocol string `json:"protocol"`
|
||||||
|
}
|
||||||
|
|
||||||
|
UpdateServerReq {
|
||||||
|
Id int64 `path:"id"`
|
||||||
|
Name string `json:"name"`
|
||||||
|
Address string `json:"address"`
|
||||||
|
Port int `json:"port"`
|
||||||
|
Protocol string `json:"protocol"`
|
||||||
|
}
|
||||||
|
|
||||||
|
DeleteServerReq {
|
||||||
|
Id int64 `path:"id"`
|
||||||
|
}
|
||||||
|
)
|
||||||
|
|
||||||
|
@server (
|
||||||
|
prefix: /api/v1/admin/server
|
||||||
|
group: server
|
||||||
|
jwt: JwtAuth
|
||||||
|
)
|
||||||
|
service ppaneladmin {
|
||||||
|
@handler GetServerListHandler
|
||||||
|
get /list (ServerListReq) returns (ServerListResp)
|
||||||
|
|
||||||
|
@handler CreateServerHandler
|
||||||
|
post /create (CreateServerReq) returns (ServerResp)
|
||||||
|
|
||||||
|
@handler UpdateServerHandler
|
||||||
|
put /:id (UpdateServerReq)
|
||||||
|
|
||||||
|
@handler DeleteServerHandler
|
||||||
|
delete /:id (DeleteServerReq)
|
||||||
|
}
|
||||||
61
apps/admin/desc/subscribe.api
Normal file
61
apps/admin/desc/subscribe.api
Normal file
@ -0,0 +1,61 @@
|
|||||||
|
syntax = "v1"
|
||||||
|
|
||||||
|
info (
|
||||||
|
title: "订阅管理"
|
||||||
|
)
|
||||||
|
|
||||||
|
type (
|
||||||
|
AdminSubscribeListReq {
|
||||||
|
Page int `form:"page,default=1"`
|
||||||
|
PageSize int `form:"page_size,default=20"`
|
||||||
|
}
|
||||||
|
|
||||||
|
AdminSubscribeResp {
|
||||||
|
Id int64 `json:"id"`
|
||||||
|
Name string `json:"name"`
|
||||||
|
Price int64 `json:"price"`
|
||||||
|
Traffic int64 `json:"traffic"`
|
||||||
|
Enable bool `json:"enable"`
|
||||||
|
}
|
||||||
|
|
||||||
|
AdminSubscribeListResp {
|
||||||
|
Total int64 `json:"total"`
|
||||||
|
List []AdminSubscribeResp `json:"list"`
|
||||||
|
}
|
||||||
|
|
||||||
|
CreateSubscribeReq {
|
||||||
|
Name string `json:"name"`
|
||||||
|
Price int64 `json:"price"`
|
||||||
|
Traffic int64 `json:"traffic"`
|
||||||
|
}
|
||||||
|
|
||||||
|
UpdateSubscribeReq {
|
||||||
|
Id int64 `path:"id"`
|
||||||
|
Name string `json:"name"`
|
||||||
|
Price int64 `json:"price"`
|
||||||
|
Traffic int64 `json:"traffic"`
|
||||||
|
}
|
||||||
|
|
||||||
|
DeleteSubscribeReq {
|
||||||
|
Id int64 `path:"id"`
|
||||||
|
}
|
||||||
|
)
|
||||||
|
|
||||||
|
@server (
|
||||||
|
prefix: /api/v1/admin/subscribe
|
||||||
|
group: subscribe
|
||||||
|
jwt: JwtAuth
|
||||||
|
)
|
||||||
|
service ppaneladmin {
|
||||||
|
@handler GetSubscribeListHandler
|
||||||
|
get /list (AdminSubscribeListReq) returns (AdminSubscribeListResp)
|
||||||
|
|
||||||
|
@handler CreateSubscribeHandler
|
||||||
|
post /create (CreateSubscribeReq) returns (AdminSubscribeResp)
|
||||||
|
|
||||||
|
@handler UpdateSubscribeHandler
|
||||||
|
put /:id (UpdateSubscribeReq)
|
||||||
|
|
||||||
|
@handler DeleteSubscribeHandler
|
||||||
|
delete /:id (DeleteSubscribeReq)
|
||||||
|
}
|
||||||
54
apps/admin/desc/system.api
Normal file
54
apps/admin/desc/system.api
Normal file
@ -0,0 +1,54 @@
|
|||||||
|
syntax = "v1"
|
||||||
|
|
||||||
|
info (
|
||||||
|
title: "系统配置管理"
|
||||||
|
)
|
||||||
|
|
||||||
|
type (
|
||||||
|
SiteConfigResp {
|
||||||
|
SiteName string `json:"site_name"`
|
||||||
|
SiteDesc string `json:"site_desc"`
|
||||||
|
SiteLogo string `json:"site_logo"`
|
||||||
|
ForceHttps bool `json:"force_https"`
|
||||||
|
}
|
||||||
|
|
||||||
|
UpdateSiteConfigReq {
|
||||||
|
SiteName string `json:"site_name"`
|
||||||
|
SiteDesc string `json:"site_desc"`
|
||||||
|
SiteLogo string `json:"site_logo"`
|
||||||
|
ForceHttps bool `json:"force_https"`
|
||||||
|
}
|
||||||
|
|
||||||
|
RegisterConfigResp {
|
||||||
|
StopRegister bool `json:"stop_register"`
|
||||||
|
EmailVerify bool `json:"email_verify"`
|
||||||
|
EmailWhitelist string `json:"email_whitelist"`
|
||||||
|
InviteForce bool `json:"invite_force"`
|
||||||
|
}
|
||||||
|
|
||||||
|
UpdateRegisterConfigReq {
|
||||||
|
StopRegister bool `json:"stop_register"`
|
||||||
|
EmailVerify bool `json:"email_verify"`
|
||||||
|
EmailWhitelist string `json:"email_whitelist"`
|
||||||
|
InviteForce bool `json:"invite_force"`
|
||||||
|
}
|
||||||
|
)
|
||||||
|
|
||||||
|
@server (
|
||||||
|
prefix: /api/v1/admin/system
|
||||||
|
group: system
|
||||||
|
jwt: JwtAuth
|
||||||
|
)
|
||||||
|
service ppaneladmin {
|
||||||
|
@handler GetSiteConfigHandler
|
||||||
|
get /site returns (SiteConfigResp)
|
||||||
|
|
||||||
|
@handler UpdateSiteConfigHandler
|
||||||
|
put /site (UpdateSiteConfigReq)
|
||||||
|
|
||||||
|
@handler GetRegisterConfigHandler
|
||||||
|
get /register returns (RegisterConfigResp)
|
||||||
|
|
||||||
|
@handler UpdateRegisterConfigHandler
|
||||||
|
put /register (UpdateRegisterConfigReq)
|
||||||
|
}
|
||||||
59
apps/admin/desc/ticket.api
Normal file
59
apps/admin/desc/ticket.api
Normal file
@ -0,0 +1,59 @@
|
|||||||
|
syntax = "v1"
|
||||||
|
|
||||||
|
info (
|
||||||
|
title: "工单管理"
|
||||||
|
)
|
||||||
|
|
||||||
|
type (
|
||||||
|
AdminTicketListReq {
|
||||||
|
Page int `form:"page,default=1"`
|
||||||
|
PageSize int `form:"page_size,default=20"`
|
||||||
|
Status int `form:"status,optional"`
|
||||||
|
}
|
||||||
|
|
||||||
|
AdminTicketResp {
|
||||||
|
Id int64 `json:"id"`
|
||||||
|
UserId int64 `json:"user_id"`
|
||||||
|
Title string `json:"title"`
|
||||||
|
Status int `json:"status"`
|
||||||
|
CreatedAt string `json:"created_at"`
|
||||||
|
}
|
||||||
|
|
||||||
|
AdminTicketListResp {
|
||||||
|
Total int64 `json:"total"`
|
||||||
|
List []AdminTicketResp `json:"list"`
|
||||||
|
}
|
||||||
|
|
||||||
|
AdminTicketDetailReq {
|
||||||
|
Id int64 `path:"id"`
|
||||||
|
}
|
||||||
|
|
||||||
|
AdminUpdateTicketStatusReq {
|
||||||
|
Id int64 `path:"id"`
|
||||||
|
Status int `json:"status"`
|
||||||
|
}
|
||||||
|
|
||||||
|
AdminCreateTicketFollowReq {
|
||||||
|
Id int64 `path:"id"`
|
||||||
|
Content string `json:"content"`
|
||||||
|
}
|
||||||
|
)
|
||||||
|
|
||||||
|
@server (
|
||||||
|
prefix: /api/v1/admin/ticket
|
||||||
|
group: ticket
|
||||||
|
jwt: JwtAuth
|
||||||
|
)
|
||||||
|
service ppaneladmin {
|
||||||
|
@handler GetTicketListHandler
|
||||||
|
get /list (AdminTicketListReq) returns (AdminTicketListResp)
|
||||||
|
|
||||||
|
@handler GetTicketDetailHandler
|
||||||
|
get /:id (AdminTicketDetailReq) returns (AdminTicketResp)
|
||||||
|
|
||||||
|
@handler UpdateTicketStatusHandler
|
||||||
|
put /:id/status (AdminUpdateTicketStatusReq)
|
||||||
|
|
||||||
|
@handler CreateTicketFollowHandler
|
||||||
|
post /:id/follow (AdminCreateTicketFollowReq)
|
||||||
|
}
|
||||||
11
apps/admin/desc/types.api
Normal file
11
apps/admin/desc/types.api
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
syntax = "v1"
|
||||||
|
|
||||||
|
info (
|
||||||
|
title: "管理后台公共类型"
|
||||||
|
)
|
||||||
|
|
||||||
|
type (
|
||||||
|
HealthResp {
|
||||||
|
Status string `json:"status"`
|
||||||
|
}
|
||||||
|
)
|
||||||
51
apps/admin/desc/user.api
Normal file
51
apps/admin/desc/user.api
Normal file
@ -0,0 +1,51 @@
|
|||||||
|
syntax = "v1"
|
||||||
|
|
||||||
|
info (
|
||||||
|
title: "用户管理"
|
||||||
|
)
|
||||||
|
|
||||||
|
type (
|
||||||
|
AdminUserListReq {
|
||||||
|
Page int `form:"page,default=1"`
|
||||||
|
PageSize int `form:"page_size,default=20"`
|
||||||
|
Search string `form:"search,optional"`
|
||||||
|
}
|
||||||
|
|
||||||
|
AdminUserResp {
|
||||||
|
Id int64 `json:"id"`
|
||||||
|
Email string `json:"email"`
|
||||||
|
Balance int64 `json:"balance"`
|
||||||
|
IsAdmin bool `json:"is_admin"`
|
||||||
|
Enable bool `json:"enable"`
|
||||||
|
CreatedAt string `json:"created_at"`
|
||||||
|
}
|
||||||
|
|
||||||
|
AdminUserListResp {
|
||||||
|
Total int64 `json:"total"`
|
||||||
|
List []AdminUserResp `json:"list"`
|
||||||
|
}
|
||||||
|
|
||||||
|
AdminUserDetailReq {
|
||||||
|
Id int64 `path:"id"`
|
||||||
|
}
|
||||||
|
|
||||||
|
AdminDeleteUserReq {
|
||||||
|
Id int64 `path:"id"`
|
||||||
|
}
|
||||||
|
)
|
||||||
|
|
||||||
|
@server (
|
||||||
|
prefix: /api/v1/admin/user
|
||||||
|
group: user
|
||||||
|
jwt: JwtAuth
|
||||||
|
)
|
||||||
|
service ppaneladmin {
|
||||||
|
@handler GetUserListHandler
|
||||||
|
get /list (AdminUserListReq) returns (AdminUserListResp)
|
||||||
|
|
||||||
|
@handler GetUserDetailHandler
|
||||||
|
get /:id (AdminUserDetailReq) returns (AdminUserResp)
|
||||||
|
|
||||||
|
@handler DeleteUserHandler
|
||||||
|
delete /:id (AdminDeleteUserReq)
|
||||||
|
}
|
||||||
32
apps/admin/etc/admin-dev.yaml
Normal file
32
apps/admin/etc/admin-dev.yaml
Normal file
@ -0,0 +1,32 @@
|
|||||||
|
Name: zero-ppanel-admin
|
||||||
|
Host: 0.0.0.0
|
||||||
|
Port: 8081
|
||||||
|
Mode: dev
|
||||||
|
|
||||||
|
Log:
|
||||||
|
Mode: console
|
||||||
|
Encoding: plain
|
||||||
|
Level: debug
|
||||||
|
|
||||||
|
Telemetry:
|
||||||
|
Name: zero-ppanel-admin
|
||||||
|
Endpoint: 127.0.0.1:4318
|
||||||
|
Sampler: 1.0
|
||||||
|
Batcher: otlphttp
|
||||||
|
|
||||||
|
DevServer:
|
||||||
|
Enabled: true
|
||||||
|
Port: 6161
|
||||||
|
EnableMetrics: true
|
||||||
|
EnablePprof: true
|
||||||
|
|
||||||
|
JwtAuth:
|
||||||
|
AccessSecret: "dev-admin-secret-key-change-me"
|
||||||
|
AccessExpire: 28800
|
||||||
|
|
||||||
|
MySQL:
|
||||||
|
DataSource: "root:password@tcp(127.0.0.1:3306)/ppanel?charset=utf8mb4&parseTime=true"
|
||||||
|
|
||||||
|
Redis:
|
||||||
|
Host: 127.0.0.1:6379
|
||||||
|
Type: node
|
||||||
36
apps/admin/etc/admin-prod.yaml
Normal file
36
apps/admin/etc/admin-prod.yaml
Normal file
@ -0,0 +1,36 @@
|
|||||||
|
Name: zero-ppanel-admin
|
||||||
|
Host: 0.0.0.0
|
||||||
|
Port: 8081
|
||||||
|
Mode: pro
|
||||||
|
|
||||||
|
Log:
|
||||||
|
Mode: file
|
||||||
|
Encoding: json
|
||||||
|
Level: info
|
||||||
|
Path: /var/log/zero-ppanel/admin
|
||||||
|
KeepDays: 15
|
||||||
|
Rotation: daily
|
||||||
|
|
||||||
|
Telemetry:
|
||||||
|
Name: zero-ppanel-admin
|
||||||
|
Endpoint: http://jaeger:4318/v1/traces
|
||||||
|
Sampler: 0.1
|
||||||
|
Batcher: otlphttp
|
||||||
|
|
||||||
|
DevServer:
|
||||||
|
Enabled: true
|
||||||
|
Port: 6161
|
||||||
|
EnableMetrics: true
|
||||||
|
EnablePprof: false
|
||||||
|
|
||||||
|
JwtAuth:
|
||||||
|
AccessSecret: "${JWT_ADMIN_SECRET}"
|
||||||
|
AccessExpire: 28800
|
||||||
|
|
||||||
|
MySQL:
|
||||||
|
DataSource: "${MYSQL_DSN}"
|
||||||
|
|
||||||
|
Redis:
|
||||||
|
Host: "${REDIS_HOST}"
|
||||||
|
Type: node
|
||||||
|
Pass: "${REDIS_PASS}"
|
||||||
34
apps/admin/etc/admin-test.yaml
Normal file
34
apps/admin/etc/admin-test.yaml
Normal file
@ -0,0 +1,34 @@
|
|||||||
|
Name: zero-ppanel-admin
|
||||||
|
Host: 0.0.0.0
|
||||||
|
Port: 8081
|
||||||
|
Mode: test
|
||||||
|
|
||||||
|
Log:
|
||||||
|
Mode: file
|
||||||
|
Encoding: json
|
||||||
|
Level: info
|
||||||
|
Path: logs/admin
|
||||||
|
KeepDays: 7
|
||||||
|
|
||||||
|
Telemetry:
|
||||||
|
Name: zero-ppanel-admin
|
||||||
|
Endpoint: http://jaeger:4318/v1/traces
|
||||||
|
Sampler: 0.5
|
||||||
|
Batcher: otlphttp
|
||||||
|
|
||||||
|
DevServer:
|
||||||
|
Enabled: true
|
||||||
|
Port: 6161
|
||||||
|
EnableMetrics: true
|
||||||
|
EnablePprof: true
|
||||||
|
|
||||||
|
JwtAuth:
|
||||||
|
AccessSecret: "test-admin-secret-key-change-me"
|
||||||
|
AccessExpire: 28800
|
||||||
|
|
||||||
|
MySQL:
|
||||||
|
DataSource: "root:password@tcp(mysql:3306)/ppanel?charset=utf8mb4&parseTime=true"
|
||||||
|
|
||||||
|
Redis:
|
||||||
|
Host: redis:6379
|
||||||
|
Type: node
|
||||||
3
apps/admin/etc/ppaneladmin.yaml
Normal file
3
apps/admin/etc/ppaneladmin.yaml
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
Name: ppaneladmin
|
||||||
|
Host: 0.0.0.0
|
||||||
|
Port: 8888
|
||||||
14
apps/admin/internal/config/config.go
Normal file
14
apps/admin/internal/config/config.go
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
// Code scaffolded by goctl. Safe to edit.
|
||||||
|
// goctl 1.9.2
|
||||||
|
|
||||||
|
package config
|
||||||
|
|
||||||
|
import "github.com/zeromicro/go-zero/rest"
|
||||||
|
|
||||||
|
type Config struct {
|
||||||
|
rest.RestConf
|
||||||
|
JwtAuth struct {
|
||||||
|
AccessSecret string
|
||||||
|
AccessExpire int64
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,31 @@
|
|||||||
|
// Code scaffolded by goctl. Safe to edit.
|
||||||
|
// goctl 1.9.2
|
||||||
|
|
||||||
|
package announcement
|
||||||
|
|
||||||
|
import (
|
||||||
|
"net/http"
|
||||||
|
|
||||||
|
"github.com/zero-ppanel/zero-ppanel/apps/admin/internal/logic/announcement"
|
||||||
|
"github.com/zero-ppanel/zero-ppanel/apps/admin/internal/svc"
|
||||||
|
"github.com/zero-ppanel/zero-ppanel/apps/admin/internal/types"
|
||||||
|
"github.com/zeromicro/go-zero/rest/httpx"
|
||||||
|
)
|
||||||
|
|
||||||
|
func CreateAnnouncementHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
|
||||||
|
return func(w http.ResponseWriter, r *http.Request) {
|
||||||
|
var req types.CreateAnnouncementReq
|
||||||
|
if err := httpx.Parse(r, &req); err != nil {
|
||||||
|
httpx.ErrorCtx(r.Context(), w, err)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
l := announcement.NewCreateAnnouncementLogic(r.Context(), svcCtx)
|
||||||
|
resp, err := l.CreateAnnouncement(&req)
|
||||||
|
if err != nil {
|
||||||
|
httpx.ErrorCtx(r.Context(), w, err)
|
||||||
|
} else {
|
||||||
|
httpx.OkJsonCtx(r.Context(), w, resp)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,31 @@
|
|||||||
|
// Code scaffolded by goctl. Safe to edit.
|
||||||
|
// goctl 1.9.2
|
||||||
|
|
||||||
|
package announcement
|
||||||
|
|
||||||
|
import (
|
||||||
|
"net/http"
|
||||||
|
|
||||||
|
"github.com/zero-ppanel/zero-ppanel/apps/admin/internal/logic/announcement"
|
||||||
|
"github.com/zero-ppanel/zero-ppanel/apps/admin/internal/svc"
|
||||||
|
"github.com/zero-ppanel/zero-ppanel/apps/admin/internal/types"
|
||||||
|
"github.com/zeromicro/go-zero/rest/httpx"
|
||||||
|
)
|
||||||
|
|
||||||
|
func DeleteAnnouncementHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
|
||||||
|
return func(w http.ResponseWriter, r *http.Request) {
|
||||||
|
var req types.DeleteAnnouncementReq
|
||||||
|
if err := httpx.Parse(r, &req); err != nil {
|
||||||
|
httpx.ErrorCtx(r.Context(), w, err)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
l := announcement.NewDeleteAnnouncementLogic(r.Context(), svcCtx)
|
||||||
|
err := l.DeleteAnnouncement(&req)
|
||||||
|
if err != nil {
|
||||||
|
httpx.ErrorCtx(r.Context(), w, err)
|
||||||
|
} else {
|
||||||
|
httpx.Ok(w)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,31 @@
|
|||||||
|
// Code scaffolded by goctl. Safe to edit.
|
||||||
|
// goctl 1.9.2
|
||||||
|
|
||||||
|
package announcement
|
||||||
|
|
||||||
|
import (
|
||||||
|
"net/http"
|
||||||
|
|
||||||
|
"github.com/zero-ppanel/zero-ppanel/apps/admin/internal/logic/announcement"
|
||||||
|
"github.com/zero-ppanel/zero-ppanel/apps/admin/internal/svc"
|
||||||
|
"github.com/zero-ppanel/zero-ppanel/apps/admin/internal/types"
|
||||||
|
"github.com/zeromicro/go-zero/rest/httpx"
|
||||||
|
)
|
||||||
|
|
||||||
|
func UpdateAnnouncementHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
|
||||||
|
return func(w http.ResponseWriter, r *http.Request) {
|
||||||
|
var req types.UpdateAnnouncementReq
|
||||||
|
if err := httpx.Parse(r, &req); err != nil {
|
||||||
|
httpx.ErrorCtx(r.Context(), w, err)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
l := announcement.NewUpdateAnnouncementLogic(r.Context(), svcCtx)
|
||||||
|
err := l.UpdateAnnouncement(&req)
|
||||||
|
if err != nil {
|
||||||
|
httpx.ErrorCtx(r.Context(), w, err)
|
||||||
|
} else {
|
||||||
|
httpx.Ok(w)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
24
apps/admin/internal/handler/common/healthHandler.go
Normal file
24
apps/admin/internal/handler/common/healthHandler.go
Normal file
@ -0,0 +1,24 @@
|
|||||||
|
// Code scaffolded by goctl. Safe to edit.
|
||||||
|
// goctl 1.9.2
|
||||||
|
|
||||||
|
package common
|
||||||
|
|
||||||
|
import (
|
||||||
|
"net/http"
|
||||||
|
|
||||||
|
"github.com/zero-ppanel/zero-ppanel/apps/admin/internal/logic/common"
|
||||||
|
"github.com/zero-ppanel/zero-ppanel/apps/admin/internal/svc"
|
||||||
|
"github.com/zeromicro/go-zero/rest/httpx"
|
||||||
|
)
|
||||||
|
|
||||||
|
func HealthHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
|
||||||
|
return func(w http.ResponseWriter, r *http.Request) {
|
||||||
|
l := common.NewHealthLogic(r.Context(), svcCtx)
|
||||||
|
resp, err := l.Health()
|
||||||
|
if err != nil {
|
||||||
|
httpx.ErrorCtx(r.Context(), w, err)
|
||||||
|
} else {
|
||||||
|
httpx.OkJsonCtx(r.Context(), w, resp)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,24 @@
|
|||||||
|
// Code scaffolded by goctl. Safe to edit.
|
||||||
|
// goctl 1.9.2
|
||||||
|
|
||||||
|
package console
|
||||||
|
|
||||||
|
import (
|
||||||
|
"net/http"
|
||||||
|
|
||||||
|
"github.com/zero-ppanel/zero-ppanel/apps/admin/internal/logic/console"
|
||||||
|
"github.com/zero-ppanel/zero-ppanel/apps/admin/internal/svc"
|
||||||
|
"github.com/zeromicro/go-zero/rest/httpx"
|
||||||
|
)
|
||||||
|
|
||||||
|
func GetConsoleStatsHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
|
||||||
|
return func(w http.ResponseWriter, r *http.Request) {
|
||||||
|
l := console.NewGetConsoleStatsLogic(r.Context(), svcCtx)
|
||||||
|
resp, err := l.GetConsoleStats()
|
||||||
|
if err != nil {
|
||||||
|
httpx.ErrorCtx(r.Context(), w, err)
|
||||||
|
} else {
|
||||||
|
httpx.OkJsonCtx(r.Context(), w, resp)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
31
apps/admin/internal/handler/order/getOrderListHandler.go
Normal file
31
apps/admin/internal/handler/order/getOrderListHandler.go
Normal file
@ -0,0 +1,31 @@
|
|||||||
|
// Code scaffolded by goctl. Safe to edit.
|
||||||
|
// goctl 1.9.2
|
||||||
|
|
||||||
|
package order
|
||||||
|
|
||||||
|
import (
|
||||||
|
"net/http"
|
||||||
|
|
||||||
|
"github.com/zero-ppanel/zero-ppanel/apps/admin/internal/logic/order"
|
||||||
|
"github.com/zero-ppanel/zero-ppanel/apps/admin/internal/svc"
|
||||||
|
"github.com/zero-ppanel/zero-ppanel/apps/admin/internal/types"
|
||||||
|
"github.com/zeromicro/go-zero/rest/httpx"
|
||||||
|
)
|
||||||
|
|
||||||
|
func GetOrderListHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
|
||||||
|
return func(w http.ResponseWriter, r *http.Request) {
|
||||||
|
var req types.AdminOrderListReq
|
||||||
|
if err := httpx.Parse(r, &req); err != nil {
|
||||||
|
httpx.ErrorCtx(r.Context(), w, err)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
l := order.NewGetOrderListLogic(r.Context(), svcCtx)
|
||||||
|
resp, err := l.GetOrderList(&req)
|
||||||
|
if err != nil {
|
||||||
|
httpx.ErrorCtx(r.Context(), w, err)
|
||||||
|
} else {
|
||||||
|
httpx.OkJsonCtx(r.Context(), w, resp)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,31 @@
|
|||||||
|
// Code scaffolded by goctl. Safe to edit.
|
||||||
|
// goctl 1.9.2
|
||||||
|
|
||||||
|
package order
|
||||||
|
|
||||||
|
import (
|
||||||
|
"net/http"
|
||||||
|
|
||||||
|
"github.com/zero-ppanel/zero-ppanel/apps/admin/internal/logic/order"
|
||||||
|
"github.com/zero-ppanel/zero-ppanel/apps/admin/internal/svc"
|
||||||
|
"github.com/zero-ppanel/zero-ppanel/apps/admin/internal/types"
|
||||||
|
"github.com/zeromicro/go-zero/rest/httpx"
|
||||||
|
)
|
||||||
|
|
||||||
|
func UpdateOrderStatusHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
|
||||||
|
return func(w http.ResponseWriter, r *http.Request) {
|
||||||
|
var req types.UpdateOrderStatusReq
|
||||||
|
if err := httpx.Parse(r, &req); err != nil {
|
||||||
|
httpx.ErrorCtx(r.Context(), w, err)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
l := order.NewUpdateOrderStatusLogic(r.Context(), svcCtx)
|
||||||
|
err := l.UpdateOrderStatus(&req)
|
||||||
|
if err != nil {
|
||||||
|
httpx.ErrorCtx(r.Context(), w, err)
|
||||||
|
} else {
|
||||||
|
httpx.Ok(w)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
215
apps/admin/internal/handler/routes.go
Normal file
215
apps/admin/internal/handler/routes.go
Normal file
@ -0,0 +1,215 @@
|
|||||||
|
// Code generated by goctl. DO NOT EDIT.
|
||||||
|
// goctl 1.9.2
|
||||||
|
|
||||||
|
package handler
|
||||||
|
|
||||||
|
import (
|
||||||
|
"net/http"
|
||||||
|
|
||||||
|
announcement "github.com/zero-ppanel/zero-ppanel/apps/admin/internal/handler/announcement"
|
||||||
|
common "github.com/zero-ppanel/zero-ppanel/apps/admin/internal/handler/common"
|
||||||
|
console "github.com/zero-ppanel/zero-ppanel/apps/admin/internal/handler/console"
|
||||||
|
order "github.com/zero-ppanel/zero-ppanel/apps/admin/internal/handler/order"
|
||||||
|
serverhandler "github.com/zero-ppanel/zero-ppanel/apps/admin/internal/handler/server"
|
||||||
|
subscribe "github.com/zero-ppanel/zero-ppanel/apps/admin/internal/handler/subscribe"
|
||||||
|
system "github.com/zero-ppanel/zero-ppanel/apps/admin/internal/handler/system"
|
||||||
|
ticket "github.com/zero-ppanel/zero-ppanel/apps/admin/internal/handler/ticket"
|
||||||
|
user "github.com/zero-ppanel/zero-ppanel/apps/admin/internal/handler/user"
|
||||||
|
"github.com/zero-ppanel/zero-ppanel/apps/admin/internal/svc"
|
||||||
|
|
||||||
|
"github.com/zeromicro/go-zero/rest"
|
||||||
|
)
|
||||||
|
|
||||||
|
func RegisterHandlers(server *rest.Server, serverCtx *svc.ServiceContext) {
|
||||||
|
server.AddRoutes(
|
||||||
|
[]rest.Route{
|
||||||
|
{
|
||||||
|
Method: http.MethodPut,
|
||||||
|
Path: "/:id",
|
||||||
|
Handler: announcement.UpdateAnnouncementHandler(serverCtx),
|
||||||
|
},
|
||||||
|
{
|
||||||
|
Method: http.MethodDelete,
|
||||||
|
Path: "/:id",
|
||||||
|
Handler: announcement.DeleteAnnouncementHandler(serverCtx),
|
||||||
|
},
|
||||||
|
{
|
||||||
|
Method: http.MethodPost,
|
||||||
|
Path: "/create",
|
||||||
|
Handler: announcement.CreateAnnouncementHandler(serverCtx),
|
||||||
|
},
|
||||||
|
},
|
||||||
|
rest.WithJwt(serverCtx.Config.JwtAuth.AccessSecret),
|
||||||
|
rest.WithPrefix("/api/v1/admin/announcement"),
|
||||||
|
)
|
||||||
|
|
||||||
|
server.AddRoutes(
|
||||||
|
[]rest.Route{
|
||||||
|
{
|
||||||
|
Method: http.MethodGet,
|
||||||
|
Path: "/health",
|
||||||
|
Handler: common.HealthHandler(serverCtx),
|
||||||
|
},
|
||||||
|
},
|
||||||
|
rest.WithPrefix("/api/v1/admin"),
|
||||||
|
)
|
||||||
|
|
||||||
|
server.AddRoutes(
|
||||||
|
[]rest.Route{
|
||||||
|
{
|
||||||
|
Method: http.MethodGet,
|
||||||
|
Path: "/stats",
|
||||||
|
Handler: console.GetConsoleStatsHandler(serverCtx),
|
||||||
|
},
|
||||||
|
},
|
||||||
|
rest.WithJwt(serverCtx.Config.JwtAuth.AccessSecret),
|
||||||
|
rest.WithPrefix("/api/v1/admin/console"),
|
||||||
|
)
|
||||||
|
|
||||||
|
server.AddRoutes(
|
||||||
|
[]rest.Route{
|
||||||
|
{
|
||||||
|
Method: http.MethodPut,
|
||||||
|
Path: "/:order_no/status",
|
||||||
|
Handler: order.UpdateOrderStatusHandler(serverCtx),
|
||||||
|
},
|
||||||
|
{
|
||||||
|
Method: http.MethodGet,
|
||||||
|
Path: "/list",
|
||||||
|
Handler: order.GetOrderListHandler(serverCtx),
|
||||||
|
},
|
||||||
|
},
|
||||||
|
rest.WithJwt(serverCtx.Config.JwtAuth.AccessSecret),
|
||||||
|
rest.WithPrefix("/api/v1/admin/order"),
|
||||||
|
)
|
||||||
|
|
||||||
|
server.AddRoutes(
|
||||||
|
[]rest.Route{
|
||||||
|
{
|
||||||
|
Method: http.MethodPut,
|
||||||
|
Path: "/:id",
|
||||||
|
Handler: serverhandler.UpdateServerHandler(serverCtx),
|
||||||
|
},
|
||||||
|
{
|
||||||
|
Method: http.MethodDelete,
|
||||||
|
Path: "/:id",
|
||||||
|
Handler: serverhandler.DeleteServerHandler(serverCtx),
|
||||||
|
},
|
||||||
|
{
|
||||||
|
Method: http.MethodPost,
|
||||||
|
Path: "/create",
|
||||||
|
Handler: serverhandler.CreateServerHandler(serverCtx),
|
||||||
|
},
|
||||||
|
{
|
||||||
|
Method: http.MethodGet,
|
||||||
|
Path: "/list",
|
||||||
|
Handler: serverhandler.GetServerListHandler(serverCtx),
|
||||||
|
},
|
||||||
|
},
|
||||||
|
rest.WithJwt(serverCtx.Config.JwtAuth.AccessSecret),
|
||||||
|
rest.WithPrefix("/api/v1/admin/server"),
|
||||||
|
)
|
||||||
|
|
||||||
|
server.AddRoutes(
|
||||||
|
[]rest.Route{
|
||||||
|
{
|
||||||
|
Method: http.MethodPut,
|
||||||
|
Path: "/:id",
|
||||||
|
Handler: subscribe.UpdateSubscribeHandler(serverCtx),
|
||||||
|
},
|
||||||
|
{
|
||||||
|
Method: http.MethodDelete,
|
||||||
|
Path: "/:id",
|
||||||
|
Handler: subscribe.DeleteSubscribeHandler(serverCtx),
|
||||||
|
},
|
||||||
|
{
|
||||||
|
Method: http.MethodPost,
|
||||||
|
Path: "/create",
|
||||||
|
Handler: subscribe.CreateSubscribeHandler(serverCtx),
|
||||||
|
},
|
||||||
|
{
|
||||||
|
Method: http.MethodGet,
|
||||||
|
Path: "/list",
|
||||||
|
Handler: subscribe.GetSubscribeListHandler(serverCtx),
|
||||||
|
},
|
||||||
|
},
|
||||||
|
rest.WithJwt(serverCtx.Config.JwtAuth.AccessSecret),
|
||||||
|
rest.WithPrefix("/api/v1/admin/subscribe"),
|
||||||
|
)
|
||||||
|
|
||||||
|
server.AddRoutes(
|
||||||
|
[]rest.Route{
|
||||||
|
{
|
||||||
|
Method: http.MethodGet,
|
||||||
|
Path: "/register",
|
||||||
|
Handler: system.GetRegisterConfigHandler(serverCtx),
|
||||||
|
},
|
||||||
|
{
|
||||||
|
Method: http.MethodPut,
|
||||||
|
Path: "/register",
|
||||||
|
Handler: system.UpdateRegisterConfigHandler(serverCtx),
|
||||||
|
},
|
||||||
|
{
|
||||||
|
Method: http.MethodGet,
|
||||||
|
Path: "/site",
|
||||||
|
Handler: system.GetSiteConfigHandler(serverCtx),
|
||||||
|
},
|
||||||
|
{
|
||||||
|
Method: http.MethodPut,
|
||||||
|
Path: "/site",
|
||||||
|
Handler: system.UpdateSiteConfigHandler(serverCtx),
|
||||||
|
},
|
||||||
|
},
|
||||||
|
rest.WithJwt(serverCtx.Config.JwtAuth.AccessSecret),
|
||||||
|
rest.WithPrefix("/api/v1/admin/system"),
|
||||||
|
)
|
||||||
|
|
||||||
|
server.AddRoutes(
|
||||||
|
[]rest.Route{
|
||||||
|
{
|
||||||
|
Method: http.MethodGet,
|
||||||
|
Path: "/:id",
|
||||||
|
Handler: ticket.GetTicketDetailHandler(serverCtx),
|
||||||
|
},
|
||||||
|
{
|
||||||
|
Method: http.MethodPost,
|
||||||
|
Path: "/:id/follow",
|
||||||
|
Handler: ticket.CreateTicketFollowHandler(serverCtx),
|
||||||
|
},
|
||||||
|
{
|
||||||
|
Method: http.MethodPut,
|
||||||
|
Path: "/:id/status",
|
||||||
|
Handler: ticket.UpdateTicketStatusHandler(serverCtx),
|
||||||
|
},
|
||||||
|
{
|
||||||
|
Method: http.MethodGet,
|
||||||
|
Path: "/list",
|
||||||
|
Handler: ticket.GetTicketListHandler(serverCtx),
|
||||||
|
},
|
||||||
|
},
|
||||||
|
rest.WithJwt(serverCtx.Config.JwtAuth.AccessSecret),
|
||||||
|
rest.WithPrefix("/api/v1/admin/ticket"),
|
||||||
|
)
|
||||||
|
|
||||||
|
server.AddRoutes(
|
||||||
|
[]rest.Route{
|
||||||
|
{
|
||||||
|
Method: http.MethodGet,
|
||||||
|
Path: "/:id",
|
||||||
|
Handler: user.GetUserDetailHandler(serverCtx),
|
||||||
|
},
|
||||||
|
{
|
||||||
|
Method: http.MethodDelete,
|
||||||
|
Path: "/:id",
|
||||||
|
Handler: user.DeleteUserHandler(serverCtx),
|
||||||
|
},
|
||||||
|
{
|
||||||
|
Method: http.MethodGet,
|
||||||
|
Path: "/list",
|
||||||
|
Handler: user.GetUserListHandler(serverCtx),
|
||||||
|
},
|
||||||
|
},
|
||||||
|
rest.WithJwt(serverCtx.Config.JwtAuth.AccessSecret),
|
||||||
|
rest.WithPrefix("/api/v1/admin/user"),
|
||||||
|
)
|
||||||
|
}
|
||||||
31
apps/admin/internal/handler/server/createServerHandler.go
Normal file
31
apps/admin/internal/handler/server/createServerHandler.go
Normal file
@ -0,0 +1,31 @@
|
|||||||
|
// Code scaffolded by goctl. Safe to edit.
|
||||||
|
// goctl 1.9.2
|
||||||
|
|
||||||
|
package server
|
||||||
|
|
||||||
|
import (
|
||||||
|
"net/http"
|
||||||
|
|
||||||
|
"github.com/zero-ppanel/zero-ppanel/apps/admin/internal/logic/server"
|
||||||
|
"github.com/zero-ppanel/zero-ppanel/apps/admin/internal/svc"
|
||||||
|
"github.com/zero-ppanel/zero-ppanel/apps/admin/internal/types"
|
||||||
|
"github.com/zeromicro/go-zero/rest/httpx"
|
||||||
|
)
|
||||||
|
|
||||||
|
func CreateServerHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
|
||||||
|
return func(w http.ResponseWriter, r *http.Request) {
|
||||||
|
var req types.CreateServerReq
|
||||||
|
if err := httpx.Parse(r, &req); err != nil {
|
||||||
|
httpx.ErrorCtx(r.Context(), w, err)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
l := server.NewCreateServerLogic(r.Context(), svcCtx)
|
||||||
|
resp, err := l.CreateServer(&req)
|
||||||
|
if err != nil {
|
||||||
|
httpx.ErrorCtx(r.Context(), w, err)
|
||||||
|
} else {
|
||||||
|
httpx.OkJsonCtx(r.Context(), w, resp)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
31
apps/admin/internal/handler/server/deleteServerHandler.go
Normal file
31
apps/admin/internal/handler/server/deleteServerHandler.go
Normal file
@ -0,0 +1,31 @@
|
|||||||
|
// Code scaffolded by goctl. Safe to edit.
|
||||||
|
// goctl 1.9.2
|
||||||
|
|
||||||
|
package server
|
||||||
|
|
||||||
|
import (
|
||||||
|
"net/http"
|
||||||
|
|
||||||
|
"github.com/zero-ppanel/zero-ppanel/apps/admin/internal/logic/server"
|
||||||
|
"github.com/zero-ppanel/zero-ppanel/apps/admin/internal/svc"
|
||||||
|
"github.com/zero-ppanel/zero-ppanel/apps/admin/internal/types"
|
||||||
|
"github.com/zeromicro/go-zero/rest/httpx"
|
||||||
|
)
|
||||||
|
|
||||||
|
func DeleteServerHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
|
||||||
|
return func(w http.ResponseWriter, r *http.Request) {
|
||||||
|
var req types.DeleteServerReq
|
||||||
|
if err := httpx.Parse(r, &req); err != nil {
|
||||||
|
httpx.ErrorCtx(r.Context(), w, err)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
l := server.NewDeleteServerLogic(r.Context(), svcCtx)
|
||||||
|
err := l.DeleteServer(&req)
|
||||||
|
if err != nil {
|
||||||
|
httpx.ErrorCtx(r.Context(), w, err)
|
||||||
|
} else {
|
||||||
|
httpx.Ok(w)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
31
apps/admin/internal/handler/server/getServerListHandler.go
Normal file
31
apps/admin/internal/handler/server/getServerListHandler.go
Normal file
@ -0,0 +1,31 @@
|
|||||||
|
// Code scaffolded by goctl. Safe to edit.
|
||||||
|
// goctl 1.9.2
|
||||||
|
|
||||||
|
package server
|
||||||
|
|
||||||
|
import (
|
||||||
|
"net/http"
|
||||||
|
|
||||||
|
"github.com/zero-ppanel/zero-ppanel/apps/admin/internal/logic/server"
|
||||||
|
"github.com/zero-ppanel/zero-ppanel/apps/admin/internal/svc"
|
||||||
|
"github.com/zero-ppanel/zero-ppanel/apps/admin/internal/types"
|
||||||
|
"github.com/zeromicro/go-zero/rest/httpx"
|
||||||
|
)
|
||||||
|
|
||||||
|
func GetServerListHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
|
||||||
|
return func(w http.ResponseWriter, r *http.Request) {
|
||||||
|
var req types.ServerListReq
|
||||||
|
if err := httpx.Parse(r, &req); err != nil {
|
||||||
|
httpx.ErrorCtx(r.Context(), w, err)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
l := server.NewGetServerListLogic(r.Context(), svcCtx)
|
||||||
|
resp, err := l.GetServerList(&req)
|
||||||
|
if err != nil {
|
||||||
|
httpx.ErrorCtx(r.Context(), w, err)
|
||||||
|
} else {
|
||||||
|
httpx.OkJsonCtx(r.Context(), w, resp)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
31
apps/admin/internal/handler/server/updateServerHandler.go
Normal file
31
apps/admin/internal/handler/server/updateServerHandler.go
Normal file
@ -0,0 +1,31 @@
|
|||||||
|
// Code scaffolded by goctl. Safe to edit.
|
||||||
|
// goctl 1.9.2
|
||||||
|
|
||||||
|
package server
|
||||||
|
|
||||||
|
import (
|
||||||
|
"net/http"
|
||||||
|
|
||||||
|
"github.com/zero-ppanel/zero-ppanel/apps/admin/internal/logic/server"
|
||||||
|
"github.com/zero-ppanel/zero-ppanel/apps/admin/internal/svc"
|
||||||
|
"github.com/zero-ppanel/zero-ppanel/apps/admin/internal/types"
|
||||||
|
"github.com/zeromicro/go-zero/rest/httpx"
|
||||||
|
)
|
||||||
|
|
||||||
|
func UpdateServerHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
|
||||||
|
return func(w http.ResponseWriter, r *http.Request) {
|
||||||
|
var req types.UpdateServerReq
|
||||||
|
if err := httpx.Parse(r, &req); err != nil {
|
||||||
|
httpx.ErrorCtx(r.Context(), w, err)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
l := server.NewUpdateServerLogic(r.Context(), svcCtx)
|
||||||
|
err := l.UpdateServer(&req)
|
||||||
|
if err != nil {
|
||||||
|
httpx.ErrorCtx(r.Context(), w, err)
|
||||||
|
} else {
|
||||||
|
httpx.Ok(w)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,31 @@
|
|||||||
|
// Code scaffolded by goctl. Safe to edit.
|
||||||
|
// goctl 1.9.2
|
||||||
|
|
||||||
|
package subscribe
|
||||||
|
|
||||||
|
import (
|
||||||
|
"net/http"
|
||||||
|
|
||||||
|
"github.com/zero-ppanel/zero-ppanel/apps/admin/internal/logic/subscribe"
|
||||||
|
"github.com/zero-ppanel/zero-ppanel/apps/admin/internal/svc"
|
||||||
|
"github.com/zero-ppanel/zero-ppanel/apps/admin/internal/types"
|
||||||
|
"github.com/zeromicro/go-zero/rest/httpx"
|
||||||
|
)
|
||||||
|
|
||||||
|
func CreateSubscribeHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
|
||||||
|
return func(w http.ResponseWriter, r *http.Request) {
|
||||||
|
var req types.CreateSubscribeReq
|
||||||
|
if err := httpx.Parse(r, &req); err != nil {
|
||||||
|
httpx.ErrorCtx(r.Context(), w, err)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
l := subscribe.NewCreateSubscribeLogic(r.Context(), svcCtx)
|
||||||
|
resp, err := l.CreateSubscribe(&req)
|
||||||
|
if err != nil {
|
||||||
|
httpx.ErrorCtx(r.Context(), w, err)
|
||||||
|
} else {
|
||||||
|
httpx.OkJsonCtx(r.Context(), w, resp)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,31 @@
|
|||||||
|
// Code scaffolded by goctl. Safe to edit.
|
||||||
|
// goctl 1.9.2
|
||||||
|
|
||||||
|
package subscribe
|
||||||
|
|
||||||
|
import (
|
||||||
|
"net/http"
|
||||||
|
|
||||||
|
"github.com/zero-ppanel/zero-ppanel/apps/admin/internal/logic/subscribe"
|
||||||
|
"github.com/zero-ppanel/zero-ppanel/apps/admin/internal/svc"
|
||||||
|
"github.com/zero-ppanel/zero-ppanel/apps/admin/internal/types"
|
||||||
|
"github.com/zeromicro/go-zero/rest/httpx"
|
||||||
|
)
|
||||||
|
|
||||||
|
func DeleteSubscribeHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
|
||||||
|
return func(w http.ResponseWriter, r *http.Request) {
|
||||||
|
var req types.DeleteSubscribeReq
|
||||||
|
if err := httpx.Parse(r, &req); err != nil {
|
||||||
|
httpx.ErrorCtx(r.Context(), w, err)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
l := subscribe.NewDeleteSubscribeLogic(r.Context(), svcCtx)
|
||||||
|
err := l.DeleteSubscribe(&req)
|
||||||
|
if err != nil {
|
||||||
|
httpx.ErrorCtx(r.Context(), w, err)
|
||||||
|
} else {
|
||||||
|
httpx.Ok(w)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,31 @@
|
|||||||
|
// Code scaffolded by goctl. Safe to edit.
|
||||||
|
// goctl 1.9.2
|
||||||
|
|
||||||
|
package subscribe
|
||||||
|
|
||||||
|
import (
|
||||||
|
"net/http"
|
||||||
|
|
||||||
|
"github.com/zero-ppanel/zero-ppanel/apps/admin/internal/logic/subscribe"
|
||||||
|
"github.com/zero-ppanel/zero-ppanel/apps/admin/internal/svc"
|
||||||
|
"github.com/zero-ppanel/zero-ppanel/apps/admin/internal/types"
|
||||||
|
"github.com/zeromicro/go-zero/rest/httpx"
|
||||||
|
)
|
||||||
|
|
||||||
|
func GetSubscribeListHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
|
||||||
|
return func(w http.ResponseWriter, r *http.Request) {
|
||||||
|
var req types.AdminSubscribeListReq
|
||||||
|
if err := httpx.Parse(r, &req); err != nil {
|
||||||
|
httpx.ErrorCtx(r.Context(), w, err)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
l := subscribe.NewGetSubscribeListLogic(r.Context(), svcCtx)
|
||||||
|
resp, err := l.GetSubscribeList(&req)
|
||||||
|
if err != nil {
|
||||||
|
httpx.ErrorCtx(r.Context(), w, err)
|
||||||
|
} else {
|
||||||
|
httpx.OkJsonCtx(r.Context(), w, resp)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,31 @@
|
|||||||
|
// Code scaffolded by goctl. Safe to edit.
|
||||||
|
// goctl 1.9.2
|
||||||
|
|
||||||
|
package subscribe
|
||||||
|
|
||||||
|
import (
|
||||||
|
"net/http"
|
||||||
|
|
||||||
|
"github.com/zero-ppanel/zero-ppanel/apps/admin/internal/logic/subscribe"
|
||||||
|
"github.com/zero-ppanel/zero-ppanel/apps/admin/internal/svc"
|
||||||
|
"github.com/zero-ppanel/zero-ppanel/apps/admin/internal/types"
|
||||||
|
"github.com/zeromicro/go-zero/rest/httpx"
|
||||||
|
)
|
||||||
|
|
||||||
|
func UpdateSubscribeHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
|
||||||
|
return func(w http.ResponseWriter, r *http.Request) {
|
||||||
|
var req types.UpdateSubscribeReq
|
||||||
|
if err := httpx.Parse(r, &req); err != nil {
|
||||||
|
httpx.ErrorCtx(r.Context(), w, err)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
l := subscribe.NewUpdateSubscribeLogic(r.Context(), svcCtx)
|
||||||
|
err := l.UpdateSubscribe(&req)
|
||||||
|
if err != nil {
|
||||||
|
httpx.ErrorCtx(r.Context(), w, err)
|
||||||
|
} else {
|
||||||
|
httpx.Ok(w)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,24 @@
|
|||||||
|
// Code scaffolded by goctl. Safe to edit.
|
||||||
|
// goctl 1.9.2
|
||||||
|
|
||||||
|
package system
|
||||||
|
|
||||||
|
import (
|
||||||
|
"net/http"
|
||||||
|
|
||||||
|
"github.com/zero-ppanel/zero-ppanel/apps/admin/internal/logic/system"
|
||||||
|
"github.com/zero-ppanel/zero-ppanel/apps/admin/internal/svc"
|
||||||
|
"github.com/zeromicro/go-zero/rest/httpx"
|
||||||
|
)
|
||||||
|
|
||||||
|
func GetRegisterConfigHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
|
||||||
|
return func(w http.ResponseWriter, r *http.Request) {
|
||||||
|
l := system.NewGetRegisterConfigLogic(r.Context(), svcCtx)
|
||||||
|
resp, err := l.GetRegisterConfig()
|
||||||
|
if err != nil {
|
||||||
|
httpx.ErrorCtx(r.Context(), w, err)
|
||||||
|
} else {
|
||||||
|
httpx.OkJsonCtx(r.Context(), w, resp)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
24
apps/admin/internal/handler/system/getSiteConfigHandler.go
Normal file
24
apps/admin/internal/handler/system/getSiteConfigHandler.go
Normal file
@ -0,0 +1,24 @@
|
|||||||
|
// Code scaffolded by goctl. Safe to edit.
|
||||||
|
// goctl 1.9.2
|
||||||
|
|
||||||
|
package system
|
||||||
|
|
||||||
|
import (
|
||||||
|
"net/http"
|
||||||
|
|
||||||
|
"github.com/zero-ppanel/zero-ppanel/apps/admin/internal/logic/system"
|
||||||
|
"github.com/zero-ppanel/zero-ppanel/apps/admin/internal/svc"
|
||||||
|
"github.com/zeromicro/go-zero/rest/httpx"
|
||||||
|
)
|
||||||
|
|
||||||
|
func GetSiteConfigHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
|
||||||
|
return func(w http.ResponseWriter, r *http.Request) {
|
||||||
|
l := system.NewGetSiteConfigLogic(r.Context(), svcCtx)
|
||||||
|
resp, err := l.GetSiteConfig()
|
||||||
|
if err != nil {
|
||||||
|
httpx.ErrorCtx(r.Context(), w, err)
|
||||||
|
} else {
|
||||||
|
httpx.OkJsonCtx(r.Context(), w, resp)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,31 @@
|
|||||||
|
// Code scaffolded by goctl. Safe to edit.
|
||||||
|
// goctl 1.9.2
|
||||||
|
|
||||||
|
package system
|
||||||
|
|
||||||
|
import (
|
||||||
|
"net/http"
|
||||||
|
|
||||||
|
"github.com/zero-ppanel/zero-ppanel/apps/admin/internal/logic/system"
|
||||||
|
"github.com/zero-ppanel/zero-ppanel/apps/admin/internal/svc"
|
||||||
|
"github.com/zero-ppanel/zero-ppanel/apps/admin/internal/types"
|
||||||
|
"github.com/zeromicro/go-zero/rest/httpx"
|
||||||
|
)
|
||||||
|
|
||||||
|
func UpdateRegisterConfigHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
|
||||||
|
return func(w http.ResponseWriter, r *http.Request) {
|
||||||
|
var req types.UpdateRegisterConfigReq
|
||||||
|
if err := httpx.Parse(r, &req); err != nil {
|
||||||
|
httpx.ErrorCtx(r.Context(), w, err)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
l := system.NewUpdateRegisterConfigLogic(r.Context(), svcCtx)
|
||||||
|
err := l.UpdateRegisterConfig(&req)
|
||||||
|
if err != nil {
|
||||||
|
httpx.ErrorCtx(r.Context(), w, err)
|
||||||
|
} else {
|
||||||
|
httpx.Ok(w)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,31 @@
|
|||||||
|
// Code scaffolded by goctl. Safe to edit.
|
||||||
|
// goctl 1.9.2
|
||||||
|
|
||||||
|
package system
|
||||||
|
|
||||||
|
import (
|
||||||
|
"net/http"
|
||||||
|
|
||||||
|
"github.com/zero-ppanel/zero-ppanel/apps/admin/internal/logic/system"
|
||||||
|
"github.com/zero-ppanel/zero-ppanel/apps/admin/internal/svc"
|
||||||
|
"github.com/zero-ppanel/zero-ppanel/apps/admin/internal/types"
|
||||||
|
"github.com/zeromicro/go-zero/rest/httpx"
|
||||||
|
)
|
||||||
|
|
||||||
|
func UpdateSiteConfigHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
|
||||||
|
return func(w http.ResponseWriter, r *http.Request) {
|
||||||
|
var req types.UpdateSiteConfigReq
|
||||||
|
if err := httpx.Parse(r, &req); err != nil {
|
||||||
|
httpx.ErrorCtx(r.Context(), w, err)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
l := system.NewUpdateSiteConfigLogic(r.Context(), svcCtx)
|
||||||
|
err := l.UpdateSiteConfig(&req)
|
||||||
|
if err != nil {
|
||||||
|
httpx.ErrorCtx(r.Context(), w, err)
|
||||||
|
} else {
|
||||||
|
httpx.Ok(w)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,31 @@
|
|||||||
|
// Code scaffolded by goctl. Safe to edit.
|
||||||
|
// goctl 1.9.2
|
||||||
|
|
||||||
|
package ticket
|
||||||
|
|
||||||
|
import (
|
||||||
|
"net/http"
|
||||||
|
|
||||||
|
"github.com/zero-ppanel/zero-ppanel/apps/admin/internal/logic/ticket"
|
||||||
|
"github.com/zero-ppanel/zero-ppanel/apps/admin/internal/svc"
|
||||||
|
"github.com/zero-ppanel/zero-ppanel/apps/admin/internal/types"
|
||||||
|
"github.com/zeromicro/go-zero/rest/httpx"
|
||||||
|
)
|
||||||
|
|
||||||
|
func CreateTicketFollowHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
|
||||||
|
return func(w http.ResponseWriter, r *http.Request) {
|
||||||
|
var req types.AdminCreateTicketFollowReq
|
||||||
|
if err := httpx.Parse(r, &req); err != nil {
|
||||||
|
httpx.ErrorCtx(r.Context(), w, err)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
l := ticket.NewCreateTicketFollowLogic(r.Context(), svcCtx)
|
||||||
|
err := l.CreateTicketFollow(&req)
|
||||||
|
if err != nil {
|
||||||
|
httpx.ErrorCtx(r.Context(), w, err)
|
||||||
|
} else {
|
||||||
|
httpx.Ok(w)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
31
apps/admin/internal/handler/ticket/getTicketDetailHandler.go
Normal file
31
apps/admin/internal/handler/ticket/getTicketDetailHandler.go
Normal file
@ -0,0 +1,31 @@
|
|||||||
|
// Code scaffolded by goctl. Safe to edit.
|
||||||
|
// goctl 1.9.2
|
||||||
|
|
||||||
|
package ticket
|
||||||
|
|
||||||
|
import (
|
||||||
|
"net/http"
|
||||||
|
|
||||||
|
"github.com/zero-ppanel/zero-ppanel/apps/admin/internal/logic/ticket"
|
||||||
|
"github.com/zero-ppanel/zero-ppanel/apps/admin/internal/svc"
|
||||||
|
"github.com/zero-ppanel/zero-ppanel/apps/admin/internal/types"
|
||||||
|
"github.com/zeromicro/go-zero/rest/httpx"
|
||||||
|
)
|
||||||
|
|
||||||
|
func GetTicketDetailHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
|
||||||
|
return func(w http.ResponseWriter, r *http.Request) {
|
||||||
|
var req types.AdminTicketDetailReq
|
||||||
|
if err := httpx.Parse(r, &req); err != nil {
|
||||||
|
httpx.ErrorCtx(r.Context(), w, err)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
l := ticket.NewGetTicketDetailLogic(r.Context(), svcCtx)
|
||||||
|
resp, err := l.GetTicketDetail(&req)
|
||||||
|
if err != nil {
|
||||||
|
httpx.ErrorCtx(r.Context(), w, err)
|
||||||
|
} else {
|
||||||
|
httpx.OkJsonCtx(r.Context(), w, resp)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
31
apps/admin/internal/handler/ticket/getTicketListHandler.go
Normal file
31
apps/admin/internal/handler/ticket/getTicketListHandler.go
Normal file
@ -0,0 +1,31 @@
|
|||||||
|
// Code scaffolded by goctl. Safe to edit.
|
||||||
|
// goctl 1.9.2
|
||||||
|
|
||||||
|
package ticket
|
||||||
|
|
||||||
|
import (
|
||||||
|
"net/http"
|
||||||
|
|
||||||
|
"github.com/zero-ppanel/zero-ppanel/apps/admin/internal/logic/ticket"
|
||||||
|
"github.com/zero-ppanel/zero-ppanel/apps/admin/internal/svc"
|
||||||
|
"github.com/zero-ppanel/zero-ppanel/apps/admin/internal/types"
|
||||||
|
"github.com/zeromicro/go-zero/rest/httpx"
|
||||||
|
)
|
||||||
|
|
||||||
|
func GetTicketListHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
|
||||||
|
return func(w http.ResponseWriter, r *http.Request) {
|
||||||
|
var req types.AdminTicketListReq
|
||||||
|
if err := httpx.Parse(r, &req); err != nil {
|
||||||
|
httpx.ErrorCtx(r.Context(), w, err)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
l := ticket.NewGetTicketListLogic(r.Context(), svcCtx)
|
||||||
|
resp, err := l.GetTicketList(&req)
|
||||||
|
if err != nil {
|
||||||
|
httpx.ErrorCtx(r.Context(), w, err)
|
||||||
|
} else {
|
||||||
|
httpx.OkJsonCtx(r.Context(), w, resp)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,31 @@
|
|||||||
|
// Code scaffolded by goctl. Safe to edit.
|
||||||
|
// goctl 1.9.2
|
||||||
|
|
||||||
|
package ticket
|
||||||
|
|
||||||
|
import (
|
||||||
|
"net/http"
|
||||||
|
|
||||||
|
"github.com/zero-ppanel/zero-ppanel/apps/admin/internal/logic/ticket"
|
||||||
|
"github.com/zero-ppanel/zero-ppanel/apps/admin/internal/svc"
|
||||||
|
"github.com/zero-ppanel/zero-ppanel/apps/admin/internal/types"
|
||||||
|
"github.com/zeromicro/go-zero/rest/httpx"
|
||||||
|
)
|
||||||
|
|
||||||
|
func UpdateTicketStatusHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
|
||||||
|
return func(w http.ResponseWriter, r *http.Request) {
|
||||||
|
var req types.AdminUpdateTicketStatusReq
|
||||||
|
if err := httpx.Parse(r, &req); err != nil {
|
||||||
|
httpx.ErrorCtx(r.Context(), w, err)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
l := ticket.NewUpdateTicketStatusLogic(r.Context(), svcCtx)
|
||||||
|
err := l.UpdateTicketStatus(&req)
|
||||||
|
if err != nil {
|
||||||
|
httpx.ErrorCtx(r.Context(), w, err)
|
||||||
|
} else {
|
||||||
|
httpx.Ok(w)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
31
apps/admin/internal/handler/user/deleteUserHandler.go
Normal file
31
apps/admin/internal/handler/user/deleteUserHandler.go
Normal file
@ -0,0 +1,31 @@
|
|||||||
|
// Code scaffolded by goctl. Safe to edit.
|
||||||
|
// goctl 1.9.2
|
||||||
|
|
||||||
|
package user
|
||||||
|
|
||||||
|
import (
|
||||||
|
"net/http"
|
||||||
|
|
||||||
|
"github.com/zero-ppanel/zero-ppanel/apps/admin/internal/logic/user"
|
||||||
|
"github.com/zero-ppanel/zero-ppanel/apps/admin/internal/svc"
|
||||||
|
"github.com/zero-ppanel/zero-ppanel/apps/admin/internal/types"
|
||||||
|
"github.com/zeromicro/go-zero/rest/httpx"
|
||||||
|
)
|
||||||
|
|
||||||
|
func DeleteUserHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
|
||||||
|
return func(w http.ResponseWriter, r *http.Request) {
|
||||||
|
var req types.AdminDeleteUserReq
|
||||||
|
if err := httpx.Parse(r, &req); err != nil {
|
||||||
|
httpx.ErrorCtx(r.Context(), w, err)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
l := user.NewDeleteUserLogic(r.Context(), svcCtx)
|
||||||
|
err := l.DeleteUser(&req)
|
||||||
|
if err != nil {
|
||||||
|
httpx.ErrorCtx(r.Context(), w, err)
|
||||||
|
} else {
|
||||||
|
httpx.Ok(w)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
31
apps/admin/internal/handler/user/getUserDetailHandler.go
Normal file
31
apps/admin/internal/handler/user/getUserDetailHandler.go
Normal file
@ -0,0 +1,31 @@
|
|||||||
|
// Code scaffolded by goctl. Safe to edit.
|
||||||
|
// goctl 1.9.2
|
||||||
|
|
||||||
|
package user
|
||||||
|
|
||||||
|
import (
|
||||||
|
"net/http"
|
||||||
|
|
||||||
|
"github.com/zero-ppanel/zero-ppanel/apps/admin/internal/logic/user"
|
||||||
|
"github.com/zero-ppanel/zero-ppanel/apps/admin/internal/svc"
|
||||||
|
"github.com/zero-ppanel/zero-ppanel/apps/admin/internal/types"
|
||||||
|
"github.com/zeromicro/go-zero/rest/httpx"
|
||||||
|
)
|
||||||
|
|
||||||
|
func GetUserDetailHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
|
||||||
|
return func(w http.ResponseWriter, r *http.Request) {
|
||||||
|
var req types.AdminUserDetailReq
|
||||||
|
if err := httpx.Parse(r, &req); err != nil {
|
||||||
|
httpx.ErrorCtx(r.Context(), w, err)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
l := user.NewGetUserDetailLogic(r.Context(), svcCtx)
|
||||||
|
resp, err := l.GetUserDetail(&req)
|
||||||
|
if err != nil {
|
||||||
|
httpx.ErrorCtx(r.Context(), w, err)
|
||||||
|
} else {
|
||||||
|
httpx.OkJsonCtx(r.Context(), w, resp)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
31
apps/admin/internal/handler/user/getUserListHandler.go
Normal file
31
apps/admin/internal/handler/user/getUserListHandler.go
Normal file
@ -0,0 +1,31 @@
|
|||||||
|
// Code scaffolded by goctl. Safe to edit.
|
||||||
|
// goctl 1.9.2
|
||||||
|
|
||||||
|
package user
|
||||||
|
|
||||||
|
import (
|
||||||
|
"net/http"
|
||||||
|
|
||||||
|
"github.com/zero-ppanel/zero-ppanel/apps/admin/internal/logic/user"
|
||||||
|
"github.com/zero-ppanel/zero-ppanel/apps/admin/internal/svc"
|
||||||
|
"github.com/zero-ppanel/zero-ppanel/apps/admin/internal/types"
|
||||||
|
"github.com/zeromicro/go-zero/rest/httpx"
|
||||||
|
)
|
||||||
|
|
||||||
|
func GetUserListHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
|
||||||
|
return func(w http.ResponseWriter, r *http.Request) {
|
||||||
|
var req types.AdminUserListReq
|
||||||
|
if err := httpx.Parse(r, &req); err != nil {
|
||||||
|
httpx.ErrorCtx(r.Context(), w, err)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
l := user.NewGetUserListLogic(r.Context(), svcCtx)
|
||||||
|
resp, err := l.GetUserList(&req)
|
||||||
|
if err != nil {
|
||||||
|
httpx.ErrorCtx(r.Context(), w, err)
|
||||||
|
} else {
|
||||||
|
httpx.OkJsonCtx(r.Context(), w, resp)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,33 @@
|
|||||||
|
// Code scaffolded by goctl. Safe to edit.
|
||||||
|
// goctl 1.9.2
|
||||||
|
|
||||||
|
package announcement
|
||||||
|
|
||||||
|
import (
|
||||||
|
"context"
|
||||||
|
|
||||||
|
"github.com/zero-ppanel/zero-ppanel/apps/admin/internal/svc"
|
||||||
|
"github.com/zero-ppanel/zero-ppanel/apps/admin/internal/types"
|
||||||
|
|
||||||
|
"github.com/zeromicro/go-zero/core/logx"
|
||||||
|
)
|
||||||
|
|
||||||
|
type CreateAnnouncementLogic struct {
|
||||||
|
logx.Logger
|
||||||
|
ctx context.Context
|
||||||
|
svcCtx *svc.ServiceContext
|
||||||
|
}
|
||||||
|
|
||||||
|
func NewCreateAnnouncementLogic(ctx context.Context, svcCtx *svc.ServiceContext) *CreateAnnouncementLogic {
|
||||||
|
return &CreateAnnouncementLogic{
|
||||||
|
Logger: logx.WithContext(ctx),
|
||||||
|
ctx: ctx,
|
||||||
|
svcCtx: svcCtx,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (l *CreateAnnouncementLogic) CreateAnnouncement(req *types.CreateAnnouncementReq) (resp *types.AdminAnnouncementResp, err error) {
|
||||||
|
// todo: add your logic here and delete this line
|
||||||
|
|
||||||
|
return
|
||||||
|
}
|
||||||
@ -0,0 +1,33 @@
|
|||||||
|
// Code scaffolded by goctl. Safe to edit.
|
||||||
|
// goctl 1.9.2
|
||||||
|
|
||||||
|
package announcement
|
||||||
|
|
||||||
|
import (
|
||||||
|
"context"
|
||||||
|
|
||||||
|
"github.com/zero-ppanel/zero-ppanel/apps/admin/internal/svc"
|
||||||
|
"github.com/zero-ppanel/zero-ppanel/apps/admin/internal/types"
|
||||||
|
|
||||||
|
"github.com/zeromicro/go-zero/core/logx"
|
||||||
|
)
|
||||||
|
|
||||||
|
type DeleteAnnouncementLogic struct {
|
||||||
|
logx.Logger
|
||||||
|
ctx context.Context
|
||||||
|
svcCtx *svc.ServiceContext
|
||||||
|
}
|
||||||
|
|
||||||
|
func NewDeleteAnnouncementLogic(ctx context.Context, svcCtx *svc.ServiceContext) *DeleteAnnouncementLogic {
|
||||||
|
return &DeleteAnnouncementLogic{
|
||||||
|
Logger: logx.WithContext(ctx),
|
||||||
|
ctx: ctx,
|
||||||
|
svcCtx: svcCtx,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (l *DeleteAnnouncementLogic) DeleteAnnouncement(req *types.DeleteAnnouncementReq) error {
|
||||||
|
// todo: add your logic here and delete this line
|
||||||
|
|
||||||
|
return nil
|
||||||
|
}
|
||||||
@ -0,0 +1,33 @@
|
|||||||
|
// Code scaffolded by goctl. Safe to edit.
|
||||||
|
// goctl 1.9.2
|
||||||
|
|
||||||
|
package announcement
|
||||||
|
|
||||||
|
import (
|
||||||
|
"context"
|
||||||
|
|
||||||
|
"github.com/zero-ppanel/zero-ppanel/apps/admin/internal/svc"
|
||||||
|
"github.com/zero-ppanel/zero-ppanel/apps/admin/internal/types"
|
||||||
|
|
||||||
|
"github.com/zeromicro/go-zero/core/logx"
|
||||||
|
)
|
||||||
|
|
||||||
|
type UpdateAnnouncementLogic struct {
|
||||||
|
logx.Logger
|
||||||
|
ctx context.Context
|
||||||
|
svcCtx *svc.ServiceContext
|
||||||
|
}
|
||||||
|
|
||||||
|
func NewUpdateAnnouncementLogic(ctx context.Context, svcCtx *svc.ServiceContext) *UpdateAnnouncementLogic {
|
||||||
|
return &UpdateAnnouncementLogic{
|
||||||
|
Logger: logx.WithContext(ctx),
|
||||||
|
ctx: ctx,
|
||||||
|
svcCtx: svcCtx,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (l *UpdateAnnouncementLogic) UpdateAnnouncement(req *types.UpdateAnnouncementReq) error {
|
||||||
|
// todo: add your logic here and delete this line
|
||||||
|
|
||||||
|
return nil
|
||||||
|
}
|
||||||
33
apps/admin/internal/logic/common/healthLogic.go
Normal file
33
apps/admin/internal/logic/common/healthLogic.go
Normal file
@ -0,0 +1,33 @@
|
|||||||
|
// Code scaffolded by goctl. Safe to edit.
|
||||||
|
// goctl 1.9.2
|
||||||
|
|
||||||
|
package common
|
||||||
|
|
||||||
|
import (
|
||||||
|
"context"
|
||||||
|
|
||||||
|
"github.com/zero-ppanel/zero-ppanel/apps/admin/internal/svc"
|
||||||
|
"github.com/zero-ppanel/zero-ppanel/apps/admin/internal/types"
|
||||||
|
|
||||||
|
"github.com/zeromicro/go-zero/core/logx"
|
||||||
|
)
|
||||||
|
|
||||||
|
type HealthLogic struct {
|
||||||
|
logx.Logger
|
||||||
|
ctx context.Context
|
||||||
|
svcCtx *svc.ServiceContext
|
||||||
|
}
|
||||||
|
|
||||||
|
func NewHealthLogic(ctx context.Context, svcCtx *svc.ServiceContext) *HealthLogic {
|
||||||
|
return &HealthLogic{
|
||||||
|
Logger: logx.WithContext(ctx),
|
||||||
|
ctx: ctx,
|
||||||
|
svcCtx: svcCtx,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (l *HealthLogic) Health() (resp *types.HealthResp, err error) {
|
||||||
|
// todo: add your logic here and delete this line
|
||||||
|
|
||||||
|
return
|
||||||
|
}
|
||||||
33
apps/admin/internal/logic/console/getConsoleStatsLogic.go
Normal file
33
apps/admin/internal/logic/console/getConsoleStatsLogic.go
Normal file
@ -0,0 +1,33 @@
|
|||||||
|
// Code scaffolded by goctl. Safe to edit.
|
||||||
|
// goctl 1.9.2
|
||||||
|
|
||||||
|
package console
|
||||||
|
|
||||||
|
import (
|
||||||
|
"context"
|
||||||
|
|
||||||
|
"github.com/zero-ppanel/zero-ppanel/apps/admin/internal/svc"
|
||||||
|
"github.com/zero-ppanel/zero-ppanel/apps/admin/internal/types"
|
||||||
|
|
||||||
|
"github.com/zeromicro/go-zero/core/logx"
|
||||||
|
)
|
||||||
|
|
||||||
|
type GetConsoleStatsLogic struct {
|
||||||
|
logx.Logger
|
||||||
|
ctx context.Context
|
||||||
|
svcCtx *svc.ServiceContext
|
||||||
|
}
|
||||||
|
|
||||||
|
func NewGetConsoleStatsLogic(ctx context.Context, svcCtx *svc.ServiceContext) *GetConsoleStatsLogic {
|
||||||
|
return &GetConsoleStatsLogic{
|
||||||
|
Logger: logx.WithContext(ctx),
|
||||||
|
ctx: ctx,
|
||||||
|
svcCtx: svcCtx,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (l *GetConsoleStatsLogic) GetConsoleStats() (resp *types.ConsoleStatsResp, err error) {
|
||||||
|
// todo: add your logic here and delete this line
|
||||||
|
|
||||||
|
return
|
||||||
|
}
|
||||||
33
apps/admin/internal/logic/order/getOrderListLogic.go
Normal file
33
apps/admin/internal/logic/order/getOrderListLogic.go
Normal file
@ -0,0 +1,33 @@
|
|||||||
|
// Code scaffolded by goctl. Safe to edit.
|
||||||
|
// goctl 1.9.2
|
||||||
|
|
||||||
|
package order
|
||||||
|
|
||||||
|
import (
|
||||||
|
"context"
|
||||||
|
|
||||||
|
"github.com/zero-ppanel/zero-ppanel/apps/admin/internal/svc"
|
||||||
|
"github.com/zero-ppanel/zero-ppanel/apps/admin/internal/types"
|
||||||
|
|
||||||
|
"github.com/zeromicro/go-zero/core/logx"
|
||||||
|
)
|
||||||
|
|
||||||
|
type GetOrderListLogic struct {
|
||||||
|
logx.Logger
|
||||||
|
ctx context.Context
|
||||||
|
svcCtx *svc.ServiceContext
|
||||||
|
}
|
||||||
|
|
||||||
|
func NewGetOrderListLogic(ctx context.Context, svcCtx *svc.ServiceContext) *GetOrderListLogic {
|
||||||
|
return &GetOrderListLogic{
|
||||||
|
Logger: logx.WithContext(ctx),
|
||||||
|
ctx: ctx,
|
||||||
|
svcCtx: svcCtx,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (l *GetOrderListLogic) GetOrderList(req *types.AdminOrderListReq) (resp *types.AdminOrderListResp, err error) {
|
||||||
|
// todo: add your logic here and delete this line
|
||||||
|
|
||||||
|
return
|
||||||
|
}
|
||||||
33
apps/admin/internal/logic/order/updateOrderStatusLogic.go
Normal file
33
apps/admin/internal/logic/order/updateOrderStatusLogic.go
Normal file
@ -0,0 +1,33 @@
|
|||||||
|
// Code scaffolded by goctl. Safe to edit.
|
||||||
|
// goctl 1.9.2
|
||||||
|
|
||||||
|
package order
|
||||||
|
|
||||||
|
import (
|
||||||
|
"context"
|
||||||
|
|
||||||
|
"github.com/zero-ppanel/zero-ppanel/apps/admin/internal/svc"
|
||||||
|
"github.com/zero-ppanel/zero-ppanel/apps/admin/internal/types"
|
||||||
|
|
||||||
|
"github.com/zeromicro/go-zero/core/logx"
|
||||||
|
)
|
||||||
|
|
||||||
|
type UpdateOrderStatusLogic struct {
|
||||||
|
logx.Logger
|
||||||
|
ctx context.Context
|
||||||
|
svcCtx *svc.ServiceContext
|
||||||
|
}
|
||||||
|
|
||||||
|
func NewUpdateOrderStatusLogic(ctx context.Context, svcCtx *svc.ServiceContext) *UpdateOrderStatusLogic {
|
||||||
|
return &UpdateOrderStatusLogic{
|
||||||
|
Logger: logx.WithContext(ctx),
|
||||||
|
ctx: ctx,
|
||||||
|
svcCtx: svcCtx,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (l *UpdateOrderStatusLogic) UpdateOrderStatus(req *types.UpdateOrderStatusReq) error {
|
||||||
|
// todo: add your logic here and delete this line
|
||||||
|
|
||||||
|
return nil
|
||||||
|
}
|
||||||
33
apps/admin/internal/logic/server/createServerLogic.go
Normal file
33
apps/admin/internal/logic/server/createServerLogic.go
Normal file
@ -0,0 +1,33 @@
|
|||||||
|
// Code scaffolded by goctl. Safe to edit.
|
||||||
|
// goctl 1.9.2
|
||||||
|
|
||||||
|
package server
|
||||||
|
|
||||||
|
import (
|
||||||
|
"context"
|
||||||
|
|
||||||
|
"github.com/zero-ppanel/zero-ppanel/apps/admin/internal/svc"
|
||||||
|
"github.com/zero-ppanel/zero-ppanel/apps/admin/internal/types"
|
||||||
|
|
||||||
|
"github.com/zeromicro/go-zero/core/logx"
|
||||||
|
)
|
||||||
|
|
||||||
|
type CreateServerLogic struct {
|
||||||
|
logx.Logger
|
||||||
|
ctx context.Context
|
||||||
|
svcCtx *svc.ServiceContext
|
||||||
|
}
|
||||||
|
|
||||||
|
func NewCreateServerLogic(ctx context.Context, svcCtx *svc.ServiceContext) *CreateServerLogic {
|
||||||
|
return &CreateServerLogic{
|
||||||
|
Logger: logx.WithContext(ctx),
|
||||||
|
ctx: ctx,
|
||||||
|
svcCtx: svcCtx,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (l *CreateServerLogic) CreateServer(req *types.CreateServerReq) (resp *types.ServerResp, err error) {
|
||||||
|
// todo: add your logic here and delete this line
|
||||||
|
|
||||||
|
return
|
||||||
|
}
|
||||||
33
apps/admin/internal/logic/server/deleteServerLogic.go
Normal file
33
apps/admin/internal/logic/server/deleteServerLogic.go
Normal file
@ -0,0 +1,33 @@
|
|||||||
|
// Code scaffolded by goctl. Safe to edit.
|
||||||
|
// goctl 1.9.2
|
||||||
|
|
||||||
|
package server
|
||||||
|
|
||||||
|
import (
|
||||||
|
"context"
|
||||||
|
|
||||||
|
"github.com/zero-ppanel/zero-ppanel/apps/admin/internal/svc"
|
||||||
|
"github.com/zero-ppanel/zero-ppanel/apps/admin/internal/types"
|
||||||
|
|
||||||
|
"github.com/zeromicro/go-zero/core/logx"
|
||||||
|
)
|
||||||
|
|
||||||
|
type DeleteServerLogic struct {
|
||||||
|
logx.Logger
|
||||||
|
ctx context.Context
|
||||||
|
svcCtx *svc.ServiceContext
|
||||||
|
}
|
||||||
|
|
||||||
|
func NewDeleteServerLogic(ctx context.Context, svcCtx *svc.ServiceContext) *DeleteServerLogic {
|
||||||
|
return &DeleteServerLogic{
|
||||||
|
Logger: logx.WithContext(ctx),
|
||||||
|
ctx: ctx,
|
||||||
|
svcCtx: svcCtx,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (l *DeleteServerLogic) DeleteServer(req *types.DeleteServerReq) error {
|
||||||
|
// todo: add your logic here and delete this line
|
||||||
|
|
||||||
|
return nil
|
||||||
|
}
|
||||||
33
apps/admin/internal/logic/server/getServerListLogic.go
Normal file
33
apps/admin/internal/logic/server/getServerListLogic.go
Normal file
@ -0,0 +1,33 @@
|
|||||||
|
// Code scaffolded by goctl. Safe to edit.
|
||||||
|
// goctl 1.9.2
|
||||||
|
|
||||||
|
package server
|
||||||
|
|
||||||
|
import (
|
||||||
|
"context"
|
||||||
|
|
||||||
|
"github.com/zero-ppanel/zero-ppanel/apps/admin/internal/svc"
|
||||||
|
"github.com/zero-ppanel/zero-ppanel/apps/admin/internal/types"
|
||||||
|
|
||||||
|
"github.com/zeromicro/go-zero/core/logx"
|
||||||
|
)
|
||||||
|
|
||||||
|
type GetServerListLogic struct {
|
||||||
|
logx.Logger
|
||||||
|
ctx context.Context
|
||||||
|
svcCtx *svc.ServiceContext
|
||||||
|
}
|
||||||
|
|
||||||
|
func NewGetServerListLogic(ctx context.Context, svcCtx *svc.ServiceContext) *GetServerListLogic {
|
||||||
|
return &GetServerListLogic{
|
||||||
|
Logger: logx.WithContext(ctx),
|
||||||
|
ctx: ctx,
|
||||||
|
svcCtx: svcCtx,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (l *GetServerListLogic) GetServerList(req *types.ServerListReq) (resp *types.ServerListResp, err error) {
|
||||||
|
// todo: add your logic here and delete this line
|
||||||
|
|
||||||
|
return
|
||||||
|
}
|
||||||
33
apps/admin/internal/logic/server/updateServerLogic.go
Normal file
33
apps/admin/internal/logic/server/updateServerLogic.go
Normal file
@ -0,0 +1,33 @@
|
|||||||
|
// Code scaffolded by goctl. Safe to edit.
|
||||||
|
// goctl 1.9.2
|
||||||
|
|
||||||
|
package server
|
||||||
|
|
||||||
|
import (
|
||||||
|
"context"
|
||||||
|
|
||||||
|
"github.com/zero-ppanel/zero-ppanel/apps/admin/internal/svc"
|
||||||
|
"github.com/zero-ppanel/zero-ppanel/apps/admin/internal/types"
|
||||||
|
|
||||||
|
"github.com/zeromicro/go-zero/core/logx"
|
||||||
|
)
|
||||||
|
|
||||||
|
type UpdateServerLogic struct {
|
||||||
|
logx.Logger
|
||||||
|
ctx context.Context
|
||||||
|
svcCtx *svc.ServiceContext
|
||||||
|
}
|
||||||
|
|
||||||
|
func NewUpdateServerLogic(ctx context.Context, svcCtx *svc.ServiceContext) *UpdateServerLogic {
|
||||||
|
return &UpdateServerLogic{
|
||||||
|
Logger: logx.WithContext(ctx),
|
||||||
|
ctx: ctx,
|
||||||
|
svcCtx: svcCtx,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (l *UpdateServerLogic) UpdateServer(req *types.UpdateServerReq) error {
|
||||||
|
// todo: add your logic here and delete this line
|
||||||
|
|
||||||
|
return nil
|
||||||
|
}
|
||||||
33
apps/admin/internal/logic/subscribe/createSubscribeLogic.go
Normal file
33
apps/admin/internal/logic/subscribe/createSubscribeLogic.go
Normal file
@ -0,0 +1,33 @@
|
|||||||
|
// Code scaffolded by goctl. Safe to edit.
|
||||||
|
// goctl 1.9.2
|
||||||
|
|
||||||
|
package subscribe
|
||||||
|
|
||||||
|
import (
|
||||||
|
"context"
|
||||||
|
|
||||||
|
"github.com/zero-ppanel/zero-ppanel/apps/admin/internal/svc"
|
||||||
|
"github.com/zero-ppanel/zero-ppanel/apps/admin/internal/types"
|
||||||
|
|
||||||
|
"github.com/zeromicro/go-zero/core/logx"
|
||||||
|
)
|
||||||
|
|
||||||
|
type CreateSubscribeLogic struct {
|
||||||
|
logx.Logger
|
||||||
|
ctx context.Context
|
||||||
|
svcCtx *svc.ServiceContext
|
||||||
|
}
|
||||||
|
|
||||||
|
func NewCreateSubscribeLogic(ctx context.Context, svcCtx *svc.ServiceContext) *CreateSubscribeLogic {
|
||||||
|
return &CreateSubscribeLogic{
|
||||||
|
Logger: logx.WithContext(ctx),
|
||||||
|
ctx: ctx,
|
||||||
|
svcCtx: svcCtx,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (l *CreateSubscribeLogic) CreateSubscribe(req *types.CreateSubscribeReq) (resp *types.AdminSubscribeResp, err error) {
|
||||||
|
// todo: add your logic here and delete this line
|
||||||
|
|
||||||
|
return
|
||||||
|
}
|
||||||
33
apps/admin/internal/logic/subscribe/deleteSubscribeLogic.go
Normal file
33
apps/admin/internal/logic/subscribe/deleteSubscribeLogic.go
Normal file
@ -0,0 +1,33 @@
|
|||||||
|
// Code scaffolded by goctl. Safe to edit.
|
||||||
|
// goctl 1.9.2
|
||||||
|
|
||||||
|
package subscribe
|
||||||
|
|
||||||
|
import (
|
||||||
|
"context"
|
||||||
|
|
||||||
|
"github.com/zero-ppanel/zero-ppanel/apps/admin/internal/svc"
|
||||||
|
"github.com/zero-ppanel/zero-ppanel/apps/admin/internal/types"
|
||||||
|
|
||||||
|
"github.com/zeromicro/go-zero/core/logx"
|
||||||
|
)
|
||||||
|
|
||||||
|
type DeleteSubscribeLogic struct {
|
||||||
|
logx.Logger
|
||||||
|
ctx context.Context
|
||||||
|
svcCtx *svc.ServiceContext
|
||||||
|
}
|
||||||
|
|
||||||
|
func NewDeleteSubscribeLogic(ctx context.Context, svcCtx *svc.ServiceContext) *DeleteSubscribeLogic {
|
||||||
|
return &DeleteSubscribeLogic{
|
||||||
|
Logger: logx.WithContext(ctx),
|
||||||
|
ctx: ctx,
|
||||||
|
svcCtx: svcCtx,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (l *DeleteSubscribeLogic) DeleteSubscribe(req *types.DeleteSubscribeReq) error {
|
||||||
|
// todo: add your logic here and delete this line
|
||||||
|
|
||||||
|
return nil
|
||||||
|
}
|
||||||
33
apps/admin/internal/logic/subscribe/getSubscribeListLogic.go
Normal file
33
apps/admin/internal/logic/subscribe/getSubscribeListLogic.go
Normal file
@ -0,0 +1,33 @@
|
|||||||
|
// Code scaffolded by goctl. Safe to edit.
|
||||||
|
// goctl 1.9.2
|
||||||
|
|
||||||
|
package subscribe
|
||||||
|
|
||||||
|
import (
|
||||||
|
"context"
|
||||||
|
|
||||||
|
"github.com/zero-ppanel/zero-ppanel/apps/admin/internal/svc"
|
||||||
|
"github.com/zero-ppanel/zero-ppanel/apps/admin/internal/types"
|
||||||
|
|
||||||
|
"github.com/zeromicro/go-zero/core/logx"
|
||||||
|
)
|
||||||
|
|
||||||
|
type GetSubscribeListLogic struct {
|
||||||
|
logx.Logger
|
||||||
|
ctx context.Context
|
||||||
|
svcCtx *svc.ServiceContext
|
||||||
|
}
|
||||||
|
|
||||||
|
func NewGetSubscribeListLogic(ctx context.Context, svcCtx *svc.ServiceContext) *GetSubscribeListLogic {
|
||||||
|
return &GetSubscribeListLogic{
|
||||||
|
Logger: logx.WithContext(ctx),
|
||||||
|
ctx: ctx,
|
||||||
|
svcCtx: svcCtx,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (l *GetSubscribeListLogic) GetSubscribeList(req *types.AdminSubscribeListReq) (resp *types.AdminSubscribeListResp, err error) {
|
||||||
|
// todo: add your logic here and delete this line
|
||||||
|
|
||||||
|
return
|
||||||
|
}
|
||||||
33
apps/admin/internal/logic/subscribe/updateSubscribeLogic.go
Normal file
33
apps/admin/internal/logic/subscribe/updateSubscribeLogic.go
Normal file
@ -0,0 +1,33 @@
|
|||||||
|
// Code scaffolded by goctl. Safe to edit.
|
||||||
|
// goctl 1.9.2
|
||||||
|
|
||||||
|
package subscribe
|
||||||
|
|
||||||
|
import (
|
||||||
|
"context"
|
||||||
|
|
||||||
|
"github.com/zero-ppanel/zero-ppanel/apps/admin/internal/svc"
|
||||||
|
"github.com/zero-ppanel/zero-ppanel/apps/admin/internal/types"
|
||||||
|
|
||||||
|
"github.com/zeromicro/go-zero/core/logx"
|
||||||
|
)
|
||||||
|
|
||||||
|
type UpdateSubscribeLogic struct {
|
||||||
|
logx.Logger
|
||||||
|
ctx context.Context
|
||||||
|
svcCtx *svc.ServiceContext
|
||||||
|
}
|
||||||
|
|
||||||
|
func NewUpdateSubscribeLogic(ctx context.Context, svcCtx *svc.ServiceContext) *UpdateSubscribeLogic {
|
||||||
|
return &UpdateSubscribeLogic{
|
||||||
|
Logger: logx.WithContext(ctx),
|
||||||
|
ctx: ctx,
|
||||||
|
svcCtx: svcCtx,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (l *UpdateSubscribeLogic) UpdateSubscribe(req *types.UpdateSubscribeReq) error {
|
||||||
|
// todo: add your logic here and delete this line
|
||||||
|
|
||||||
|
return nil
|
||||||
|
}
|
||||||
33
apps/admin/internal/logic/system/getRegisterConfigLogic.go
Normal file
33
apps/admin/internal/logic/system/getRegisterConfigLogic.go
Normal file
@ -0,0 +1,33 @@
|
|||||||
|
// Code scaffolded by goctl. Safe to edit.
|
||||||
|
// goctl 1.9.2
|
||||||
|
|
||||||
|
package system
|
||||||
|
|
||||||
|
import (
|
||||||
|
"context"
|
||||||
|
|
||||||
|
"github.com/zero-ppanel/zero-ppanel/apps/admin/internal/svc"
|
||||||
|
"github.com/zero-ppanel/zero-ppanel/apps/admin/internal/types"
|
||||||
|
|
||||||
|
"github.com/zeromicro/go-zero/core/logx"
|
||||||
|
)
|
||||||
|
|
||||||
|
type GetRegisterConfigLogic struct {
|
||||||
|
logx.Logger
|
||||||
|
ctx context.Context
|
||||||
|
svcCtx *svc.ServiceContext
|
||||||
|
}
|
||||||
|
|
||||||
|
func NewGetRegisterConfigLogic(ctx context.Context, svcCtx *svc.ServiceContext) *GetRegisterConfigLogic {
|
||||||
|
return &GetRegisterConfigLogic{
|
||||||
|
Logger: logx.WithContext(ctx),
|
||||||
|
ctx: ctx,
|
||||||
|
svcCtx: svcCtx,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (l *GetRegisterConfigLogic) GetRegisterConfig() (resp *types.RegisterConfigResp, err error) {
|
||||||
|
// todo: add your logic here and delete this line
|
||||||
|
|
||||||
|
return
|
||||||
|
}
|
||||||
33
apps/admin/internal/logic/system/getSiteConfigLogic.go
Normal file
33
apps/admin/internal/logic/system/getSiteConfigLogic.go
Normal file
@ -0,0 +1,33 @@
|
|||||||
|
// Code scaffolded by goctl. Safe to edit.
|
||||||
|
// goctl 1.9.2
|
||||||
|
|
||||||
|
package system
|
||||||
|
|
||||||
|
import (
|
||||||
|
"context"
|
||||||
|
|
||||||
|
"github.com/zero-ppanel/zero-ppanel/apps/admin/internal/svc"
|
||||||
|
"github.com/zero-ppanel/zero-ppanel/apps/admin/internal/types"
|
||||||
|
|
||||||
|
"github.com/zeromicro/go-zero/core/logx"
|
||||||
|
)
|
||||||
|
|
||||||
|
type GetSiteConfigLogic struct {
|
||||||
|
logx.Logger
|
||||||
|
ctx context.Context
|
||||||
|
svcCtx *svc.ServiceContext
|
||||||
|
}
|
||||||
|
|
||||||
|
func NewGetSiteConfigLogic(ctx context.Context, svcCtx *svc.ServiceContext) *GetSiteConfigLogic {
|
||||||
|
return &GetSiteConfigLogic{
|
||||||
|
Logger: logx.WithContext(ctx),
|
||||||
|
ctx: ctx,
|
||||||
|
svcCtx: svcCtx,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (l *GetSiteConfigLogic) GetSiteConfig() (resp *types.SiteConfigResp, err error) {
|
||||||
|
// todo: add your logic here and delete this line
|
||||||
|
|
||||||
|
return
|
||||||
|
}
|
||||||
@ -0,0 +1,33 @@
|
|||||||
|
// Code scaffolded by goctl. Safe to edit.
|
||||||
|
// goctl 1.9.2
|
||||||
|
|
||||||
|
package system
|
||||||
|
|
||||||
|
import (
|
||||||
|
"context"
|
||||||
|
|
||||||
|
"github.com/zero-ppanel/zero-ppanel/apps/admin/internal/svc"
|
||||||
|
"github.com/zero-ppanel/zero-ppanel/apps/admin/internal/types"
|
||||||
|
|
||||||
|
"github.com/zeromicro/go-zero/core/logx"
|
||||||
|
)
|
||||||
|
|
||||||
|
type UpdateRegisterConfigLogic struct {
|
||||||
|
logx.Logger
|
||||||
|
ctx context.Context
|
||||||
|
svcCtx *svc.ServiceContext
|
||||||
|
}
|
||||||
|
|
||||||
|
func NewUpdateRegisterConfigLogic(ctx context.Context, svcCtx *svc.ServiceContext) *UpdateRegisterConfigLogic {
|
||||||
|
return &UpdateRegisterConfigLogic{
|
||||||
|
Logger: logx.WithContext(ctx),
|
||||||
|
ctx: ctx,
|
||||||
|
svcCtx: svcCtx,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (l *UpdateRegisterConfigLogic) UpdateRegisterConfig(req *types.UpdateRegisterConfigReq) error {
|
||||||
|
// todo: add your logic here and delete this line
|
||||||
|
|
||||||
|
return nil
|
||||||
|
}
|
||||||
33
apps/admin/internal/logic/system/updateSiteConfigLogic.go
Normal file
33
apps/admin/internal/logic/system/updateSiteConfigLogic.go
Normal file
@ -0,0 +1,33 @@
|
|||||||
|
// Code scaffolded by goctl. Safe to edit.
|
||||||
|
// goctl 1.9.2
|
||||||
|
|
||||||
|
package system
|
||||||
|
|
||||||
|
import (
|
||||||
|
"context"
|
||||||
|
|
||||||
|
"github.com/zero-ppanel/zero-ppanel/apps/admin/internal/svc"
|
||||||
|
"github.com/zero-ppanel/zero-ppanel/apps/admin/internal/types"
|
||||||
|
|
||||||
|
"github.com/zeromicro/go-zero/core/logx"
|
||||||
|
)
|
||||||
|
|
||||||
|
type UpdateSiteConfigLogic struct {
|
||||||
|
logx.Logger
|
||||||
|
ctx context.Context
|
||||||
|
svcCtx *svc.ServiceContext
|
||||||
|
}
|
||||||
|
|
||||||
|
func NewUpdateSiteConfigLogic(ctx context.Context, svcCtx *svc.ServiceContext) *UpdateSiteConfigLogic {
|
||||||
|
return &UpdateSiteConfigLogic{
|
||||||
|
Logger: logx.WithContext(ctx),
|
||||||
|
ctx: ctx,
|
||||||
|
svcCtx: svcCtx,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (l *UpdateSiteConfigLogic) UpdateSiteConfig(req *types.UpdateSiteConfigReq) error {
|
||||||
|
// todo: add your logic here and delete this line
|
||||||
|
|
||||||
|
return nil
|
||||||
|
}
|
||||||
33
apps/admin/internal/logic/ticket/createTicketFollowLogic.go
Normal file
33
apps/admin/internal/logic/ticket/createTicketFollowLogic.go
Normal file
@ -0,0 +1,33 @@
|
|||||||
|
// Code scaffolded by goctl. Safe to edit.
|
||||||
|
// goctl 1.9.2
|
||||||
|
|
||||||
|
package ticket
|
||||||
|
|
||||||
|
import (
|
||||||
|
"context"
|
||||||
|
|
||||||
|
"github.com/zero-ppanel/zero-ppanel/apps/admin/internal/svc"
|
||||||
|
"github.com/zero-ppanel/zero-ppanel/apps/admin/internal/types"
|
||||||
|
|
||||||
|
"github.com/zeromicro/go-zero/core/logx"
|
||||||
|
)
|
||||||
|
|
||||||
|
type CreateTicketFollowLogic struct {
|
||||||
|
logx.Logger
|
||||||
|
ctx context.Context
|
||||||
|
svcCtx *svc.ServiceContext
|
||||||
|
}
|
||||||
|
|
||||||
|
func NewCreateTicketFollowLogic(ctx context.Context, svcCtx *svc.ServiceContext) *CreateTicketFollowLogic {
|
||||||
|
return &CreateTicketFollowLogic{
|
||||||
|
Logger: logx.WithContext(ctx),
|
||||||
|
ctx: ctx,
|
||||||
|
svcCtx: svcCtx,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (l *CreateTicketFollowLogic) CreateTicketFollow(req *types.AdminCreateTicketFollowReq) error {
|
||||||
|
// todo: add your logic here and delete this line
|
||||||
|
|
||||||
|
return nil
|
||||||
|
}
|
||||||
33
apps/admin/internal/logic/ticket/getTicketDetailLogic.go
Normal file
33
apps/admin/internal/logic/ticket/getTicketDetailLogic.go
Normal file
@ -0,0 +1,33 @@
|
|||||||
|
// Code scaffolded by goctl. Safe to edit.
|
||||||
|
// goctl 1.9.2
|
||||||
|
|
||||||
|
package ticket
|
||||||
|
|
||||||
|
import (
|
||||||
|
"context"
|
||||||
|
|
||||||
|
"github.com/zero-ppanel/zero-ppanel/apps/admin/internal/svc"
|
||||||
|
"github.com/zero-ppanel/zero-ppanel/apps/admin/internal/types"
|
||||||
|
|
||||||
|
"github.com/zeromicro/go-zero/core/logx"
|
||||||
|
)
|
||||||
|
|
||||||
|
type GetTicketDetailLogic struct {
|
||||||
|
logx.Logger
|
||||||
|
ctx context.Context
|
||||||
|
svcCtx *svc.ServiceContext
|
||||||
|
}
|
||||||
|
|
||||||
|
func NewGetTicketDetailLogic(ctx context.Context, svcCtx *svc.ServiceContext) *GetTicketDetailLogic {
|
||||||
|
return &GetTicketDetailLogic{
|
||||||
|
Logger: logx.WithContext(ctx),
|
||||||
|
ctx: ctx,
|
||||||
|
svcCtx: svcCtx,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (l *GetTicketDetailLogic) GetTicketDetail(req *types.AdminTicketDetailReq) (resp *types.AdminTicketResp, err error) {
|
||||||
|
// todo: add your logic here and delete this line
|
||||||
|
|
||||||
|
return
|
||||||
|
}
|
||||||
33
apps/admin/internal/logic/ticket/getTicketListLogic.go
Normal file
33
apps/admin/internal/logic/ticket/getTicketListLogic.go
Normal file
@ -0,0 +1,33 @@
|
|||||||
|
// Code scaffolded by goctl. Safe to edit.
|
||||||
|
// goctl 1.9.2
|
||||||
|
|
||||||
|
package ticket
|
||||||
|
|
||||||
|
import (
|
||||||
|
"context"
|
||||||
|
|
||||||
|
"github.com/zero-ppanel/zero-ppanel/apps/admin/internal/svc"
|
||||||
|
"github.com/zero-ppanel/zero-ppanel/apps/admin/internal/types"
|
||||||
|
|
||||||
|
"github.com/zeromicro/go-zero/core/logx"
|
||||||
|
)
|
||||||
|
|
||||||
|
type GetTicketListLogic struct {
|
||||||
|
logx.Logger
|
||||||
|
ctx context.Context
|
||||||
|
svcCtx *svc.ServiceContext
|
||||||
|
}
|
||||||
|
|
||||||
|
func NewGetTicketListLogic(ctx context.Context, svcCtx *svc.ServiceContext) *GetTicketListLogic {
|
||||||
|
return &GetTicketListLogic{
|
||||||
|
Logger: logx.WithContext(ctx),
|
||||||
|
ctx: ctx,
|
||||||
|
svcCtx: svcCtx,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (l *GetTicketListLogic) GetTicketList(req *types.AdminTicketListReq) (resp *types.AdminTicketListResp, err error) {
|
||||||
|
// todo: add your logic here and delete this line
|
||||||
|
|
||||||
|
return
|
||||||
|
}
|
||||||
33
apps/admin/internal/logic/ticket/updateTicketStatusLogic.go
Normal file
33
apps/admin/internal/logic/ticket/updateTicketStatusLogic.go
Normal file
@ -0,0 +1,33 @@
|
|||||||
|
// Code scaffolded by goctl. Safe to edit.
|
||||||
|
// goctl 1.9.2
|
||||||
|
|
||||||
|
package ticket
|
||||||
|
|
||||||
|
import (
|
||||||
|
"context"
|
||||||
|
|
||||||
|
"github.com/zero-ppanel/zero-ppanel/apps/admin/internal/svc"
|
||||||
|
"github.com/zero-ppanel/zero-ppanel/apps/admin/internal/types"
|
||||||
|
|
||||||
|
"github.com/zeromicro/go-zero/core/logx"
|
||||||
|
)
|
||||||
|
|
||||||
|
type UpdateTicketStatusLogic struct {
|
||||||
|
logx.Logger
|
||||||
|
ctx context.Context
|
||||||
|
svcCtx *svc.ServiceContext
|
||||||
|
}
|
||||||
|
|
||||||
|
func NewUpdateTicketStatusLogic(ctx context.Context, svcCtx *svc.ServiceContext) *UpdateTicketStatusLogic {
|
||||||
|
return &UpdateTicketStatusLogic{
|
||||||
|
Logger: logx.WithContext(ctx),
|
||||||
|
ctx: ctx,
|
||||||
|
svcCtx: svcCtx,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (l *UpdateTicketStatusLogic) UpdateTicketStatus(req *types.AdminUpdateTicketStatusReq) error {
|
||||||
|
// todo: add your logic here and delete this line
|
||||||
|
|
||||||
|
return nil
|
||||||
|
}
|
||||||
33
apps/admin/internal/logic/user/deleteUserLogic.go
Normal file
33
apps/admin/internal/logic/user/deleteUserLogic.go
Normal file
@ -0,0 +1,33 @@
|
|||||||
|
// Code scaffolded by goctl. Safe to edit.
|
||||||
|
// goctl 1.9.2
|
||||||
|
|
||||||
|
package user
|
||||||
|
|
||||||
|
import (
|
||||||
|
"context"
|
||||||
|
|
||||||
|
"github.com/zero-ppanel/zero-ppanel/apps/admin/internal/svc"
|
||||||
|
"github.com/zero-ppanel/zero-ppanel/apps/admin/internal/types"
|
||||||
|
|
||||||
|
"github.com/zeromicro/go-zero/core/logx"
|
||||||
|
)
|
||||||
|
|
||||||
|
type DeleteUserLogic struct {
|
||||||
|
logx.Logger
|
||||||
|
ctx context.Context
|
||||||
|
svcCtx *svc.ServiceContext
|
||||||
|
}
|
||||||
|
|
||||||
|
func NewDeleteUserLogic(ctx context.Context, svcCtx *svc.ServiceContext) *DeleteUserLogic {
|
||||||
|
return &DeleteUserLogic{
|
||||||
|
Logger: logx.WithContext(ctx),
|
||||||
|
ctx: ctx,
|
||||||
|
svcCtx: svcCtx,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (l *DeleteUserLogic) DeleteUser(req *types.AdminDeleteUserReq) error {
|
||||||
|
// todo: add your logic here and delete this line
|
||||||
|
|
||||||
|
return nil
|
||||||
|
}
|
||||||
33
apps/admin/internal/logic/user/getUserDetailLogic.go
Normal file
33
apps/admin/internal/logic/user/getUserDetailLogic.go
Normal file
@ -0,0 +1,33 @@
|
|||||||
|
// Code scaffolded by goctl. Safe to edit.
|
||||||
|
// goctl 1.9.2
|
||||||
|
|
||||||
|
package user
|
||||||
|
|
||||||
|
import (
|
||||||
|
"context"
|
||||||
|
|
||||||
|
"github.com/zero-ppanel/zero-ppanel/apps/admin/internal/svc"
|
||||||
|
"github.com/zero-ppanel/zero-ppanel/apps/admin/internal/types"
|
||||||
|
|
||||||
|
"github.com/zeromicro/go-zero/core/logx"
|
||||||
|
)
|
||||||
|
|
||||||
|
type GetUserDetailLogic struct {
|
||||||
|
logx.Logger
|
||||||
|
ctx context.Context
|
||||||
|
svcCtx *svc.ServiceContext
|
||||||
|
}
|
||||||
|
|
||||||
|
func NewGetUserDetailLogic(ctx context.Context, svcCtx *svc.ServiceContext) *GetUserDetailLogic {
|
||||||
|
return &GetUserDetailLogic{
|
||||||
|
Logger: logx.WithContext(ctx),
|
||||||
|
ctx: ctx,
|
||||||
|
svcCtx: svcCtx,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (l *GetUserDetailLogic) GetUserDetail(req *types.AdminUserDetailReq) (resp *types.AdminUserResp, err error) {
|
||||||
|
// todo: add your logic here and delete this line
|
||||||
|
|
||||||
|
return
|
||||||
|
}
|
||||||
33
apps/admin/internal/logic/user/getUserListLogic.go
Normal file
33
apps/admin/internal/logic/user/getUserListLogic.go
Normal file
@ -0,0 +1,33 @@
|
|||||||
|
// Code scaffolded by goctl. Safe to edit.
|
||||||
|
// goctl 1.9.2
|
||||||
|
|
||||||
|
package user
|
||||||
|
|
||||||
|
import (
|
||||||
|
"context"
|
||||||
|
|
||||||
|
"github.com/zero-ppanel/zero-ppanel/apps/admin/internal/svc"
|
||||||
|
"github.com/zero-ppanel/zero-ppanel/apps/admin/internal/types"
|
||||||
|
|
||||||
|
"github.com/zeromicro/go-zero/core/logx"
|
||||||
|
)
|
||||||
|
|
||||||
|
type GetUserListLogic struct {
|
||||||
|
logx.Logger
|
||||||
|
ctx context.Context
|
||||||
|
svcCtx *svc.ServiceContext
|
||||||
|
}
|
||||||
|
|
||||||
|
func NewGetUserListLogic(ctx context.Context, svcCtx *svc.ServiceContext) *GetUserListLogic {
|
||||||
|
return &GetUserListLogic{
|
||||||
|
Logger: logx.WithContext(ctx),
|
||||||
|
ctx: ctx,
|
||||||
|
svcCtx: svcCtx,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (l *GetUserListLogic) GetUserList(req *types.AdminUserListReq) (resp *types.AdminUserListResp, err error) {
|
||||||
|
// todo: add your logic here and delete this line
|
||||||
|
|
||||||
|
return
|
||||||
|
}
|
||||||
18
apps/admin/internal/svc/serviceContext.go
Normal file
18
apps/admin/internal/svc/serviceContext.go
Normal file
@ -0,0 +1,18 @@
|
|||||||
|
// Code scaffolded by goctl. Safe to edit.
|
||||||
|
// goctl 1.9.2
|
||||||
|
|
||||||
|
package svc
|
||||||
|
|
||||||
|
import (
|
||||||
|
"github.com/zero-ppanel/zero-ppanel/apps/admin/internal/config"
|
||||||
|
)
|
||||||
|
|
||||||
|
type ServiceContext struct {
|
||||||
|
Config config.Config
|
||||||
|
}
|
||||||
|
|
||||||
|
func NewServiceContext(c config.Config) *ServiceContext {
|
||||||
|
return &ServiceContext{
|
||||||
|
Config: c,
|
||||||
|
}
|
||||||
|
}
|
||||||
228
apps/admin/internal/types/types.go
Normal file
228
apps/admin/internal/types/types.go
Normal file
@ -0,0 +1,228 @@
|
|||||||
|
// Code generated by goctl. DO NOT EDIT.
|
||||||
|
// goctl 1.9.2
|
||||||
|
|
||||||
|
package types
|
||||||
|
|
||||||
|
type AdminAnnouncementResp struct {
|
||||||
|
Id int64 `json:"id"`
|
||||||
|
Title string `json:"title"`
|
||||||
|
Content string `json:"content"`
|
||||||
|
CreatedAt string `json:"created_at"`
|
||||||
|
}
|
||||||
|
|
||||||
|
type AdminCreateTicketFollowReq struct {
|
||||||
|
Id int64 `path:"id"`
|
||||||
|
Content string `json:"content"`
|
||||||
|
}
|
||||||
|
|
||||||
|
type AdminDeleteUserReq struct {
|
||||||
|
Id int64 `path:"id"`
|
||||||
|
}
|
||||||
|
|
||||||
|
type AdminOrderListReq struct {
|
||||||
|
Page int `form:"page,default=1"`
|
||||||
|
PageSize int `form:"page_size,default=20"`
|
||||||
|
Status int `form:"status,optional"`
|
||||||
|
}
|
||||||
|
|
||||||
|
type AdminOrderListResp struct {
|
||||||
|
Total int64 `json:"total"`
|
||||||
|
List []AdminOrderResp `json:"list"`
|
||||||
|
}
|
||||||
|
|
||||||
|
type AdminOrderResp struct {
|
||||||
|
Id int64 `json:"id"`
|
||||||
|
OrderNo string `json:"order_no"`
|
||||||
|
UserId int64 `json:"user_id"`
|
||||||
|
Amount int64 `json:"amount"`
|
||||||
|
Status int `json:"status"`
|
||||||
|
CreatedAt string `json:"created_at"`
|
||||||
|
}
|
||||||
|
|
||||||
|
type AdminSubscribeListReq struct {
|
||||||
|
Page int `form:"page,default=1"`
|
||||||
|
PageSize int `form:"page_size,default=20"`
|
||||||
|
}
|
||||||
|
|
||||||
|
type AdminSubscribeListResp struct {
|
||||||
|
Total int64 `json:"total"`
|
||||||
|
List []AdminSubscribeResp `json:"list"`
|
||||||
|
}
|
||||||
|
|
||||||
|
type AdminSubscribeResp struct {
|
||||||
|
Id int64 `json:"id"`
|
||||||
|
Name string `json:"name"`
|
||||||
|
Price int64 `json:"price"`
|
||||||
|
Traffic int64 `json:"traffic"`
|
||||||
|
Enable bool `json:"enable"`
|
||||||
|
}
|
||||||
|
|
||||||
|
type AdminTicketDetailReq struct {
|
||||||
|
Id int64 `path:"id"`
|
||||||
|
}
|
||||||
|
|
||||||
|
type AdminTicketListReq struct {
|
||||||
|
Page int `form:"page,default=1"`
|
||||||
|
PageSize int `form:"page_size,default=20"`
|
||||||
|
Status int `form:"status,optional"`
|
||||||
|
}
|
||||||
|
|
||||||
|
type AdminTicketListResp struct {
|
||||||
|
Total int64 `json:"total"`
|
||||||
|
List []AdminTicketResp `json:"list"`
|
||||||
|
}
|
||||||
|
|
||||||
|
type AdminTicketResp struct {
|
||||||
|
Id int64 `json:"id"`
|
||||||
|
UserId int64 `json:"user_id"`
|
||||||
|
Title string `json:"title"`
|
||||||
|
Status int `json:"status"`
|
||||||
|
CreatedAt string `json:"created_at"`
|
||||||
|
}
|
||||||
|
|
||||||
|
type AdminUpdateTicketStatusReq struct {
|
||||||
|
Id int64 `path:"id"`
|
||||||
|
Status int `json:"status"`
|
||||||
|
}
|
||||||
|
|
||||||
|
type AdminUserDetailReq struct {
|
||||||
|
Id int64 `path:"id"`
|
||||||
|
}
|
||||||
|
|
||||||
|
type AdminUserListReq struct {
|
||||||
|
Page int `form:"page,default=1"`
|
||||||
|
PageSize int `form:"page_size,default=20"`
|
||||||
|
Search string `form:"search,optional"`
|
||||||
|
}
|
||||||
|
|
||||||
|
type AdminUserListResp struct {
|
||||||
|
Total int64 `json:"total"`
|
||||||
|
List []AdminUserResp `json:"list"`
|
||||||
|
}
|
||||||
|
|
||||||
|
type AdminUserResp struct {
|
||||||
|
Id int64 `json:"id"`
|
||||||
|
Email string `json:"email"`
|
||||||
|
Balance int64 `json:"balance"`
|
||||||
|
IsAdmin bool `json:"is_admin"`
|
||||||
|
Enable bool `json:"enable"`
|
||||||
|
CreatedAt string `json:"created_at"`
|
||||||
|
}
|
||||||
|
|
||||||
|
type ConsoleStatsResp struct {
|
||||||
|
TotalUsers int64 `json:"total_users"`
|
||||||
|
TotalOrders int64 `json:"total_orders"`
|
||||||
|
TotalRevenue int64 `json:"total_revenue"`
|
||||||
|
TodayNewUsers int64 `json:"today_new_users"`
|
||||||
|
TodayOrders int64 `json:"today_orders"`
|
||||||
|
TodayRevenue int64 `json:"today_revenue"`
|
||||||
|
OnlineNodes int64 `json:"online_nodes"`
|
||||||
|
TotalNodes int64 `json:"total_nodes"`
|
||||||
|
}
|
||||||
|
|
||||||
|
type CreateAnnouncementReq struct {
|
||||||
|
Title string `json:"title"`
|
||||||
|
Content string `json:"content"`
|
||||||
|
}
|
||||||
|
|
||||||
|
type CreateServerReq struct {
|
||||||
|
Name string `json:"name"`
|
||||||
|
Address string `json:"address"`
|
||||||
|
Port int `json:"port"`
|
||||||
|
Protocol string `json:"protocol"`
|
||||||
|
}
|
||||||
|
|
||||||
|
type CreateSubscribeReq struct {
|
||||||
|
Name string `json:"name"`
|
||||||
|
Price int64 `json:"price"`
|
||||||
|
Traffic int64 `json:"traffic"`
|
||||||
|
}
|
||||||
|
|
||||||
|
type DeleteAnnouncementReq struct {
|
||||||
|
Id int64 `path:"id"`
|
||||||
|
}
|
||||||
|
|
||||||
|
type DeleteServerReq struct {
|
||||||
|
Id int64 `path:"id"`
|
||||||
|
}
|
||||||
|
|
||||||
|
type DeleteSubscribeReq struct {
|
||||||
|
Id int64 `path:"id"`
|
||||||
|
}
|
||||||
|
|
||||||
|
type HealthResp struct {
|
||||||
|
Status string `json:"status"`
|
||||||
|
}
|
||||||
|
|
||||||
|
type RegisterConfigResp struct {
|
||||||
|
StopRegister bool `json:"stop_register"`
|
||||||
|
EmailVerify bool `json:"email_verify"`
|
||||||
|
EmailWhitelist string `json:"email_whitelist"`
|
||||||
|
InviteForce bool `json:"invite_force"`
|
||||||
|
}
|
||||||
|
|
||||||
|
type ServerListReq struct {
|
||||||
|
Page int `form:"page,default=1"`
|
||||||
|
PageSize int `form:"page_size,default=20"`
|
||||||
|
}
|
||||||
|
|
||||||
|
type ServerListResp struct {
|
||||||
|
Total int64 `json:"total"`
|
||||||
|
List []ServerResp `json:"list"`
|
||||||
|
}
|
||||||
|
|
||||||
|
type ServerResp struct {
|
||||||
|
Id int64 `json:"id"`
|
||||||
|
Name string `json:"name"`
|
||||||
|
Address string `json:"address"`
|
||||||
|
Port int `json:"port"`
|
||||||
|
Protocol string `json:"protocol"`
|
||||||
|
Enable bool `json:"enable"`
|
||||||
|
}
|
||||||
|
|
||||||
|
type SiteConfigResp struct {
|
||||||
|
SiteName string `json:"site_name"`
|
||||||
|
SiteDesc string `json:"site_desc"`
|
||||||
|
SiteLogo string `json:"site_logo"`
|
||||||
|
ForceHttps bool `json:"force_https"`
|
||||||
|
}
|
||||||
|
|
||||||
|
type UpdateAnnouncementReq struct {
|
||||||
|
Id int64 `path:"id"`
|
||||||
|
Title string `json:"title"`
|
||||||
|
Content string `json:"content"`
|
||||||
|
}
|
||||||
|
|
||||||
|
type UpdateOrderStatusReq struct {
|
||||||
|
OrderNo string `path:"order_no"`
|
||||||
|
Status int `json:"status"`
|
||||||
|
}
|
||||||
|
|
||||||
|
type UpdateRegisterConfigReq struct {
|
||||||
|
StopRegister bool `json:"stop_register"`
|
||||||
|
EmailVerify bool `json:"email_verify"`
|
||||||
|
EmailWhitelist string `json:"email_whitelist"`
|
||||||
|
InviteForce bool `json:"invite_force"`
|
||||||
|
}
|
||||||
|
|
||||||
|
type UpdateServerReq struct {
|
||||||
|
Id int64 `path:"id"`
|
||||||
|
Name string `json:"name"`
|
||||||
|
Address string `json:"address"`
|
||||||
|
Port int `json:"port"`
|
||||||
|
Protocol string `json:"protocol"`
|
||||||
|
}
|
||||||
|
|
||||||
|
type UpdateSiteConfigReq struct {
|
||||||
|
SiteName string `json:"site_name"`
|
||||||
|
SiteDesc string `json:"site_desc"`
|
||||||
|
SiteLogo string `json:"site_logo"`
|
||||||
|
ForceHttps bool `json:"force_https"`
|
||||||
|
}
|
||||||
|
|
||||||
|
type UpdateSubscribeReq struct {
|
||||||
|
Id int64 `path:"id"`
|
||||||
|
Name string `json:"name"`
|
||||||
|
Price int64 `json:"price"`
|
||||||
|
Traffic int64 `json:"traffic"`
|
||||||
|
}
|
||||||
34
apps/admin/ppaneladmin.go
Normal file
34
apps/admin/ppaneladmin.go
Normal file
@ -0,0 +1,34 @@
|
|||||||
|
// Code scaffolded by goctl. Safe to edit.
|
||||||
|
// goctl 1.9.2
|
||||||
|
|
||||||
|
package main
|
||||||
|
|
||||||
|
import (
|
||||||
|
"flag"
|
||||||
|
"fmt"
|
||||||
|
|
||||||
|
"github.com/zero-ppanel/zero-ppanel/apps/admin/internal/config"
|
||||||
|
"github.com/zero-ppanel/zero-ppanel/apps/admin/internal/handler"
|
||||||
|
"github.com/zero-ppanel/zero-ppanel/apps/admin/internal/svc"
|
||||||
|
|
||||||
|
"github.com/zeromicro/go-zero/core/conf"
|
||||||
|
"github.com/zeromicro/go-zero/rest"
|
||||||
|
)
|
||||||
|
|
||||||
|
var configFile = flag.String("f", "etc/admin-dev.yaml", "the config file")
|
||||||
|
|
||||||
|
func main() {
|
||||||
|
flag.Parse()
|
||||||
|
|
||||||
|
var c config.Config
|
||||||
|
conf.MustLoad(*configFile, &c)
|
||||||
|
|
||||||
|
server := rest.MustNewServer(c.RestConf)
|
||||||
|
defer server.Stop()
|
||||||
|
|
||||||
|
ctx := svc.NewServiceContext(c)
|
||||||
|
handler.RegisterHandlers(server, ctx)
|
||||||
|
|
||||||
|
fmt.Printf("Starting server at %s:%d...\n", c.Host, c.Port)
|
||||||
|
server.Start()
|
||||||
|
}
|
||||||
18
apps/api/api.api
Normal file
18
apps/api/api.api
Normal file
@ -0,0 +1,18 @@
|
|||||||
|
syntax = "v1"
|
||||||
|
|
||||||
|
info (
|
||||||
|
title: "PPanel API"
|
||||||
|
desc: "用户端 BFF 服务"
|
||||||
|
author: "ppanel"
|
||||||
|
version: "1.0"
|
||||||
|
)
|
||||||
|
|
||||||
|
import (
|
||||||
|
"desc/types.api"
|
||||||
|
"desc/common.api"
|
||||||
|
"desc/auth.api"
|
||||||
|
"desc/user.api"
|
||||||
|
"desc/order.api"
|
||||||
|
"desc/ticket.api"
|
||||||
|
)
|
||||||
|
|
||||||
45
apps/api/desc/auth.api
Normal file
45
apps/api/desc/auth.api
Normal file
@ -0,0 +1,45 @@
|
|||||||
|
syntax = "v1"
|
||||||
|
|
||||||
|
info (
|
||||||
|
title: "认证接口"
|
||||||
|
)
|
||||||
|
|
||||||
|
type (
|
||||||
|
UserLoginReq {
|
||||||
|
Email string `json:"email"`
|
||||||
|
Password string `json:"password"`
|
||||||
|
}
|
||||||
|
|
||||||
|
UserRegisterReq {
|
||||||
|
Email string `json:"email"`
|
||||||
|
Password string `json:"password"`
|
||||||
|
Code string `json:"code"`
|
||||||
|
ReferCode string `json:"refer_code,optional"`
|
||||||
|
}
|
||||||
|
|
||||||
|
AuthResp {
|
||||||
|
Token string `json:"token"`
|
||||||
|
Expire int64 `json:"expire"`
|
||||||
|
}
|
||||||
|
|
||||||
|
ResetPasswordReq {
|
||||||
|
Email string `json:"email"`
|
||||||
|
Password string `json:"password"`
|
||||||
|
Code string `json:"code"`
|
||||||
|
}
|
||||||
|
)
|
||||||
|
|
||||||
|
@server (
|
||||||
|
prefix: /api/v1/auth
|
||||||
|
group: auth
|
||||||
|
)
|
||||||
|
service ppanel-api {
|
||||||
|
@handler UserLoginHandler
|
||||||
|
post /login (UserLoginReq) returns (AuthResp)
|
||||||
|
|
||||||
|
@handler UserRegisterHandler
|
||||||
|
post /register (UserRegisterReq) returns (AuthResp)
|
||||||
|
|
||||||
|
@handler ResetPasswordHandler
|
||||||
|
post /reset_password (ResetPasswordReq)
|
||||||
|
}
|
||||||
38
apps/api/desc/common.api
Normal file
38
apps/api/desc/common.api
Normal file
@ -0,0 +1,38 @@
|
|||||||
|
syntax = "v1"
|
||||||
|
|
||||||
|
info (
|
||||||
|
title: "公共接口"
|
||||||
|
)
|
||||||
|
|
||||||
|
@server (
|
||||||
|
prefix: /api/v1
|
||||||
|
group: common
|
||||||
|
)
|
||||||
|
service ppanel-api {
|
||||||
|
@handler HealthHandler
|
||||||
|
get /health returns (HealthResp)
|
||||||
|
|
||||||
|
@handler GetGlobalConfigHandler
|
||||||
|
get /config returns (GlobalConfigResp)
|
||||||
|
|
||||||
|
@handler SendEmailCodeHandler
|
||||||
|
post /send_email_code (SendEmailCodeReq)
|
||||||
|
|
||||||
|
@handler GetAnnouncementListHandler
|
||||||
|
get /announcement returns ([]AnnouncementResp)
|
||||||
|
|
||||||
|
@handler GetDocumentListHandler
|
||||||
|
get /document returns ([]DocumentListResp)
|
||||||
|
|
||||||
|
@handler GetDocumentDetailHandler
|
||||||
|
get /document/:id (DocumentDetailReq) returns (DocumentDetailResp)
|
||||||
|
|
||||||
|
@handler GetAvailablePaymentMethodsHandler
|
||||||
|
get /payment/methods returns ([]PaymentMethodResp)
|
||||||
|
|
||||||
|
@handler GetSubscribeGroupListHandler
|
||||||
|
get /subscribe/group returns ([]SubscribeGroupResp)
|
||||||
|
|
||||||
|
@handler GetSubscribeListHandler
|
||||||
|
get /subscribe returns ([]SubscribeResp)
|
||||||
|
}
|
||||||
47
apps/api/desc/order.api
Normal file
47
apps/api/desc/order.api
Normal file
@ -0,0 +1,47 @@
|
|||||||
|
syntax = "v1"
|
||||||
|
|
||||||
|
info (
|
||||||
|
title: "订单接口"
|
||||||
|
)
|
||||||
|
|
||||||
|
type (
|
||||||
|
CreateOrderReq {
|
||||||
|
SubscribeId int64 `json:"subscribe_id"`
|
||||||
|
CouponCode string `json:"coupon_code,optional"`
|
||||||
|
PaymentId int64 `json:"payment_id"`
|
||||||
|
Period string `json:"period"`
|
||||||
|
}
|
||||||
|
|
||||||
|
OrderResp {
|
||||||
|
Id int64 `json:"id"`
|
||||||
|
OrderNo string `json:"order_no"`
|
||||||
|
Amount int64 `json:"amount"`
|
||||||
|
Status int `json:"status"`
|
||||||
|
PaymentUrl string `json:"payment_url,omitempty"`
|
||||||
|
CreatedAt string `json:"created_at"`
|
||||||
|
}
|
||||||
|
|
||||||
|
OrderDetailReq {
|
||||||
|
OrderNo string `path:"order_no"`
|
||||||
|
}
|
||||||
|
|
||||||
|
CloseOrderReq {
|
||||||
|
OrderNo string `path:"order_no"`
|
||||||
|
}
|
||||||
|
)
|
||||||
|
|
||||||
|
@server (
|
||||||
|
prefix: /api/v1/order
|
||||||
|
group: order
|
||||||
|
jwt: JwtAuth
|
||||||
|
)
|
||||||
|
service ppanel-api {
|
||||||
|
@handler CreateOrderHandler
|
||||||
|
post /create (CreateOrderReq) returns (OrderResp)
|
||||||
|
|
||||||
|
@handler GetOrderDetailHandler
|
||||||
|
get /:order_no (OrderDetailReq) returns (OrderResp)
|
||||||
|
|
||||||
|
@handler CloseOrderHandler
|
||||||
|
post /:order_no/close (CloseOrderReq)
|
||||||
|
}
|
||||||
44
apps/api/desc/ticket.api
Normal file
44
apps/api/desc/ticket.api
Normal file
@ -0,0 +1,44 @@
|
|||||||
|
syntax = "v1"
|
||||||
|
|
||||||
|
info (
|
||||||
|
title: "工单接口"
|
||||||
|
)
|
||||||
|
|
||||||
|
type (
|
||||||
|
CreateTicketReq {
|
||||||
|
Title string `json:"title"`
|
||||||
|
Content string `json:"content"`
|
||||||
|
}
|
||||||
|
|
||||||
|
TicketResp {
|
||||||
|
Id int64 `json:"id"`
|
||||||
|
Title string `json:"title"`
|
||||||
|
Status int `json:"status"`
|
||||||
|
CreatedAt string `json:"created_at"`
|
||||||
|
}
|
||||||
|
|
||||||
|
TicketDetailReq {
|
||||||
|
Id int64 `path:"id"`
|
||||||
|
}
|
||||||
|
|
||||||
|
CreateTicketFollowReq {
|
||||||
|
Id int64 `path:"id"`
|
||||||
|
Content string `json:"content"`
|
||||||
|
}
|
||||||
|
)
|
||||||
|
|
||||||
|
@server (
|
||||||
|
prefix: /api/v1/ticket
|
||||||
|
group: ticket
|
||||||
|
jwt: JwtAuth
|
||||||
|
)
|
||||||
|
service ppanel-api {
|
||||||
|
@handler CreateTicketHandler
|
||||||
|
post /create (CreateTicketReq) returns (TicketResp)
|
||||||
|
|
||||||
|
@handler GetTicketDetailHandler
|
||||||
|
get /:id (TicketDetailReq) returns (TicketResp)
|
||||||
|
|
||||||
|
@handler CreateTicketFollowHandler
|
||||||
|
post /:id/follow (CreateTicketFollowReq)
|
||||||
|
}
|
||||||
65
apps/api/desc/types.api
Normal file
65
apps/api/desc/types.api
Normal file
@ -0,0 +1,65 @@
|
|||||||
|
syntax = "v1"
|
||||||
|
|
||||||
|
info (
|
||||||
|
title: "公共类型定义"
|
||||||
|
)
|
||||||
|
|
||||||
|
type (
|
||||||
|
HealthResp {
|
||||||
|
Status string `json:"status"`
|
||||||
|
}
|
||||||
|
|
||||||
|
GlobalConfigResp {
|
||||||
|
SiteName string `json:"site_name"`
|
||||||
|
SiteDesc string `json:"site_desc"`
|
||||||
|
SiteLogo string `json:"site_logo"`
|
||||||
|
ForceHttps bool `json:"force_https"`
|
||||||
|
StopRegister bool `json:"stop_register"`
|
||||||
|
}
|
||||||
|
|
||||||
|
SendEmailCodeReq {
|
||||||
|
Email string `json:"email"`
|
||||||
|
}
|
||||||
|
|
||||||
|
AnnouncementResp {
|
||||||
|
Id int64 `json:"id"`
|
||||||
|
Title string `json:"title"`
|
||||||
|
Content string `json:"content"`
|
||||||
|
CreatedAt string `json:"created_at"`
|
||||||
|
}
|
||||||
|
|
||||||
|
DocumentListResp {
|
||||||
|
Id int64 `json:"id"`
|
||||||
|
Title string `json:"title"`
|
||||||
|
}
|
||||||
|
|
||||||
|
DocumentDetailReq {
|
||||||
|
Id int64 `path:"id"`
|
||||||
|
}
|
||||||
|
|
||||||
|
DocumentDetailResp {
|
||||||
|
Id int64 `json:"id"`
|
||||||
|
Title string `json:"title"`
|
||||||
|
Content string `json:"content"`
|
||||||
|
}
|
||||||
|
|
||||||
|
PaymentMethodResp {
|
||||||
|
Id int64 `json:"id"`
|
||||||
|
Name string `json:"name"`
|
||||||
|
Platform string `json:"platform"`
|
||||||
|
Icon string `json:"icon"`
|
||||||
|
}
|
||||||
|
|
||||||
|
SubscribeGroupResp {
|
||||||
|
Id int64 `json:"id"`
|
||||||
|
Name string `json:"name"`
|
||||||
|
}
|
||||||
|
|
||||||
|
SubscribeResp {
|
||||||
|
Id int64 `json:"id"`
|
||||||
|
Name string `json:"name"`
|
||||||
|
Price int64 `json:"price"`
|
||||||
|
Traffic int64 `json:"traffic"`
|
||||||
|
GroupId int64 `json:"group_id"`
|
||||||
|
}
|
||||||
|
)
|
||||||
47
apps/api/desc/user.api
Normal file
47
apps/api/desc/user.api
Normal file
@ -0,0 +1,47 @@
|
|||||||
|
syntax = "v1"
|
||||||
|
|
||||||
|
info (
|
||||||
|
title: "用户接口"
|
||||||
|
)
|
||||||
|
|
||||||
|
type (
|
||||||
|
UserInfoResp {
|
||||||
|
Id int64 `json:"id"`
|
||||||
|
Email string `json:"email"`
|
||||||
|
Avatar string `json:"avatar"`
|
||||||
|
Balance int64 `json:"balance"`
|
||||||
|
Commission int64 `json:"commission"`
|
||||||
|
IsAdmin bool `json:"is_admin"`
|
||||||
|
}
|
||||||
|
|
||||||
|
UpdatePasswordReq {
|
||||||
|
OldPassword string `json:"old_password"`
|
||||||
|
NewPassword string `json:"new_password"`
|
||||||
|
}
|
||||||
|
|
||||||
|
UserSubscribeResp {
|
||||||
|
Id int64 `json:"id"`
|
||||||
|
SubscribeId int64 `json:"subscribe_id"`
|
||||||
|
Name string `json:"name"`
|
||||||
|
ExpireAt string `json:"expire_at"`
|
||||||
|
Traffic int64 `json:"traffic"`
|
||||||
|
UsedTraffic int64 `json:"used_traffic"`
|
||||||
|
Token string `json:"token"`
|
||||||
|
}
|
||||||
|
)
|
||||||
|
|
||||||
|
@server (
|
||||||
|
prefix: /api/v1/user
|
||||||
|
group: user
|
||||||
|
jwt: JwtAuth
|
||||||
|
)
|
||||||
|
service ppanel-api {
|
||||||
|
@handler GetUserInfoHandler
|
||||||
|
get /info returns (UserInfoResp)
|
||||||
|
|
||||||
|
@handler UpdateUserPasswordHandler
|
||||||
|
post /password (UpdatePasswordReq)
|
||||||
|
|
||||||
|
@handler GetUserSubscribeHandler
|
||||||
|
get /subscribe returns ([]UserSubscribeResp)
|
||||||
|
}
|
||||||
38
apps/api/etc/api-dev.yaml
Normal file
38
apps/api/etc/api-dev.yaml
Normal file
@ -0,0 +1,38 @@
|
|||||||
|
Name: zero-ppanel-api
|
||||||
|
Host: 0.0.0.0
|
||||||
|
Port: 8080
|
||||||
|
Mode: dev
|
||||||
|
|
||||||
|
Log:
|
||||||
|
Mode: console
|
||||||
|
Encoding: plain
|
||||||
|
Level: debug
|
||||||
|
|
||||||
|
Telemetry:
|
||||||
|
Name: zero-ppanel-api
|
||||||
|
Endpoint: 127.0.0.1:4318
|
||||||
|
Sampler: 1.0
|
||||||
|
Batcher: otlphttp
|
||||||
|
|
||||||
|
DevServer:
|
||||||
|
Enabled: true
|
||||||
|
Port: 6160
|
||||||
|
EnableMetrics: true
|
||||||
|
EnablePprof: true
|
||||||
|
|
||||||
|
JwtAuth:
|
||||||
|
AccessSecret: "dev-secret-key-change-me"
|
||||||
|
AccessExpire: 86400
|
||||||
|
|
||||||
|
MySQL:
|
||||||
|
DataSource: "root:password@tcp(127.0.0.1:3306)/ppanel?charset=utf8mb4&parseTime=true"
|
||||||
|
|
||||||
|
Redis:
|
||||||
|
Host: 127.0.0.1:6379
|
||||||
|
Type: node
|
||||||
|
|
||||||
|
Asynq:
|
||||||
|
Addr: 127.0.0.1:6379
|
||||||
|
|
||||||
|
CoreRpc:
|
||||||
|
Target: 127.0.0.1:8083
|
||||||
40
apps/api/etc/api-prod.yaml
Normal file
40
apps/api/etc/api-prod.yaml
Normal file
@ -0,0 +1,40 @@
|
|||||||
|
Name: zero-ppanel-api
|
||||||
|
Host: 0.0.0.0
|
||||||
|
Port: 8080
|
||||||
|
Mode: pro
|
||||||
|
|
||||||
|
Log:
|
||||||
|
Mode: file
|
||||||
|
Encoding: json
|
||||||
|
Level: info
|
||||||
|
Path: /var/log/zero-ppanel/api
|
||||||
|
KeepDays: 15
|
||||||
|
Rotation: daily
|
||||||
|
|
||||||
|
Telemetry:
|
||||||
|
Name: zero-ppanel-api
|
||||||
|
Endpoint: http://jaeger:4318/v1/traces
|
||||||
|
Sampler: 0.1
|
||||||
|
Batcher: otlphttp
|
||||||
|
|
||||||
|
DevServer:
|
||||||
|
Enabled: true
|
||||||
|
Port: 6160
|
||||||
|
EnableMetrics: true
|
||||||
|
EnablePprof: false
|
||||||
|
|
||||||
|
JwtAuth:
|
||||||
|
AccessSecret: "${JWT_SECRET}"
|
||||||
|
AccessExpire: 86400
|
||||||
|
|
||||||
|
MySQL:
|
||||||
|
DataSource: "${MYSQL_DSN}"
|
||||||
|
|
||||||
|
Redis:
|
||||||
|
Host: "${REDIS_HOST}"
|
||||||
|
Type: node
|
||||||
|
Pass: "${REDIS_PASS}"
|
||||||
|
|
||||||
|
Asynq:
|
||||||
|
Addr: "${REDIS_HOST}"
|
||||||
|
Pass: "${REDIS_PASS}"
|
||||||
37
apps/api/etc/api-test.yaml
Normal file
37
apps/api/etc/api-test.yaml
Normal file
@ -0,0 +1,37 @@
|
|||||||
|
Name: zero-ppanel-api
|
||||||
|
Host: 0.0.0.0
|
||||||
|
Port: 8080
|
||||||
|
Mode: test
|
||||||
|
|
||||||
|
Log:
|
||||||
|
Mode: file
|
||||||
|
Encoding: json
|
||||||
|
Level: info
|
||||||
|
Path: logs/api
|
||||||
|
KeepDays: 7
|
||||||
|
|
||||||
|
Telemetry:
|
||||||
|
Name: zero-ppanel-api
|
||||||
|
Endpoint: http://jaeger:4318/v1/traces
|
||||||
|
Sampler: 0.5
|
||||||
|
Batcher: otlphttp
|
||||||
|
|
||||||
|
DevServer:
|
||||||
|
Enabled: true
|
||||||
|
Port: 6160
|
||||||
|
EnableMetrics: true
|
||||||
|
EnablePprof: true
|
||||||
|
|
||||||
|
JwtAuth:
|
||||||
|
AccessSecret: "test-secret-key-change-me"
|
||||||
|
AccessExpire: 86400
|
||||||
|
|
||||||
|
MySQL:
|
||||||
|
DataSource: "root:password@tcp(mysql:3306)/ppanel?charset=utf8mb4&parseTime=true"
|
||||||
|
|
||||||
|
Redis:
|
||||||
|
Host: redis:6379
|
||||||
|
Type: node
|
||||||
|
|
||||||
|
Asynq:
|
||||||
|
Addr: redis:6379
|
||||||
3
apps/api/etc/ppanel-api.yaml
Normal file
3
apps/api/etc/ppanel-api.yaml
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
Name: ppanel-api
|
||||||
|
Host: 0.0.0.0
|
||||||
|
Port: 8888
|
||||||
18
apps/api/internal/config/config.go
Normal file
18
apps/api/internal/config/config.go
Normal file
@ -0,0 +1,18 @@
|
|||||||
|
// Code scaffolded by goctl. Safe to edit.
|
||||||
|
// goctl 1.9.2
|
||||||
|
|
||||||
|
package config
|
||||||
|
|
||||||
|
import (
|
||||||
|
"github.com/zeromicro/go-zero/rest"
|
||||||
|
"github.com/zeromicro/go-zero/zrpc"
|
||||||
|
)
|
||||||
|
|
||||||
|
type Config struct {
|
||||||
|
rest.RestConf
|
||||||
|
JwtAuth struct {
|
||||||
|
AccessSecret string
|
||||||
|
AccessExpire int64
|
||||||
|
}
|
||||||
|
CoreRpc zrpc.RpcClientConf
|
||||||
|
}
|
||||||
31
apps/api/internal/handler/auth/resetPasswordHandler.go
Normal file
31
apps/api/internal/handler/auth/resetPasswordHandler.go
Normal file
@ -0,0 +1,31 @@
|
|||||||
|
// Code scaffolded by goctl. Safe to edit.
|
||||||
|
// goctl 1.9.2
|
||||||
|
|
||||||
|
package auth
|
||||||
|
|
||||||
|
import (
|
||||||
|
"net/http"
|
||||||
|
|
||||||
|
"github.com/zero-ppanel/zero-ppanel/apps/api/internal/logic/auth"
|
||||||
|
"github.com/zero-ppanel/zero-ppanel/apps/api/internal/svc"
|
||||||
|
"github.com/zero-ppanel/zero-ppanel/apps/api/internal/types"
|
||||||
|
"github.com/zeromicro/go-zero/rest/httpx"
|
||||||
|
)
|
||||||
|
|
||||||
|
func ResetPasswordHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
|
||||||
|
return func(w http.ResponseWriter, r *http.Request) {
|
||||||
|
var req types.ResetPasswordReq
|
||||||
|
if err := httpx.Parse(r, &req); err != nil {
|
||||||
|
httpx.ErrorCtx(r.Context(), w, err)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
l := auth.NewResetPasswordLogic(r.Context(), svcCtx)
|
||||||
|
err := l.ResetPassword(&req)
|
||||||
|
if err != nil {
|
||||||
|
httpx.ErrorCtx(r.Context(), w, err)
|
||||||
|
} else {
|
||||||
|
httpx.Ok(w)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
31
apps/api/internal/handler/auth/userLoginHandler.go
Normal file
31
apps/api/internal/handler/auth/userLoginHandler.go
Normal file
@ -0,0 +1,31 @@
|
|||||||
|
// Code scaffolded by goctl. Safe to edit.
|
||||||
|
// goctl 1.9.2
|
||||||
|
|
||||||
|
package auth
|
||||||
|
|
||||||
|
import (
|
||||||
|
"net/http"
|
||||||
|
|
||||||
|
"github.com/zero-ppanel/zero-ppanel/apps/api/internal/logic/auth"
|
||||||
|
"github.com/zero-ppanel/zero-ppanel/apps/api/internal/svc"
|
||||||
|
"github.com/zero-ppanel/zero-ppanel/apps/api/internal/types"
|
||||||
|
"github.com/zeromicro/go-zero/rest/httpx"
|
||||||
|
)
|
||||||
|
|
||||||
|
func UserLoginHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
|
||||||
|
return func(w http.ResponseWriter, r *http.Request) {
|
||||||
|
var req types.UserLoginReq
|
||||||
|
if err := httpx.Parse(r, &req); err != nil {
|
||||||
|
httpx.ErrorCtx(r.Context(), w, err)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
l := auth.NewUserLoginLogic(r.Context(), svcCtx)
|
||||||
|
resp, err := l.UserLogin(&req)
|
||||||
|
if err != nil {
|
||||||
|
httpx.ErrorCtx(r.Context(), w, err)
|
||||||
|
} else {
|
||||||
|
httpx.OkJsonCtx(r.Context(), w, resp)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
31
apps/api/internal/handler/auth/userRegisterHandler.go
Normal file
31
apps/api/internal/handler/auth/userRegisterHandler.go
Normal file
@ -0,0 +1,31 @@
|
|||||||
|
// Code scaffolded by goctl. Safe to edit.
|
||||||
|
// goctl 1.9.2
|
||||||
|
|
||||||
|
package auth
|
||||||
|
|
||||||
|
import (
|
||||||
|
"net/http"
|
||||||
|
|
||||||
|
"github.com/zero-ppanel/zero-ppanel/apps/api/internal/logic/auth"
|
||||||
|
"github.com/zero-ppanel/zero-ppanel/apps/api/internal/svc"
|
||||||
|
"github.com/zero-ppanel/zero-ppanel/apps/api/internal/types"
|
||||||
|
"github.com/zeromicro/go-zero/rest/httpx"
|
||||||
|
)
|
||||||
|
|
||||||
|
func UserRegisterHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
|
||||||
|
return func(w http.ResponseWriter, r *http.Request) {
|
||||||
|
var req types.UserRegisterReq
|
||||||
|
if err := httpx.Parse(r, &req); err != nil {
|
||||||
|
httpx.ErrorCtx(r.Context(), w, err)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
l := auth.NewUserRegisterLogic(r.Context(), svcCtx)
|
||||||
|
resp, err := l.UserRegister(&req)
|
||||||
|
if err != nil {
|
||||||
|
httpx.ErrorCtx(r.Context(), w, err)
|
||||||
|
} else {
|
||||||
|
httpx.OkJsonCtx(r.Context(), w, resp)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,24 @@
|
|||||||
|
// Code scaffolded by goctl. Safe to edit.
|
||||||
|
// goctl 1.9.2
|
||||||
|
|
||||||
|
package common
|
||||||
|
|
||||||
|
import (
|
||||||
|
"net/http"
|
||||||
|
|
||||||
|
"github.com/zero-ppanel/zero-ppanel/apps/api/internal/logic/common"
|
||||||
|
"github.com/zero-ppanel/zero-ppanel/apps/api/internal/svc"
|
||||||
|
"github.com/zeromicro/go-zero/rest/httpx"
|
||||||
|
)
|
||||||
|
|
||||||
|
func GetAnnouncementListHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
|
||||||
|
return func(w http.ResponseWriter, r *http.Request) {
|
||||||
|
l := common.NewGetAnnouncementListLogic(r.Context(), svcCtx)
|
||||||
|
resp, err := l.GetAnnouncementList()
|
||||||
|
if err != nil {
|
||||||
|
httpx.ErrorCtx(r.Context(), w, err)
|
||||||
|
} else {
|
||||||
|
httpx.OkJsonCtx(r.Context(), w, resp)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,24 @@
|
|||||||
|
// Code scaffolded by goctl. Safe to edit.
|
||||||
|
// goctl 1.9.2
|
||||||
|
|
||||||
|
package common
|
||||||
|
|
||||||
|
import (
|
||||||
|
"net/http"
|
||||||
|
|
||||||
|
"github.com/zero-ppanel/zero-ppanel/apps/api/internal/logic/common"
|
||||||
|
"github.com/zero-ppanel/zero-ppanel/apps/api/internal/svc"
|
||||||
|
"github.com/zeromicro/go-zero/rest/httpx"
|
||||||
|
)
|
||||||
|
|
||||||
|
func GetAvailablePaymentMethodsHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
|
||||||
|
return func(w http.ResponseWriter, r *http.Request) {
|
||||||
|
l := common.NewGetAvailablePaymentMethodsLogic(r.Context(), svcCtx)
|
||||||
|
resp, err := l.GetAvailablePaymentMethods()
|
||||||
|
if err != nil {
|
||||||
|
httpx.ErrorCtx(r.Context(), w, err)
|
||||||
|
} else {
|
||||||
|
httpx.OkJsonCtx(r.Context(), w, resp)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
31
apps/api/internal/handler/common/getDocumentDetailHandler.go
Normal file
31
apps/api/internal/handler/common/getDocumentDetailHandler.go
Normal file
@ -0,0 +1,31 @@
|
|||||||
|
// Code scaffolded by goctl. Safe to edit.
|
||||||
|
// goctl 1.9.2
|
||||||
|
|
||||||
|
package common
|
||||||
|
|
||||||
|
import (
|
||||||
|
"net/http"
|
||||||
|
|
||||||
|
"github.com/zero-ppanel/zero-ppanel/apps/api/internal/logic/common"
|
||||||
|
"github.com/zero-ppanel/zero-ppanel/apps/api/internal/svc"
|
||||||
|
"github.com/zero-ppanel/zero-ppanel/apps/api/internal/types"
|
||||||
|
"github.com/zeromicro/go-zero/rest/httpx"
|
||||||
|
)
|
||||||
|
|
||||||
|
func GetDocumentDetailHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
|
||||||
|
return func(w http.ResponseWriter, r *http.Request) {
|
||||||
|
var req types.DocumentDetailReq
|
||||||
|
if err := httpx.Parse(r, &req); err != nil {
|
||||||
|
httpx.ErrorCtx(r.Context(), w, err)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
l := common.NewGetDocumentDetailLogic(r.Context(), svcCtx)
|
||||||
|
resp, err := l.GetDocumentDetail(&req)
|
||||||
|
if err != nil {
|
||||||
|
httpx.ErrorCtx(r.Context(), w, err)
|
||||||
|
} else {
|
||||||
|
httpx.OkJsonCtx(r.Context(), w, resp)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
24
apps/api/internal/handler/common/getDocumentListHandler.go
Normal file
24
apps/api/internal/handler/common/getDocumentListHandler.go
Normal file
@ -0,0 +1,24 @@
|
|||||||
|
// Code scaffolded by goctl. Safe to edit.
|
||||||
|
// goctl 1.9.2
|
||||||
|
|
||||||
|
package common
|
||||||
|
|
||||||
|
import (
|
||||||
|
"net/http"
|
||||||
|
|
||||||
|
"github.com/zero-ppanel/zero-ppanel/apps/api/internal/logic/common"
|
||||||
|
"github.com/zero-ppanel/zero-ppanel/apps/api/internal/svc"
|
||||||
|
"github.com/zeromicro/go-zero/rest/httpx"
|
||||||
|
)
|
||||||
|
|
||||||
|
func GetDocumentListHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
|
||||||
|
return func(w http.ResponseWriter, r *http.Request) {
|
||||||
|
l := common.NewGetDocumentListLogic(r.Context(), svcCtx)
|
||||||
|
resp, err := l.GetDocumentList()
|
||||||
|
if err != nil {
|
||||||
|
httpx.ErrorCtx(r.Context(), w, err)
|
||||||
|
} else {
|
||||||
|
httpx.OkJsonCtx(r.Context(), w, resp)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
24
apps/api/internal/handler/common/getGlobalConfigHandler.go
Normal file
24
apps/api/internal/handler/common/getGlobalConfigHandler.go
Normal file
@ -0,0 +1,24 @@
|
|||||||
|
// Code scaffolded by goctl. Safe to edit.
|
||||||
|
// goctl 1.9.2
|
||||||
|
|
||||||
|
package common
|
||||||
|
|
||||||
|
import (
|
||||||
|
"net/http"
|
||||||
|
|
||||||
|
"github.com/zero-ppanel/zero-ppanel/apps/api/internal/logic/common"
|
||||||
|
"github.com/zero-ppanel/zero-ppanel/apps/api/internal/svc"
|
||||||
|
"github.com/zeromicro/go-zero/rest/httpx"
|
||||||
|
)
|
||||||
|
|
||||||
|
func GetGlobalConfigHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
|
||||||
|
return func(w http.ResponseWriter, r *http.Request) {
|
||||||
|
l := common.NewGetGlobalConfigLogic(r.Context(), svcCtx)
|
||||||
|
resp, err := l.GetGlobalConfig()
|
||||||
|
if err != nil {
|
||||||
|
httpx.ErrorCtx(r.Context(), w, err)
|
||||||
|
} else {
|
||||||
|
httpx.OkJsonCtx(r.Context(), w, resp)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,24 @@
|
|||||||
|
// Code scaffolded by goctl. Safe to edit.
|
||||||
|
// goctl 1.9.2
|
||||||
|
|
||||||
|
package common
|
||||||
|
|
||||||
|
import (
|
||||||
|
"net/http"
|
||||||
|
|
||||||
|
"github.com/zero-ppanel/zero-ppanel/apps/api/internal/logic/common"
|
||||||
|
"github.com/zero-ppanel/zero-ppanel/apps/api/internal/svc"
|
||||||
|
"github.com/zeromicro/go-zero/rest/httpx"
|
||||||
|
)
|
||||||
|
|
||||||
|
func GetSubscribeGroupListHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
|
||||||
|
return func(w http.ResponseWriter, r *http.Request) {
|
||||||
|
l := common.NewGetSubscribeGroupListLogic(r.Context(), svcCtx)
|
||||||
|
resp, err := l.GetSubscribeGroupList()
|
||||||
|
if err != nil {
|
||||||
|
httpx.ErrorCtx(r.Context(), w, err)
|
||||||
|
} else {
|
||||||
|
httpx.OkJsonCtx(r.Context(), w, resp)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
24
apps/api/internal/handler/common/getSubscribeListHandler.go
Normal file
24
apps/api/internal/handler/common/getSubscribeListHandler.go
Normal file
@ -0,0 +1,24 @@
|
|||||||
|
// Code scaffolded by goctl. Safe to edit.
|
||||||
|
// goctl 1.9.2
|
||||||
|
|
||||||
|
package common
|
||||||
|
|
||||||
|
import (
|
||||||
|
"net/http"
|
||||||
|
|
||||||
|
"github.com/zero-ppanel/zero-ppanel/apps/api/internal/logic/common"
|
||||||
|
"github.com/zero-ppanel/zero-ppanel/apps/api/internal/svc"
|
||||||
|
"github.com/zeromicro/go-zero/rest/httpx"
|
||||||
|
)
|
||||||
|
|
||||||
|
func GetSubscribeListHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
|
||||||
|
return func(w http.ResponseWriter, r *http.Request) {
|
||||||
|
l := common.NewGetSubscribeListLogic(r.Context(), svcCtx)
|
||||||
|
resp, err := l.GetSubscribeList()
|
||||||
|
if err != nil {
|
||||||
|
httpx.ErrorCtx(r.Context(), w, err)
|
||||||
|
} else {
|
||||||
|
httpx.OkJsonCtx(r.Context(), w, resp)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
24
apps/api/internal/handler/common/healthHandler.go
Normal file
24
apps/api/internal/handler/common/healthHandler.go
Normal file
@ -0,0 +1,24 @@
|
|||||||
|
// Code scaffolded by goctl. Safe to edit.
|
||||||
|
// goctl 1.9.2
|
||||||
|
|
||||||
|
package common
|
||||||
|
|
||||||
|
import (
|
||||||
|
"net/http"
|
||||||
|
|
||||||
|
"github.com/zero-ppanel/zero-ppanel/apps/api/internal/logic/common"
|
||||||
|
"github.com/zero-ppanel/zero-ppanel/apps/api/internal/svc"
|
||||||
|
"github.com/zeromicro/go-zero/rest/httpx"
|
||||||
|
)
|
||||||
|
|
||||||
|
func HealthHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
|
||||||
|
return func(w http.ResponseWriter, r *http.Request) {
|
||||||
|
l := common.NewHealthLogic(r.Context(), svcCtx)
|
||||||
|
resp, err := l.Health()
|
||||||
|
if err != nil {
|
||||||
|
httpx.ErrorCtx(r.Context(), w, err)
|
||||||
|
} else {
|
||||||
|
httpx.OkJsonCtx(r.Context(), w, resp)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
31
apps/api/internal/handler/common/sendEmailCodeHandler.go
Normal file
31
apps/api/internal/handler/common/sendEmailCodeHandler.go
Normal file
@ -0,0 +1,31 @@
|
|||||||
|
// Code scaffolded by goctl. Safe to edit.
|
||||||
|
// goctl 1.9.2
|
||||||
|
|
||||||
|
package common
|
||||||
|
|
||||||
|
import (
|
||||||
|
"net/http"
|
||||||
|
|
||||||
|
"github.com/zero-ppanel/zero-ppanel/apps/api/internal/logic/common"
|
||||||
|
"github.com/zero-ppanel/zero-ppanel/apps/api/internal/svc"
|
||||||
|
"github.com/zero-ppanel/zero-ppanel/apps/api/internal/types"
|
||||||
|
"github.com/zeromicro/go-zero/rest/httpx"
|
||||||
|
)
|
||||||
|
|
||||||
|
func SendEmailCodeHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
|
||||||
|
return func(w http.ResponseWriter, r *http.Request) {
|
||||||
|
var req types.SendEmailCodeReq
|
||||||
|
if err := httpx.Parse(r, &req); err != nil {
|
||||||
|
httpx.ErrorCtx(r.Context(), w, err)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
l := common.NewSendEmailCodeLogic(r.Context(), svcCtx)
|
||||||
|
err := l.SendEmailCode(&req)
|
||||||
|
if err != nil {
|
||||||
|
httpx.ErrorCtx(r.Context(), w, err)
|
||||||
|
} else {
|
||||||
|
httpx.Ok(w)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
31
apps/api/internal/handler/order/closeOrderHandler.go
Normal file
31
apps/api/internal/handler/order/closeOrderHandler.go
Normal file
@ -0,0 +1,31 @@
|
|||||||
|
// Code scaffolded by goctl. Safe to edit.
|
||||||
|
// goctl 1.9.2
|
||||||
|
|
||||||
|
package order
|
||||||
|
|
||||||
|
import (
|
||||||
|
"net/http"
|
||||||
|
|
||||||
|
"github.com/zero-ppanel/zero-ppanel/apps/api/internal/logic/order"
|
||||||
|
"github.com/zero-ppanel/zero-ppanel/apps/api/internal/svc"
|
||||||
|
"github.com/zero-ppanel/zero-ppanel/apps/api/internal/types"
|
||||||
|
"github.com/zeromicro/go-zero/rest/httpx"
|
||||||
|
)
|
||||||
|
|
||||||
|
func CloseOrderHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
|
||||||
|
return func(w http.ResponseWriter, r *http.Request) {
|
||||||
|
var req types.CloseOrderReq
|
||||||
|
if err := httpx.Parse(r, &req); err != nil {
|
||||||
|
httpx.ErrorCtx(r.Context(), w, err)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
l := order.NewCloseOrderLogic(r.Context(), svcCtx)
|
||||||
|
err := l.CloseOrder(&req)
|
||||||
|
if err != nil {
|
||||||
|
httpx.ErrorCtx(r.Context(), w, err)
|
||||||
|
} else {
|
||||||
|
httpx.Ok(w)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user