初始化
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
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:
@@ -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"
|
||||
)
|
||||
|
||||
@@ -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)
|
||||
}
|
||||
@@ -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)
|
||||
}
|
||||
@@ -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)
|
||||
}
|
||||
@@ -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)
|
||||
}
|
||||
@@ -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"`
|
||||
}
|
||||
)
|
||||
@@ -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)
|
||||
}
|
||||
@@ -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
|
||||
@@ -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}"
|
||||
@@ -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
|
||||
@@ -0,0 +1,3 @@
|
||||
Name: ppanel-api
|
||||
Host: 0.0.0.0
|
||||
Port: 8888
|
||||
@@ -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
|
||||
}
|
||||
@@ -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)
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -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)
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -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)
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -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)
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -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)
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -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)
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -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)
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -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)
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -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)
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -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)
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -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 CreateOrderHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
|
||||
return func(w http.ResponseWriter, r *http.Request) {
|
||||
var req types.CreateOrderReq
|
||||
if err := httpx.Parse(r, &req); err != nil {
|
||||
httpx.ErrorCtx(r.Context(), w, err)
|
||||
return
|
||||
}
|
||||
|
||||
l := order.NewCreateOrderLogic(r.Context(), svcCtx)
|
||||
resp, err := l.CreateOrder(&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/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 GetOrderDetailHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
|
||||
return func(w http.ResponseWriter, r *http.Request) {
|
||||
var req types.OrderDetailReq
|
||||
if err := httpx.Parse(r, &req); err != nil {
|
||||
httpx.ErrorCtx(r.Context(), w, err)
|
||||
return
|
||||
}
|
||||
|
||||
l := order.NewGetOrderDetailLogic(r.Context(), svcCtx)
|
||||
resp, err := l.GetOrderDetail(&req)
|
||||
if err != nil {
|
||||
httpx.ErrorCtx(r.Context(), w, err)
|
||||
} else {
|
||||
httpx.OkJsonCtx(r.Context(), w, resp)
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,157 @@
|
||||
// Code generated by goctl. DO NOT EDIT.
|
||||
// goctl 1.9.2
|
||||
|
||||
package handler
|
||||
|
||||
import (
|
||||
"net/http"
|
||||
|
||||
auth "github.com/zero-ppanel/zero-ppanel/apps/api/internal/handler/auth"
|
||||
common "github.com/zero-ppanel/zero-ppanel/apps/api/internal/handler/common"
|
||||
order "github.com/zero-ppanel/zero-ppanel/apps/api/internal/handler/order"
|
||||
ticket "github.com/zero-ppanel/zero-ppanel/apps/api/internal/handler/ticket"
|
||||
user "github.com/zero-ppanel/zero-ppanel/apps/api/internal/handler/user"
|
||||
"github.com/zero-ppanel/zero-ppanel/apps/api/internal/svc"
|
||||
|
||||
"github.com/zeromicro/go-zero/rest"
|
||||
)
|
||||
|
||||
func RegisterHandlers(server *rest.Server, serverCtx *svc.ServiceContext) {
|
||||
server.AddRoutes(
|
||||
[]rest.Route{
|
||||
{
|
||||
Method: http.MethodPost,
|
||||
Path: "/login",
|
||||
Handler: auth.UserLoginHandler(serverCtx),
|
||||
},
|
||||
{
|
||||
Method: http.MethodPost,
|
||||
Path: "/register",
|
||||
Handler: auth.UserRegisterHandler(serverCtx),
|
||||
},
|
||||
{
|
||||
Method: http.MethodPost,
|
||||
Path: "/reset_password",
|
||||
Handler: auth.ResetPasswordHandler(serverCtx),
|
||||
},
|
||||
},
|
||||
rest.WithPrefix("/api/v1/auth"),
|
||||
)
|
||||
|
||||
server.AddRoutes(
|
||||
[]rest.Route{
|
||||
{
|
||||
Method: http.MethodGet,
|
||||
Path: "/announcement",
|
||||
Handler: common.GetAnnouncementListHandler(serverCtx),
|
||||
},
|
||||
{
|
||||
Method: http.MethodGet,
|
||||
Path: "/config",
|
||||
Handler: common.GetGlobalConfigHandler(serverCtx),
|
||||
},
|
||||
{
|
||||
Method: http.MethodGet,
|
||||
Path: "/document",
|
||||
Handler: common.GetDocumentListHandler(serverCtx),
|
||||
},
|
||||
{
|
||||
Method: http.MethodGet,
|
||||
Path: "/document/:id",
|
||||
Handler: common.GetDocumentDetailHandler(serverCtx),
|
||||
},
|
||||
{
|
||||
Method: http.MethodGet,
|
||||
Path: "/health",
|
||||
Handler: common.HealthHandler(serverCtx),
|
||||
},
|
||||
{
|
||||
Method: http.MethodGet,
|
||||
Path: "/payment/methods",
|
||||
Handler: common.GetAvailablePaymentMethodsHandler(serverCtx),
|
||||
},
|
||||
{
|
||||
Method: http.MethodPost,
|
||||
Path: "/send_email_code",
|
||||
Handler: common.SendEmailCodeHandler(serverCtx),
|
||||
},
|
||||
{
|
||||
Method: http.MethodGet,
|
||||
Path: "/subscribe",
|
||||
Handler: common.GetSubscribeListHandler(serverCtx),
|
||||
},
|
||||
{
|
||||
Method: http.MethodGet,
|
||||
Path: "/subscribe/group",
|
||||
Handler: common.GetSubscribeGroupListHandler(serverCtx),
|
||||
},
|
||||
},
|
||||
rest.WithPrefix("/api/v1"),
|
||||
)
|
||||
|
||||
server.AddRoutes(
|
||||
[]rest.Route{
|
||||
{
|
||||
Method: http.MethodGet,
|
||||
Path: "/:order_no",
|
||||
Handler: order.GetOrderDetailHandler(serverCtx),
|
||||
},
|
||||
{
|
||||
Method: http.MethodPost,
|
||||
Path: "/:order_no/close",
|
||||
Handler: order.CloseOrderHandler(serverCtx),
|
||||
},
|
||||
{
|
||||
Method: http.MethodPost,
|
||||
Path: "/create",
|
||||
Handler: order.CreateOrderHandler(serverCtx),
|
||||
},
|
||||
},
|
||||
rest.WithJwt(serverCtx.Config.JwtAuth.AccessSecret),
|
||||
rest.WithPrefix("/api/v1/order"),
|
||||
)
|
||||
|
||||
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.MethodPost,
|
||||
Path: "/create",
|
||||
Handler: ticket.CreateTicketHandler(serverCtx),
|
||||
},
|
||||
},
|
||||
rest.WithJwt(serverCtx.Config.JwtAuth.AccessSecret),
|
||||
rest.WithPrefix("/api/v1/ticket"),
|
||||
)
|
||||
|
||||
server.AddRoutes(
|
||||
[]rest.Route{
|
||||
{
|
||||
Method: http.MethodGet,
|
||||
Path: "/info",
|
||||
Handler: user.GetUserInfoHandler(serverCtx),
|
||||
},
|
||||
{
|
||||
Method: http.MethodPost,
|
||||
Path: "/password",
|
||||
Handler: user.UpdateUserPasswordHandler(serverCtx),
|
||||
},
|
||||
{
|
||||
Method: http.MethodGet,
|
||||
Path: "/subscribe",
|
||||
Handler: user.GetUserSubscribeHandler(serverCtx),
|
||||
},
|
||||
},
|
||||
rest.WithJwt(serverCtx.Config.JwtAuth.AccessSecret),
|
||||
rest.WithPrefix("/api/v1/user"),
|
||||
)
|
||||
}
|
||||
@@ -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/api/internal/logic/ticket"
|
||||
"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 CreateTicketFollowHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
|
||||
return func(w http.ResponseWriter, r *http.Request) {
|
||||
var req types.CreateTicketFollowReq
|
||||
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)
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -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/api/internal/logic/ticket"
|
||||
"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 CreateTicketHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
|
||||
return func(w http.ResponseWriter, r *http.Request) {
|
||||
var req types.CreateTicketReq
|
||||
if err := httpx.Parse(r, &req); err != nil {
|
||||
httpx.ErrorCtx(r.Context(), w, err)
|
||||
return
|
||||
}
|
||||
|
||||
l := ticket.NewCreateTicketLogic(r.Context(), svcCtx)
|
||||
resp, err := l.CreateTicket(&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/api/internal/logic/ticket"
|
||||
"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 GetTicketDetailHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
|
||||
return func(w http.ResponseWriter, r *http.Request) {
|
||||
var req types.TicketDetailReq
|
||||
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)
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
// Code scaffolded by goctl. Safe to edit.
|
||||
// goctl 1.9.2
|
||||
|
||||
package user
|
||||
|
||||
import (
|
||||
"net/http"
|
||||
|
||||
"github.com/zero-ppanel/zero-ppanel/apps/api/internal/logic/user"
|
||||
"github.com/zero-ppanel/zero-ppanel/apps/api/internal/svc"
|
||||
"github.com/zeromicro/go-zero/rest/httpx"
|
||||
)
|
||||
|
||||
func GetUserInfoHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
|
||||
return func(w http.ResponseWriter, r *http.Request) {
|
||||
l := user.NewGetUserInfoLogic(r.Context(), svcCtx)
|
||||
resp, err := l.GetUserInfo()
|
||||
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 user
|
||||
|
||||
import (
|
||||
"net/http"
|
||||
|
||||
"github.com/zero-ppanel/zero-ppanel/apps/api/internal/logic/user"
|
||||
"github.com/zero-ppanel/zero-ppanel/apps/api/internal/svc"
|
||||
"github.com/zeromicro/go-zero/rest/httpx"
|
||||
)
|
||||
|
||||
func GetUserSubscribeHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
|
||||
return func(w http.ResponseWriter, r *http.Request) {
|
||||
l := user.NewGetUserSubscribeLogic(r.Context(), svcCtx)
|
||||
resp, err := l.GetUserSubscribe()
|
||||
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 user
|
||||
|
||||
import (
|
||||
"net/http"
|
||||
|
||||
"github.com/zero-ppanel/zero-ppanel/apps/api/internal/logic/user"
|
||||
"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 UpdateUserPasswordHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
|
||||
return func(w http.ResponseWriter, r *http.Request) {
|
||||
var req types.UpdatePasswordReq
|
||||
if err := httpx.Parse(r, &req); err != nil {
|
||||
httpx.ErrorCtx(r.Context(), w, err)
|
||||
return
|
||||
}
|
||||
|
||||
l := user.NewUpdateUserPasswordLogic(r.Context(), svcCtx)
|
||||
err := l.UpdateUserPassword(&req)
|
||||
if err != nil {
|
||||
httpx.ErrorCtx(r.Context(), w, err)
|
||||
} else {
|
||||
httpx.Ok(w)
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,33 @@
|
||||
// Code scaffolded by goctl. Safe to edit.
|
||||
// goctl 1.9.2
|
||||
|
||||
package auth
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
"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/core/logx"
|
||||
)
|
||||
|
||||
type ResetPasswordLogic struct {
|
||||
logx.Logger
|
||||
ctx context.Context
|
||||
svcCtx *svc.ServiceContext
|
||||
}
|
||||
|
||||
func NewResetPasswordLogic(ctx context.Context, svcCtx *svc.ServiceContext) *ResetPasswordLogic {
|
||||
return &ResetPasswordLogic{
|
||||
Logger: logx.WithContext(ctx),
|
||||
ctx: ctx,
|
||||
svcCtx: svcCtx,
|
||||
}
|
||||
}
|
||||
|
||||
func (l *ResetPasswordLogic) ResetPassword(req *types.ResetPasswordReq) 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 auth
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
"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/core/logx"
|
||||
)
|
||||
|
||||
type UserLoginLogic struct {
|
||||
logx.Logger
|
||||
ctx context.Context
|
||||
svcCtx *svc.ServiceContext
|
||||
}
|
||||
|
||||
func NewUserLoginLogic(ctx context.Context, svcCtx *svc.ServiceContext) *UserLoginLogic {
|
||||
return &UserLoginLogic{
|
||||
Logger: logx.WithContext(ctx),
|
||||
ctx: ctx,
|
||||
svcCtx: svcCtx,
|
||||
}
|
||||
}
|
||||
|
||||
func (l *UserLoginLogic) UserLogin(req *types.UserLoginReq) (resp *types.AuthResp, 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 auth
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
"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/core/logx"
|
||||
)
|
||||
|
||||
type UserRegisterLogic struct {
|
||||
logx.Logger
|
||||
ctx context.Context
|
||||
svcCtx *svc.ServiceContext
|
||||
}
|
||||
|
||||
func NewUserRegisterLogic(ctx context.Context, svcCtx *svc.ServiceContext) *UserRegisterLogic {
|
||||
return &UserRegisterLogic{
|
||||
Logger: logx.WithContext(ctx),
|
||||
ctx: ctx,
|
||||
svcCtx: svcCtx,
|
||||
}
|
||||
}
|
||||
|
||||
func (l *UserRegisterLogic) UserRegister(req *types.UserRegisterReq) (resp *types.AuthResp, 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 common
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
"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/core/logx"
|
||||
)
|
||||
|
||||
type GetAnnouncementListLogic struct {
|
||||
logx.Logger
|
||||
ctx context.Context
|
||||
svcCtx *svc.ServiceContext
|
||||
}
|
||||
|
||||
func NewGetAnnouncementListLogic(ctx context.Context, svcCtx *svc.ServiceContext) *GetAnnouncementListLogic {
|
||||
return &GetAnnouncementListLogic{
|
||||
Logger: logx.WithContext(ctx),
|
||||
ctx: ctx,
|
||||
svcCtx: svcCtx,
|
||||
}
|
||||
}
|
||||
|
||||
func (l *GetAnnouncementListLogic) GetAnnouncementList() (resp []types.AnnouncementResp, 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 common
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
"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/core/logx"
|
||||
)
|
||||
|
||||
type GetAvailablePaymentMethodsLogic struct {
|
||||
logx.Logger
|
||||
ctx context.Context
|
||||
svcCtx *svc.ServiceContext
|
||||
}
|
||||
|
||||
func NewGetAvailablePaymentMethodsLogic(ctx context.Context, svcCtx *svc.ServiceContext) *GetAvailablePaymentMethodsLogic {
|
||||
return &GetAvailablePaymentMethodsLogic{
|
||||
Logger: logx.WithContext(ctx),
|
||||
ctx: ctx,
|
||||
svcCtx: svcCtx,
|
||||
}
|
||||
}
|
||||
|
||||
func (l *GetAvailablePaymentMethodsLogic) GetAvailablePaymentMethods() (resp []types.PaymentMethodResp, 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 common
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
"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/core/logx"
|
||||
)
|
||||
|
||||
type GetDocumentDetailLogic struct {
|
||||
logx.Logger
|
||||
ctx context.Context
|
||||
svcCtx *svc.ServiceContext
|
||||
}
|
||||
|
||||
func NewGetDocumentDetailLogic(ctx context.Context, svcCtx *svc.ServiceContext) *GetDocumentDetailLogic {
|
||||
return &GetDocumentDetailLogic{
|
||||
Logger: logx.WithContext(ctx),
|
||||
ctx: ctx,
|
||||
svcCtx: svcCtx,
|
||||
}
|
||||
}
|
||||
|
||||
func (l *GetDocumentDetailLogic) GetDocumentDetail(req *types.DocumentDetailReq) (resp *types.DocumentDetailResp, 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 common
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
"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/core/logx"
|
||||
)
|
||||
|
||||
type GetDocumentListLogic struct {
|
||||
logx.Logger
|
||||
ctx context.Context
|
||||
svcCtx *svc.ServiceContext
|
||||
}
|
||||
|
||||
func NewGetDocumentListLogic(ctx context.Context, svcCtx *svc.ServiceContext) *GetDocumentListLogic {
|
||||
return &GetDocumentListLogic{
|
||||
Logger: logx.WithContext(ctx),
|
||||
ctx: ctx,
|
||||
svcCtx: svcCtx,
|
||||
}
|
||||
}
|
||||
|
||||
func (l *GetDocumentListLogic) GetDocumentList() (resp []types.DocumentListResp, 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 common
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
"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/core/logx"
|
||||
)
|
||||
|
||||
type GetGlobalConfigLogic struct {
|
||||
logx.Logger
|
||||
ctx context.Context
|
||||
svcCtx *svc.ServiceContext
|
||||
}
|
||||
|
||||
func NewGetGlobalConfigLogic(ctx context.Context, svcCtx *svc.ServiceContext) *GetGlobalConfigLogic {
|
||||
return &GetGlobalConfigLogic{
|
||||
Logger: logx.WithContext(ctx),
|
||||
ctx: ctx,
|
||||
svcCtx: svcCtx,
|
||||
}
|
||||
}
|
||||
|
||||
func (l *GetGlobalConfigLogic) GetGlobalConfig() (resp *types.GlobalConfigResp, 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 common
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
"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/core/logx"
|
||||
)
|
||||
|
||||
type GetSubscribeGroupListLogic struct {
|
||||
logx.Logger
|
||||
ctx context.Context
|
||||
svcCtx *svc.ServiceContext
|
||||
}
|
||||
|
||||
func NewGetSubscribeGroupListLogic(ctx context.Context, svcCtx *svc.ServiceContext) *GetSubscribeGroupListLogic {
|
||||
return &GetSubscribeGroupListLogic{
|
||||
Logger: logx.WithContext(ctx),
|
||||
ctx: ctx,
|
||||
svcCtx: svcCtx,
|
||||
}
|
||||
}
|
||||
|
||||
func (l *GetSubscribeGroupListLogic) GetSubscribeGroupList() (resp []types.SubscribeGroupResp, 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 common
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
"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/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() (resp []types.SubscribeResp, err error) {
|
||||
// todo: add your logic here and delete this line
|
||||
|
||||
return
|
||||
}
|
||||
@@ -0,0 +1,44 @@
|
||||
// Code scaffolded by goctl. Safe to edit.
|
||||
// goctl 1.9.2
|
||||
|
||||
package common
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
"github.com/zero-ppanel/zero-ppanel/apps/api/internal/svc"
|
||||
"github.com/zero-ppanel/zero-ppanel/apps/api/internal/types"
|
||||
"github.com/zero-ppanel/zero-ppanel/apps/rpc/core/core"
|
||||
|
||||
"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) {
|
||||
// 调用 RPC 进行 Ping 测试,这能触发全链路追踪 (API -> RPC)
|
||||
rpcResp, err := l.svcCtx.CoreRpc.Ping(l.ctx, &core.Empty{})
|
||||
|
||||
status := "ok"
|
||||
if err != nil {
|
||||
status = "rpc_error: " + err.Error()
|
||||
} else if rpcResp.Msg != "" {
|
||||
status = rpcResp.Msg
|
||||
}
|
||||
|
||||
return &types.HealthResp{
|
||||
Status: status,
|
||||
}, nil
|
||||
}
|
||||
@@ -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/api/internal/svc"
|
||||
"github.com/zero-ppanel/zero-ppanel/apps/api/internal/types"
|
||||
|
||||
"github.com/zeromicro/go-zero/core/logx"
|
||||
)
|
||||
|
||||
type SendEmailCodeLogic struct {
|
||||
logx.Logger
|
||||
ctx context.Context
|
||||
svcCtx *svc.ServiceContext
|
||||
}
|
||||
|
||||
func NewSendEmailCodeLogic(ctx context.Context, svcCtx *svc.ServiceContext) *SendEmailCodeLogic {
|
||||
return &SendEmailCodeLogic{
|
||||
Logger: logx.WithContext(ctx),
|
||||
ctx: ctx,
|
||||
svcCtx: svcCtx,
|
||||
}
|
||||
}
|
||||
|
||||
func (l *SendEmailCodeLogic) SendEmailCode(req *types.SendEmailCodeReq) 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 order
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
"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/core/logx"
|
||||
)
|
||||
|
||||
type CloseOrderLogic struct {
|
||||
logx.Logger
|
||||
ctx context.Context
|
||||
svcCtx *svc.ServiceContext
|
||||
}
|
||||
|
||||
func NewCloseOrderLogic(ctx context.Context, svcCtx *svc.ServiceContext) *CloseOrderLogic {
|
||||
return &CloseOrderLogic{
|
||||
Logger: logx.WithContext(ctx),
|
||||
ctx: ctx,
|
||||
svcCtx: svcCtx,
|
||||
}
|
||||
}
|
||||
|
||||
func (l *CloseOrderLogic) CloseOrder(req *types.CloseOrderReq) 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 order
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
"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/core/logx"
|
||||
)
|
||||
|
||||
type CreateOrderLogic struct {
|
||||
logx.Logger
|
||||
ctx context.Context
|
||||
svcCtx *svc.ServiceContext
|
||||
}
|
||||
|
||||
func NewCreateOrderLogic(ctx context.Context, svcCtx *svc.ServiceContext) *CreateOrderLogic {
|
||||
return &CreateOrderLogic{
|
||||
Logger: logx.WithContext(ctx),
|
||||
ctx: ctx,
|
||||
svcCtx: svcCtx,
|
||||
}
|
||||
}
|
||||
|
||||
func (l *CreateOrderLogic) CreateOrder(req *types.CreateOrderReq) (resp *types.OrderResp, 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 order
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
"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/core/logx"
|
||||
)
|
||||
|
||||
type GetOrderDetailLogic struct {
|
||||
logx.Logger
|
||||
ctx context.Context
|
||||
svcCtx *svc.ServiceContext
|
||||
}
|
||||
|
||||
func NewGetOrderDetailLogic(ctx context.Context, svcCtx *svc.ServiceContext) *GetOrderDetailLogic {
|
||||
return &GetOrderDetailLogic{
|
||||
Logger: logx.WithContext(ctx),
|
||||
ctx: ctx,
|
||||
svcCtx: svcCtx,
|
||||
}
|
||||
}
|
||||
|
||||
func (l *GetOrderDetailLogic) GetOrderDetail(req *types.OrderDetailReq) (resp *types.OrderResp, 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 ticket
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
"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/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.CreateTicketFollowReq) 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 ticket
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
"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/core/logx"
|
||||
)
|
||||
|
||||
type CreateTicketLogic struct {
|
||||
logx.Logger
|
||||
ctx context.Context
|
||||
svcCtx *svc.ServiceContext
|
||||
}
|
||||
|
||||
func NewCreateTicketLogic(ctx context.Context, svcCtx *svc.ServiceContext) *CreateTicketLogic {
|
||||
return &CreateTicketLogic{
|
||||
Logger: logx.WithContext(ctx),
|
||||
ctx: ctx,
|
||||
svcCtx: svcCtx,
|
||||
}
|
||||
}
|
||||
|
||||
func (l *CreateTicketLogic) CreateTicket(req *types.CreateTicketReq) (resp *types.TicketResp, 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 ticket
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
"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/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.TicketDetailReq) (resp *types.TicketResp, 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 user
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
"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/core/logx"
|
||||
)
|
||||
|
||||
type GetUserInfoLogic struct {
|
||||
logx.Logger
|
||||
ctx context.Context
|
||||
svcCtx *svc.ServiceContext
|
||||
}
|
||||
|
||||
func NewGetUserInfoLogic(ctx context.Context, svcCtx *svc.ServiceContext) *GetUserInfoLogic {
|
||||
return &GetUserInfoLogic{
|
||||
Logger: logx.WithContext(ctx),
|
||||
ctx: ctx,
|
||||
svcCtx: svcCtx,
|
||||
}
|
||||
}
|
||||
|
||||
func (l *GetUserInfoLogic) GetUserInfo() (resp *types.UserInfoResp, 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 user
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
"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/core/logx"
|
||||
)
|
||||
|
||||
type GetUserSubscribeLogic struct {
|
||||
logx.Logger
|
||||
ctx context.Context
|
||||
svcCtx *svc.ServiceContext
|
||||
}
|
||||
|
||||
func NewGetUserSubscribeLogic(ctx context.Context, svcCtx *svc.ServiceContext) *GetUserSubscribeLogic {
|
||||
return &GetUserSubscribeLogic{
|
||||
Logger: logx.WithContext(ctx),
|
||||
ctx: ctx,
|
||||
svcCtx: svcCtx,
|
||||
}
|
||||
}
|
||||
|
||||
func (l *GetUserSubscribeLogic) GetUserSubscribe() (resp []types.UserSubscribeResp, 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 user
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
"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/core/logx"
|
||||
)
|
||||
|
||||
type UpdateUserPasswordLogic struct {
|
||||
logx.Logger
|
||||
ctx context.Context
|
||||
svcCtx *svc.ServiceContext
|
||||
}
|
||||
|
||||
func NewUpdateUserPasswordLogic(ctx context.Context, svcCtx *svc.ServiceContext) *UpdateUserPasswordLogic {
|
||||
return &UpdateUserPasswordLogic{
|
||||
Logger: logx.WithContext(ctx),
|
||||
ctx: ctx,
|
||||
svcCtx: svcCtx,
|
||||
}
|
||||
}
|
||||
|
||||
func (l *UpdateUserPasswordLogic) UpdateUserPassword(req *types.UpdatePasswordReq) error {
|
||||
// todo: add your logic here and delete this line
|
||||
|
||||
return nil
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
// Code scaffolded by goctl. Safe to edit.
|
||||
// goctl 1.9.2
|
||||
|
||||
package svc
|
||||
|
||||
import (
|
||||
"github.com/zero-ppanel/zero-ppanel/apps/api/internal/config"
|
||||
"github.com/zero-ppanel/zero-ppanel/apps/rpc/core/coreclient"
|
||||
"github.com/zeromicro/go-zero/zrpc"
|
||||
)
|
||||
|
||||
type ServiceContext struct {
|
||||
Config config.Config
|
||||
CoreRpc coreClient.Core
|
||||
}
|
||||
|
||||
func NewServiceContext(c config.Config) *ServiceContext {
|
||||
return &ServiceContext{
|
||||
Config: c,
|
||||
CoreRpc: coreClient.NewCore(zrpc.MustNewClient(c.CoreRpc)),
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,154 @@
|
||||
// Code generated by goctl. DO NOT EDIT.
|
||||
// goctl 1.9.2
|
||||
|
||||
package types
|
||||
|
||||
type AnnouncementResp struct {
|
||||
Id int64 `json:"id"`
|
||||
Title string `json:"title"`
|
||||
Content string `json:"content"`
|
||||
CreatedAt string `json:"created_at"`
|
||||
}
|
||||
|
||||
type AuthResp struct {
|
||||
Token string `json:"token"`
|
||||
Expire int64 `json:"expire"`
|
||||
}
|
||||
|
||||
type CloseOrderReq struct {
|
||||
OrderNo string `path:"order_no"`
|
||||
}
|
||||
|
||||
type CreateOrderReq struct {
|
||||
SubscribeId int64 `json:"subscribe_id"`
|
||||
CouponCode string `json:"coupon_code,optional"`
|
||||
PaymentId int64 `json:"payment_id"`
|
||||
Period string `json:"period"`
|
||||
}
|
||||
|
||||
type CreateTicketFollowReq struct {
|
||||
Id int64 `path:"id"`
|
||||
Content string `json:"content"`
|
||||
}
|
||||
|
||||
type CreateTicketReq struct {
|
||||
Title string `json:"title"`
|
||||
Content string `json:"content"`
|
||||
}
|
||||
|
||||
type DocumentDetailReq struct {
|
||||
Id int64 `path:"id"`
|
||||
}
|
||||
|
||||
type DocumentDetailResp struct {
|
||||
Id int64 `json:"id"`
|
||||
Title string `json:"title"`
|
||||
Content string `json:"content"`
|
||||
}
|
||||
|
||||
type DocumentListResp struct {
|
||||
Id int64 `json:"id"`
|
||||
Title string `json:"title"`
|
||||
}
|
||||
|
||||
type GlobalConfigResp struct {
|
||||
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"`
|
||||
}
|
||||
|
||||
type HealthResp struct {
|
||||
Status string `json:"status"`
|
||||
}
|
||||
|
||||
type OrderDetailReq struct {
|
||||
OrderNo string `path:"order_no"`
|
||||
}
|
||||
|
||||
type OrderResp struct {
|
||||
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"`
|
||||
}
|
||||
|
||||
type PaymentMethodResp struct {
|
||||
Id int64 `json:"id"`
|
||||
Name string `json:"name"`
|
||||
Platform string `json:"platform"`
|
||||
Icon string `json:"icon"`
|
||||
}
|
||||
|
||||
type ResetPasswordReq struct {
|
||||
Email string `json:"email"`
|
||||
Password string `json:"password"`
|
||||
Code string `json:"code"`
|
||||
}
|
||||
|
||||
type SendEmailCodeReq struct {
|
||||
Email string `json:"email"`
|
||||
}
|
||||
|
||||
type SubscribeGroupResp struct {
|
||||
Id int64 `json:"id"`
|
||||
Name string `json:"name"`
|
||||
}
|
||||
|
||||
type SubscribeResp struct {
|
||||
Id int64 `json:"id"`
|
||||
Name string `json:"name"`
|
||||
Price int64 `json:"price"`
|
||||
Traffic int64 `json:"traffic"`
|
||||
GroupId int64 `json:"group_id"`
|
||||
}
|
||||
|
||||
type TicketDetailReq struct {
|
||||
Id int64 `path:"id"`
|
||||
}
|
||||
|
||||
type TicketResp struct {
|
||||
Id int64 `json:"id"`
|
||||
Title string `json:"title"`
|
||||
Status int `json:"status"`
|
||||
CreatedAt string `json:"created_at"`
|
||||
}
|
||||
|
||||
type UpdatePasswordReq struct {
|
||||
OldPassword string `json:"old_password"`
|
||||
NewPassword string `json:"new_password"`
|
||||
}
|
||||
|
||||
type UserInfoResp struct {
|
||||
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"`
|
||||
}
|
||||
|
||||
type UserLoginReq struct {
|
||||
Email string `json:"email"`
|
||||
Password string `json:"password"`
|
||||
}
|
||||
|
||||
type UserRegisterReq struct {
|
||||
Email string `json:"email"`
|
||||
Password string `json:"password"`
|
||||
Code string `json:"code"`
|
||||
ReferCode string `json:"refer_code,optional"`
|
||||
}
|
||||
|
||||
type UserSubscribeResp struct {
|
||||
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"`
|
||||
}
|
||||
@@ -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/api/internal/config"
|
||||
"github.com/zero-ppanel/zero-ppanel/apps/api/internal/handler"
|
||||
"github.com/zero-ppanel/zero-ppanel/apps/api/internal/svc"
|
||||
|
||||
"github.com/zeromicro/go-zero/core/conf"
|
||||
"github.com/zeromicro/go-zero/rest"
|
||||
)
|
||||
|
||||
var configFile = flag.String("f", "etc/api-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()
|
||||
}
|
||||
Reference in New Issue
Block a user