forked from daren.hsu/line_push
42 lines
1.9 KiB
Bash
42 lines
1.9 KiB
Bash
ID_COUNT=`jq . users|grep id| tail -n1 |awk -F " " '{ print $2 }'`
|
|
echo $ID_COUNT
|
|
touch OnedayTRIP
|
|
touch TwodayTRIP
|
|
for ((i=1;i<=$ID_COUNT;i++))
|
|
do
|
|
echo $i
|
|
curl -s https://json_2series.digitalent.tw/users?id=$i |grep -q 一日遊
|
|
daytrip_status=$?
|
|
echo $daytrip_status
|
|
if [ $daytrip_status -eq 0 ]
|
|
then
|
|
NumberOfPeople=`curl -s https://json_2series.digitalent.tw/users?id=$i |grep NumberOfPeople | awk -F "\"" '{ print $4 }'`
|
|
NumberOfChild=`curl -s https://json_2series.digitalent.tw/users?id=$i |grep NumberOfChild | awk -F "\"" '{ print $4 }'`
|
|
NumberOfBaby=`curl -s https://json_2series.digitalent.tw/users?id=$i |grep NumberOfBaby | awk -F "\"" '{ print $4 }'`
|
|
OneDAYTotalPeople=$((OneDAYTotalPeople+$NumberOfPeople))
|
|
OneDAYTotalChild=$((OneDAYTotalChild+$NumberOfChild))
|
|
OneDAYTotalBaby=$((OneDAYTotalBaby+$NumberOfBaby))
|
|
echo "一日遊 7歲以上 ${OneDAYTotalPeople}位" >OnedayTRIP
|
|
echo "一日遊 3-6歲 ${OneDAYTotalChild}位">>OnedayTRIP
|
|
echo "一日遊 2歲以下 ${OneDAYTotalBaby}位">>OnedayTRIP
|
|
|
|
fi
|
|
curl -s https://json_2series.digitalent.tw/users?id=$i |grep -q 二日遊
|
|
daytrip_status=$?
|
|
echo $daytrip_status
|
|
if [ $daytrip_status -eq 0 ]
|
|
then
|
|
NumberOfPeople=`curl -s https://json_2series.digitalent.tw/users?id=$i |grep NumberOfPeople | awk -F "\"" '{ print $4 }'`
|
|
NumberOfChild=`curl -s https://json_2series.digitalent.tw/users?id=$i |grep NumberOfChild | awk -F "\"" '{ print $4 }'`
|
|
NumberOfBaby=`curl -s https://json_2series.digitalent.tw/users?id=$i |grep NumberOfBaby | awk -F "\"" '{ print $4 }'`
|
|
TwoDAYTotalPeople=$((TwoDAYTotalPeople+$NumberOfPeople))
|
|
TwoDAYTotalChild=$((TwoDAYTotalChild+$NumberOfChild))
|
|
TwoDAYTotalBaby=$((TwoDAYTotalBaby+$NumberOfBaby))
|
|
echo "二日遊 7歲以上 ${TwoDAYTotalPeople}位">TwodayTRIP
|
|
echo "二日遊 3-6歲 ${TwoDAYTotalChild}位">>TwodayTRIP
|
|
echo "二日遊 2歲以下 ${TwoDAYTotalBaby}位">>TwodayTRIP
|
|
fi
|
|
|
|
|
|
done
|