补充一些文档

This commit is contained in:
johlanse 2022-07-29 15:55:42 +08:00
parent 12d98eb163
commit fb4c46279c
7 changed files with 67 additions and 5 deletions

View File

@ -1,4 +1,4 @@
## linux基本使用
## 可执行文件运行
+ 本地访问[Releases]([Release](https://github.com/johlanse/study_xxqg/releases)) ,查找对应版本并复制链接
+ 使用wget下载对应版本压缩包
@ -13,3 +13,19 @@
```
docker run --name study_xxqg -d -p 8080:8080 -v /etc/study_xxqg/:/opt/config/ jolanse/study_xxqg
```
## docker-compose运行
```shell
wget https://raw.githubusercontent.com/johlanse/study_xxqg/main/docker-compose.yml
docker-compose up -d
```
## 二种运行方式的区别
+ #### 可执行文件运行
可执行文件运行节省存储空间拥有更低的占用但是可能会存在浏览器依赖安装的问题适合拥有一定linux基础的用户使用
如果系统为debian11用户可以参考DockerFile文件中的依赖安装语句执行即可centos用户推荐使用docker.
+ #### docker运行
docker运行不需要解决依赖问题但是可能面临更高的运行占用建议使用docker控制内存占用

View File

@ -6,6 +6,12 @@
然后查看报错内容截图并在[github](https://github.com/johlanse/study_xxqg/issues) 提交issue
```
+ ### windows下出现找不到浏览器的问题
```yaml
自行安装chromium内核的浏览器包括chromeedge浏览器之类然后在配置文件中配置 edge_path 配置项,配置时将路径中的 \ 换成 / 或者 \\
```
+ ### arm设备报错```could not download driver: could not check if driver is up2date: could not run driver: exit status 127```
@ -29,12 +35,19 @@
nohup参考命令
nohup ./study_xxqg > xxqg.log 2>&1 & echo $! >pid.pid
nohup ./study_xxqg > xxqg.log 2>&1
退出程序可以通过**cat pid.pid**查看程序pid,然后kill对应pid进行退出
```
+ ### linux上退出后台正在执行的进程
```yaml
study_xxqg进程会在运行的时候将pid输出到目录下的pid.pid文件使用kil -9 命令即可退出后台进程
```
+ ### 刷文章或者视频无法加分
```yaml
偶尔出现视频和文章无法加分的bug,可以进行等待一段时间后重启程序再次测试,目前尚不清楚造成原因

View File

@ -6,4 +6,6 @@
+ 进入解压后的文件夹,双击运行```study_xxqg.exe```,第一次打开可能会出现闪退发现文件夹下生成了config文件夹
+ 打开config目录下的```confif.yml```文件,进行编辑,详情内容见[配置文件](../config.md)
+ 再次进行运行```study_xxqg.exe```
+ 使用浏览器打开```http://127.0.0.1:8080```

View File

@ -165,7 +165,6 @@ func main() {
}
func do(m string) {
defer func() {
err := recover()
if err != nil {

View File

@ -148,6 +148,11 @@ func UserCount(uid string) int {
return count
}
// DeleteUser
/* @Description:
* @param uid
* @return error
*/
func DeleteUser(uid string) error {
ping()
_, err := db.Exec("delete from user where uid = ?;", uid)

View File

@ -302,3 +302,28 @@ func generate() gin.HandlerFunc {
proxy.ServeHTTP(ctx.Writer, ctx.Request)
}
}
// 删除用户
func deleteUser() gin.HandlerFunc {
return func(ctx *gin.Context) {
uid := ctx.Query("uid")
err := model.DeleteUser(uid)
if err != nil {
ctx.JSON(200, Resp{
Code: 503,
Message: "",
Data: "",
Success: false,
Error: err.Error(),
})
return
}
ctx.JSON(200, Resp{
Code: 200,
Message: "删除成功",
Data: "",
Success: true,
Error: "",
})
}
}

View File

@ -39,6 +39,8 @@ func RouterInit() *gin.Engine {
user.GET("/", getUsers())
user.DELETE("/", deleteUser())
router.GET("/score", getScore())
router.POST("/study", study())