1
0
api/scpt/card_limit.zsh

25 lines
745 B
Bash
Raw Normal View History

2023-07-23 14:40:24 +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"
updated_at_n=`date --iso-8601=seconds -d '1 days ago'`
2024-02-21 09:16:45 +00:00
#updated_at_n=`date --iso-8601=seconds`
2023-07-23 14:40:24 +00:00
data=`curl -sL "$host_users"|jq .`
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 09:16:45 +00:00
echo "{\"updated_at\":\"$updated_at_n\"} -s $host/users/$id"
curl -X PATCH -H "Content-Type: application/json" -d "{\"raid_at\": \"$updated_at_n\",\"updated_at\":\"$updated_at_n\",\"token\":\"$token\",\"ten_at\":\"$updated_at_n\"}" -s $host/users/$id
2023-07-23 14:40:24 +00:00
done