From c7b7e919ed5d180a136b3290ac25b4d5ebfcad6c Mon Sep 17 00:00:00 2001 From: wangfuduo Date: Wed, 8 Jul 2026 17:25:02 +0800 Subject: [PATCH] refactor: param int --- app/api/service/user.go | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/app/api/service/user.go b/app/api/service/user.go index 5cd9d53..3fd2ea2 100644 --- a/app/api/service/user.go +++ b/app/api/service/user.go @@ -19,6 +19,10 @@ func (p Params) Str(key string) string { return cast.ToString(p[key]) } +func (p Params) Int(key string) int { + return cast.ToInt(p[key]) +} + type User struct { sess *session.ApiSession params Params @@ -82,7 +86,7 @@ func (u *User) VipCheck() *response.Response { return nil } - free := time.Unix(u.sess.GetUserInfo().ActiveTime, 0).AddDate(0, 0, cast.ToInt(u.params[config.ServiceFreeDay])).Unix() + free := time.Unix(u.sess.GetUserInfo().ActiveTime, 0).AddDate(0, 0, u.params.Int(config.ServiceFreeDay)).Unix() if free-u.sess.GetUserInfo().ActiveTime > 0 { return nil }