-
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
Showing
58 changed files
with
5,190 additions
and
1 deletion.
There are no files selected for viewing
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,17 @@ | ||
# Binaries for programs and plugins | ||
*.exe | ||
*.exe~ | ||
*.dll | ||
*.so | ||
*.dylib | ||
|
||
# Test binary, built with `go test -c` | ||
*.test | ||
|
||
# Output of the go coverage tool, specifically when used with LiteIDE | ||
*.out | ||
|
||
# Dependency directories (remove the comment below to include it) | ||
# vendor/ | ||
# 屏蔽所有的.log文件 | ||
*.log |
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,15 @@ | ||
FROM centos:7.9.2009 | ||
ENV MYPATH /enjoy-research | ||
WORKDIR $MYPATH | ||
RUN yum -y update \ | ||
&& yum -y install vim \ | ||
&& yum -y install git \ | ||
&& yum install -y gcc-c++ \ | ||
&& yum -y install wget \ | ||
&& wget -P /root/ https://studygolang.com/dl/golang/go1.17.11.linux-amd64.tar.gz \ | ||
&& tar -zxvf /root/go1.17.11.linux-amd64.tar.gz -C /usr/local \ | ||
&& echo export PATH=$PATH:/usr/local/go/bin >> /etc/profile \ | ||
&& source /etc/profile && go version \ | ||
&& echo "source /etc/profile" >> /root/.bashrc \ | ||
&& go env -w GOPROXY=https://goproxy.cn,direct \ | ||
&& go env -w GO111MODULE=on \ |
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,36 @@ | ||
project: | ||
name: "项目名称" | ||
mode: "dev" | ||
port: 端口 | ||
start: "创建时间" | ||
log: | ||
level: "日志水平" | ||
filename: "日志文件名" | ||
max_size: 200 | ||
max_age: 30 | ||
max_backups: 7 | ||
mysql: | ||
host: "IP" | ||
port: 端口 | ||
user: "用户名" | ||
password: "密码" | ||
dbname: "数据库" | ||
max_open_conns: 200 | ||
max_idle_conns: 50 | ||
redis: | ||
db: redis仓库 | ||
host: IP:端口 | ||
password: "密码" | ||
#阿里云oss配置 | ||
oss: | ||
end_point: "" | ||
access_key_id : "" | ||
access_key_secret: "" | ||
bucket_name: "" | ||
base_path: "" | ||
rabbitMQ: | ||
username: 用户名 | ||
password: 密码 | ||
host: IP | ||
post: 端口 | ||
|
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,149 @@ | ||
package controller | ||
|
||
import ( | ||
"github.com/gin-gonic/gin" | ||
"go.uber.org/zap" | ||
"strconv" | ||
"web_app/dao/mysql" | ||
"web_app/model" | ||
) | ||
|
||
// 查找所有省 | ||
func SearchProvince(c *gin.Context) { | ||
//直接去查数据库 | ||
province, err := mysql.SearchProvince() | ||
if err != nil { | ||
zap.L().Error("查询省出错了", zap.Error(err)) | ||
ResponseError(c, CodeServerBusy) | ||
return | ||
} | ||
//成功返回省的信息 | ||
ResponseSuccess(c, province) | ||
} | ||
|
||
// 查找所有市 | ||
func SearchCity(c *gin.Context) { | ||
province, _ := strconv.Atoi(c.Query("provinceid")) | ||
provinceid := uint(province) | ||
citys, err := mysql.SearchCity(provinceid) | ||
if err != nil { | ||
zap.L().Error("查询市失败", zap.Error(err)) | ||
ResponseError(c, CodeServerBusy) | ||
return | ||
} | ||
ResponseSuccess(c, citys) | ||
|
||
} | ||
|
||
// 查找市下面的学校 | ||
func SearchSchool(c *gin.Context) { | ||
city, _ := strconv.Atoi(c.Query("cityid")) | ||
cityid := uint(city) | ||
citys, err := mysql.SearchSchool(cityid) | ||
if err != nil { | ||
zap.L().Error("查询学校失败", zap.Error(err)) | ||
ResponseError(c, CodeServerBusy) | ||
return | ||
} | ||
ResponseSuccess(c, citys) | ||
} | ||
|
||
func SearchAcademies(c *gin.Context) { | ||
school, _ := strconv.Atoi(c.Query("schoolid")) | ||
schoolid := uint(school) | ||
academies, err := mysql.SearchAcademies(schoolid) | ||
if err != nil { | ||
zap.L().Error("查询专业失败", zap.Error(err)) | ||
ResponseError(c, CodeServerBusy) | ||
return | ||
} | ||
ResponseSuccess(c, academies) | ||
} | ||
|
||
//查询所有的地址 | ||
func SelectAllAddress(c *gin.Context) { | ||
err, address := mysql.SelectAllAddress() | ||
if err != nil { | ||
zap.L().Error("查询所有地址", zap.Error(err)) | ||
ResponseError(c, CodeServerBusy) | ||
return | ||
} | ||
ResponseSuccess(c, address) | ||
} | ||
|
||
//模糊查询学校 | ||
func SelectLikeSchool(c *gin.Context) { | ||
|
||
} | ||
|
||
//根据学校id查询该学校下面所有专业 | ||
func SelectMajorBySchool(c *gin.Context) { | ||
id := c.Query("id") | ||
ids, err := strconv.Atoi(id) | ||
if err != nil { | ||
zap.L().Error("查询学校下所有专业失败", zap.Error(err)) | ||
ResponseErrorWithMsg(c, CodeServerBusy, "参数错误") | ||
return | ||
} | ||
var academies []model.Academy | ||
var academiesid []uint | ||
err = mysql.DB.Where("school_id", ids).Find(&academies).Error | ||
if err != nil { | ||
zap.L().Error("查询学校下所有专业失败", zap.Error(err)) | ||
ResponseError(c, CodeServerBusy) | ||
return | ||
} | ||
for _, academy := range academies { | ||
academiesid = append(academiesid, academy.ID) | ||
} | ||
//去查学院下面的各个专业 | ||
var majors []model.Major | ||
err = mysql.DB.Where("academy_id IN ?", academiesid).Find(&majors).Error | ||
if err != nil { | ||
zap.L().Error("查询学校下所有专业失败", zap.Error(err)) | ||
ResponseError(c, CodeServerBusy) | ||
return | ||
} | ||
ResponseSuccess(c, majors) | ||
} | ||
|
||
//根据学院id查询学院下专业 | ||
func SelectMajorByAcademyId(c *gin.Context) { | ||
id := c.Query("id") | ||
academyid, err := strconv.Atoi(id) | ||
if err != nil { | ||
zap.L().Error("查询学院下所有专业失败", zap.Error(err)) | ||
ResponseErrorWithMsg(c, CodeServerBusy, "参数错误") | ||
return | ||
} | ||
var p *[]model.Major | ||
err = mysql.DB.Where("academy_id", academyid).Find(&p).Error | ||
if err != nil { | ||
zap.L().Error("查询专业下所有科目失败", zap.Error(err)) | ||
ResponseErrorWithMsg(c, CodeServerBusy, "查询失败") | ||
return | ||
} | ||
ResponseSuccess(c, p) | ||
} | ||
|
||
//根据专业id查询考试科目 | ||
func SeleteSubjectByAcademiyid(c *gin.Context) { | ||
id := c.Query("id") | ||
marjorid, err := strconv.Atoi(id) | ||
if err != nil { | ||
zap.L().Error("查询专业下所有科目失败", zap.Error(err)) | ||
ResponseErrorWithMsg(c, CodeServerBusy, "参数错误") | ||
return | ||
} | ||
var p model.Major | ||
p.ID = uint(marjorid) | ||
err = mysql.DB.Preload("Subjects").Find(&p).Error | ||
if err != nil { | ||
zap.L().Error("查询专业下所有科目失败", zap.Error(err)) | ||
ResponseErrorWithMsg(c, CodeServerBusy, "查询失败") | ||
return | ||
} | ||
ResponseSuccess(c, p) | ||
} | ||
|
||
//根据学校及专业id查询考研科目 |
Oops, something went wrong.