diff --git a/controller/admin.php b/controller/admin.php index cf8d1b8..e497e51 100755 --- a/controller/admin.php +++ b/controller/admin.php @@ -303,9 +303,25 @@ if( $page == 'setting/subscribe' ) { $subscribe = array_merge([ 'order_id' => '', 'email' => '', - 'end_time' => '' + 'end_time' => 0 ], $subscribe); + //规范化到期时间:空值统一为0,数字视为时间戳,其它字符串尝试解析 + $end_time = $subscribe['end_time']; + if ( is_numeric($end_time) ) { + $end_time = (int) $end_time; + } + elseif ( is_string($end_time) && $end_time !== '' ) { + $end_time = strtotime($end_time) ?: 0; + } + else { + $end_time = 0; + } + $subscribe['end_time'] = $end_time; + + //是否存在订阅记录:有订单号、邮箱或到期时间即视为已填写 + $has_subscribe = ( $subscribe['order_id'] !== '' || $subscribe['email'] !== '' || $subscribe['end_time'] > 0 ); + //获取当前版本信息 $current_version = explode("-",file_get_contents("version.txt")); $current_version = str_replace("v","",$current_version[0]); diff --git a/controller/api.php b/controller/api.php index ab07dc2..b8e2f05 100755 --- a/controller/api.php +++ b/controller/api.php @@ -427,8 +427,9 @@ function set_subscribe($api) { $data['order_id'] = htmlspecialchars( trim(req_param('order_id', '')) ); //获取邮箱 $data['email'] = htmlspecialchars( trim(req_param('email', '')) ); - //到期时间 - $data['end_time'] = htmlspecialchars( trim(req_param('end_time', '')) ); + //到期时间:统一存为整型时间戳,空值存0 + $end_time = trim(req_param('end_time', '')); + $data['end_time'] = is_numeric($end_time) ? (int) $end_time : 0; //重置订阅状态 session_start(); $_SESSION['subscribe'] = NULL; diff --git a/templates/admin/setting/subscribe.php b/templates/admin/setting/subscribe.php index e2cbce0..06a38e4 100755 --- a/templates/admin/setting/subscribe.php +++ b/templates/admin/setting/subscribe.php @@ -57,16 +57,20 @@ +
- " autocomplete="off" placeholder="订阅到期时间" class="layui-input"> + " autocomplete="off" placeholder="订阅到期时间" class="layui-input">
+
+ + 购买订阅 使用兑换码
diff --git a/version.txt b/version.txt old mode 100755 new mode 100644 index a12822d..e0d75cb --- a/version.txt +++ b/version.txt @@ -1 +1 @@ -v1.3.1-20261023 \ No newline at end of file +v1.3.2-20261029 \ No newline at end of file