1
0

fix data -1

This commit is contained in:
syui 2024-02-06 07:21:38 +09:00
parent f1bfdf41fb
commit f7df1224e0
Signed by: syui
GPG Key ID: 5417CFEBAD92DF56
10 changed files with 68 additions and 9 deletions

1
.gitignore vendored
View File

@ -7,3 +7,4 @@ tmp/card_limit.zsh
tmp/card_day.zsh
tmp/card_delete.zsh
memo.md
api

View File

@ -129,7 +129,7 @@ var (
{Name: "ten_post", Type: field.TypeString, Nullable: true},
{Name: "ten_get", Type: field.TypeString, Nullable: true},
{Name: "ten_at", Type: field.TypeTime, Nullable: true},
{Name: "next", Type: field.TypeString, Nullable: true, Default: "20240203"},
{Name: "next", Type: field.TypeString, Nullable: true, Default: "20240213"},
{Name: "room", Type: field.TypeInt, Nullable: true},
{Name: "model", Type: field.TypeBool, Nullable: true},
{Name: "model_at", Type: field.TypeTime, Nullable: true},

View File

@ -198,8 +198,8 @@ func (h *OgentHandler) UpdateCard(ctx context.Context, req *UpdateCardReq, param
// DeleteCard handles DELETE /cards/{id} requests.
func (h *OgentHandler) DeleteCard(ctx context.Context, params DeleteCardParams) (DeleteCardRes, error) {
//err := h.client.Card.DeleteOneID(params.ID).Exec(ctx)
err := h.client.Card.DeleteOneID(0).Exec(ctx)
err := h.client.Card.DeleteOneID(params.ID).Exec(ctx)
//err := h.client.Card.DeleteOneID(0).Exec(ctx)
if err != nil {
switch {
case ent.IsNotFound(err):

View File

@ -19,8 +19,9 @@ type User struct {
}
func Nextime() (tt string){
t := time.Now().In(jst)
//t := time.Now().In(jst)
//t := time.Now().Add(time.Hour * 24 * 1).In(jst)
t := time.Now().AddDate(0, 0, -1).In(jst)
tt = t.Format("20060102")
return
}

View File

@ -27,5 +27,6 @@ do
s=`echo $data|jq -r ".[$i].status"`
cp=`echo $data|jq -r ".[$i].cp"`
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
author=`echo $data|jq -r ".[$i].author"`
curl -X POST -H "Content-Type: application/json" -d "{\"owner\":$id_n,\"card\":$card,\"status\":\"$s\",\"cp\":$cp,\"password\":\"$pass\",\"skill\":\"$skill\",\"author\":\"$author\"}" -sL $host/cards
done

View File

@ -15,5 +15,6 @@ else
s=true
fi
token=`cat ~/.config/atr/api_card.json|jq -r .token`
curl -X PATCH -H "Content-Type: application/json" -d "{\"delete\":$s,\"token\":\"$token\"}" -s $host/users/$id

32
tmp/card_limit_loop.zsh Executable file
View File

@ -0,0 +1,32 @@
#!/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'`
#updated_at_n=`date --iso-8601=seconds`
data=`curl -sL "$host_users"|jq .`
while true
do
for ((id=1221;id<=1230;id++))
do
t=`curl -sL $host/users/$id|jq .code`
sleep 3
if [ $t -ne 404 ];then
echo ok
curl -X PATCH -H "Content-Type: application/json" -d "{\"raid_at\": \"$updated_at_n\",\"updated_at\":\"$updated_at_n\",\"token\":\"$token\",\"ten_at\":\"$updated_at_n\"}" -s $host/users/$id
else
echo $t
fi
done
done

20
tmp/card_limit_select.zsh Executable file
View File

@ -0,0 +1,20 @@
#!/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'`
#updated_at_n=`date --iso-8601=seconds`
data=`curl -sL "$host_users"|jq .`
if [ -z "$1" ];then
exit
fi
id=$1
curl -X PATCH -H "Content-Type: application/json" -d "{\"raid_at\": \"$updated_at_n\",\"updated_at\":\"$updated_at_n\",\"token\":\"$token\",\"ten_at\":\"$updated_at_n\"}" -s $host/users/$id

View File

@ -11,4 +11,7 @@ id=`curl -sL "$host/users?itemsPerPage=2000"|jq ".[]|select(.username == \"$1\")
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
#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
curl -X PATCH -H "Content-Type: application/json" -d "{\"model_critical\":1, \"token\":\"$token\"}" -s $host/users/$id

View File

@ -198,8 +198,8 @@ func (h *OgentHandler) UpdateCard(ctx context.Context, req *UpdateCardReq, param
// DeleteCard handles DELETE /cards/{id} requests.
func (h *OgentHandler) DeleteCard(ctx context.Context, params DeleteCardParams) (DeleteCardRes, error) {
//err := h.client.Card.DeleteOneID(params.ID).Exec(ctx)
err := h.client.Card.DeleteOneID(0).Exec(ctx)
err := h.client.Card.DeleteOneID(params.ID).Exec(ctx)
//err := h.client.Card.DeleteOneID(0).Exec(ctx)
if err != nil {
switch {
case ent.IsNotFound(err):