This commit is contained in:
lightings 2023-05-18 14:34:55 +08:00
parent 5c722ca1a8
commit be0a4bb224
3 changed files with 114 additions and 3 deletions

View File

@ -273,7 +273,7 @@ class GuildDao {
const qfl = "SELECT * FROM t_guild_members WHERE uid=? AND apply=2";
const rfl = await query_guild(qfl, [uId]);
if (rfl && rfl.length > 0) {
if (rfl[0].g_rank === 10 && rfl[0].guild_idx == gId) {
if (rfl[0].g_rank >= 5 && rfl[0].guild_idx == gId) {
const qfnm =
"SELECT * FROM t_guild_members WHERE uid=? AND guild_idx=?";
const rfnm = await query_guild(qfnm, [nuId, gId]);
@ -291,7 +291,7 @@ class GuildDao {
const qfl = "SELECT * FROM t_guild_members WHERE uid=? AND apply=2 AND guild_idx=?";
const rfl = await query_guild(qfl, [uId, gId]);
if (rfl && rfl.length > 0) {
if (rfl[0].g_rank === 10 && rfl[0].guild_idx == gId) {
if (rfl[0].g_rank >= 5 && rfl[0].guild_idx == gId) {
const qfnm = "SELECT * FROM t_guild_members WHERE uid=? AND guild_idx=?";
const rfnm = await query_guild(qfnm, [nuId, gId]);
if (rfnm && rfnm.length > 0) {

View File

@ -39,7 +39,7 @@ class FriendHandler {
await this.friendService.sendFriendRequest(uid, fid);
next(null, { code: Code.OK, msg: "Friend request sent successfully." });
} catch (err) {
next(null, { code: Code.FAIL, msg: "Failed to send friend request." });
next(null, { code: Code.FAIL, msg: err.message });
}
}

111
r2.sql Normal file
View File

@ -0,0 +1,111 @@
/*
Navicat Premium Data Transfer
Source Server : mysql5
Source Server Type : MySQL
Source Server Version : 50729
Source Host : lsmbp.local:3307
Source Schema : r2
Target Server Type : MySQL
Target Server Version : 50729
File Encoding : 65001
Date: 17/05/2023 19:43:12
*/
SET NAMES utf8mb4;
SET FOREIGN_KEY_CHECKS = 0;
-- ----------------------------
-- Table structure for t_blacklist
-- ----------------------------
DROP TABLE IF EXISTS `t_blacklist`;
CREATE TABLE `t_blacklist` (
`idx` int(11) NOT NULL AUTO_INCREMENT,
`muid` varchar(64) NOT NULL,
`buid` varchar(64) NOT NULL,
PRIMARY KEY (`idx`),
UNIQUE KEY `black` (`muid`,`buid`) USING HASH
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
-- ----------------------------
-- Table structure for t_friends
-- ----------------------------
DROP TABLE IF EXISTS `t_friends`;
CREATE TABLE `t_friends` (
`idx` int(11) NOT NULL AUTO_INCREMENT,
`muid` varchar(64) NOT NULL,
`fuid` varchar(64) NOT NULL,
`apply` int(11) NOT NULL COMMENT '申请状态 0-未通过 2-已通过',
PRIMARY KEY (`idx`),
UNIQUE KEY `link_unique` (`muid`,`fuid`) USING HASH COMMENT '一个玩家与另一个玩家只能建立一个连接关系'
) ENGINE=InnoDB AUTO_INCREMENT=109 DEFAULT CHARSET=utf8;
-- ----------------------------
-- Table structure for t_guild_chat
-- ----------------------------
DROP TABLE IF EXISTS `t_guild_chat`;
CREATE TABLE `t_guild_chat` (
`idx` int(11) NOT NULL AUTO_INCREMENT,
`guild_idx` int(11) NOT NULL,
`content` varchar(255) CHARACTER SET latin1 DEFAULT NULL,
PRIMARY KEY (`idx`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
-- ----------------------------
-- Table structure for t_guild_logs
-- ----------------------------
DROP TABLE IF EXISTS `t_guild_logs`;
CREATE TABLE `t_guild_logs` (
`idx` int(11) NOT NULL AUTO_INCREMENT,
`content` varchar(255) CHARACTER SET latin1 DEFAULT NULL,
PRIMARY KEY (`idx`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
-- ----------------------------
-- Table structure for t_guild_members
-- ----------------------------
DROP TABLE IF EXISTS `t_guild_members`;
CREATE TABLE `t_guild_members` (
`idx` int(11) NOT NULL AUTO_INCREMENT,
`guild_idx` int(11) NOT NULL,
`uid` varchar(64) NOT NULL,
`name` varchar(32) DEFAULT NULL,
`g_rank` int(11) NOT NULL COMMENT '工会官衔 10-会长 5-助理 0-普通成员',
`apply` int(11) NOT NULL COMMENT '申请状态 0-未通过 2-已通过',
`chat_g_last` int(11) NOT NULL DEFAULT '0',
PRIMARY KEY (`idx`),
UNIQUE KEY `guild_idx_uid` (`guild_idx`,`uid`) USING HASH
) ENGINE=InnoDB AUTO_INCREMENT=16 DEFAULT CHARSET=utf8;
-- ----------------------------
-- Table structure for t_guilds
-- ----------------------------
DROP TABLE IF EXISTS `t_guilds`;
CREATE TABLE `t_guilds` (
`idx` int(11) NOT NULL AUTO_INCREMENT,
`gname` varchar(48) CHARACTER SET latin1 NOT NULL,
`logo` varchar(32) DEFAULT NULL COMMENT '工会图标',
`gowner` varchar(64) NOT NULL,
`gownername` varchar(32) DEFAULT NULL,
`gmaxmember` int(11) DEFAULT '100' COMMENT '成员上限',
`announce` varchar(512) DEFAULT NULL COMMENT '公告内容',
PRIMARY KEY (`idx`),
UNIQUE KEY `gname` (`gname`) USING HASH
) ENGINE=InnoDB AUTO_INCREMENT=69 DEFAULT CHARSET=utf8;
-- ----------------------------
-- Table structure for t_users
-- ----------------------------
DROP TABLE IF EXISTS `t_users`;
CREATE TABLE `t_users` (
`idx` int(11) NOT NULL AUTO_INCREMENT,
`account` varchar(64) CHARACTER SET latin1 NOT NULL,
`username` varchar(64) CHARACTER SET latin1 NOT NULL,
`password` varchar(64) CHARACTER SET latin1 NOT NULL,
PRIMARY KEY (`idx`),
UNIQUE KEY `account` (`account`) USING HASH
) ENGINE=InnoDB AUTO_INCREMENT=136 DEFAULT CHARSET=utf8;
SET FOREIGN_KEY_CHECKS = 1;