1
0
This commit is contained in:
2023-09-10 17:53:30 +09:00
parent 1124b851aa
commit a35e67d683
20 changed files with 1263 additions and 177 deletions

View File

@ -19,5 +19,7 @@ id=`curl -sL "$host/users?itemsPerPage=2000"|jq ".[]|select(.username == \"$1\")
card=$2
cp=$3
s=normal
skill=ten
curl -X POST -H "Content-Type: application/json" -d "{\"owner\":$id,\"card\":$card,\"status\":\"$s\",\"cp\":$cp,\"password\":\"$pass\",\"skill\":\"$skill\"}" -sL $host/cards
skill=normal
count=1
author=ai
curl -X POST -H "Content-Type: application/json" -d "{\"owner\":$id,\"card\":$card,\"status\":\"$s\",\"cp\":$cp,\"password\":\"$pass\",\"skill\":\"$skill\",\"count\":$count,\"author\":\"$author\"}" -sL $host/cards

View File

@ -9,8 +9,8 @@ fi
echo username
read
id=`curl -sL "$host/users?itemsPerPage=2000"|jq ".[]|select(.username == \"$1\")"|jq -r .id`
card=16
cp=0
s=super
skill=badge
card=2
cp=$(($RANDOM % 500 + 300))
s=3d
skill=3d
curl -X POST -H "Content-Type: application/json" -d "{\"owner\":$id,\"card\":$card,\"status\":\"$s\",\"cp\":$cp,\"password\":\"$pass\",\"skill\":\"$skill\"}" -sL $host/cards

28
tmp/card_author_first.zsh Executable file
View File

@ -0,0 +1,28 @@
#!/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'`
now_at=`date --iso-8601=seconds`
raid_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))
count=1
for ((i=0;i<=$n;i++))
do
username=`echo $data|jq ".[$i]"|jq -r .username`
uid=`echo $data|jq ".[$i]"|jq -r .id`
acard=`curl -sL "$host/users/$uid/card?itemsPerPage=3000"|jq ".[0]"`
cid=`echo $acard|jq -r .id`
curl -X PATCH -H "Content-Type: application/json" -d "{\"author\":\"$username\", \"count\":$count,\"token\":\"$token\"}" $host/cards/$cid
done

View File

@ -22,7 +22,7 @@ if [ -n "$1" ];then
if [ "ai" = "$1" ] || [ "yui" = "$1" ];then
curl -X PATCH -H "Content-Type: application/json" -d "{\"next\":\"$nd\",\"ten_at\":\"$updated_at_n\", \"updated_at\":\"$updated_at_n\", \"raid_at\":\"$raid_at_n\", \"token\":\"$token\", \"luck_at\": \"$now_at\", \"ten_kai\":0,\"ten\": false}" -s $host/users/$id
else
curl -X PATCH -H "Content-Type: application/json" -d "{\"ten_at\":\"$updated_at_n\", \"token\": \"$token\"}" -s $host/users/$id
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
#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
#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
fi
@ -37,8 +37,6 @@ do
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
#curl -X PATCH -H "Content-Type: application/json" -d "{\"egg_at\":\"$raid_at_n\", \"raid_at\":\"$raid_at_n\",\"token\": \"$token\"}" -s $host/users/$id
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
#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\", \"ten_at\": \"$updated_at_n\"}" -s $host/users/$id
fi
done

View File

@ -29,11 +29,15 @@ curl -X POST -H "Content-Type: application/json" -d "{\"owner\":$id}" $host/card
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 select card (yes password)"
curl -X POST -H "Content-Type: application/json" -d "{\"owner\":$id,\"card\":0,\"status\":\"normal\",\"cp\":1,\"password\":\"$pass\"}" $host/cards
## token
echo "\ntest token (no token)"
curl -X PATCH -H "Content-Type: application/json" -d "{\"next\":\"1\"}" -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
exit
read

View File

@ -506,6 +506,13 @@ func (h *OgentHandler) CreateUser(ctx context.Context, req *CreateUserReq) (Crea
b.SetPassword(req.Password)
if v, ok := req.ServerAt.Get(); ok {
b.SetServerAt(v)
}
if v, ok := req.Room.Get(); ok {
b.SetRoom(v)
}
if v, ok := req.Fav.Get(); ok {
b.SetFav(v)
}
@ -663,6 +670,12 @@ func (h *OgentHandler) UpdateUser(ctx context.Context, req *UpdateUserReq, param
if v == token {
b.SetToken(v)
if v, ok := req.ServerAt.Get(); ok {
b.SetServerAt(v)
}
if v, ok := req.Room.Get(); ok {
b.SetRoom(v)
}
if v, ok := req.Fav.Get(); ok {
b.SetFav(v)
}