update card 17
This commit is contained in:
35
tmp/card_account_change.zsh
Executable file
35
tmp/card_account_change.zsh
Executable file
@ -0,0 +1,35 @@
|
||||
#!/bin/zsh
|
||||
echo old_id old_did new_name
|
||||
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
|
||||
if [ -z "$3" ];then
|
||||
exit
|
||||
fi
|
||||
if [ -z "$4" ];then
|
||||
exit
|
||||
fi
|
||||
|
||||
id=$1
|
||||
data=`curl -sL "$host/users/$id/card?itemsPerPage=2550"`
|
||||
echo $data
|
||||
id_n=$4
|
||||
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"`
|
||||
curl -X POST -H "Content-Type: application/json" -d "{\"owner\":$id_n,\"card\":$card,\"status\":\"$s\",\"cp\":$cp,\"password\":\"$pass\"}" -sL $host/cards
|
||||
done
|
||||
|
24
tmp/card_limit_all.zsh
Executable file
24
tmp/card_limit_all.zsh
Executable file
@ -0,0 +1,24 @@
|
||||
#!/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'`
|
||||
data=`curl -sL "$host_users"|jq .`
|
||||
nd=`date +"%Y%m%d"`
|
||||
|
||||
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`
|
||||
echo "{\"updated_at\":\"$updated_at_n\"} -s $host/users/$id"
|
||||
curl -X PATCH -H "Content-Type: application/json" -d "{\"next\":\"$nd\", \"updated_at\":\"$updated_at_n\",\"token\":\"$token\"}" -s $host/users/$id
|
||||
done
|
61
tmp/card_test.zsh
Executable file
61
tmp/card_test.zsh
Executable file
@ -0,0 +1,61 @@
|
||||
#!/bin/zsh
|
||||
|
||||
username=yui
|
||||
id=381
|
||||
|
||||
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`
|
||||
pass=`cat ~/.config/atr/api_card.json|jq -r .password`
|
||||
host_users="$host/users?itemsPerPage=255"
|
||||
data=`curl -sL "$host_users"|jq .`
|
||||
nd=`date +"%Y%m%d"`
|
||||
nd=20230101
|
||||
|
||||
## users
|
||||
curl -sL "$host/users?itemsPerPage=2550"|jq .
|
||||
read
|
||||
curl -sL "$host/users/$id?itemsPerPage=2550"|jq .
|
||||
read
|
||||
curl -sL "$host/users/$id/card?itemsPerPage=2550"|jq .
|
||||
read
|
||||
|
||||
## cards
|
||||
curl -sL "$host/cards?itemsPerPage=2550"|jq .
|
||||
read
|
||||
|
||||
## token
|
||||
echo "\ntest token (no token)"
|
||||
curl -X PATCH -H "Content-Type: application/json" -d "{\"next\":\"$nd\"}" -s $host/users/$id
|
||||
echo "\ntest token (yes token)"
|
||||
curl -X PATCH -H "Content-Type: application/json" -d "{\"next\":\"$nd\",\"token\":\"$token\"}" -s $host/users/$id
|
||||
|
||||
## delete
|
||||
echo "\ntest delete"
|
||||
data=`curl -sL https://api.syui.ai/users/$id/card`
|
||||
n=`echo $data|jq length`
|
||||
n=$((n - 1))
|
||||
|
||||
for ((i=0;i<=$n;i++))
|
||||
do
|
||||
card=`echo $data|jq -r ".[$i].id"`
|
||||
echo "\ncard id : $card"
|
||||
curl -X DELETE -H "Content-Type: application/json" -d "{'owner':\"$id\"}" $host/cards/$card
|
||||
done
|
||||
curl -X DELETE -H "Content-Type: application/json" https://api.syui.ai/users/$id
|
||||
|
||||
## card select
|
||||
echo "\ntest select card (no password)"
|
||||
curl -X POST -H "Content-Type: application/json" -d "{\"owner\":$id,\"card\":0,\"status\":\"normal\",\"cp\":1}" $host/cards
|
||||
echo "\ntest get card (no password)"
|
||||
curl -X POST -H "Content-Type: application/json" -d "{\"owner\":$id}" $host/cards
|
||||
#echo "\ntest get card (yes password)"
|
||||
#curl -X POST -H "Content-Type: application/json" -d "{\"owner\":$id,\"password\":\"$pass\"}" $host/cards
|
||||
|
||||
## create user
|
||||
echo "\ntest create user (no password)"
|
||||
curl -X POST -H "Content-Type: application/json" -d "{\"username\":\"test\"}" $host/users
|
Reference in New Issue
Block a user