From 791ceb25c85b12a1bc156643b7668927b9809898 Mon Sep 17 00:00:00 2001 From: Swling Date: Mon, 7 Feb 2022 10:37:23 +0800 Subject: [PATCH] v 0.9.57.7 --- includes/model/wnd-admin.php | 6 ++++++ includes/model/wnd-db.php | 2 -- includes/model/wnd-user.php | 8 ++++---- wnd-frontend.php | 4 ++-- 4 files changed, 12 insertions(+), 8 deletions(-) diff --git a/includes/model/wnd-admin.php b/includes/model/wnd-admin.php index e6d51452..1f011f8b 100644 --- a/includes/model/wnd-admin.php +++ b/includes/model/wnd-admin.php @@ -242,4 +242,10 @@ private static function v_0_9_57_5() { $wpdb->query("ALTER TABLE $wpdb->wnd_users ADD COLUMN `login_count` BIGINT NOT NULL AFTER `last_login`, ADD INDEX(login_count)"); } + + // 删除自定义用户表 role 及 attribute 字段 + private static function v_0_9_57_7() { + global $wpdb; + $wpdb->query("ALTER TABLE $wpdb->wnd_users DROP COLUMN role, DROP COLUMN attribute"); + } } diff --git a/includes/model/wnd-db.php b/includes/model/wnd-db.php index 9f131a51..4181310f 100644 --- a/includes/model/wnd-db.php +++ b/includes/model/wnd-db.php @@ -69,8 +69,6 @@ public static function create_table() { ID bigint(20) NOT NULL auto_increment, user_id bigint(20) NOT NULL, balance decimal(10, 2) NOT NULL, - role varchar(64) NOT NULL, - attribute varchar(64) NOT NULL, last_login bigint(20) NOT NULL, login_count bigint(20) NOT NULL, client_ip varchar(100) NOT NULL, diff --git a/includes/model/wnd-user.php b/includes/model/wnd-user.php index 7f77b177..81be5c51 100644 --- a/includes/model/wnd-user.php +++ b/includes/model/wnd-user.php @@ -11,7 +11,7 @@ abstract class Wnd_User { /** * 获取自定义用户对象 - * - Users 主要数据:balance、role、attribute、last_login、client_ip + * - Users 主要数据:balance、last_login、client_ip * @since 2019.11.06 */ public static function get_wnd_user(int $user_id): object{ @@ -28,12 +28,12 @@ public static function get_wnd_user(int $user_id): object{ /** * 更新自定义用户对象 - * - Users 主要数据:balance、role、attribute、last_login、client_ip + * - Users 主要数据:balance、last_login、client_ip * - 此处不直接清理用户数据缓存,旨在减少一次数据查询 * @since 2019.11.06 */ public static function update_wnd_user(int $user_id, array $data): bool{ - $defaults = ['user_id' => 0, 'balance' => 0, 'role' => '', 'attribute' => '', 'last_login' => '', 'login_count' => '', 'client_ip' => '']; + $defaults = ['user_id' => 0, 'balance' => 0, 'last_login' => '', 'login_count' => '', 'client_ip' => '']; $db_records = ((array) static::get_wnd_user($user_id)) ?: $defaults; $data = array_merge($db_records, $data); @@ -158,7 +158,7 @@ private static function insert_db(array $data): bool{ } global $wpdb; - $data_format = ['%d', '%f', '%s', '%s', '%d', '%d', '%s']; + $data_format = ['%d', '%f', '%d', '%d', '%s']; $update_ID = $data['ID'] ?? 0; if ($update_ID) { unset($data['ID']); diff --git a/wnd-frontend.php b/wnd-frontend.php index 581e78f4..1e6f0297 100644 --- a/wnd-frontend.php +++ b/wnd-frontend.php @@ -3,7 +3,7 @@ * Plugin Name: Wnd-Frontend * Plugin URI: https://github.com/swling/wnd-frontend * Description: Wnd-Frontend 是一套基于 ajax 交互逻辑的 WordPress 前端基础框架。商业用途需购买授权。更新日志 - * Version: 0.9.57.6 + * Version: 0.9.57.7 * Author: swling * Author URI: https://wndwp.com * Requires PHP: 7.3 @@ -26,7 +26,7 @@ use Wnd\Model\Wnd_Init; // 版本 -define('WND_VER', '0.9.57.6'); +define('WND_VER', '0.9.57.7'); // 定义插件网址路径 define('WND_URL', plugin_dir_url(__FILE__));