diff --git a/.gitignore b/.gitignore index 11c0625..b5feb04 100644 --- a/.gitignore +++ b/.gitignore @@ -7,3 +7,4 @@ tmp/card_limit.zsh tmp/card_day.zsh tmp/card_delete.zsh memo.md +api diff --git a/ent/migrate/schema.go b/ent/migrate/schema.go index 55420e6..1ed4e83 100644 --- a/ent/migrate/schema.go +++ b/ent/migrate/schema.go @@ -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}, diff --git a/ent/ogent/ogent.go b/ent/ogent/ogent.go index 7c83275..612544b 100644 --- a/ent/ogent/ogent.go +++ b/ent/ogent/ogent.go @@ -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): diff --git a/ent/schema/user.go b/ent/schema/user.go index cce57b8..2df5660 100644 --- a/ent/schema/user.go +++ b/ent/schema/user.go @@ -19,8 +19,9 @@ type User struct { } func Nextime() (tt string){ - t := time.Now().In(jst) - //t := time.Now().Add(time.Hour * 24 * 1).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 } diff --git a/tmp/card_account_change.zsh b/tmp/card_account_change.zsh index a1021ce..0ac7eeb 100755 --- a/tmp/card_account_change.zsh +++ b/tmp/card_account_change.zsh @@ -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 diff --git a/tmp/card_account_delete.zsh b/tmp/card_account_delete.zsh index e8548b6..b814795 100755 --- a/tmp/card_account_delete.zsh +++ b/tmp/card_account_delete.zsh @@ -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 diff --git a/tmp/card_limit_loop.zsh b/tmp/card_limit_loop.zsh new file mode 100755 index 0000000..a60c6af --- /dev/null +++ b/tmp/card_limit_loop.zsh @@ -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 diff --git a/tmp/card_limit_select.zsh b/tmp/card_limit_select.zsh new file mode 100755 index 0000000..cc7c669 --- /dev/null +++ b/tmp/card_limit_select.zsh @@ -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 diff --git a/tmp/model_account.zsh b/tmp/model_account.zsh index ecb006e..a6e3e90 100755 --- a/tmp/model_account.zsh +++ b/tmp/model_account.zsh @@ -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 diff --git a/tmp/ogent/ogent.go b/tmp/ogent/ogent.go index 7c83275..612544b 100644 --- a/tmp/ogent/ogent.go +++ b/tmp/ogent/ogent.go @@ -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):