Skip to content

Commit

Permalink
v 0.9.57.7
Browse files Browse the repository at this point in the history
  • Loading branch information
swling committed Feb 7, 2022
1 parent 1f0f231 commit 791ceb2
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 8 deletions.
6 changes: 6 additions & 0 deletions includes/model/wnd-admin.php
Original file line number Diff line number Diff line change
Expand Up @@ -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");
}
}
2 changes: 0 additions & 2 deletions includes/model/wnd-db.php
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
8 changes: 4 additions & 4 deletions includes/model/wnd-user.php
Original file line number Diff line number Diff line change
Expand Up @@ -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{
Expand All @@ -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);

Expand Down Expand Up @@ -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']);
Expand Down
4 changes: 2 additions & 2 deletions wnd-frontend.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* Plugin Name: Wnd-Frontend
* Plugin URI: https://github.com/swling/wnd-frontend
* Description: Wnd-Frontend 是一套基于 ajax 交互逻辑的 WordPress 前端基础框架。商业用途需购买授权。<a href="https://github.com/swling/wnd-frontend/releases">更新日志</a>
* Version: 0.9.57.6
* Version: 0.9.57.7
* Author: swling
* Author URI: https://wndwp.com
* Requires PHP: 7.3
Expand All @@ -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__));
Expand Down

0 comments on commit 791ceb2

Please sign in to comment.