1
0
api/scpt/card_day.zsh

24 lines
578 B
Bash
Raw Normal View History

2023-11-03 02:24:42 +00:00
#!/bin/zsh
case $OSTYPE in
darwin*)
alias date="/opt/homebrew/bin/gdate"
;;
esac
host=https://api.syui.ai
token=`cat ~/.config/atr/api_card.json|jq -r .token`
host_users="$host/users?itemsPerPage=2550"
data=`curl -sL "$host_users"|jq .`
2024-02-21 07:06:08 +00:00
nd=`date +"%Y%m%d"`
2023-11-03 02:24:42 +00:00
n=`echo $data|jq length`
n=$((n - 1))
for ((i=0;i<=$n;i++))
do
name=`echo $data|jq ".[$i]"|jq -r .username`
id=`echo $data|jq ".[$i]"|jq -r .id`
2024-02-21 07:06:08 +00:00
echo "{\"next\":\"$nd\"} -s $host/users/$id"
curl -X PATCH -H "Content-Type: application/json" -d "{\"next\":\"$nd\",\"token\":\"$token\"}" -s $host/users/$id
2023-11-03 02:24:42 +00:00
done