mirror of
https://github.com/whyour/qinglong.git
synced 2025-07-08 04:16:07 +08:00
使用jq获取json数据
This commit is contained in:
parent
f706b1aa2e
commit
17c50d0c9e
|
@ -24,6 +24,7 @@ RUN sed -i 's/dl-cdn.alpinelinux.org/mirrors.aliyun.com/g' /etc/apk/repositories
|
||||||
nginx \
|
nginx \
|
||||||
python3 \
|
python3 \
|
||||||
yarn \
|
yarn \
|
||||||
|
jq \
|
||||||
&& rm -rf /var/cache/apk/* \
|
&& rm -rf /var/cache/apk/* \
|
||||||
&& ln -sf /usr/share/zoneinfo/Asia/Shanghai /etc/localtime \
|
&& ln -sf /usr/share/zoneinfo/Asia/Shanghai /etc/localtime \
|
||||||
&& echo "Asia/Shanghai" > /etc/timezone \
|
&& echo "Asia/Shanghai" > /etc/timezone \
|
||||||
|
|
|
@ -1,8 +1,7 @@
|
||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
get_token() {
|
get_token() {
|
||||||
local authInfo=$(cat $AuthConf)
|
token=$(cat $AuthConf | jq -r .token)
|
||||||
token=$(get_json_value "$authInfo" "token")
|
|
||||||
}
|
}
|
||||||
|
|
||||||
get_json_value() {
|
get_json_value() {
|
||||||
|
@ -42,8 +41,7 @@ add_cron_api() {
|
||||||
-H "Accept-Language: en-US,en;q=0.9,zh-CN;q=0.8,zh;q=0.7" \
|
-H "Accept-Language: en-US,en;q=0.9,zh-CN;q=0.8,zh;q=0.7" \
|
||||||
--data-raw "{\"name\":\"$name\",\"command\":\"$command\",\"schedule\":\"$schedule\"}" \
|
--data-raw "{\"name\":\"$name\",\"command\":\"$command\",\"schedule\":\"$schedule\"}" \
|
||||||
--compressed)
|
--compressed)
|
||||||
echo $api
|
code=$(echo $api | jq -r .code)
|
||||||
code=$(get_json_value $api "code")
|
|
||||||
if [[ $code == 200 ]]; then
|
if [[ $code == 200 ]]; then
|
||||||
echo -e "$name 添加成功"
|
echo -e "$name 添加成功"
|
||||||
else
|
else
|
||||||
|
@ -63,8 +61,7 @@ del_cron_api() {
|
||||||
-H "Origin: http://localhost:5700" \
|
-H "Origin: http://localhost:5700" \
|
||||||
-H "Referer: http://localhost:5700/crontab" \
|
-H "Referer: http://localhost:5700/crontab" \
|
||||||
-H "Accept-Language: en-US,en;q=0.9,zh-CN;q=0.8,zh;q=0.7")
|
-H "Accept-Language: en-US,en;q=0.9,zh-CN;q=0.8,zh;q=0.7")
|
||||||
echo $api
|
code=$(echo $api | jq -r .code)
|
||||||
code=$(get_json_value $api "code")
|
|
||||||
if [[ $code == 200 ]]; then
|
if [[ $code == 200 ]]; then
|
||||||
echo -e "$name 删除成功"
|
echo -e "$name 删除成功"
|
||||||
else
|
else
|
||||||
|
|
Loading…
Reference in New Issue
Block a user