Skip to content

Commit eeaa4e5

Browse files
author
Ropon
committed
fix
1 parent d7fb219 commit eeaa4e5

4 files changed

Lines changed: 9 additions & 6 deletions

File tree

.air.conf

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,9 @@ cmd = "swag init && go build -o tmp/main ."
1212
bin = "tmp/main"
1313
# 自定义的二进制,可以添加额外的编译标识例如添加 GIN_MODE=release
1414
# full_bin = "APP_ENV=dev APP_USER=air ./main"
15-
full_bin = "tmp/main -c conf/work_api.json"
15+
full_bin = "tmp/main -c conf/work_api_dev.json"
1616
# 监听以下文件扩展名的文件.
17-
include_ext = ["go", "tpl", "tmpl", "html"]
17+
include_ext = ["go", "tpl", "tmpl", "html", "json"]
1818
# 忽略这些文件扩展名或目录
1919
exclude_dir = ["assets", "tmp", "docs"]
2020
# 监听以下指定目录的文件

.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,5 +19,5 @@ config.conf
1919

2020
log
2121
work_api
22-
conf/work_api.json
22+
conf/work_api_dev.json
2323
tmp

controllers/service.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,8 @@ func checkParamsId(c *gin.Context) (uint, bool) {
2525

2626
//检查请求体
2727
func checkData(c *gin.Context, v interface{}) bool {
28-
if err := c.Bind(v); err != nil {
29-
utils.GinErrRsp(c, utils.ErrCodeParamInvalid, "参数有误")
28+
if err := c.ShouldBind(v); err != nil {
29+
utils.GinErrRsp(c, utils.ErrCodeParamInvalid, "参数有误:"+err.Error())
3030
return false
3131
}
3232
return true

new_project.sh

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,12 @@ pushd $(pwd)/$1
88
rm -rf .git
99
rm -f new_project.sh
1010
find . -type f|grep -vE "air$"|xargs -L 1 sed -i "" "s/work_api/$1/g"
11-
mv conf/work_api.json conf/$1.json
11+
mv conf/ops_work_api.json conf/$1.json && cp conf/$1.json conf/${1}_dev.json
12+
find . -type f|grep -vE "air$"|xargs -L 1 sed -i "" "s/2345/$2/g"
1213
mkdir log
14+
git config --global init.defaultBranch master
1315
git init
16+
go mod tidy
1417
git remote add origin https://github.com/ropon/$1.git
1518
echo "init project success"
1619
popd

0 commit comments

Comments
 (0)