优化授权内容

This commit is contained in:
李超 2025-03-17 00:15:13 +08:00
parent 3546ccdd48
commit 4e36e21f73
4 changed files with 8 additions and 5 deletions

View File

@ -22,7 +22,7 @@ func Auth_main() map[string]string {
// var typecho_userss []dbpool.Typecho_users
for rows.Next() {
if err := rows.Scan(&auth_s.Mobile_phone_number, &auth_s.SerialNumber, &auth_s.Username, &auth_s.Initial_time, &auth_s.End_time, &auth_s.Surplus_time, &auth_s.Key); err != nil {
if err := rows.Scan(&auth_s.Mobile_phone_number, &auth_s.SerialNumber, &auth_s.Username, &auth_s.Initial_time, &auth_s.End_time, &auth_s.Surplus_time, &auth_s.Key, &auth_s.Status); err != nil {
log.Println(err)
}
// typecho_userss = append(typecho_userss, users)
@ -42,6 +42,7 @@ func Auth_main() map[string]string {
"end_time": auth_s.End_time.String,
"surplus_time": auth_s.Surplus_time.String,
"key": auth_s.Key.String,
"status": auth_s.Status.String,
}
// b, err := json.Marshal(aa)
// if err != nil {

View File

@ -54,4 +54,5 @@ type Douy_info struct {
End_time sql.NullString
Surplus_time sql.NullString
Key sql.NullString
Status sql.NullString
}

View File

@ -35,7 +35,7 @@ func main() {
if len(os.Args) > 1 {
if keyss {
key := tool.Keyprin(auth.Auth_main()["key"])
if key.End_time != "" {
if key.Status == "2" {
a, _ := strconv.ParseInt(key.End_time, 10, 64)
// b, _ := strconv.ParseInt(key.Initial_time, 10, 64) // 获取的不是当前时间
duration := time.Unix(a, 0).Sub(time.Unix(tool.Timestamp("second"), 0))
@ -51,12 +51,12 @@ func main() {
}
// log.Printf("剩余时间:%d天 %d小时 %d分钟 %d秒", days, hours, minutes, secod) //剩余时间
} else {
log.Println("没有授权")
log.Println("没有授权,请联系管理员")
}
}
if runs {
key := tool.Keyprin(auth.Auth_main()["key"])
if key.End_time != "" {
if key.Status == "2" {
a, _ := strconv.ParseInt(key.End_time, 10, 64)
// b, _ := strconv.ParseInt(key.Initial_time, 10, 64) // 获取的不是当前时间
duration := time.Unix(a, 0).Sub(time.Unix(tool.Timestamp("second"), 0))
@ -106,7 +106,7 @@ func main() {
}
} else {
log.Println("没有授权")
log.Println("没有授权,请联系管理员")
}
}

View File

@ -76,6 +76,7 @@ type Auth_s struct {
Initial_time string `json:"initial_time"` //初始时间
End_time string `json:"end_time"` //结束时间
Surplus_time string `json:"surplus_time"` //授权总时长/天
Status string `json:"status"` //状态
}
// 解密