chore: initial commit of ai site platform

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
whm
2026-07-31 10:19:22 +08:00
commit 6366859bb3
222 changed files with 47313 additions and 0 deletions

View File

@@ -0,0 +1,23 @@
package smsstore
import (
"testing"
"time"
)
func TestIssueAndConsume(t *testing.T) {
s := New(time.Minute, time.Second, "654321")
code, exp, retry, err := s.Issue(PurposeLogin, "13800138000")
if err != nil || code != "654321" || exp <= 0 || retry != 0 {
t.Fatalf("issue %q %d %d %v", code, exp, retry, err)
}
if err := s.Consume(PurposeLogin, "13800138000", "000000"); err == nil {
t.Fatal("bad code should fail")
}
if err := s.Consume(PurposeLogin, "13800138000", "654321"); err != nil {
t.Fatal(err)
}
if err := s.Consume(PurposeLogin, "13800138000", "654321"); err == nil {
t.Fatal("consumed twice")
}
}