add model
This commit is contained in:
21
tmp/card_account_change_fix.zsh
Executable file
21
tmp/card_account_change_fix.zsh
Executable file
@ -0,0 +1,21 @@
|
||||
#!/bin/zsh
|
||||
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`
|
||||
if [ -z "$1" ];then
|
||||
exit
|
||||
fi
|
||||
if [ -z "$2" ];then
|
||||
did=`curl -sL "$host/users?itemsPerPage=2000"|jq ".[]|select(.did == \"$1\")"|jq -r .id`
|
||||
echo $did
|
||||
exit
|
||||
fi
|
||||
|
||||
echo old-id new-id
|
||||
read
|
||||
|
||||
echo account delete $1 token
|
||||
curl -X PATCH -H "Content-Type: application/json" -d "{\"delete\":true,\"token\":\"$token\"}" -s $host/users/$1
|
||||
|
||||
echo account refresh $2 token
|
||||
curl -X PATCH -H "Content-Type: application/json" -d "{\"delete\":false,\"token\":\"$token\"}" -s $host/users/$2
|
@ -8,5 +8,12 @@ if [ -z "$1" ];then
|
||||
fi
|
||||
|
||||
id=$1
|
||||
curl -X PATCH -H "Content-Type: application/json" -d "{\"delete\":true,\"token\":\"$token\"}" -s $host/users/$id
|
||||
s=$2
|
||||
if [ -n "$2" ];then
|
||||
s=$2
|
||||
else
|
||||
s=true
|
||||
fi
|
||||
|
||||
curl -X PATCH -H "Content-Type: application/json" -d "{\"delete\":$s,\"token\":\"$token\"}" -s $host/users/$id
|
||||
|
||||
|
@ -9,8 +9,9 @@ fi
|
||||
echo username
|
||||
read
|
||||
id=`curl -sL "$host/users?itemsPerPage=2000"|jq ".[]|select(.username == \"$1\")"|jq -r .id`
|
||||
card=2
|
||||
cp=$(($RANDOM % 500 + 300))
|
||||
s=3d
|
||||
skill=3d
|
||||
card=7
|
||||
cp=$(($RANDOM % 1000 + 400))
|
||||
s=yui
|
||||
skill=model
|
||||
st=$s
|
||||
curl -X POST -H "Content-Type: application/json" -d "{\"owner\":$id,\"card\":$card,\"status\":\"$s\",\"cp\":$cp,\"password\":\"$pass\",\"skill\":\"$skill\"}" -sL $host/cards
|
||||
|
@ -20,7 +20,7 @@ n=$((n - 1))
|
||||
if [ -n "$1" ];then
|
||||
id=`curl -sL "$host/users?itemsPerPage=2000"|jq ".[]|select(.username == \"$1\")"|jq -r .id`
|
||||
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
|
||||
curl -X PATCH -H "Content-Type: application/json" -d "{\"token\":\"$token\", \"ten_su\": 0}" -s $host/users/$id
|
||||
else
|
||||
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
|
||||
@ -33,6 +33,10 @@ for ((i=0;i<=$n;i++))
|
||||
do
|
||||
name=`echo $data|jq ".[$i]"|jq -r .username`
|
||||
id=`echo $data|jq ".[$i]"|jq -r .id`
|
||||
echo "{\"username\":\"$name\",\"id\":\"$id\"}"
|
||||
if [ $n -ne $i ];then
|
||||
echo ","
|
||||
fi
|
||||
echo "{\"updated_at\":\"$updated_at_n\"} -s $host/users/$id"
|
||||
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
|
||||
|
13
tmp/game_account.zsh
Executable file
13
tmp/game_account.zsh
Executable file
@ -0,0 +1,13 @@
|
||||
#!/bin/zsh
|
||||
host=https://api.syui.ai
|
||||
token=`cat ~/.config/atr/api_card.json|jq -r .token`
|
||||
|
||||
username=ai
|
||||
id=`curl -sL "$host/users?itemsPerPage=2000"|jq ".[]|select(.username == \"$username\")"|jq -r .id`
|
||||
|
||||
curl -sL $host/users/$id
|
||||
read
|
||||
echo $id
|
||||
o=false
|
||||
echo $o
|
||||
curl -X PATCH -H "Content-Type: application/json" -d "{\"game\":true, \"game_test\":$o, \"game_end\":$o, \"token\":\"$token\"}" -s $host/users/$id
|
14
tmp/model_account.zsh
Executable file
14
tmp/model_account.zsh
Executable file
@ -0,0 +1,14 @@
|
||||
#!/bin/zsh
|
||||
host=https://api.syui.ai
|
||||
token=`cat ~/.config/atr/api_card.json|jq -r .token`
|
||||
if [ -z "$1" ];then
|
||||
exit
|
||||
fi
|
||||
echo username
|
||||
read
|
||||
id=`curl -sL "$host/users?itemsPerPage=2000"|jq ".[]|select(.username == \"$1\")"|jq -r .id`
|
||||
|
||||
echo $id
|
||||
read
|
||||
|
||||
curl -X PATCH -H "Content-Type: application/json" -d "{\"model_mode\":1, \"model_skill\":1,\"model_attack\":1,\"model_limit\":1,\"model_critical\":1,\"model_critical_d\":10, \"model\":true,\"token\":\"$token\"}" -s $host/users/$id
|
33
tmp/model_account_all.zsh
Executable file
33
tmp/model_account_all.zsh
Executable file
@ -0,0 +1,33 @@
|
||||
#!/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))
|
||||
|
||||
for ((i=0;i<=$n;i++))
|
||||
do
|
||||
name=`echo $data|jq ".[$i]"|jq -r .username`
|
||||
id=`echo $data|jq ".[$i]"|jq -r .id`
|
||||
model=`echo $data|jq ".[$i]"|jq -r .model`
|
||||
#echo $model
|
||||
if [ "$model" = false ];then
|
||||
card=`curl -sL "$host/users/$id/card?itemsPerPage=2550"|jq -r ".[]|select(.skill == \"model\")"`
|
||||
if [ -n "$card" ];then
|
||||
echo "\n[${id}] $name"
|
||||
curl -X PATCH -H "Content-Type: application/json" -d "{\"model\":true,\"model_limit\": 1,\"token\":\"$token\"}" -s $host/users/$id
|
||||
fi
|
||||
fi
|
||||
done
|
@ -915,7 +915,7 @@ func encodeReadGroupResponse(response ReadGroupRes, w http.ResponseWriter, span
|
||||
}
|
||||
|
||||
func encodeReadUserResponse(response ReadUserRes, w http.ResponseWriter, span trace.Span) error {
|
||||
w.Header().Set("Access-Control-Allow-Origin", "https://card.syui.ai")
|
||||
w.Header().Set("Access-Control-Allow-Origin", "*")
|
||||
switch response := response.(type) {
|
||||
case *UserRead:
|
||||
w.Header().Set("Content-Type", "application/json")
|
||||
|
@ -603,6 +603,46 @@ func (h *OgentHandler) CreateUser(ctx context.Context, req *CreateUserReq) (Crea
|
||||
if v, ok := req.Next.Get(); ok {
|
||||
b.SetNext(v)
|
||||
}
|
||||
if v, ok := req.Model.Get(); ok {
|
||||
b.SetModel(v)
|
||||
}
|
||||
if v, ok := req.ModelAt.Get(); ok {
|
||||
b.SetModelAt(v)
|
||||
}
|
||||
if v, ok := req.ModelAttack.Get(); ok {
|
||||
b.SetModelAttack(v)
|
||||
}
|
||||
if v, ok := req.ModelCriticalD.Get(); ok {
|
||||
b.SetModelCriticalD(v)
|
||||
}
|
||||
if v, ok := req.ModelCritical.Get(); ok {
|
||||
b.SetModelCritical(v)
|
||||
}
|
||||
if v, ok := req.ModelLimit.Get(); ok {
|
||||
b.SetModelLimit(v)
|
||||
}
|
||||
if v, ok := req.ModelSkill.Get(); ok {
|
||||
b.SetModelSkill(v)
|
||||
}
|
||||
if v, ok := req.ModelMode.Get(); ok {
|
||||
b.SetModelMode(v)
|
||||
}
|
||||
if v, ok := req.Game.Get(); ok {
|
||||
b.SetGame(v)
|
||||
}
|
||||
if v, ok := req.GameTest.Get(); ok {
|
||||
b.SetGameTest(v)
|
||||
}
|
||||
if v, ok := req.GameEnd.Get(); ok {
|
||||
b.SetGameEnd(v)
|
||||
}
|
||||
if v, ok := req.GameAccount.Get(); ok {
|
||||
b.SetGameAccount(v)
|
||||
}
|
||||
if v, ok := req.GameLv.Get(); ok {
|
||||
b.SetGameLv(v)
|
||||
}
|
||||
|
||||
// Add all edges.
|
||||
b.AddCardIDs(req.Card...)
|
||||
// Persist to storage.
|
||||
@ -760,6 +800,45 @@ func (h *OgentHandler) UpdateUser(ctx context.Context, req *UpdateUserReq, param
|
||||
if v, ok := req.Next.Get(); ok {
|
||||
b.SetNext(v)
|
||||
}
|
||||
if v, ok := req.Model.Get(); ok {
|
||||
b.SetModel(v)
|
||||
}
|
||||
if v, ok := req.ModelAt.Get(); ok {
|
||||
b.SetModelAt(v)
|
||||
}
|
||||
if v, ok := req.ModelAttack.Get(); ok {
|
||||
b.SetModelAttack(v)
|
||||
}
|
||||
if v, ok := req.ModelCriticalD.Get(); ok {
|
||||
b.SetModelCriticalD(v)
|
||||
}
|
||||
if v, ok := req.ModelCritical.Get(); ok {
|
||||
b.SetModelCritical(v)
|
||||
}
|
||||
if v, ok := req.ModelLimit.Get(); ok {
|
||||
b.SetModelLimit(v)
|
||||
}
|
||||
if v, ok := req.ModelSkill.Get(); ok {
|
||||
b.SetModelSkill(v)
|
||||
}
|
||||
if v, ok := req.ModelMode.Get(); ok {
|
||||
b.SetModelMode(v)
|
||||
}
|
||||
if v, ok := req.Game.Get(); ok {
|
||||
b.SetGame(v)
|
||||
}
|
||||
if v, ok := req.GameTest.Get(); ok {
|
||||
b.SetGameTest(v)
|
||||
}
|
||||
if v, ok := req.GameEnd.Get(); ok {
|
||||
b.SetGameEnd(v)
|
||||
}
|
||||
if v, ok := req.GameAccount.Get(); ok {
|
||||
b.SetGameAccount(v)
|
||||
}
|
||||
if v, ok := req.GameLv.Get(); ok {
|
||||
b.SetGameLv(v)
|
||||
}
|
||||
// Add all edges.
|
||||
if req.Card != nil {
|
||||
b.ClearCard().AddCardIDs(req.Card...)
|
||||
|
35
tmp/user_json.zsh
Executable file
35
tmp/user_json.zsh
Executable file
@ -0,0 +1,35 @@
|
||||
#!/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"
|
||||
data=`curl -sL "$host_users"|jq .`
|
||||
n=`echo $data|jq length`
|
||||
n=$((n - 1))
|
||||
|
||||
f=/Volumes/ssd/project/yui/Content/user.json
|
||||
if [ -f $f ];then
|
||||
rm $f
|
||||
fi
|
||||
|
||||
echo "{" >! $f
|
||||
|
||||
for ((i=0;i<=$n;i++))
|
||||
do
|
||||
name=`echo $data|jq ".[$i]"|jq -r .username`
|
||||
id=`echo $data|jq ".[$i]"|jq -r .id`
|
||||
j="\"$name\":$id"
|
||||
j="\"$name\":\"$id\""
|
||||
if [ $n -ne $i ];then
|
||||
j="${j},"
|
||||
fi
|
||||
echo $j
|
||||
echo $j >> $f
|
||||
done
|
||||
|
||||
echo "}" >> $f
|
Reference in New Issue
Block a user