Skip to content

Commit

Permalink
pref: first commit
Browse files Browse the repository at this point in the history
  • Loading branch information
paterleng committed Dec 4, 2024
0 parents commit f3b6600
Show file tree
Hide file tree
Showing 78 changed files with 51,494 additions and 0 deletions.
9 changes: 9 additions & 0 deletions .idea/ activity.iml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 8 additions & 0 deletions .idea/.gitignore

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 8 additions & 0 deletions .idea/modules.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions .idea/vcs.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

20 changes: 20 additions & 0 deletions Dockerfile
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"]
258 changes: 258 additions & 0 deletions activity.log

Large diffs are not rendered by default.

37 changes: 37 additions & 0 deletions api/api-manager.go
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
}
10 changes: 10 additions & 0 deletions api/checkerboard.go
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)
}
11 changes: 11 additions & 0 deletions api/register.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
package api

import (
"activity/dao"
)

// 用于注册全局对象
func Register() {
CreateManager()
dao.CreateDaoManager()
}
38 changes: 38 additions & 0 deletions api/route.go
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)
}
}
11 changes: 11 additions & 0 deletions api/user.go
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)
}
7 changes: 7 additions & 0 deletions api/websocket.go
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)
}
24 changes: 24 additions & 0 deletions checkerboard/.gitignore
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?
8 changes: 8 additions & 0 deletions checkerboard/README.md
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 added checkerboard/dist.zip
Binary file not shown.
38 changes: 38 additions & 0 deletions checkerboard/eslint.config.js
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 },
],
},
},
]
13 changes: 13 additions & 0 deletions checkerboard/index.html
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>
Loading

0 comments on commit f3b6600

Please sign in to comment.