-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit f3b6600
Showing
78 changed files
with
51,494 additions
and
0 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
FROM golang:1.21 as builder | ||
#配置go代理 | ||
ARG GOPROXY="https://goproxy.cn,direct" | ||
WORKDIR /workspace | ||
COPY go.mod go.mod | ||
COPY go.sum go.sum | ||
|
||
ENV GOPROXY=$GOPROXY | ||
|
||
RUN go mod download | ||
|
||
COPY . . | ||
|
||
RUN CGO_ENABLED=0 GOOS=linux GO111MODULE=on go build -a -o manager main.go | ||
|
||
|
||
FROM alpine:3.11.2 | ||
WORKDIR / | ||
COPY --from=builder /workspace/manager . | ||
CMD ["/manager"] |
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
package api | ||
|
||
import ( | ||
"activity/controller" | ||
"activity/utils" | ||
) | ||
|
||
var apiManager ApiManager | ||
|
||
type Routes struct { | ||
controller.UserController | ||
controller.CheckerBoardController | ||
controller.WebSocketController | ||
} | ||
|
||
type ApiManager interface { | ||
UserInterface | ||
CheckerboardInterface | ||
WebSocketInterface | ||
} | ||
|
||
func CreateManager() { | ||
apiManager = NewManager() | ||
} | ||
|
||
func NewManager() *Routes { | ||
var router Routes | ||
router.UserController.LG = utils.Tools.LG | ||
router.UserController.SnowId = utils.Tools.SnowId | ||
router.CheckerBoardController.LG = utils.Tools.LG | ||
router.WebSocketController.ConnManager = utils.ConnManager | ||
return &router | ||
} | ||
|
||
func GetApiManager() ApiManager { | ||
return apiManager | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
package api | ||
|
||
import "github.com/gin-gonic/gin" | ||
|
||
type CheckerboardInterface interface { | ||
UserBetting(c *gin.Context) | ||
GetUserOperateRecords(c *gin.Context) | ||
GetCheckBoardInfo(c *gin.Context) | ||
GetRecords(c *gin.Context) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
package api | ||
|
||
import ( | ||
"activity/dao" | ||
) | ||
|
||
// 用于注册全局对象 | ||
func Register() { | ||
CreateManager() | ||
dao.CreateDaoManager() | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
package api | ||
|
||
import ( | ||
"activity/middleware" | ||
"github.com/gin-gonic/gin" | ||
) | ||
|
||
func ApiRoute(r *gin.Engine) { | ||
r.Use(middleware.Cors()) | ||
api := r.Group("/api") | ||
api.POST("/login", GetApiManager().Login) | ||
api.POST("/register", GetApiManager().Register) | ||
api.Use(middleware.JWTAuthMiddleware()) | ||
user := api.Group("/user") | ||
{ | ||
// 用户信息 | ||
user.GET("/userinfo", GetApiManager().GetUserInfo) | ||
// 修改用户信息 | ||
user.PUT("/put/userinfo") | ||
// 充值信息 | ||
user.POST("/recharge", GetApiManager().Recharge) | ||
} | ||
board := api.Group("/checkboard") | ||
{ | ||
// 押注 | ||
board.POST("/betting", GetApiManager().UserBetting) | ||
// 获取用户的押注记录 | ||
board.GET("/record", GetApiManager().GetUserOperateRecords) | ||
// 获取交易记录的前50条 | ||
board.GET("/records", GetApiManager().GetRecords) | ||
// 获取棋盘信息 | ||
board.GET("/boardInfo/:block_id", GetApiManager().GetCheckBoardInfo) | ||
} | ||
ws := api.Group("/ws") | ||
{ | ||
ws.GET("/handle", GetApiManager().Connect) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
package api | ||
|
||
import "github.com/gin-gonic/gin" | ||
|
||
type UserInterface interface { | ||
Login(c *gin.Context) | ||
Register(c *gin.Context) | ||
PutUserInfo(c *gin.Context) | ||
GetUserInfo(c *gin.Context) | ||
Recharge(c *gin.Context) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
package api | ||
|
||
import "github.com/gin-gonic/gin" | ||
|
||
type WebSocketInterface interface { | ||
Connect(c *gin.Context) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
# Logs | ||
logs | ||
*.log | ||
npm-debug.log* | ||
yarn-debug.log* | ||
yarn-error.log* | ||
pnpm-debug.log* | ||
lerna-debug.log* | ||
|
||
node_modules | ||
dist | ||
dist-ssr | ||
*.local | ||
|
||
# Editor directories and files | ||
.vscode/* | ||
!.vscode/extensions.json | ||
.idea | ||
.DS_Store | ||
*.suo | ||
*.ntvs* | ||
*.njsproj | ||
*.sln | ||
*.sw? |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
# React + Vite | ||
|
||
This template provides a minimal setup to get React working in Vite with HMR and some ESLint rules. | ||
|
||
Currently, two official plugins are available: | ||
|
||
- [@vitejs/plugin-react](https://github.com/vitejs/vite-plugin-react/blob/main/packages/plugin-react/README.md) uses [Babel](https://babeljs.io/) for Fast Refresh | ||
- [@vitejs/plugin-react-swc](https://github.com/vitejs/vite-plugin-react-swc) uses [SWC](https://swc.rs/) for Fast Refresh |
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
import js from '@eslint/js' | ||
import globals from 'globals' | ||
import react from 'eslint-plugin-react' | ||
import reactHooks from 'eslint-plugin-react-hooks' | ||
import reactRefresh from 'eslint-plugin-react-refresh' | ||
|
||
export default [ | ||
{ ignores: ['dist'] }, | ||
{ | ||
files: ['**/*.{js,jsx}'], | ||
languageOptions: { | ||
ecmaVersion: 2020, | ||
globals: globals.browser, | ||
parserOptions: { | ||
ecmaVersion: 'latest', | ||
ecmaFeatures: { jsx: true }, | ||
sourceType: 'module', | ||
}, | ||
}, | ||
settings: { react: { version: '18.3' } }, | ||
plugins: { | ||
react, | ||
'react-hooks': reactHooks, | ||
'react-refresh': reactRefresh, | ||
}, | ||
rules: { | ||
...js.configs.recommended.rules, | ||
...react.configs.recommended.rules, | ||
...react.configs['jsx-runtime'].rules, | ||
...reactHooks.configs.recommended.rules, | ||
'react/jsx-no-target-blank': 'off', | ||
'react-refresh/only-export-components': [ | ||
'warn', | ||
{ allowConstantExport: true }, | ||
], | ||
}, | ||
}, | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
<!doctype html> | ||
<html lang="en"> | ||
<head> | ||
<meta charset="UTF-8" /> | ||
<link rel="icon" type="image/svg+xml" href="/vite.svg" /> | ||
<meta name="viewport" content="width=device-width, initial-scale=1.0" /> | ||
<title>test</title> | ||
</head> | ||
<body> | ||
<div id="root"></div> | ||
<script type="module" src="/src/main.jsx"></script> | ||
</body> | ||
</html> |
Oops, something went wrong.