syntax = "console" //---------------------------- Base ------------------------ type ( healthResp { time string `json:"time"` } ) @server ( group: base prefix: /api/console/base ) service gateway-api { @handler health get /health returns (healthResp) } //--------------------------- Auth ------------------------ type ( LoginReq { username string `json:"username"` password string `json:"password"` } phoneLoginReq { phone string `json:"phone"` code string `json:"code"` } RegisterReq { username string `json:"username"` password string `json:"password"` confirmPassword string `json:"confirmPassword"` phone string `json:"phone"` code string `json:"code"` } GetVerifyCodeReq { phone string `json:"phone"` actionType string `json:"actionType"` } ) @server ( group: auth prefix: /api/console/auth ) service gateway-api { @handler registerUser post /register (RegisterReq) @handler loginUser post /login (LoginReq) @handler phoneLoginUser post /phoneLogin (phoneLoginReq) @handler getVerifyCode post /getVerifyCode (GetVerifyCodeReq) @handler Logout post /logout } //------------------------------ User ----------------------------- type ( enterpriseAuthReq { enterpriseName string `json:"enterpriseName"` creditCode string `json:"creditCode"` legalPerson string `json:"legalPerson"` businessLicense string `json:"businessLicense"` enterpriseContact string `json:"enterpriseContact"` } UserInfoResp { username string `json:"username"` phone string `json:"phone"` enterpriseAuthStatus string `json:"enterpriseAuthStatus"` enterpriseName string `json:"enterpriseName"` creditCode string `json:"creditCode"` legalPerson string `json:"legalPerson"` } UploadBusinessLicenseResp { url string `json:"url"` enterpriseName string `json:"enterpriseName"` creditCode string `json:"creditCode"` legalPerson string `json:"legalPerson"` } secretInfoResp { AccessId string `json:"accessId"` AccessKey string `json:"accessKey"` } ) @server ( group: user prefix: /api/console/user middleware: AuthInterceptor ) service gateway-api { @handler getUserInfo get /info returns (UserInfoResp) @handler enterpriseAuth post /enterpriseAuth (enterpriseAuthReq) @handler UploadBusinessLicense post /businessLicenseUpload returns (UploadBusinessLicenseResp) @handler GetSecretInfo post /getSecretInfo returns (secretInfoResp) } type ( GetProductByIdReq { ProductId int64 `path:"productId"` } GetProductByIdResp { ProductItem } GetProductListReq { Page int64 `form:"page"` PageSize int64 `form:"pageSize"` } GetProductListResp { Total int64 `json:"total"` List []ProductItem `json:"list"` } ProductItem { ProductId int64 `json:"productId"` ProductName string `json:"productName"` ProductCode string `json:"productCode"` ProductDescription string `json:"productDescription"` ProductContent string `json:"productContent"` ProductGroup string `json:"productGroup"` ProductPrice float64 `json:"productPrice"` CreatedAt string `json:"createdAt"` UpdatedAt string `json:"updatedAt"` } ) @server ( group: product prefix: /api/console/product middleware: AuthInterceptor ) service gateway-api { @handler getProductById get /:productId (GetProductByIdReq) returns (GetProductByIdResp) @handler getProductList get /list (GetProductListReq) returns (GetProductListResp) } type ( // 添加用户产品请求 AddUserProductReq { ProductId int64 `json:"productId"` } // 删除用户产品请求 DeleteUserProductReq { Id int64 `json:"id"` } // 分页查询用户产品列表请求 GetUserProductListReq { Page int64 `form:"page"` PageSize int64 `form:"pageSize"` } // 分页查询用户产品列表响应 GetUserProductListResp { Total int64 `json:"total"` List []UserProductItem `json:"list"` } // 用户产品条目 UserProductItem { Id int64 `json:"id"` // 用户产品ID ProductId int64 `json:"productId"` // 产品ID ProductName string `json:"productName"` // 产品名称 ProductCode string `json:"productCode"` // 产品编号 ProductDescription string `json:"productDescription"` // 产品简介 ProductGroup string `json:"productGroup"` // 产品分类 ProductPrice float64 `json:"productPrice"` // 产品价格 CreatedAt string `json:"createdAt"` // 创建时间 UpdatedAt string `json:"updatedAt"` // 更新时间 } ) @server ( group: userProduct prefix: /api/console/user-product middleware: AuthInterceptor ) service gateway-api { @handler getUserProductList get /userProductList (GetUserProductListReq) returns (GetUserProductListResp) } @server ( group: userProduct prefix: /api/console/user-product middleware: AuthInterceptor,EntAuthInterceptor ) service gateway-api { @handler addUserProduct post /userProductAdd (AddUserProductReq) @handler deleteUserProduct delete /userProductDel/:id (DeleteUserProductReq) } type ( AddWhitelistReq { Ip string `json:"ip"` } DeleteWhitelistReq { Id int64 `json:"id"` } GetWhitelistListReq { Page int64 `form:"page"` PageSize int64 `form:"pageSize"` } GetWhitelistListResp { Total int64 `json:"total"` List []WhitelistItem `json:"list"` } WhitelistItem { Id int64 `json:"id"` // 用户产品ID WhitelistIp string `json:"whiteIp"` // 产品名称 CreatedAt string `json:"createdAt"` // 创建时间 UpdatedAt string `json:"updatedAt"` // 更新时间 } ) @server ( group: whitelistr prefix: /api/console/whitelist middleware: AuthInterceptor ) service gateway-api { @handler getWhitelistList get /getWhitelistList (GetWhitelistListReq) returns (GetUserProductListResp) } @server ( group: whitelistr prefix: /api/console/whitelist middleware: AuthInterceptor,EntAuthInterceptor ) service gateway-api { @handler addWhitelist post /addWhitelist (AddWhitelistReq) @handler deleteWhitelist delete /delWhitelist (DeleteWhitelistReq) } type ( AliTopUpRequest { amount int64 `json:"amount"` } AliTopUpResponse { payUrl string `json:"payUrl"` } ) @server ( group: topup prefix: /api/console/topupfmghnjx middleware: AuthInterceptor,EntAuthInterceptor ) service gateway-api { @handler aliTopUp post /aliTopUp (AliTopUpRequest) returns (AliTopUpResponse) @handler aliTopUpCallback post /aliTopUpCallback }