From 8fae3400d3d3f408cd86cc7a7307b2ef117c2f3d Mon Sep 17 00:00:00 2001 From: eson <9673575+githubcontent@user.noreply.gitee.com> Date: Sun, 25 Jun 2023 19:33:25 +0800 Subject: [PATCH] =?UTF-8?q?=E5=8F=AF=E4=BB=A5=E4=BA=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- fs_gen_api.sh | 2 +- fs_gen_api_backend.sh | 19 +++++++++++++------ fs_gen_mysql_model.sh | 4 ++-- 3 files changed, 16 insertions(+), 9 deletions(-) diff --git a/fs_gen_api.sh b/fs_gen_api.sh index fbc7a45a..6d35a29e 100755 --- a/fs_gen_api.sh +++ b/fs_gen_api.sh @@ -1,5 +1,5 @@ #! /bin/bash -name=${1%\/} +name=${1%%\\*} echo $name goctl api go -api server_api/$name.api -dir server/$name --home ./goctl_template/ # ctxName=server/$name/internal/svc/servicecontext.go diff --git a/fs_gen_api_backend.sh b/fs_gen_api_backend.sh index 037cfba9..d051a688 100755 --- a/fs_gen_api_backend.sh +++ b/fs_gen_api_backend.sh @@ -1,7 +1,14 @@ #! /bin/bash -# 专为后台序列化 -name=${1%\/} -echo $name -goctl api go -api server_api/$name.api -dir server/$name --home ./goctl_template_backend/ -# ctxName=server/$name/internal/svc/servicecontext.go -# gofmt -w $ctxName \ No newline at end of file +name=${1%%\\*} +options=("backend" "backend1" "backend2") +for option in "${options[@]}"; do + if [ "$name" = "$option" ]; then + echo $name + goctl api go -api server_api/$name.api -dir server/$name --home ./goctl_template_backend/ + exit + fi +done + +for option in "${options[@]}"; do + echo "只支持 $option" +done \ No newline at end of file diff --git a/fs_gen_mysql_model.sh b/fs_gen_mysql_model.sh index 81e4550e..e6347e26 100755 --- a/fs_gen_mysql_model.sh +++ b/fs_gen_mysql_model.sh @@ -1,4 +1,4 @@ #! /bin/bash # goctl model mysql ddl --src ./ddl/$1.sql --dir model/ --home ./goctl_template - -go run generator/main.go -name $1 \ No newline at end of file +name=${1%%\\*} +go run generator/main.go -name $name \ No newline at end of file