From fbb53411a80deb16c62e9bbfef4decf61834f34d Mon Sep 17 00:00:00 2001 From: liujiangyong Date: Fri, 29 Jul 2022 15:09:15 +0800 Subject: [PATCH 1/3] =?UTF-8?q?=E4=B8=8A=E6=8A=A5=E5=B7=A5=E7=A8=8B?= =?UTF-8?q?=E7=B1=BB=E5=9E=8B=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- weapp/src/packages/patrol/index.jsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/weapp/src/packages/patrol/index.jsx b/weapp/src/packages/patrol/index.jsx index c99df9a8..b4cbdbf5 100644 --- a/weapp/src/packages/patrol/index.jsx +++ b/weapp/src/packages/patrol/index.jsx @@ -36,7 +36,7 @@ const Index = () => { const prjType = [ { text: '道路', value: 'road'}, - { text: '桥梁', value: 'birdge'}, + { text: '桥梁', value: 'bridge'}, { text: '涵洞', value: 'culvert'}, { text: '其他', value: 'other'}, ] From e11b4e2b1b3d4459793ed9ce16de0afc89bec495 Mon Sep 17 00:00:00 2001 From: "gao.zhiyuan" Date: Fri, 29 Jul 2022 15:25:36 +0800 Subject: [PATCH 2/3] API_URL --- code996.sh | 140 ++++++++++++++++++++++++++++++++++++++++++++++++++ web/config.js | 4 +- 2 files changed, 143 insertions(+), 1 deletion(-) create mode 100644 code996.sh diff --git a/code996.sh b/code996.sh new file mode 100644 index 00000000..d0844e79 --- /dev/null +++ b/code996.sh @@ -0,0 +1,140 @@ +#!/usr/bin/env bash + +Help() +{ + echo "你也可以使用自定义参数进行指定查询" + echo + echo "格式: bash $0 [2021-01-01] [2022-04-04] [author]" + echo "示例: bash code996.sh 2021-01-01 2022-12-31 digua" + echo "参数:" + echo "1st 分析的起始时间." + echo "2nd 分析的结束时间." + echo "3rd 指定提交用户,可以是 name 或 email." + echo +} + +OS_DETECT() +{ + # Detect OS + case "$(uname -s)" in + + Linux) + # echo 'Linux' + open_url="xdg-open" + ;; + + Darwin) + # echo 'macOS' + open_url="open" + ;; + + CYGWIN*|MINGW32*|MSYS*|MINGW*) + # echo 'Windows' + open_url="start" + ;; + + *) + echo 'Other OS' + echo "trying to use xdg-open to open the url" + open_url="xdg-open" + ;; + esac + +} +OS_DETECT + + +time_start=$1 + + +if [ "$1" == "--help" ] + then + Help + exit 0 +elif [ "$1" == "-h" ] + then + Help + exit 0 +fi + +if [ -z $1 ] + then + time_start="2021-01-01" +fi + +time_end=$2 +if [ -z $2 ] + then + time_end=$(date "+%Y-%m-%d") +fi + +author=$3 +if [ -z $3 ] + then + author="" +fi + + +by_day_output=`git -C $PWD log --author=$author --date=format:%u --after="$time_start" --before="$time_end" |grep "Date:"|awk '{print $2}'|sort|uniq -c` + +by_hour_output=`git -C $PWD log --author=$author --date=format:%H --after="$time_start" --before="$time_end" |grep "Date:"|awk '{print $2}'|sort|uniq -c` + +for i in "${by_day_output[@]}" + do + by_day_result=`echo "$i"|sed -E 's/^ +//g'|sed 's/ /_/g'|tr '\n' ','` + + done + + +# should modify by day format %a or %A +# day_sorted=('Monday' 'Tuesday' 'Wednesday' 'Thursday' 'Friday' 'Saturday' 'Sunday') +# day_sorted=('Mon' 'Tue' 'Wed' 'Thu' 'Fri' 'Sat' 'Sun') + +RED='\033[1;91m' +NC='\033[0m' # No Color + +echo -e "${RED}统计时间范围:$time_start 至 $time_end" + +for i in "${by_day_output[@]}" + do + echo + echo -e "${NC}一周七天 commit 分布${RED}" + echo -e " 总提交次数 星期\n$i"|column -t + by_day_result=`echo "$i"|sed -E 's/^ +//g'|sed "s/ /_/g"|tr '\n' ','` + done + + +for i in "${by_hour_output[@]}" + do + echo + echo -e "${NC}24小时 commit 分布${RED}" + echo -e " 总提交次数 小时\n$i"|column -t + by_hour_result=`echo "$i"|sed -E 's/^ +//g'|sed "s/ /_/g"|tr '\n' ','` + done + + +by_day_result=`echo "$by_day_result"|sed -E 's/,$//g'` + +by_hour_result=`echo "$by_hour_result"|sed -E 's/,$//g'` + + +result=$time_start"_"$time_end"&week="$by_day_result"&hour="$by_hour_result + +# url +github_url="https://hellodigua.github.io/code996/#/result?time=$result" +vercel_url="https://code996.vercel.app/#/result?time=$result" +gitee_url="https://hellodigua.gitee.io/code996/#/result?time=$result" + +echo +echo -e "${NC}复制以下url以查看可视化分析结果:" +echo -e "${RED}$github_url" +echo -e "${NC}" +echo -e "${NC}若 GitHub 访问过慢,也可以访问以下镜像链接:" +echo -e "${NC}Vercel节点:" +echo -e "${RED}$vercel_url" +echo -e "${NC}" +echo -e "${NC}Gitee节点:" +echo -e "${RED}$gitee_url" +echo -e "${NC}" + +$open_url "$github_url" diff --git a/web/config.js b/web/config.js index 0736a5c0..4acfc2b1 100644 --- a/web/config.js +++ b/web/config.js @@ -15,12 +15,14 @@ dev && console.log('\x1B[33m%s\x1b[0m', '请遵循并及时更新 readme.md, // // 启动参数 args.option(['p', 'port'], '启动端口'); args.option(['u', 'api-url'], 'webapi的URL'); +args.option('apiUrl', '可外网访问的 webapi 的URL'); args.option(['r', 'report-node'], '报表进程地址'); args.option('qndmn', '七牛'); const flags = args.parse(process.argv); const FS_UNIAPP_API = process.env.FS_UNIAPP_API || flags.apiUrl; const QINIU_DOMAIN_QNDMN_RESOURCE = process.env.ANXINCLOUD_QINIU_DOMAIN_QNDMN_RESOURC || flags.qndmn; +const API_URL = process.env.API_URL || flags.apiUrl; if (!FS_UNIAPP_API) { console.log('缺少启动参数,异常退出'); @@ -52,7 +54,7 @@ const product = { }, { entry: require('./routes').entry, opts: { - apiUrl: FS_UNIAPP_API, + apiUrl: API_URL, qndmn: QINIU_DOMAIN_QNDMN_RESOURCE, staticRoot: './client', } From 0b989fe87fe8066522a2da3280db5d55023c44de Mon Sep 17 00:00:00 2001 From: "gao.zhiyuan" Date: Fri, 29 Jul 2022 15:31:02 +0800 Subject: [PATCH 3/3] =?UTF-8?q?=20=E7=94=A8=E6=88=B7=E7=AE=A1=E7=90=86-?= =?UTF-8?q?=E5=88=A0=E9=99=A4=E9=83=A8=E9=97=A8=E5=90=8E=E9=87=8D=E6=96=B0?= =?UTF-8?q?=E5=88=9B=E5=BB=BA=E7=9B=B8=E5=90=8C=E5=90=8D=E7=A7=B0=E9=83=A8?= =?UTF-8?q?=E9=97=A8=E5=A4=B1=E8=B4=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- api/app/lib/controllers/organization/department.js | 1 + 1 file changed, 1 insertion(+) diff --git a/api/app/lib/controllers/organization/department.js b/api/app/lib/controllers/organization/department.js index 3fa5e66a..9e55dc35 100644 --- a/api/app/lib/controllers/organization/department.js +++ b/api/app/lib/controllers/organization/department.js @@ -70,6 +70,7 @@ async function editDep (ctx) { dependence: dependence || null, name: name, id: { $ne: depId }, + delete: false } }) if (repeatNameCount) {