完全同API项目。
差异之处如下:
- 本程序是前后端分离的single page web app,后端需要输出HTML,模版文件放在
web文件夹下,使用的模版引擎是https://github.com/flosch/pongo2,语法和Django、Nunjucks类似。这些模版文件在build时嵌入到二进制文件中,见web/render.go文件。 - 后端输出的网页只是一个空白页,所有UI都交给前端用react渲染,这个空白网页对应的模版是
web/template/next.html。 - 另外一个模版文件
web/template/ng.html供此前用Angular写的前端app使用,但Angular版已不再开发,仅保留此前已有的功能。 - 模版文件并非手写,而是用superyard-react中的脚本生成。
- 根目录下的
client_version_next和client_version_ng也由前端项目的脚本生成。
godoc -http=:6060
Login by FTC staff only.
- POST
/auth/loginLogin. See more details - POST
/auth/password-reset/letterSend user a letter to reset password. - GET
/auth/password-reset/tokens/{token}Verify password reset token. - POST
/auth/password-resetReset password.
Request header must contain X-User-Name field.
- GET
/settings/account - PATCH
/settings/account/emailChange email - PATCH
/settings/account/display-nameChange display name - PATCH
/settings/account/passwordChange password - GET
/settings/account/profileShow a logged in staff's information.
-
GET
/oauth/apps?page<int>&per_page=<int>Get a list of apps. -
POST
/oauth/appsCreate a new app for which you can generate access tokens. -
GET
/oauth/apps/:idGet a specific app -
PATCH
/oauth/apps/:idUpdate an app -
DELETE
/oauth/apps/:idDeactivate an app. -
GET
/oauth/keys?client_id=<string>&page=<number>&per_page=<number>Get a list of access tokens. -
POST
/oauth/keysCraete a new access token. -
DELETE
/oauth/keys/:idDelete an access token.
- GET
/readers/search?q=<email|username|phone>&kind=<ftc|wechat> - GET
/readers/ftc/:idGet an ftc account - GET
/readers/ftc/:id/profileGet the profile of an ftc account - GET
/readers/wx/:idLoad a wechat account - GET
/readers/wx/:id/profileLoad more details a wechat account.
FTC user in sandbox mode. Used for testing only.
- POST
/sandboxCreate a test user - GET
/sandboxList aoo test users - GET
/sandbox/:idLoad a test account - DELETE
/sandbox/:idDelete a test account - PATCH
/sandbox/:id/passwordChange the password of a test account
- POST
/membershipsUpdate or create a membership - DELETE
/membershipsDeelete a membership.
Show memberships change history
- GET
/snapshots?ftc_id=<string>&union_id=<string>&page=<int>&per_page=<int>Show a user's membership change history.
- GET
/iap?page=<int>&per_page=<int>List a user's IAP record - GET
/iap/:idLoad a single IAP subscription - PATCH
/iap/:idRefresh an existing IAP - POST
/iap/:id/linkLink iap to an ftc account - POST
/iap/:id/unlinkSever links between an iap and ftc account
Please refer to the Paywall section on how the paywall system is designed. This project simply transfer requests to API.
- GET
/paywallLoad paywall data - POST
/paywall/bannerCreate a banner - POST
/paywall/banner/promoCreate promo banner - DELETE
/paywall/banner/promoDelete promo banner - POST
/paywall/productsCreate a product - GET
/paywall/productsList products - GET
/paywall/products/:productIdLoad product by id - POST
/paywall/products/:productId/activatePut a product on paywall - PATCH
/paywall/products/:productIdUpdate a product - POST
/paywall/pricesCreate a new price under a specific product. - GET
/paywall/prices?product_id=<string>&live=<true|false>List all prices under a product. - GET
/paywall/prices/:priceIdLoad a price - POST
/paywall/prices/:priceId/activateTurn a price into active state under a product. - POST
/paywall/prices/:priceId/deactivateTurn a price into deactivatie state under a product. - PATCH
/paywall/prices/:priceIdUpdate a price - PATCH
/paywall/prices/:priceId/discountsRefersh discounts attached to a price. - DELETE
/paywall/prices/:priceIdArchive a price. - POST
/paywall/discountsCreate discount - DELETE
/paywall/discounts/:idDelete a discount
Link Stripe price and coupon to ftc price.
- GET
/stripe/prices?page=<int>&per_page=<int>&live=<bool>Get a list of stripe prices - GET
/stripe/prices/:id?live=<bool>&refresh=<bool>Load a stripe price - PATCH
/stripe/prices/:id?live=<bool>Update a stripe price's metadata - PATCH
/stripe/prices/:id/activate?live=<bool>Activate a stripe price. - PATCH
/stripe/prices/:id/deactivate?live=<bool>Deactivate a stripe price. - GET
/stripe/prices/:id/coupons?live<bool>List coupons attached to a price. - GET
/stripe/coupons/:id?live=<bool>&refresh=<bool>Load a stripe coupon - POST
/stripe/coupons/:id?live=<bool>Update a coupon - PATCH
/stripe/coupons/:id/activate?live<bool>Activate a coupon - DELETE
/stripe/coupons/:id?live=<bool>
This is used to publish latest version data to API. You also need to upload Android APK to minio storage for user to download.
- POST
/android/releasesCreate a new release. - GET
/android/releasesList android releases. - GET
/android/release/:versionNameLoad the details of a specific version. - PATCH
/android/release/:versionNameUpdate a release. - DELETE
/android/release/:versionNameDelete a release.
Used to store development documentations.
- GET
/wikiList wiki articles - POST
/wikiCreate a new wiki article - GET
/wiki/:idLoad one wiki article - PATCH
/wiki/:idUpdatea a wiki article
Legal documents as listed here: https://next.ftacademy.cn/terms.
- GET
/legal?page=<int>&per_page=<int>List legal documents - POST
/legalCreate a new legal document. - GET
/legal/:idLoad a legal document. - PATCH
/legal/:idUpdatea a legal document. - POST
/legal/:id/publishMake a legal document publicly visible.