1
0
api/tmp/card_account_change.zsh

32 lines
683 B
Bash
Raw Normal View History

2023-04-28 09:19:08 +00:00
#!/bin/zsh
2023-05-01 14:00:17 +00:00
echo old_id new_id
2023-04-28 09:19:08 +00:00
host=https://api.syui.ai
pass=`cat ~/.config/atr/api_card.json|jq -r .password`
if [ -z "$1" ];then
exit
fi
if [ -z "$2" ];then
exit
fi
2023-07-01 09:45:06 +00:00
echo old-id new-id
2023-04-28 09:19:08 +00:00
id=$1
data=`curl -sL "$host/users/$id/card?itemsPerPage=2550"`
echo $data
2023-05-01 14:00:17 +00:00
id_n=$2
2023-04-28 09:19:08 +00:00
echo $id_n
read
n=`echo $data|jq length`
n=$((n - 1))
for ((i=0;i<=$n;i++))
do
card=`echo $data|jq -r ".[$i].card"`
s=`echo $data|jq -r ".[$i].status"`
cp=`echo $data|jq -r ".[$i].cp"`
2023-07-01 09:45:06 +00:00
skill=`echo $data|jq -r ".[$i].skill"`
curl -X POST -H "Content-Type: application/json" -d "{\"owner\":$id_n,\"card\":$card,\"status\":\"$s\",\"cp\":$cp,\"password\":\"$pass\",\"skill\":\"$skill\"}" -sL $host/cards
2023-04-28 09:19:08 +00:00
done