2023-04-28 09:19:08 +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'`
|
2023-05-24 09:36:44 +00:00
|
|
|
now_at=`date --iso-8601=seconds`
|
|
|
|
raid_at_n=`date --iso-8601=seconds -d '1 days ago'`
|
2023-04-28 09:19:08 +00:00
|
|
|
data=`curl -sL "$host_users"|jq .`
|
|
|
|
nd=`date +"%Y%m%d"`
|
|
|
|
|
|
|
|
n=`echo $data|jq length`
|
|
|
|
n=$((n - 1))
|
|
|
|
|
2023-04-28 14:34:59 +00:00
|
|
|
if [ -n "$1" ];then
|
2023-05-24 09:36:44 +00:00
|
|
|
id=`curl -sL "$host/users?itemsPerPage=2000"|jq ".[]|select(.username == \"$1\")"|jq -r .id`
|
|
|
|
if [ "ai" = "$1" ] || [ "yui" = "$1" ];then
|
2023-11-03 02:24:42 +00:00
|
|
|
curl -X PATCH -H "Content-Type: application/json" -d "{\"token\":\"$token\", \"ten_su\": 0}" -s $host/users/$id
|
2023-05-24 09:36:44 +00:00
|
|
|
else
|
2023-09-10 08:53:30 +00:00
|
|
|
curl -X PATCH -H "Content-Type: application/json" -d "{\"ten_at\":\"$updated_at_n\", \"token\": \"$token\", \"raid_at\":\"$raid_at_n\"}" -s $host/users/$id
|
2023-07-23 14:40:24 +00:00
|
|
|
#curl -X PATCH -H "Content-Type: application/json" -d "{\"updated_at\":\"$updated_at_n\", \"raid_at\":\"$raid_at_n\", \"luck_at\": \"$updated_at_n\",\"egg_at\": \"$updated_at_n\", \"token\": \"$token\"}" -s $host/users/$id
|
2023-07-20 14:18:17 +00:00
|
|
|
#curl -X PATCH -H "Content-Type: application/json" -d "{\"next\":\"$nd\", \"updated_at\":\"$updated_at_n\", \"raid_at\":\"$raid_at_n\", \"luck_at\": \"$updated_at_n\", \"ten_at\": \"$updated_at_n\",\"token\": \"$token\"}" -s $host/users/$id
|
2023-05-24 09:36:44 +00:00
|
|
|
fi
|
2023-04-28 14:34:59 +00:00
|
|
|
exit
|
|
|
|
fi
|
|
|
|
|
2023-04-28 09:19:08 +00:00
|
|
|
for ((i=0;i<=$n;i++))
|
|
|
|
do
|
|
|
|
name=`echo $data|jq ".[$i]"|jq -r .username`
|
|
|
|
id=`echo $data|jq ".[$i]"|jq -r .id`
|
2023-11-03 02:24:42 +00:00
|
|
|
echo "{\"username\":\"$name\",\"id\":\"$id\"}"
|
|
|
|
if [ $n -ne $i ];then
|
|
|
|
echo ","
|
|
|
|
fi
|
2023-04-28 09:19:08 +00:00
|
|
|
echo "{\"updated_at\":\"$updated_at_n\"} -s $host/users/$id"
|
2023-05-24 09:36:44 +00:00
|
|
|
if [ "ai" = "$1" ];then
|
|
|
|
curl -X PATCH -H "Content-Type: application/json" -d "{\"next\":\"$nd\", \"updated_at\":\"$updated_at_n\", \"raid_at\":\"$raid_at_n\", \"token\":\"$token\", \"luck_at\": \"$now_at\", \"luck\": 7}" -s $host/users/$id
|
|
|
|
else
|
2023-08-03 03:32:44 +00:00
|
|
|
curl -X PATCH -H "Content-Type: application/json" -d "{\"next\":\"$nd\", \"updated_at\":\"$updated_at_n\", \"raid_at\":\"$raid_at_n\", \"luck_at\": \"$now_at\",\"ten_at\":\"$updated_at_n\", \"token\": \"$token\"}" -s $host/users/$id
|
2023-05-24 09:36:44 +00:00
|
|
|
fi
|
2023-04-28 09:19:08 +00:00
|
|
|
done
|