From 4e36e21f73bdfe92f6fd036c0bde4b458d1d2614 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=8E=E8=B6=85?= <7546302+red_q@user.noreply.gitee.com> Date: Mon, 17 Mar 2025 00:15:13 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96=E6=8E=88=E6=9D=83=E5=86=85?= =?UTF-8?q?=E5=AE=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- auth/util.go | 3 ++- dbpool/mysqldb.go | 1 + main.go | 8 ++++---- tool/key.go | 1 + 4 files changed, 8 insertions(+), 5 deletions(-) diff --git a/auth/util.go b/auth/util.go index ed96837..7a443b5 100644 --- a/auth/util.go +++ b/auth/util.go @@ -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 { diff --git a/dbpool/mysqldb.go b/dbpool/mysqldb.go index 192d515..4b26a5f 100644 --- a/dbpool/mysqldb.go +++ b/dbpool/mysqldb.go @@ -54,4 +54,5 @@ type Douy_info struct { End_time sql.NullString Surplus_time sql.NullString Key sql.NullString + Status sql.NullString } diff --git a/main.go b/main.go index cfcfeed..1c32db1 100644 --- a/main.go +++ b/main.go @@ -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("没有授权,请联系管理员") } } diff --git a/tool/key.go b/tool/key.go index 1640796..2ab876e 100644 --- a/tool/key.go +++ b/tool/key.go @@ -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"` //状态 } // 解密