🎨 优化文章和支付回调,新增返回分享用接口

This commit is contained in:
2025-10-08 16:41:50 +08:00
parent f0ea189553
commit d593476c51
9 changed files with 94 additions and 83 deletions

View File

@@ -3,15 +3,13 @@ package test
import (
"crypto/md5"
"fmt"
"git.echol.cn/loser/lckt/core"
"git.echol.cn/loser/lckt/global"
"git.echol.cn/loser/lckt/initialize"
"git.echol.cn/loser/lckt/task"
"go.uber.org/zap"
"golang.org/x/crypto/bcrypt"
"math/rand"
"net/http"
"net/url"
"strings"
"testing"
"time"
)
@@ -90,15 +88,14 @@ func TestTime(t *testing.T) {
}
func TestTask(t *testing.T) {
global.GVA_VP = core.Viper() // 初始化Viper
global.GVA_LOG = core.Zap() // 初始化zap日志库
zap.ReplaceGlobals(global.GVA_LOG)
global.GVA_DB = initialize.Gorm() // gorm连接数据库
initialize.DBList()
err := task.CheckVip(global.GVA_DB)
if err != nil {
fmt.Println("清理表失败", err.Error())
} else {
fmt.Println("清理表成功")
}
fmt.Println(GetTeacherName("https://lckt.oss-cn-hangzhou.aliyuncs.com/lckt/uploads/2025-09-12/阿弟_6CO8KB8HCSJL_1757684981.jpg"))
}
func GetTeacherName(url string) string {
lastSlash := strings.LastIndex(url, "/")
underscore := strings.Index(url[lastSlash+1:], "_")
if lastSlash == -1 || underscore == -1 {
return ""
}
return url[lastSlash+1 : lastSlash+1+underscore]
}