|
@@ -1,2450 +0,0 @@
|
|
|
-<?php
|
|
|
-
|
|
|
-//
|
|
|
-//namespace loyalsoft;
|
|
|
-//
|
|
|
-//define("GUILDAPPLYCAPACITY", 99); // 公会申请记录的容量限制
|
|
|
-//define("CREATECODINGTIME", 86400); // 退出公会开除会员后有24小时冷却时间, 不能加入其他公会
|
|
|
-//define("GUILDIDBASE", 100000); // 公会ID开始增长的基础值
|
|
|
-//define("GUILDMAXJOURNALCOUNT", 80); // 公会日志最多存80条记录
|
|
|
-//define("ACCUSESUCCEEDNUM", 3); // 弹劾会长成功人数
|
|
|
-//define("ACCUSEFAILNUM", 2); // 弹劾会长失败人数
|
|
|
-//define("GUILDCUPSCOREREFUSE", 86400); # 公会积分刷新时间间隔
|
|
|
-//// 获取公会列表,PS根据等级排序
|
|
|
-//define("SQLSELECTGUILDBYLEVEL", "SELECT * FROM `tab_guild` where `zoneid`=%d ORDER BY `cupScore` DESC,`createts` LIMIT %s,20;");
|
|
|
-//// 查询公会总数量
|
|
|
-//define("SELECTGUILDCOUNT", "SELECT COUNT(`id`) FROM `tab_guild` where `zoneid`=%d ;");
|
|
|
-//// 通过名称模糊查询公会
|
|
|
-//define("SQLSELECTGUILDBYNAME", "SELECT * FROM `tab_guild` WHERE `zoneid`=%d and (`guildId`=%d OR `name` like '%s') LIMIT 10;");
|
|
|
-//// 通过guildid查询公会
|
|
|
-//define("SQLSELECTGUILDBYGUILDID", "SELECT * FROM `tab_guild` WHERE `zoneid`=%d and `guildId`=%d ;");
|
|
|
-//// 检查公会名称是否已存在 -》 各区也不能重名
|
|
|
-//define("SQLCHECKISNAMEEXIST", "SELECT `id` FROM `tab_guild` WHERE `name`='%s' ");
|
|
|
-//// 创建公会
|
|
|
-//define("SQLCREATEGUILD", "INSERT INTO `tab_guild` (`guildId`, `name`, `createts`,`declare`,`membercount`, `chairman_id`, `chairman_name`,`guild_img`,`zoneid`,`cupScore`,`enableQuickIn`,`condition`) VALUES (%d, '%s',%d, '%s', %d,'%s','%s','%s', %d, %d,%d,'%s'); ");
|
|
|
-//// 更新公会成员数量
|
|
|
-//define("SQLUPDATEGUILDMEMBERCOUNT", "UPDATE `tab_guild` SET `membercount`=%d WHERE `guildId`=%d and `zoneid`=%d ;");
|
|
|
-//// 更新公会的公告/宗旨 徽章
|
|
|
-//define("SQLUPDATEGUILDDECLARE", "UPDATE `tab_guild` SET `declare`='%s',`guild_img`='%s',`enableQuickIn`=%d,`condition`='%s' where `guildId`=%d and `zoneid`=%d;");
|
|
|
-//
|
|
|
-//// 解散公会
|
|
|
-//define("SQLDISSMISS", "DELETE FROM `tab_guild` WHERE `guildId`=%d and `zoneid`=%d; ");
|
|
|
-//// 更新公会会长id name
|
|
|
-//define("SQLUPDATECHAIRMAN", "UPDATE `tab_guild` SET `chairman_id`='%s',`chairman_name`='%s' WHERE `guildId`=%d and `zoneid`=%d ;");
|
|
|
-//// 更新公会积分
|
|
|
-//define("SQLUPDATEGUILDCUPSTORE", "UPDATE `tab_guild` SET `cupScore`=%d WHERE `guildId`=%d and `zoneid`=%d ;");
|
|
|
-//
|
|
|
-///**
|
|
|
-// * Description of GuildProc
|
|
|
-// *
|
|
|
-// * @author cyzhao
|
|
|
-// */
|
|
|
-//class GuildProc {
|
|
|
-//
|
|
|
-// /**
|
|
|
-// * 逻辑分发
|
|
|
-// * 所有的Proc中必须有这样一个方法
|
|
|
-// * @param Req $req
|
|
|
-// */
|
|
|
-// static function procMain($req) {
|
|
|
-//
|
|
|
-//// 筛选玩家等级是否达到 3级
|
|
|
-// //if ($req->userInfo->game->level < glc()->Guild_Join_LeastLevel) {
|
|
|
-// // return ResponseVo::err($req, ErrCode::err_guild_userlevel);
|
|
|
-// //}
|
|
|
-// switch ($req->cmd) {
|
|
|
-// case CmdCode::cmd_guild_getUserGuildInfo: # 7000 查询自己的公会
|
|
|
-// return self::GetUserGuildInfo($req);
|
|
|
-// case CmdCode::cmd_guild_getList: # 7001 查公会列表 公会浏览 列表以cupScore依据 从多到少排列 暂未开放
|
|
|
-// return self::GetGuildList($req);
|
|
|
-// case CmdCode::cmd_guild_refuseGuildCupScore: # 7002 每日一次刷新公会积分
|
|
|
-// return self::refuseGuildCupScore($req);
|
|
|
-// case CmdCode::cmd_guild_searchGuildByID: # 7003 通过id搜索公会
|
|
|
-// return self::SearchByGuildID($req);
|
|
|
-// case CmdCode::cmd_guild_create: # 7004 创建公会
|
|
|
-// return self::CreateGuild($req);
|
|
|
-// case CmdCode:: cmd_guild_apply: # 7005 申请加入
|
|
|
-// return self::ApplyForGuild($req);
|
|
|
-// case CmdCode::cmd_guild_QuickIn: # 7006 一键加入
|
|
|
-// return self::QuickIn($req);
|
|
|
-//// case CmdCode::cmd_guild_GetGuildInfo: # 7007 请求本公会数据
|
|
|
-//// return self::GetGuildInfo($req);
|
|
|
-// case CmdCode::cmd_guild_modifyDeclare: # 7008 编辑
|
|
|
-// return self::ModifyDeclare($req);
|
|
|
-// // case CmdCode::cmd_guild_chairmanQuit: # 7009 会长退会
|
|
|
-// // return self::chairmanQuit($req);
|
|
|
-// case CmdCode::cmd_guild_fireMember: # 7010 开除
|
|
|
-// return self::FireMember($req);
|
|
|
-// case CmdCode::cmd_guild_approve: # 7011 审批 申请
|
|
|
-// return self:: Approve($req);
|
|
|
-// case CmdCode::cmd_guild_setPriceChairman: # 7013 设置 会员 干部 副会长
|
|
|
-// return self::SetViceChairman($req);
|
|
|
-// case CmdCode::cmd_guild_getGuildMembers: # 7014 获取成员信息
|
|
|
-// return self::GetGuildMembers($req);
|
|
|
-// case CmdCode::cmd_guild_quit: # 7016 退会
|
|
|
-// return self::QuitGuild($req);
|
|
|
-// case CmdCode::cmd_guild_InitiateAccuse: # 7017 发起弹劾
|
|
|
-// return self::InitiateAccuseChairMan($req);
|
|
|
-// case CmdCode::cmd_guild_Accuse: # 7018 同意弹劾
|
|
|
-// return self::ApproveAccuseChairMan($req);
|
|
|
-// case CmdCode::cmd_guild_ChairmanCancelAccuse: # 7019 会长取消本次弹劾
|
|
|
-// return self::CancelAccuse($req);
|
|
|
-// case CmdCode::cmd_guild_ApplyUserIntro: # 7020 申请者玩家简介
|
|
|
-// return self::ApplyUserIntro($req);
|
|
|
-// #捐献
|
|
|
-// case CmdCode::cmd_guild_requestDonate: # 7021 请求捐献
|
|
|
-// return self::requestDonate($req);
|
|
|
-// case CmdCode::cmd_guild_donate: # 7022 捐献
|
|
|
-// return self::Donate($req);
|
|
|
-// case CmdCode::cmd_guild_donateInfoRefresh: # 7023 到捐献时间后 刷新
|
|
|
-// return self::donateInfoRefresh($req);
|
|
|
-// #礼包
|
|
|
-// case CmdCode::cmd_guild_buyDonateGift: # 7024 购买捐献度礼包
|
|
|
-// return self::buyDonateGift($req);
|
|
|
-// case CmdCode::cmd_guild_buyGuildCashGift: # 7025 购买公会钻石礼包 弃用
|
|
|
-// return self::buyGuildCashGift($req);
|
|
|
-// #公会公告 邮件 会长 副会长有权限
|
|
|
-// case CmdCode::cmd_guild_announcement: # 7026 公告
|
|
|
-// return self::announcement($req);
|
|
|
-// case CmdCode::cmd_guild_noticeMail: # 7027 公会邮件
|
|
|
-// return self::noticeMail($req);
|
|
|
-// #公会战 未开启状态
|
|
|
-// case CmdCode::cmd_guild_vsFightInvite: #7028 邀请战斗
|
|
|
-// return self::vsFightInvite($req);
|
|
|
-// case CmdCode::cmd_guild_cancelInvite: #7029 取消邀请战斗
|
|
|
-// return self::cancelInvite($req);
|
|
|
-// case CmdCode::cmd_guild_fight: #7030 接受并战斗
|
|
|
-// return self::fight($req);
|
|
|
-// default:
|
|
|
-// return Resp::err(ErrCode::err_msg_cmd);
|
|
|
-// }
|
|
|
-// }
|
|
|
-//
|
|
|
-//// <editor-fold defaultstate="collapsed" desc="公会基础操作">
|
|
|
-//
|
|
|
-// /**
|
|
|
-// * [7000]查询自己的公会信息
|
|
|
-// * 玩家打开公会的时候第一步就是这个,如果没有数据,就显示公会列表吧。
|
|
|
-// * @param Req $req
|
|
|
-// * @return type Description
|
|
|
-// */
|
|
|
-// static function GetUserGuildInfo($req) {
|
|
|
-// $mem = $req->mem;
|
|
|
-// $game = $req->userInfo->game;
|
|
|
-// $uid = $req->uid;
|
|
|
-//
|
|
|
-//
|
|
|
-// $userGuildInfo = self:: getMemUserGuildInfo($mem, $uid, $req->zoneid); // 取玩家公会信息
|
|
|
-// if ($userGuildInfo == null) {
|
|
|
-// $userGuildInfo = UserGuildModel::Clear();
|
|
|
-// } else {
|
|
|
-// GuildProc::refuseGuildCupScore($req); # 公会积分清理
|
|
|
-// UserGuildModel::checkFirstlog($userGuildInfo); # 清理一下每日该清除的内容
|
|
|
-// }
|
|
|
-// UserGuildModel::userGuildInfoInit($userGuildInfo, $uid, $game->baseInfo, $mem, $req->zoneid); # 更新数据
|
|
|
-// if (is_array($userGuildInfo->donateCount)) { # todo:上线后删除
|
|
|
-// $userGuildInfo->donateCount = ObjectInit();
|
|
|
-// }
|
|
|
-// self::updateUserGuildInfo($mem, $uid, $userGuildInfo, $req->zoneid);
|
|
|
-// $resp = Resp::ok($userGuildInfo);
|
|
|
-// return $resp;
|
|
|
-// }
|
|
|
-//
|
|
|
-// /**
|
|
|
-// * [7001]获取公会列表,
|
|
|
-// * @param Req $req
|
|
|
-// */
|
|
|
-// static function GetGuildList($req) { #
|
|
|
-// $mem = $req->mem;
|
|
|
-// $zoneid = $req->zoneid;
|
|
|
-// $paydb = CPayInit(); // 公会信息记录在paydb中了
|
|
|
-////客户端参数解析
|
|
|
-// $page = (count($req->paras) > 0) ? intval($req->paras[0]) : 1; // 起始索引编号
|
|
|
-// $startIndex = ($page - 1) * 20;
|
|
|
-// if ($startIndex < 0) { // 防御代码避免出现 小于0的索引值
|
|
|
-// $startIndex = 0;
|
|
|
-// }
|
|
|
-//
|
|
|
-// $memList = self::getGuildListCache($mem, $page, $zoneid);
|
|
|
-// if ($memList == null || $memList->ts < now()) {
|
|
|
-// $dbret = $paydb->fetch_array(sprintf(SQLSELECTGUILDBYLEVEL, $zoneid, $startIndex)); // 查询数据库取得公会列表
|
|
|
-// $count = $paydb->fetch_row(sprintf(SELECTGUILDCOUNT, $zoneid));
|
|
|
-// $memList = ObjectInit();
|
|
|
-// $memList->ts = now(60); // 设置为3秒好了,如果体验差,再缩短一下
|
|
|
-// $memList->table = $dbret;
|
|
|
-// $memList->count = $count[0];
|
|
|
-// $mem->set(MemKey_Guild::guildListCache($page, $zoneid), $memList); // 更新缓存的公会列表
|
|
|
-// }
|
|
|
-//
|
|
|
-// $result = array(# # 返回值
|
|
|
-// "totalcount" => $memList->count, // # 有多少个公会 分页用
|
|
|
-// "guildlist" => $memList->table # # 该页的公会信息
|
|
|
-// );
|
|
|
-// $resp = Resp::ok($result);
|
|
|
-//
|
|
|
-// $paydb->close();
|
|
|
-// return $resp;
|
|
|
-// }
|
|
|
-//
|
|
|
-// /**
|
|
|
-// * [7002]每日一次刷新公会积分
|
|
|
-// * @param type $req
|
|
|
-// */
|
|
|
-// static function refuseGuildCupScore($req) {
|
|
|
-// $mem = $req->mem;
|
|
|
-// $game = $req->userInfo->game;
|
|
|
-// $uid = $req->uid;
|
|
|
-// $zoneid = $req->zoneid;
|
|
|
-//
|
|
|
-// $userGuildInfo = GuildProc::getMemUserGuildInfo($mem, $uid, $req->zoneid);
|
|
|
-//
|
|
|
-// $guildCupScore = 0;
|
|
|
-// if ($userGuildInfo != null && $userGuildInfo->guildId > 0) {
|
|
|
-// $guildInfo = GuildProc::getMemGuildInfo($mem, $userGuildInfo->guildId, $zoneid);
|
|
|
-// if ($guildInfo != null) {
|
|
|
-// if (now() - $guildInfo->ts_refuse <= GUILDCUPSCOREREFUSE) { # 一天刷一次,以第一个进入公会的玩家为准
|
|
|
-// return;
|
|
|
-// }
|
|
|
-// $guildInfo->ts_refuse = now();
|
|
|
-// $members = $guildInfo->members;
|
|
|
-// foreach ($members as $index => $memberId) {
|
|
|
-// $memberGuildInfo = GuildProc::getMemUserGuildInfo($mem, $memberId, $zoneid);
|
|
|
-// $guildCupScore += $memberGuildInfo->cupScore;
|
|
|
-// }
|
|
|
-// $paydb = CPayInit();
|
|
|
-// $dbret = $paydb->query(sprintf(SQLUPDATEGUILDCUPSTORE, $guildCupScore, $userGuildInfo->guildId, $zoneid));
|
|
|
-// }
|
|
|
-// }
|
|
|
-// }
|
|
|
-//
|
|
|
-// /**
|
|
|
-// * [7003] 通过公会ID进行搜索
|
|
|
-// * @param Req $req
|
|
|
-// */
|
|
|
-// static function SearchByGuildID($req) {
|
|
|
-// $mem = $req->mem;
|
|
|
-// $paydb = CPayInit();
|
|
|
-////客户端参数解析
|
|
|
-// $keywords = $req->paras[0]; // 公会ID
|
|
|
-// $sql = sprintf(SQLSELECTGUILDBYNAME, $req->zoneid, $keywords, '%' . $paydb->escape_string($keywords) . '%');
|
|
|
-// $sqlret = $paydb->fetch_array($sql);
|
|
|
-// $resp = Resp::ok(array(
|
|
|
-// "guildInfo" => $sqlret,
|
|
|
-// ));
|
|
|
-// $paydb->close();
|
|
|
-// return $resp;
|
|
|
-// }
|
|
|
-//
|
|
|
-// /**
|
|
|
-// * [7004]创建公会
|
|
|
-// * @param Req $req
|
|
|
-// */
|
|
|
-// static function CreateGuild($req) {
|
|
|
-// $resp = new Resp();
|
|
|
-// $mem = $req->mem;
|
|
|
-// $paydb = CPayInit(); // 公会信息记录在paydb中了
|
|
|
-// $baseInfo = $req->userInfo->game->baseInfo;
|
|
|
-// $zoneid = $req->zoneid;
|
|
|
-// //客户端参数解析
|
|
|
-// $uid = $req->uid; //fromoid
|
|
|
-// $guildName = $req->paras[0]; // 公会 名称
|
|
|
-// $declare = $req->paras[1]; // 公会宗旨
|
|
|
-// $guild_img = $req->paras[2]; // 新增加公会徽章
|
|
|
-// $applyType = $req->paras[3]; // 允许玩家加入的类型
|
|
|
-// $condition = $req->paras[4]; // 条件
|
|
|
-// $gcfg = glc();
|
|
|
-//
|
|
|
-// $userGuildInfo = self:: getMemUserGuildInfo($mem, $uid, $zoneid); // 取玩家公会信息
|
|
|
-//
|
|
|
-// if ($userGuildInfo != null && $userGuildInfo->guildId > 0) { // 查看玩家是否已经加入了某个公会
|
|
|
-// $resp = Resp::err(ErrCode::err_guild_userhasbeenaguildmember);
|
|
|
-// } else {
|
|
|
-//
|
|
|
-// if ($paydb->num_rows(sprintf(SQLCHECKISNAMEEXIST, $guildName)) > 0) { // 检查公会名称是否已存在, 返回公会名称已存在
|
|
|
-// $resp = Resp::err(ErrCode::err_guild_nameexists);
|
|
|
-// } else {
|
|
|
-// if (is_null($guildName) || $guildName === "" || ltrim($guildName) === "") {
|
|
|
-// $resp = Resp::err(ErrCode::err_guild_nameEmputy);
|
|
|
-// } else {
|
|
|
-// if ($guild_img == null) {
|
|
|
-// $resp = Resp::err(ErrCode::err_guild_imgEmputy);
|
|
|
-// } else {
|
|
|
-// if ($baseInfo->gold < $gcfg->Guild_Found_CostGold) { # 检查是否拥有创建公会所需的金币,(等级超过20级,需要金币10万)
|
|
|
-// $resp = Resp::err(ErrCode::err_msg_goldnotenough);
|
|
|
-// } else {
|
|
|
-// UserGameModel::Consume_Gold($baseInfo, $gcfg->Guild_Found_CostGold); //扣除金币
|
|
|
-// $guildInfo = GuildModel::NewGuildInit($mem, $zoneid); // 创建公会MEM数据体,
|
|
|
-// $guildInfo->declare = $declare;
|
|
|
-// $guildInfo->name = $guildName;
|
|
|
-// $guildInfo->members[] = $uid;
|
|
|
-// $guildInfo->chairman_id = $uid;
|
|
|
-// $guildInfo->chairman_name = $baseInfo->name;
|
|
|
-// $guildInfo->guild_img = $guild_img;
|
|
|
-// $guildInfo->enableQuickIn = 0;
|
|
|
-// $guildInfo->chairmanLastLogin = $baseInfo->lastLogin;
|
|
|
-// if ($applyType != null) {
|
|
|
-// $guildInfo->enableQuickIn = $applyType;
|
|
|
-// }
|
|
|
-// $obj = ObjectInit();
|
|
|
-// $obj->cupScore = $condition == null ? 0 : $condition;
|
|
|
-// $guildInfo->condition = json_encode($obj);
|
|
|
-// $userGuildInfo = UserGuildModel::Clear(); # 创建/重置玩家公会信息
|
|
|
-// UserGuildModel::userGuildInfoInit($userGuildInfo, $uid, $baseInfo, $mem, $zoneid);
|
|
|
-// $userGuildInfo->guildId = $guildInfo->guildId;
|
|
|
-// $userGuildInfo->position = 'Chairman';
|
|
|
-// $userGuildInfo->guildName = $guildInfo->name;
|
|
|
-// if (GAME_ONLINE) {
|
|
|
-// $userGuildInfo->create_coding = now(CREATECODINGTIME); // 设置冷却时间. Ps, 24小时内不准再创建公会.
|
|
|
-// }
|
|
|
-//
|
|
|
-// $paydb->query(sprintf(SQLCREATEGUILD, $guildInfo->guildId, // Mysql 插入公会记录
|
|
|
-// $paydb->escape_string($guildName), $guildInfo->createts,
|
|
|
-// $paydb->escape_string($declare), count($guildInfo->members), $uid,
|
|
|
-// $paydb->escape_string($baseInfo->name), $guild_img, $zoneid, $score, $guildInfo->enableQuickIn, $guildInfo->condition));
|
|
|
-// self::pushNewJournal($mem, $guildInfo->guildId, GuildJournalModel::CreateJoin($uid, $baseInfo->name), $zoneid);
|
|
|
-//
|
|
|
-// self::updateUserGuildInfo($mem, $uid, $userGuildInfo, $zoneid); // 回写数据
|
|
|
-// self::addGuildInfo($mem, $guildInfo->guildId, $guildInfo, $zoneid);
|
|
|
-// UserProc::updateUserInfo();
|
|
|
-// $resp = Resp::ok($guildInfo); // 设置成功返回值
|
|
|
-// }
|
|
|
-// }
|
|
|
-// }
|
|
|
-// }
|
|
|
-// }
|
|
|
-//
|
|
|
-// $paydb->close();
|
|
|
-// return $resp;
|
|
|
-// }
|
|
|
-//
|
|
|
-// /**
|
|
|
-// * [7005] 申请加入公会
|
|
|
-// * @param Req $req
|
|
|
-// */
|
|
|
-// static function ApplyForGuild($req) {
|
|
|
-// $resp = new Resp();
|
|
|
-// $mem = $req->mem;
|
|
|
-// $game = $req->userInfo->game;
|
|
|
-// $uid = $req->uid; // fromoid
|
|
|
-// $zoneid = $req->zoneid;
|
|
|
-// //$map = $req->userInfo->map;
|
|
|
-// // 公会相关数据模型
|
|
|
-// //客户端参数解析
|
|
|
-// $guildId = $req->paras[0]; // 公会ID
|
|
|
-// // 取玩家公会信息
|
|
|
-// $userGuildInfo = self:: getMemUserGuildInfo($mem, $uid, $zoneid);
|
|
|
-// if ($userGuildInfo != null && $userGuildInfo->guildId > 0) { // 玩家已经加入某个公会
|
|
|
-// $resp = Resp::err(ErrCode::err_guild_userhasbeenaguildmember);
|
|
|
-// } else if ($userGuildInfo != null && $userGuildInfo->create_coding > now()) {
|
|
|
-// $resp = Resp::err(ErrCode::err_guild_dissmisscodingtime); // 冷却中
|
|
|
-// } else {
|
|
|
-// $guildInfo = self::getMemGuildInfo($mem, $guildId, $zoneid); // 公会信息
|
|
|
-// if ($guildInfo == null) { # 找不到公会
|
|
|
-// $resp = Resp::err(ErrCode::err_guild_guildinfono);
|
|
|
-// } else if (self::checkmemberfull($guildInfo)) { // 公会已满 Ps.公会成员数量 20~60
|
|
|
-// $resp = Resp::err(ErrCode::err_guild_memberfull);
|
|
|
-// } else if (count((array) $guildInfo->applylist) >= glc()->Guild_ApplyCapacityLimit) {
|
|
|
-// $resp = Resp::err(ErrCode::err_guild_applyListFull); // 申请队列已满
|
|
|
-// } elseif ($guildInfo->enableQuickIn == 2) {
|
|
|
-// $resp = Resp::err(ErrCode::err_guild_noallowaddguild);
|
|
|
-// } elseif ($guildInfo->enableQuickIn == 1 && $guildInfo->condition->cupScore > $userGuildInfo->cupScore) {
|
|
|
-// $resp = Resp::err(ErrCode::err_guild_applyconditionnoenough);
|
|
|
-// } else { // 如果此人已经申请过, 直接替换掉
|
|
|
-// $is_apply = true;
|
|
|
-// if (CommUtil::isPropertyExists($guildInfo->applylist, $uid)) {
|
|
|
-// if (!CommUtil::isPropertyExists($userGuildInfo, 'appliedguildRecord')) {
|
|
|
-// $userGuildInfo->appliedguildRecord = ObjectInit();
|
|
|
-// }
|
|
|
-// $appliedguildRecord = $userGuildInfo->appliedguildRecord;
|
|
|
-// if (CommUtil::isPropertyExists($appliedguildRecord, $guildId)) {
|
|
|
-// if ($appliedguildRecord->$guildId->dealSign == 0 && $appliedguildRecord->$guildId->deal_coolingts > now()) {//已经发送过申请但是没有被处理
|
|
|
-// $is_apply = false;
|
|
|
-// $resp = Resp::err(ErrCode::err_guild_applymsgalwaysexist);
|
|
|
-// } elseif ($appliedguildRecord->$guildId->dealSign == 1 && $appliedguildRecord->$guildId->deal_coolingts > now()) {//该申请已经被拒绝,但是还在冷却时间内
|
|
|
-// $is_apply = false;
|
|
|
-// $resp = Resp::err(ErrCode::err_guild_applymsgrejected);
|
|
|
-// }
|
|
|
-// }
|
|
|
-// }
|
|
|
-//
|
|
|
-// if ($is_apply) {
|
|
|
-// $appinfo = UserApplyForGuildModel::CreateApplyInfo($uid, $game->baseInfo->name, $game->baseInfo->level); // t添加请求信息
|
|
|
-// $guildInfo->applylist->$uid = $appinfo;
|
|
|
-// if ($userGuildInfo == null) {
|
|
|
-// $userGuildInfo = UserGuildModel::Clear();
|
|
|
-// }
|
|
|
-// if (!in_array($guildId, $userGuildInfo->appliedguildlist)) {
|
|
|
-// $userGuildInfo->appliedguildlist[] = $guildId;
|
|
|
-// }
|
|
|
-// $userGuildInfo->appliedguildRecord->$guildId->dealSign = 0;
|
|
|
-// $userGuildInfo->appliedguildRecord->$guildId->deal_coolingts = now(glc()->Guild_MoreApplyLimit);
|
|
|
-//
|
|
|
-// self::updateUserGuildInfo($mem, $uid, $userGuildInfo, $zoneid); // 回写数据
|
|
|
-// self::updateGuildInfo($mem, $guildId, $guildInfo, $zoneid);
|
|
|
-//
|
|
|
-// $resp = Resp::ok($userGuildInfo); // 设置成功返回值
|
|
|
-// }
|
|
|
-// }
|
|
|
-// }
|
|
|
-// return $resp;
|
|
|
-// }
|
|
|
-//
|
|
|
-// /**
|
|
|
-// * [7006] 一键加入公会
|
|
|
-// * @param Req $req
|
|
|
-// * @return Resp
|
|
|
-// */
|
|
|
-// static function QuickIn($req) {
|
|
|
-// $resp = new Resp();
|
|
|
-// $mem = $req->mem;
|
|
|
-// $game = $req->userInfo->game->baseInfo;
|
|
|
-// $zoneid = $req->zoneid;
|
|
|
-// $uid = $req->uid; //fromoid
|
|
|
-// // 公会相关数据模型
|
|
|
-// //客户端参数解析
|
|
|
-// $guildId = $req->paras[0]; // 公会ID
|
|
|
-// // 取玩家公会信息
|
|
|
-// $userGuildInfo = self:: getMemUserGuildInfo($mem, $uid, $zoneid);
|
|
|
-// if ($userGuildInfo != null && $userGuildInfo->guildId > 0) { // 玩家已经加入某个公会
|
|
|
-// $resp = Resp::err(ErrCode::err_guild_userhasbeenaguildmember);
|
|
|
-// } else if ($userGuildInfo != null && $userGuildInfo->create_coding > now()) {
|
|
|
-//
|
|
|
-// $resp = Resp::err(ErrCode::err_guild_dissmisscodingtime); // 冷却中
|
|
|
-// } else {
|
|
|
-// $guildInfo = self::getMemGuildInfo($mem, $guildId, $zoneid); // 公会信息
|
|
|
-// if ($guildInfo == null) { # 找不到公会
|
|
|
-// $resp = Resp::err(ErrCode::err_guild_guildinfono);
|
|
|
-// } else if (self::checkmemberfull($guildInfo)) { // 公会已满 Ps.公会成员数量 20~60
|
|
|
-// $resp = Resp::err(ErrCode::err_guild_memberfull);
|
|
|
-// } else if ($guildInfo->enableQuickIn != 0) { # 公会未开启一键加入功能
|
|
|
-// $resp = Resp::err(ErrCode::err_guild_quickinclosed);
|
|
|
-// } else {
|
|
|
-// if ($userGuildInfo == null) {
|
|
|
-// $userGuildInfo = UserGuildModel::Clear();
|
|
|
-// }
|
|
|
-// // 直接接上审批流程
|
|
|
-// $guildInfo->members[] = $uid; // 改写玩家公会信息
|
|
|
-// $userGuildInfo->guildId = $guildId; // 清空玩家申请记录
|
|
|
-// $userGuildInfo->guildName = $guildInfo->name == null ? "" : $guildInfo->name;
|
|
|
-// $userGuildInfo->appliedguildlist = array();
|
|
|
-// $userGuildInfo->joints = now();
|
|
|
-// $userGuildInfo->position = 'Member';
|
|
|
-//
|
|
|
-// self::updateGuildMemberCount($guildInfo, $zoneid); // 同步更新一下数据库中公会成员数量
|
|
|
-// self::updateUserGuildInfo($mem, $uid, $userGuildInfo, $zoneid); // 回写玩家公会数据
|
|
|
-// self::pushNewJournal($mem, $guildId, GuildJournalModel::CreateJoin($uid, $game->name), $zoneid); // 插入日志
|
|
|
-// self::updateGuildInfo($mem, $guildId, $guildInfo, $zoneid); // 回写公会信息
|
|
|
-// $resp = Resp::ok($userGuildInfo); // 设置成功返回值
|
|
|
-// }
|
|
|
-// }
|
|
|
-// return $resp;
|
|
|
-// }
|
|
|
-//
|
|
|
-// /**
|
|
|
-// * [7008]编辑
|
|
|
-// * @param Req $req
|
|
|
-// */
|
|
|
-// static function ModifyDeclare($req) {
|
|
|
-// $resp = new Resp();
|
|
|
-// $mem = $req->mem;
|
|
|
-// $paydb = CPayInit(); // 公会信息记录在paydb中了
|
|
|
-// $msgid = $req->msgid;
|
|
|
-// $zoneid = $req->zoneid;
|
|
|
-////客户端参数解析
|
|
|
-// $uid = $req->uid; // fromoid
|
|
|
-// $guildId = $req->paras[0]; // 公会ID
|
|
|
-// $guildEmblem = $req->paras[1]; // 徽章
|
|
|
-// $declare = $req->paras[2]; // 宗旨
|
|
|
-// $addType = $req->paras[3]; // 允许加入类型
|
|
|
-// $condition = $req->paras[4]; //条件
|
|
|
-//
|
|
|
-// $userGuildInfo = self:: getMemUserGuildInfo($mem, $uid, $zoneid); // 取玩家公会信息
|
|
|
-// if ($userGuildInfo == null) {
|
|
|
-// $resp = Resp::err(ErrCode::err_guild_userguildinfono);
|
|
|
-// } else {
|
|
|
-// $guildInfo = GuildProc::getMemGuildInfo($mem, $guildId, $zoneid);
|
|
|
-// if ($guildInfo == null) {
|
|
|
-// $resp = Resp::err(ErrCode::err_guild_guildinfono);
|
|
|
-// } else {
|
|
|
-// if (!self::isGuildMember($userGuildInfo, $guildId)) { // 玩家不属于公会
|
|
|
-// $resp = Resp::err(ErrCode::err_guild_usernotguildmember);
|
|
|
-// } else if (!self::checkPermission($uid, $guildInfo)) {
|
|
|
-// $resp = Resp::err(ErrCode::err_guild_usernotchairman);
|
|
|
-// } else {
|
|
|
-// #修改入会申请类型
|
|
|
-// $guildInfo->enableQuickIn = $addType == null ? 0 : $addType;
|
|
|
-//
|
|
|
-// if (!CommUtil::isPropertyExists($guildInfo, 'condition')) {
|
|
|
-// $obj = ObjectInit();
|
|
|
-// $obj->cupScore = 0;
|
|
|
-// $guildInfo->condition = json_encode($obj);
|
|
|
-// }
|
|
|
-//
|
|
|
-// #修改入会限制积分
|
|
|
-// $obj = ObjectInit();
|
|
|
-// $obj->cupScore = $condition == null ? 0 : $condition;
|
|
|
-// $guildInfo->condition = json_encode($obj);
|
|
|
-// #修改公会宗旨
|
|
|
-// $guildInfo->declare = $declare;
|
|
|
-// #修改公会徽章
|
|
|
-// $guildInfo->guild_img = $guildEmblem == null ? 0 : $guildEmblem;
|
|
|
-// $dbret = $paydb->query(sprintf(SQLUPDATEGUILDDECLARE, $paydb->escape_string($declare), $guildEmblem, $guildInfo->enableQuickIn, $guildInfo->condition, $guildId, $zoneid));
|
|
|
-//// 回写用户数据
|
|
|
-// self::updateGuildInfo($mem, $guildId, $guildInfo, $zoneid);
|
|
|
-//// 设置成功返回值
|
|
|
-// $resp = Resp::ok(array(
|
|
|
-// "result" => 0,
|
|
|
-// ));
|
|
|
-// }
|
|
|
-// }
|
|
|
-// }
|
|
|
-// $paydb->close();
|
|
|
-// return $resp;
|
|
|
-// }
|
|
|
-//
|
|
|
-// /**
|
|
|
-// * [7010]开除会员
|
|
|
-// * @param Req $req
|
|
|
-// */
|
|
|
-// static function FireMember($req) {
|
|
|
-// $resp = new Resp();
|
|
|
-// $mem = $req->mem;
|
|
|
-// $msgid = $req->msgid;
|
|
|
-// $zoneid = $req->zoneid;
|
|
|
-//
|
|
|
-////客户端参数解析
|
|
|
-// $uid = $req->uid; //fromoid
|
|
|
-// $guildId = $req->paras[0]; // 公会ID
|
|
|
-// $firedid = $req->paras[1]; // 被开除的玩家OpenID
|
|
|
-//// 取被开除玩家公会信息
|
|
|
-// $userGuildInfo = self::getMemUserGuildInfo($mem, $firedid, $zoneid);
|
|
|
-// if ($userGuildInfo == null) { // 找不到玩家公会信息
|
|
|
-// $resp = Resp::err(ErrCode::err_guild_userguildinfono);
|
|
|
-// } else {
|
|
|
-//// 取公会信息
|
|
|
-// $guildInfo = self::getMemGuildInfo($mem, $guildId, $zoneid);
|
|
|
-// if ($guildInfo == null) { // 找不到公会信息
|
|
|
-// $resp = Resp::err(ErrCode::err_guild_guildinfono);
|
|
|
-// } else {
|
|
|
-// if ($uid == $firedid) { # 开除自己
|
|
|
-// $resp = Resp::err(ErrCode::err_guild_cannotfireyourself);
|
|
|
-// } elseif ($firedid == $guildInfo->chairman_id) {
|
|
|
-// $resp = Resp::err(ErrCode::err_guild_cannotfireychairman);
|
|
|
-// } else {
|
|
|
-// $allow = true;
|
|
|
-// if (self::isGuildChairman($uid, $guildInfo)) {
|
|
|
-// StlUtil::arrayRemove($guildInfo->members, $firedid); // 公会列表中移除玩家Id
|
|
|
-// if (self::isViceChairman($firedid, $guildInfo)) {
|
|
|
-// self::removeViceChairman($guildInfo, $firedid);
|
|
|
-// }
|
|
|
-// if (self::isOfficerChairman($firedid, $guildInfo)) {
|
|
|
-// self::removeOfficerChairman($guildInfo, $firedid);
|
|
|
-// }
|
|
|
-// } elseif (self::isViceChairman($uid, $guildInfo)) {
|
|
|
-// if (self::isViceChairman($firedid, $guildInfo)) {
|
|
|
-// $allow = false;
|
|
|
-// } else {
|
|
|
-// StlUtil::arrayRemove($guildInfo->members, $firedid); // 公会列表中移除玩家Id
|
|
|
-// if (self::isOfficerChairman($firedid, $guildInfo)) {
|
|
|
-// self::removeOfficerChairman($guildInfo, $firedid);
|
|
|
-// }
|
|
|
-// }
|
|
|
-// } elseif (self::isOfficerChairman($uid, $guildInfo)) {
|
|
|
-// if (self::checkPermissiona_addofficer($firedid, $guildInfo)) {//没有权限开除
|
|
|
-// $allow = false;
|
|
|
-// } else {
|
|
|
-// StlUtil::arrayRemove($guildInfo->members, $firedid); // 公会列表中移除玩家Id
|
|
|
-// }
|
|
|
-// }
|
|
|
-//
|
|
|
-// if ($allow) {
|
|
|
-// if (self::isGuildMember($userGuildInfo, $guildId)) {
|
|
|
-// $userGuildInfo = UserGuildModel::Clear(); // 玩家公会信息清空
|
|
|
-// if (GAME_ONLINE) { // 设置冷却时间. Ps, 24小时内不准再创建公会.
|
|
|
-// $userGuildInfo->create_coding = now(CREATECODINGTIME);
|
|
|
-// }
|
|
|
-// self::updateUserGuildInfo($mem, $firedid, $userGuildInfo, $zoneid); // 更新被开除玩家的公会信息
|
|
|
-// }
|
|
|
-// self::updateGuildMemberCount($guildInfo, $zoneid); // 同步更新一下公会成员数量
|
|
|
-// self::updateGuildInfo($mem, $guildId, $guildInfo, $zoneid); // 更新公会数据
|
|
|
-//
|
|
|
-// $resp = Resp::ok(array(
|
|
|
-// "result" => 0,
|
|
|
-// )); // 设置成功返回值
|
|
|
-// } else {
|
|
|
-// $resp = Resp::err(ErrCode::err_guild_nopermission);
|
|
|
-// }
|
|
|
-// }
|
|
|
-// }
|
|
|
-// }
|
|
|
-//
|
|
|
-// return $resp;
|
|
|
-// }
|
|
|
-//
|
|
|
-// /**
|
|
|
-// * [7011]审批入会申请
|
|
|
-// * @param Req $req
|
|
|
-// */
|
|
|
-// static function Approve($req) {
|
|
|
-// $resp = new Resp();
|
|
|
-// $mem = $req->mem;
|
|
|
-// $msgid = $req->msgid;
|
|
|
-// $zoneID = $req->zoneid;
|
|
|
-////客户端参数解析
|
|
|
-// $uid = $req->uid; //fromoid
|
|
|
-// $guildId = $req->paras[0]; // 公会ID
|
|
|
-// $targetId = $req->paras[1]; // 申请者ID
|
|
|
-// $approved = $req->paras[2]; // 审批结果
|
|
|
-// //$pf = $req->paras[3]; // 平台
|
|
|
-//
|
|
|
-// $userGuildInfo = self:: getMemUserGuildInfo($mem, $uid, $zoneID); // 取玩家公会信息
|
|
|
-// if ($userGuildInfo == null) {
|
|
|
-// $resp = Resp::err(ErrCode::err_guild_userguildinfono);
|
|
|
-// } else { //
|
|
|
-// $guildInfo = self::getMemGuildInfo($mem, $guildId, $zoneID);
|
|
|
-// if ($guildInfo == null) {
|
|
|
-// $resp = Resp::err(ErrCode::err_guild_guildinfono);
|
|
|
-// } else {
|
|
|
-// if (!self::isGuildMember($userGuildInfo, $guildId)) { // 玩家不属于公会
|
|
|
-// $resp = Resp::err(ErrCode::err_guild_usernotguildmember);
|
|
|
-//// } else if (!self::isGuildChairman($oid, $guildInfo)) {
|
|
|
-// } else if (!self::checkPermissiona_addofficer($uid, $guildInfo)) {
|
|
|
-// $resp = Resp::err(ErrCode::err_guild_usernotchairman);
|
|
|
-// } else if ($approved && self::checkmemberfull($guildInfo)) {
|
|
|
-// $resp = Resp::err(ErrCode::err_guild_memberfull); // 公会已满
|
|
|
-// } else {
|
|
|
-// $msg = new UserApplyForGuildModel();
|
|
|
-// $msg = $guildInfo->applylist->$targetId;
|
|
|
-// if ($msg == null) {
|
|
|
-// $resp = Resp::err(ErrCode::err_guild_appmsgnotfount);
|
|
|
-// } else {
|
|
|
-// $targetUserGuildInfo = GuildProc::getMemUserGuildInfo($mem, $targetId, $zoneID);
|
|
|
-// if ($targetUserGuildInfo != null && $targetUserGuildInfo->guildId > 0) {#如果申请者已经加入一个公会了,直接返回一个错误码,并删除他的申请记录
|
|
|
-// $resp = Resp::err(ErrCode::err_guild_userhasbeenaguildmember);
|
|
|
-// $a = $guildInfo->applylist;
|
|
|
-// unset($a->$targetId);
|
|
|
-// $guildInfo->applylist = $a;
|
|
|
-// self::updateGuildInfo($mem, $guildId, $guildInfo, $zoneID);
|
|
|
-// } else {
|
|
|
-// $msg->approved = $approved;
|
|
|
-// if ($approved) { // 公会添加成员
|
|
|
-// if (CommUtil::isPropertyExists($targetUserGuildInfo->appliedguildRecord, $guildId)) {
|
|
|
-// $apply = $targetUserGuildInfo->appliedguildRecord;
|
|
|
-// unset($apply->$guildId);
|
|
|
-// $targetUserGuildInfo->appliedguildRecord = $apply;
|
|
|
-// }
|
|
|
-//
|
|
|
-// $guildInfo->members[] = $targetId; // 改写玩家公会信息
|
|
|
-// $targetUserGuildInfo->guildId = $guildId; // 清空玩家申请记录
|
|
|
-// $targetUserGuildInfo->guildName = $guildInfo->name;
|
|
|
-// $targetUserGuildInfo->appliedguildlist = array();
|
|
|
-// #$targetUserGuildInfo->uid = $targetId;
|
|
|
-// $targetUserGuildInfo->joints = now();
|
|
|
-// $targetUser = UserProc::getUserInfo($mem, $zoneID, $targetId);
|
|
|
-// #$targetUserGuildInfo->name = $targetUser->game->name;
|
|
|
-// #$targetUserGuildInfo->level = $targetUser->game->level;
|
|
|
-// $targetUserGuildInfo->position = 'Member';
|
|
|
-//
|
|
|
-// self::updateGuildMemberCount($guildInfo, $zoneID); // 同步更新一下数据库中公会成员数量
|
|
|
-// self::pushNewJournal($mem, $guildId, GuildJournalModel::CreateJoin($targetId, $targetUser->game->baseInfo->name), $zoneID); // 插入日志
|
|
|
-// } else {
|
|
|
-// #发送一封邮件通知玩家被拒绝
|
|
|
-// EmailProc::SendGuildApplyRefusedMail($zoneID, $targetId, $guildInfo->name);
|
|
|
-// if (CommUtil::isPropertyExists($targetUserGuildInfo->appliedguildRecord, $guildId)) {
|
|
|
-// $apply = $targetUserGuildInfo->appliedguildRecord->$guildId;
|
|
|
-// $apply->dealSign = 1;
|
|
|
-// $apply->deal_coolingts = now(glc()->Guild_ApplyrefuseCoolLimit);
|
|
|
-// }
|
|
|
-// }
|
|
|
-// $a = $guildInfo->applylist;
|
|
|
-// unset($a->$targetId);
|
|
|
-// $guildInfo->applylist = $a;
|
|
|
-// self::updateUserGuildInfo($mem, $targetId, $targetUserGuildInfo, $zoneID); // 回写玩家公会数据
|
|
|
-// self::updateGuildInfo($mem, $guildId, $guildInfo, $zoneID); // 回写公会信息
|
|
|
-// $resp = Resp::ok($targetUserGuildInfo); // 设置成功返回值
|
|
|
-// }
|
|
|
-// }
|
|
|
-// }
|
|
|
-// }
|
|
|
-// }
|
|
|
-// return $resp;
|
|
|
-// }
|
|
|
-//
|
|
|
-// /**
|
|
|
-// * 【会长】 转让会长身份 弃用
|
|
|
-// * @param Req $req
|
|
|
-// * @return type
|
|
|
-// */
|
|
|
-// static function TransferChair($req) {
|
|
|
-// $resp = new Resp();
|
|
|
-// $mem = $req->mem;
|
|
|
-// $game = $req->userInfo->game;
|
|
|
-// $zoneID = $req->zoneid;
|
|
|
-////客户端参数解析
|
|
|
-// $uid = $req->uid; //fromoid
|
|
|
-// $guildId = $req->paras[0]; // 公会ID
|
|
|
-// $transferedid = $req->paras[1]; // 被转让的玩家OpenID
|
|
|
-//// 取被转让玩家公会信息
|
|
|
-// $userGuildInfo = self::getMemUserGuildInfo($mem, $transferedid, $zoneID);
|
|
|
-// if ($userGuildInfo == null) { // 找不到玩家公会信息
|
|
|
-// $resp = Resp::err(ErrCode::err_guild_userguildinfono);
|
|
|
-// } else {
|
|
|
-//// 取公会信息
|
|
|
-// $guildInfo = self::getMemGuildInfo($mem, $guildId, $zoneID);
|
|
|
-// if ($guildInfo == null) { // 找不到公会信息
|
|
|
-// $resp = Resp::err(ErrCode::err_guild_guildinfono);
|
|
|
-// } else {
|
|
|
-// if (!self::isGuildMember($userGuildInfo, $guildId)) { // 玩家不属于公会
|
|
|
-// $resp = Resp::err(ErrCode::err_guild_usernotguildmember);
|
|
|
-// } else if (!self::isGuildChairman($uid, $guildInfo)) {
|
|
|
-// $resp = Resp::err(ErrCode::err_guild_usernotchairman);
|
|
|
-// } else {
|
|
|
-// $transfereduser = UserProc::getUserInfo($mem, $transferedid, $zoneID);
|
|
|
-// if ($transfereduser == null) {
|
|
|
-// $resp = Resp::err(ErrCode::err_user_no);
|
|
|
-// } else {
|
|
|
-//
|
|
|
-// $guildInfo->chairman_id = $transferedid; // 公会变更会长
|
|
|
-//
|
|
|
-// if (self::isViceChairman($transferedid, $guildInfo)) {
|
|
|
-// self::removeViceChairman($guildInfo, $transferedid);
|
|
|
-// }
|
|
|
-// if (self::isOfficerChairman($uid, $guildInfo)) {
|
|
|
-// self::removeOfficerChairman($guildInfo, $transferedid);
|
|
|
-// }
|
|
|
-// self::updateDBGuildChairmanInfo($zoneID, $transfereduser->game->baseInfo->name, $transferedid, $guildId); // 更新数据库中关于工会的信息
|
|
|
-//// 插入公会日志
|
|
|
-// self::pushNewJournal($mem, $guildId, GuildJournalModel::CreateChangeChairman($uid, $game->baseInfo->name, $transferedid, $transfereduser->game->baseInfo->name), $zoneID);
|
|
|
-//
|
|
|
-// self::updateGuildInfo($mem, $guildId, $guildInfo, $zoneID); // 更新公会数据
|
|
|
-//// 设置成功返回值
|
|
|
-// $resp = Resp::ok(ErrCode::ok);
|
|
|
-// }
|
|
|
-// }
|
|
|
-// }
|
|
|
-// }
|
|
|
-//
|
|
|
-//// 1. 取公会数据
|
|
|
-//// 2. 检查是否会长
|
|
|
-//// 3. 检查是否会员
|
|
|
-//// 4. 从公会中删除会员信息.
|
|
|
-//// 5. 通知会员被开除信息.
|
|
|
-//// 6. 返回成功信息
|
|
|
-//
|
|
|
-// return $resp;
|
|
|
-// }
|
|
|
-//
|
|
|
-// /**
|
|
|
-// * [7013]设置 会员 干部 副会长
|
|
|
-// * @param type $req
|
|
|
-// */
|
|
|
-// static function SetViceChairman($req) {
|
|
|
-// $resp = new Resp();
|
|
|
-// $mem = $req->mem;
|
|
|
-////客户端参数解析
|
|
|
-// $uid = $req->uid; //fromoid
|
|
|
-// $zoneid = $req->zoneid;
|
|
|
-// $guildId = $req->paras[0]; // 公会ID
|
|
|
-// $targetId = $req->paras[1]; // 选中要设置的人员 ID
|
|
|
-// $manType = $req->paras[2]; // 设置人员为何类型 会员 干部 副会长 1 2 3 4 会长 在加一个会长将成员设置为会长的功能
|
|
|
-//
|
|
|
-// $userGuildInfo = self:: getMemUserGuildInfo($mem, $uid, $zoneid); // 取玩家公会信息
|
|
|
-// if ($uid == $targetId) { # 自己不能更改自己的副会长状态
|
|
|
-// $resp = Resp::err(ErrCode::err_guild_nopermission);
|
|
|
-// } else if ($userGuildInfo == null) {
|
|
|
-// $resp = Resp::err(ErrCode::err_guild_userguildinfono);
|
|
|
-// } else {
|
|
|
-// $guildInfo = self::getMemGuildInfo($mem, $guildId, $zoneid);
|
|
|
-// if ($guildInfo == null) {
|
|
|
-// $resp = Resp::err(ErrCode::err_guild_guildinfono);
|
|
|
-// } else {
|
|
|
-// if (!self::isGuildMember($userGuildInfo, $guildId)) { // 玩家不属于公会
|
|
|
-// $resp = Resp::err(ErrCode::err_guild_usernotguildmember);
|
|
|
-// } elseif (self::isGuildChairman($targetId, $guildInfo)) {
|
|
|
-// $resp = Resp::err(ErrCode::err_guild_nopermission);
|
|
|
-// } else {
|
|
|
-// $targetUserGuildInfo = GuildProc::getMemUserGuildInfo($mem, $targetId, $zoneid);
|
|
|
-// if (!self::isGuildMember($targetUserGuildInfo, $guildId)) { # 玩家不是公会成员
|
|
|
-// $resp = Resp::err(ErrCode::err_guild_usernotguildmember);
|
|
|
-// } else {
|
|
|
-// if (!is_array($guildInfo->viceChairManArr)) {
|
|
|
-// $guildInfo->viceChairManArr = ArrayInit();
|
|
|
-// }
|
|
|
-// if (!is_array($guildInfo->officerManArr)) {
|
|
|
-// $guildInfo->officerManArr = ArrayInit();
|
|
|
-// }
|
|
|
-//
|
|
|
-// if (self::isGuildChairman($uid, $guildInfo)) {//会长
|
|
|
-// $err = self::ChairmanSetPosition($guildInfo, $manType, $targetId, $targetUserGuildInfo, $mem, $zoneid);
|
|
|
-// } elseif (self::isViceChairman($uid, $guildInfo)) {//副会长
|
|
|
-// $err = self::ViceChairmanSetPosition($guildInfo, $manType, $targetId, $targetUserGuildInfo);
|
|
|
-// } else {//干部或是会员没有设置职位的权限
|
|
|
-// $err = ErrCode::err_guild_nopermission;
|
|
|
-// }
|
|
|
-//
|
|
|
-// if ($err == ErrCode::ok) {
|
|
|
-// self::updateUserGuildInfo($mem, $targetId, $targetUserGuildInfo, $zoneid);
|
|
|
-// self::updateGuildInfo($mem, $guildId, $guildInfo, $zoneid); // 回写公会信息
|
|
|
-// $resp = Resp::ok(array(
|
|
|
-// "result" => 0,
|
|
|
-// )); // 设置成功返回值
|
|
|
-// } else {
|
|
|
-// $resp = Resp::err($err); // 设置成功返回值
|
|
|
-// }
|
|
|
-// }
|
|
|
-// }
|
|
|
-// }
|
|
|
-// }
|
|
|
-// return $resp;
|
|
|
-// }
|
|
|
-//
|
|
|
-// /**
|
|
|
-// * 【会长】设置 会员 副会长 干部
|
|
|
-// * @param type $req
|
|
|
-// */
|
|
|
-// static function ChairmanSetPosition(&$guildInfo, $manType, $targetId, &$targetUserGuildInfo, $mem, $zoneid) {
|
|
|
-// $err = ErrCode::ok;
|
|
|
-// if (self::isViceChairman($targetId, $guildInfo)) { #要设置的人是副会长
|
|
|
-// if ($manType == 1) {//会员
|
|
|
-// self::removeViceChairman($guildInfo, $targetId);
|
|
|
-// //更改职位
|
|
|
-// $targetUserGuildInfo->position = 'Member';
|
|
|
-// } elseif ($manType == 2) {#干部
|
|
|
-// if (count($guildInfo->officerManArr) >= glc()->Guild_OfficerManLimit) {
|
|
|
-// $err = ErrCode::err_guild_OfficermanFull;
|
|
|
-// } else {
|
|
|
-// self::removeViceChairman($guildInfo, $targetId);
|
|
|
-// $guildInfo->officerManArr[] = $targetId;
|
|
|
-// $targetUserGuildInfo->position = 'Officerman';
|
|
|
-// }
|
|
|
-// } elseif ($manType == 4) {#会长
|
|
|
-// self::removeViceChairman($guildInfo, $targetId);
|
|
|
-// $chairmanInfo = self::getMemUserGuildInfo($mem, $guildInfo->chairman_id, $zoneid);
|
|
|
-// $chairmanInfo->position = 'Member';
|
|
|
-// self::updateUserGuildInfo($mem, $guildInfo->chairman_id, $chairmanInfo, $zoneid);
|
|
|
-// $guildInfo->chairman_id = $targetId;
|
|
|
-// $guildInfo->chairman_name = $targetUserGuildInfo->name;
|
|
|
-// $targetUserGuildInfo->position = 'Chairman';
|
|
|
-// } else {
|
|
|
-// $err = ErrCode::err_guild_positionconflict;
|
|
|
-// }
|
|
|
-// } elseif (self::isOfficerChairman($targetId, $guildInfo)) {#要设置的人是干部
|
|
|
-// if ($manType == 1) {//设置为会员
|
|
|
-// self::removeOfficerChairman($guildInfo, $targetId);
|
|
|
-// //更改职位
|
|
|
-// $targetUserGuildInfo->position = 'Member';
|
|
|
-// } elseif ($manType == 2) {#设置为干部
|
|
|
-// $err = ErrCode::err_guild_positionconflict;
|
|
|
-// } elseif ($manType == 4) {#设置为会长
|
|
|
-// self::removeOfficerChairman($guildInfo, $targetId);
|
|
|
-// $chairmanInfo = self::getMemUserGuildInfo($mem, $guildInfo->chairman_id, $zoneid);
|
|
|
-// $chairmanInfo->position = 'Member';
|
|
|
-// self::updateUserGuildInfo($mem, $guildInfo->chairman_id, $chairmanInfo, $zoneid);
|
|
|
-// $guildInfo->chairman_id = $targetId;
|
|
|
-// $guildInfo->chairman_name = $targetUserGuildInfo->name;
|
|
|
-// $targetUserGuildInfo->position = 'Chairman';
|
|
|
-// } else {#设置为副会长
|
|
|
-// if (count($guildInfo->viceChairManArr) >= glc()->Guild_ViceChairManLimit) {
|
|
|
-// $err = ErrCode::err_guild_viceChairmanFull;
|
|
|
-// } else {
|
|
|
-// self::removeOfficerChairman($guildInfo, $targetId);
|
|
|
-// $guildInfo->viceChairManArr[] = $targetId;
|
|
|
-// $targetUserGuildInfo->position = 'ViceChairman';
|
|
|
-// }
|
|
|
-// }
|
|
|
-// } else {//要设置的人是会员
|
|
|
-// if ($manType == 1) {//设置为会员
|
|
|
-// $err = ErrCode::err_guild_positionconflict;
|
|
|
-// } elseif ($manType == 2) {//设置为干部
|
|
|
-// if (count($guildInfo->officerManArr) >= glc()->Guild_OfficerManLimit) {
|
|
|
-// $err = ErrCode::err_guild_OfficermanFull;
|
|
|
-// } else {
|
|
|
-// $guildInfo->officerManArr[] = $targetId;
|
|
|
-// $targetUserGuildInfo->position = 'Officerman';
|
|
|
-// }
|
|
|
-// } elseif ($manType == 4) {#设置为会长
|
|
|
-// $chairmanInfo = self::getMemUserGuildInfo($mem, $guildInfo->chairman_id, $zoneid);
|
|
|
-// $chairmanInfo->position = 'Member';
|
|
|
-// self::updateUserGuildInfo($mem, $guildInfo->chairman_id, $chairmanInfo, $zoneid);
|
|
|
-// $guildInfo->chairman_id = $targetId;
|
|
|
-// $guildInfo->chairman_name = $targetUserGuildInfo->name;
|
|
|
-// $targetUserGuildInfo->position = 'Chairman';
|
|
|
-// } else {//设置为副会长
|
|
|
-// if (count($guildInfo->viceChairManArr) >= glc()->Guild_ViceChairManLimit) {
|
|
|
-// $err = ErrCode::err_guild_viceChairmanFull;
|
|
|
-// } else {
|
|
|
-// $guildInfo->viceChairManArr[] = $targetId;
|
|
|
-// $targetUserGuildInfo->position = 'ViceChairman';
|
|
|
-// }
|
|
|
-// }
|
|
|
-// }
|
|
|
-// return $err;
|
|
|
-// }
|
|
|
-//
|
|
|
-// /**
|
|
|
-// * 【副会长】设置副会长 干部 会员
|
|
|
-// * @param type $req
|
|
|
-// */
|
|
|
-// static function ViceChairmanSetPosition(&$guildInfo, $manType, $targetId, &$targetUserGuildInfo) {
|
|
|
-// $err = ErrCode::ok;
|
|
|
-// if (self::isViceChairman($targetId, $guildInfo)) { #要设置的人是副会长
|
|
|
-// $err = ErrCode::err_guild_cannotsetpositioncon;
|
|
|
-// } elseif (self::isOfficerChairman($targetId, $guildInfo)) {#要设置的人是干部
|
|
|
-// if ($manType == 1) {//设置为会员
|
|
|
-// self::removeOfficerChairman($guildInfo, $targetId);
|
|
|
-// //更改职位
|
|
|
-// $targetUserGuildInfo->position = 'Member';
|
|
|
-// } else {#
|
|
|
-// $err = ErrCode::err_guild_cannotsetpositioncon;
|
|
|
-// }
|
|
|
-// } else {//要设置的人是会员
|
|
|
-// if ($manType == 2) {//设置为干部
|
|
|
-// if (count($guildInfo->officerManArr) >= glc()->Guild_OfficerManLimit) {
|
|
|
-// $err = ErrCode::err_guild_OfficermanFull;
|
|
|
-// } else {
|
|
|
-// $guildInfo->officerManArr[] = $targetId;
|
|
|
-// $targetUserGuildInfo->position = 'Officerman';
|
|
|
-// }
|
|
|
-// } else {
|
|
|
-// $err = ErrCode::err_guild_cannotsetpositioncon;
|
|
|
-// }
|
|
|
-// }
|
|
|
-// return $err;
|
|
|
-// }
|
|
|
-//
|
|
|
-// /**
|
|
|
-// * [7014] 获取公会成员信息
|
|
|
-// * @param Req $req
|
|
|
-// */
|
|
|
-// static function GetGuildMembers($req) {
|
|
|
-//
|
|
|
-// $resp = new Resp();
|
|
|
-// $mem = $req->mem;
|
|
|
-// //客户端参数解析
|
|
|
-// $zoneID = $req->zoneid;
|
|
|
-// $uid = $req->uid; //fromoid
|
|
|
-// $guildId = $req->paras[0]; // 公会ID
|
|
|
-// // 取公会信息
|
|
|
-// $guildInfo = self::getMemGuildInfo($mem, $guildId, $zoneID);
|
|
|
-// if ($guildInfo == null) { // 找不到公会信息
|
|
|
-// $resp = Resp::err(ErrCode::err_guild_guildinfono);
|
|
|
-// } else {
|
|
|
-// $memberArr = array();
|
|
|
-//// $key_cur = MemKey_GameRun::Game_PVPScoreByZone_zset($zoneID);
|
|
|
-// foreach ($guildInfo->members as $mboid) {
|
|
|
-// $memberInfo = self::getMemUserGuildInfo($mem, $mboid, $zoneID);
|
|
|
-// $userInfo = UserProc::getUserInfo($mem, $zoneID, $mboid);
|
|
|
-// $memberInfo->name = $userInfo->game->baseInfo->name;
|
|
|
-// $memberInfo->level = $userInfo->game->baseInfo->level;
|
|
|
-// $memberInfo->fightPower = self::initFightTeamInfo($mem, $mboid, $zoneID);
|
|
|
-// $memberInfo->uid = $mboid;
|
|
|
-// $memberInfo->img = $userInfo->game->baseInfo->headImg;
|
|
|
-// $memberInfo->imgBorderId = $userInfo->game->baseInfo->imgBorderId;
|
|
|
-//// $score = $mem->zscore($key_cur, $mboid);
|
|
|
-// $memberInfo->cupScore = $score == null ? 0 : $score;
|
|
|
-// $memberInfo->lastLogin = $userInfo->game->baseInfo->lastLogin; #成员最后登陆时间
|
|
|
-// unset($memberInfo->appliedguildlist);
|
|
|
-// unset($memberInfo->appliedguildRecord);
|
|
|
-// $memberArr[] = $memberInfo;
|
|
|
-// }
|
|
|
-//// 设置成功返回值
|
|
|
-// if (!is_string($guildInfo->condition)) {
|
|
|
-// $guildInfo->condition = json_encode($guildInfo->condition);
|
|
|
-// }
|
|
|
-//
|
|
|
-// $chairmanInfo = UserProc::getUserInfo($mem, $zoneID, $guildInfo->chairman_id);
|
|
|
-// $guildInfo->chairmanLastLogin = $chairmanInfo->game->baseInfo->lastLogin;
|
|
|
-//
|
|
|
-// $resp = Resp::ok(array(
|
|
|
-// "guildInfo" => $guildInfo,
|
|
|
-// "member" => $memberArr,
|
|
|
-// ));
|
|
|
-// }
|
|
|
-// return $resp;
|
|
|
-// }
|
|
|
-//
|
|
|
-// /**
|
|
|
-// * [7016]退出公会
|
|
|
-// * @param Req $req
|
|
|
-// */
|
|
|
-// static function QuitGuild($req) {
|
|
|
-// $resp = new Resp();
|
|
|
-// $mem = $req->mem;
|
|
|
-// $game = $req->userInfo->game;
|
|
|
-// // 公会相关数据模型
|
|
|
-// $msgid = $req->msgid;
|
|
|
-// //客户端参数解析
|
|
|
-// $uid = $req->uid; //fromoid
|
|
|
-// $guildId = $req->paras[0]; // 公会ID
|
|
|
-// $chairman = $req->paras[1]; #会长退会 需选一个人做会长
|
|
|
-// $zoneid = $req->zoneid;
|
|
|
-// // 取玩家公会信息
|
|
|
-// $userGuildInfo = self:: getMemUserGuildInfo($mem, $uid, $zoneid);
|
|
|
-// if ($userGuildInfo == null) {
|
|
|
-// $resp = Resp::err(ErrCode::err_guild_userguildinfono);
|
|
|
-// } else {
|
|
|
-// // 公会信息
|
|
|
-// $guildInfo = self::getMemGuildInfo($mem, $guildId, $zoneid);
|
|
|
-// if ($guildInfo == null) {
|
|
|
-// $resp = Resp::err(ErrCode::err_guild_guildinfono);
|
|
|
-// } else {
|
|
|
-// // 玩家是否属于该公会
|
|
|
-// if (!self::isGuildMember($userGuildInfo, $guildId)) {
|
|
|
-// $resp = Resp::err(ErrCode::err_guild_usernotguildmember);
|
|
|
-// } else {
|
|
|
-// if (self::isViceChairman($uid, $guildInfo)) { # 副会长退会.
|
|
|
-// self::removeViceChairman($guildInfo, $uid);
|
|
|
-// } elseif (self::isOfficerChairman($uid, $guildInfo)) {# 干部退会
|
|
|
-// self::removeOfficerChairman($guildInfo, $uid);
|
|
|
-// } elseif (self::isGuildChairman($uid, $guildInfo)) {//如果是会长 会长退出时必须指定下一任会长
|
|
|
-// if (count($guildInfo->members) <= 1) {//只有会长一个人 解散公会
|
|
|
-// $paydb = CPayInit(); // 公会信息记录在paydb中了
|
|
|
-// $sqlret = $paydb->query(sprintf(SQLDISSMISS, $guildId, $zoneid));
|
|
|
-// # 删除公会数据
|
|
|
-// #$mem->delete(MemKey_Guild::getGuildInfo($guildId, $zoneid));
|
|
|
-// #删除公会中journal信息
|
|
|
-// $mem->delete(MemKey_Guild::constGuildJournal($guildId, $zoneid));
|
|
|
-// #结算捐献,删除捐献有关数据
|
|
|
-// $donateInfo = GuildProc::getallGuildRequestDonateInfo($mem, $guildId, $zoneid);
|
|
|
-// foreach ($donateInfo as $index => $donateRequestInfo) {
|
|
|
-// $count = GuildProc::gainUserDonateRecordlistLength($mem, $guildId, $zoneid, $index);
|
|
|
-// GuildProc::donateSettle($mem, $donateRequestInfo, $index, $count, $guildId, $zoneid);
|
|
|
-// }
|
|
|
-// #删除解散公会的捐献缓存key
|
|
|
-// $mem->delete(MemKey_Guild::CacheGuildDonate($guildId, $zoneid));
|
|
|
-// } else {
|
|
|
-// if (self::isViceChairman($chairman, $guildInfo)) {
|
|
|
-// self::removeViceChairman($guildInfo, $chairman);
|
|
|
-// } elseif (self::isOfficerChairman($chairman, $guildInfo)) {
|
|
|
-// self::removeOfficerChairman($guildInfo, $chairman);
|
|
|
-// }
|
|
|
-// $chairmanGuildInfo = self::getMemUserGuildInfo($mem, $chairman, $zoneid);
|
|
|
-// $chairmanGuildInfo->position = 'Chairman';
|
|
|
-// $guildInfo->chairman_id = $chairman;
|
|
|
-// $guildInfo->name = $chairmanGuildInfo->name;
|
|
|
-// self::updateUserGuildInfo($mem, $chairman, $chairmanGuildInfo, $zoneid);
|
|
|
-// }
|
|
|
-// }
|
|
|
-// StlUtil::arrayRemove($guildInfo->members, $uid);
|
|
|
-// $userGuildInfo = UserGuildModel::Clear();
|
|
|
-// // 设置冷却时间. Ps, 24小时内不准再创建公会.
|
|
|
-// if (GAME_ONLINE) {
|
|
|
-// $userGuildInfo->create_coding = now(CREATECODINGTIME);
|
|
|
-// }
|
|
|
-//
|
|
|
-// // todo: 公会日志加入信息
|
|
|
-// self::pushNewJournal($mem, $guildId, GuildJournalModel::CreateQuit($uid, $game->baseInfo->name), $zoneid);
|
|
|
-// // 同步更新一下公会成员数量
|
|
|
-// self::updateGuildMemberCount($guildInfo, $zoneid);
|
|
|
-// // 回写数据
|
|
|
-// self::updateUserGuildInfo($mem, $uid, $userGuildInfo, $zoneid);
|
|
|
-// self::updateGuildInfo($mem, $guildId, $guildInfo, $zoneid);
|
|
|
-// // 设置成功返回值
|
|
|
-// $resp = Resp::ok($guildInfo);
|
|
|
-// }
|
|
|
-// }
|
|
|
-// }
|
|
|
-// return $resp;
|
|
|
-// }
|
|
|
-//
|
|
|
-// /**
|
|
|
-// * [7017] 发起弹劾会长
|
|
|
-// * @param type $req
|
|
|
-// */
|
|
|
-// static function InitiateAccuseChairMan($req) {
|
|
|
-// $resp = new Resp();
|
|
|
-// $mem = $req->mem;
|
|
|
-// $game = $req->userInfo->game;
|
|
|
-//
|
|
|
-// //客户端参数解析
|
|
|
-// $uid = $req->uid; //fromoid
|
|
|
-// $guildId = $req->paras[0]; // 公会ID
|
|
|
-// $zoneid = $req->zoneid;
|
|
|
-//
|
|
|
-// $userGuildInfo = self::getMemUserGuildInfo($mem, $uid, $zoneid);
|
|
|
-// if ($userGuildInfo == null) {
|
|
|
-// $resp = Resp::err(ErrCode::err_guild_userguildinfono);
|
|
|
-// } else {
|
|
|
-// $guildInfo = self::getMemGuildInfo($mem, $guildId, $zoneid);
|
|
|
-// if ($guildInfo == null) {
|
|
|
-// $resp = Resp::err(ErrCode::err_guild_guildinfono);
|
|
|
-// } else {
|
|
|
-// if (!self::isGuildMember($userGuildInfo, $guildId)) {
|
|
|
-// $resp = Resp::err(ErrCode::err_guild_usernotguildmember);
|
|
|
-// } else {
|
|
|
-// $chairmanInfo = UserProc::getUserInfo($mem, $zoneid, $guildInfo->chairman_id);
|
|
|
-// $lastLogin = $chairmanInfo->game->baseInfo->lastLogin; //86400
|
|
|
-// $ts = now() - $lastLogin;
|
|
|
-// if ($ts < glc()->Guild_ChairManLastLoginLimit) {
|
|
|
-// $resp = Resp::err(ErrCode::err_guild_notsatisfiedaccusecondition);
|
|
|
-// } else {
|
|
|
-// if (CommUtil::isPropertyExists($guildInfo, 'accuse_coolTime') && $guildInfo->accuse_coolTime > now()) {
|
|
|
-// $resp = Resp::err(ErrCode::err_guild_accusecooling);
|
|
|
-// } else {
|
|
|
-// $guildInfo->accuse_agreed[] = $uid;
|
|
|
-// $guildInfo->accuseTs = now(glc()->Guild_AccuseChairManTimeLimit);
|
|
|
-// self::updateGuildInfo($mem, $guildId, $guildInfo, $zoneid);
|
|
|
-// # 设置成功返回值
|
|
|
-// $resp = Resp::ok($guildInfo);
|
|
|
-// }
|
|
|
-// }
|
|
|
-// }
|
|
|
-// }
|
|
|
-// }
|
|
|
-// return $resp;
|
|
|
-// }
|
|
|
-//
|
|
|
-// /**
|
|
|
-// * [7018]同意 拒接 弹劾会长
|
|
|
-// * @param type $req
|
|
|
-// */
|
|
|
-// static function ApproveAccuseChairMan($req) {
|
|
|
-// $resp = new Resp();
|
|
|
-// $mem = $req->mem;
|
|
|
-// //$game = $req->userInfo->game;
|
|
|
-// //客户端参数解析
|
|
|
-// $uid = $req->uid; //fromoid
|
|
|
-// $guildId = $req->paras[0]; // 公会ID
|
|
|
-// $is_agreed = $req->paras[1]; // 同意 or 拒绝
|
|
|
-// $zoneid = $req->zoneid;
|
|
|
-//
|
|
|
-// $userGuildInfo = self::getMemUserGuildInfo($mem, $uid, $zoneid);
|
|
|
-// if ($userGuildInfo == null) {
|
|
|
-// $resp = Resp::err(ErrCode::err_guild_userguildinfono);
|
|
|
-// } else {
|
|
|
-// $guildInfo = self::getMemGuildInfo($mem, $guildId, $zoneid);
|
|
|
-// if ($guildInfo == null) {
|
|
|
-// $resp = Resp::err(ErrCode::err_guild_guildinfono);
|
|
|
-// } else {
|
|
|
-// if (!self::isGuildMember($userGuildInfo, $guildId)) {
|
|
|
-// $resp = Resp::err(ErrCode::err_guild_usernotguildmember);
|
|
|
-// } else {
|
|
|
-// if ($guildInfo->accuseTs < now() && $guildInfo->accuseTs > 0) {//不在有效时间内了
|
|
|
-// $resp = Resp::err(ErrCode::err_guild_noaccusevalidtimeperiod);
|
|
|
-// } else {
|
|
|
-// if (in_array($uid, $guildInfo->accuse_agreed) || in_array($uid, $guildInfo->accuse_refuse)) {
|
|
|
-// $resp = Resp::err(ErrCode::err_guild_noallowagainaccuse);
|
|
|
-// } else {
|
|
|
-// if ($is_agreed) {
|
|
|
-// $guildInfo->accuse_agreed[] = $uid;
|
|
|
-// } else {
|
|
|
-// $guildInfo->accuse_refuse[] = $uid;
|
|
|
-// }
|
|
|
-//
|
|
|
-// if (count($guildInfo->accuse_agreed) >= ACCUSESUCCEEDNUM) {//弹劾成功
|
|
|
-// self::accuseSettle($mem, $guildInfo, $guildId, $zoneid);
|
|
|
-// } elseif (count($guildInfo->accuse_refuse) >= ACCUSEFAILNUM) {//失败
|
|
|
-// # 职位不变 弹劾数据清null 冷却时间24小时
|
|
|
-// $guildInfo->accuse_agreed = array();
|
|
|
-// $guildInfo->accuse_refuse = array();
|
|
|
-// $guildInfo->accuseTs = 0;
|
|
|
-// $guildInfo->accuse_coolTime = now(glc()->Guild_AccuseFailCoolingTime);
|
|
|
-// }
|
|
|
-//
|
|
|
-// self::updateGuildInfo($mem, $guildId, $guildInfo, $zoneid);
|
|
|
-//
|
|
|
-// # 设置成功返回值
|
|
|
-// $result = array(
|
|
|
-// "result" => 0,
|
|
|
-// );
|
|
|
-// $resp = Resp::ok($result);
|
|
|
-// }
|
|
|
-// }
|
|
|
-// }
|
|
|
-// }
|
|
|
-// }
|
|
|
-// return $resp;
|
|
|
-// }
|
|
|
-//
|
|
|
-// /**
|
|
|
-// * [7019]会长取消 or 同意 本次弹劾
|
|
|
-// * @param type $req
|
|
|
-// */
|
|
|
-// static function CancelAccuse($req) {
|
|
|
-// $resp = new Resp();
|
|
|
-// $mem = $req->mem;
|
|
|
-// $zoneid = $req->zoneid;
|
|
|
-// //客户端参数解析
|
|
|
-// $is_agree = $req->paras[0];
|
|
|
-// $uid = $req->uid; //会长
|
|
|
-// $userGuildInfo = self::getMemUserGuildInfo($mem, $uid, $zoneid);
|
|
|
-// if ($userGuildInfo == null || $userGuildInfo->guildId <= 0) {
|
|
|
-// $resp = Resp::err(ErrCode::err_guild_usernotguildmember);
|
|
|
-// } else {
|
|
|
-// $guildInfo = self::getMemGuildInfo($mem, $userGuildInfo->guildId, $zoneid);
|
|
|
-// if (!self::isGuildChairman($uid, $guildInfo)) {
|
|
|
-// $resp = Resp::err(ErrCode::err_guild_guildinfono);
|
|
|
-// } else {
|
|
|
-// if (count($guildInfo->accuse_agreed) <= 0) {
|
|
|
-// $resp = Resp::err(ErrCode::err_guild_chairmannoaccused);
|
|
|
-// } else {
|
|
|
-// if ($is_agree) {//会长同意 弹劾 职位降为会员
|
|
|
-// $chairmanId = $guildInfo->chairman_id;
|
|
|
-// $userGuildInfo->position = 'Member';
|
|
|
-//
|
|
|
-// $accuseId = $guildInfo->accuse_agreed[0];
|
|
|
-// $accuseGuildInfo = self::getMemUserGuildInfo($mem, $accuseId, $zoneid);
|
|
|
-// $accuseGuildInfo->position = 'Chairman';
|
|
|
-// if (self::isOfficerChairman($accuseId, $guildInfo)) {
|
|
|
-// self::removeViceChairman($guildInfo, $accuseId);
|
|
|
-// }
|
|
|
-// if (self::isViceChairman($accuseId, $guildInfo)) {
|
|
|
-// self::removeViceChairman($guildInfo, $accuseId);
|
|
|
-// }
|
|
|
-//
|
|
|
-// self::pushNewJournal($mem, $guildInfo->guildId, GuildJournalModel::CreateChangeChairman($chairmanId, $guildInfo->chairman_name, $accuseId, $accuseGuildInfo->name), $zoneid); //加入系统消息 更改会长
|
|
|
-//
|
|
|
-// $guildInfo->chairman_id = $accuseId;
|
|
|
-// $guildInfo->chairman_name = $accuseGuildInfo->name;
|
|
|
-// $guildInfo->accuse_agreed = array();
|
|
|
-// $guildInfo->accuse_refuse = array();
|
|
|
-// $guildInfo->accuseTs = 0;
|
|
|
-// $guildInfo->accuse_coolTime = 0;
|
|
|
-//
|
|
|
-// self::updateGuildChairman($guildInfo, $zoneid);
|
|
|
-// self::updateUserGuildInfo($mem, $chairmanId, $userGuildInfo, $zoneid);
|
|
|
-// self::updateUserGuildInfo($mem, $accuseId, $accuseGuildInfo, $zoneid);
|
|
|
-// } else {//不同意
|
|
|
-// $guildInfo->accuse_agreed = array();
|
|
|
-// $guildInfo->accuse_refuse = array();
|
|
|
-// $guildInfo->accuseTs = 0;
|
|
|
-// $guildInfo->accuse_coolTime = 0;
|
|
|
-// }
|
|
|
-// self::updateGuildInfo($mem, $guildInfo->guildId, $guildInfo, $zoneid);
|
|
|
-// $resp = Resp::ok($guildInfo);
|
|
|
-// }
|
|
|
-// }
|
|
|
-// }
|
|
|
-// return $resp;
|
|
|
-// }
|
|
|
-//
|
|
|
-// /**
|
|
|
-// * [7020]申请者玩家简介
|
|
|
-// */
|
|
|
-// static function ApplyUserIntro($req) {
|
|
|
-// $resp = new Resp();
|
|
|
-// $mem = $req->mem;
|
|
|
-//
|
|
|
-// //客户端参数解析
|
|
|
-// $uid = $req->uid; //审批者
|
|
|
-// $userId = $req->paras[0]; // 请求加入公会者
|
|
|
-// $zoneid = $req->zoneid;
|
|
|
-//
|
|
|
-// $userInfo = UserProc::getUserInfo($mem, $zoneid, $userId);
|
|
|
-// if ($userInfo == null) {
|
|
|
-// $resp = Resp::err(ErrCode::err_user_no);
|
|
|
-// } else {
|
|
|
-// $applyGuildInfo = self::getMemUserGuildInfo($mem, $userInfo->uid, $zoneid);
|
|
|
-// if ($applyGuildInfo == null) {
|
|
|
-// $applyGuildInfo = UserGuildModel::Clear();
|
|
|
-// }
|
|
|
-// #字段更新
|
|
|
-// UserGuildModel::userGuildInfoInit($applyGuildInfo, $userId, $userInfo->game->baseInfo, $mem, $zoneid);
|
|
|
-// $applyGuildInfo->fightPower = GuildProc::initFightTeamInfo($mem, $userId, $zoneid); #$game->heroTeamConfig;
|
|
|
-// $applyGuildInfo->lastLogin = $userInfo->game->baseInfo->lastLogin; #成员最后登陆时间
|
|
|
-// //self::updateUserGuildInfo($mem, $applyGuildInfo->uid, $applyGuildInfo, $zoneid);
|
|
|
-// # 设置成功返回值
|
|
|
-// $resp = Resp::ok($applyGuildInfo);
|
|
|
-// }
|
|
|
-// return $resp;
|
|
|
-// }
|
|
|
-//
|
|
|
-// // const
|
|
|
-//// </editor-fold>
|
|
|
-//// <editor-fold defaultstate="collapsed" desc="公会捐献">
|
|
|
-//
|
|
|
-// /**
|
|
|
-// * [7021] 请求捐献
|
|
|
-// * @param req $req
|
|
|
-// */
|
|
|
-// static function requestDonate($req) {
|
|
|
-// $resp = new Resp();
|
|
|
-// $mem = $req->mem;
|
|
|
-//
|
|
|
-// //客户端参数解析
|
|
|
-// $uid = $req->uid; //请求捐献的人
|
|
|
-// $cardId = $req->paras[0]; // 请求捐献卡牌id
|
|
|
-// $cardCount = $req->paras[1]; //请求捐献数量
|
|
|
-// $heroId = $req->paras[2]; //拥有该碎片的英雄uid
|
|
|
-// $zoneid = $req->zoneid;
|
|
|
-// $game = $req->userInfo->game;
|
|
|
-//
|
|
|
-// $userGuildInfo = self::getMemUserGuildInfo($mem, $uid, $zoneid);
|
|
|
-// if ($userGuildInfo == null || $userGuildInfo->guildId <= 0) {
|
|
|
-// $resp = Resp::err(ErrCode::err_guild_usernotguildmember);
|
|
|
-// } else {
|
|
|
-// $guildId = $userGuildInfo->guildId;
|
|
|
-// $guildInfo = self::getMemGuildInfo($mem, $guildId, $zoneid);
|
|
|
-// if ($guildInfo == null) {
|
|
|
-// $resp = Resp::err(ErrCode::err_guild_guildinfono);
|
|
|
-// } else {
|
|
|
-// if ($cardCount == null || $cardId == null) {
|
|
|
-// $resp = Resp::err(ErrCode::err_guild_requestdonatecannotnull);
|
|
|
-// } else {
|
|
|
-// $segement = $game->store->segement;
|
|
|
-// $collectHeros = $game->heros->collectHeros;
|
|
|
-// $is_exist = false;
|
|
|
-// if (!CommUtil::isPropertyExists($segement, $cardId) || $segement->$cardId <= 0) {
|
|
|
-// if ($heroId == null) {//报错 没有该碎片
|
|
|
-// $resp = Resp::err(ErrCode::err_guild_usersegementnothechip);
|
|
|
-// } elseif (!CommUtil::isPropertyExists($collectHeros, $heroId)) {//英雄id 不存在,及没有相应的碎片
|
|
|
-// $resp = Resp::err(ErrCode::err_guild_nohero);
|
|
|
-// } else {
|
|
|
-// $modelId = $collectHeros->$heroId->typeId; #英雄id
|
|
|
-// $chipInfo = GameConfig::segment_getItem($cardId); #碎片配置数据
|
|
|
-// if ($chipInfo->prototypeData == $modelId) {
|
|
|
-// $is_exist = true;
|
|
|
-// } else {
|
|
|
-// $resp = Resp::err(ErrCode::err_guild_herochiptypeinconformity);
|
|
|
-// }
|
|
|
-// }
|
|
|
-// } elseif (CommUtil::isPropertyExists($segement, $cardId) && $segement->$cardId > 0) {
|
|
|
-// $is_exist = true;
|
|
|
-// }
|
|
|
-// if ($is_exist) {
|
|
|
-// if (CommUtil::isPropertyExists($userGuildInfo, 'requestCardTs') && $userGuildInfo->requestCardTs > now()) {//不到下次请求捐献时间
|
|
|
-// $resp = Resp::err(ErrCode::err_guild_lessthannextrequestdonate);
|
|
|
-// } else {
|
|
|
-// $cardInfo = GameConfig::segment_getItem($cardId);
|
|
|
-// if ($cardInfo == null) {
|
|
|
-// $resp = Resp::err(ErrCode::err_guild_nosegmentconst);
|
|
|
-// } else {
|
|
|
-// $noOpenArr = CommUtil::split(glc()->Guild_NotOpenChipType, ',');
|
|
|
-// if (in_array($cardInfo->quailty, $noOpenArr)) {//不能请求该颜色的卡牌
|
|
|
-// $resp = Resp::err(ErrCode::err_guild_thiscardcannotrequestordonate);
|
|
|
-// } else {
|
|
|
-// $cardNumArr = CommUtil::split(glc()->Guild_RequsetCardNum, ';');
|
|
|
-// $numList = ArrayInit();
|
|
|
-// foreach ($cardNumArr as $key => $value) {
|
|
|
-// $arr = CommUtil::split($value, ',');
|
|
|
-// $numList[$arr[0]] = $arr[1];
|
|
|
-// }
|
|
|
-//
|
|
|
-// if ($cardCount > $numList[$cardInfo->quailty]) {
|
|
|
-// $resp = Resp::err(ErrCode::err_guild_requestcardnumtomuch);
|
|
|
-// } else {
|
|
|
-// $userGuildInfo->requestCardTs = now(glc()->Guild_RequestCardIntervalTime);
|
|
|
-// #将碎片捐献信息存入哈希表中,时间戳为key+uid
|
|
|
-// GuildProc::hsetGuildRequestDonateInfo($mem, $guildId, GuildJournalModel::RequestDonate($uid, $req->userInfo->game->baseInfo->name, $cardId, $cardCount), $uid, $zoneid);
|
|
|
-// self::updateUserGuildInfo($mem, $uid, $userGuildInfo, $zoneid);
|
|
|
-// self::updateGuildInfo($mem, $guildId, $guildInfo, $zoneid);
|
|
|
-// # 设置成功返回值
|
|
|
-// $resp = Resp::ok(array(
|
|
|
-// "guildInfo" => $guildInfo,
|
|
|
-// "userGuildInfo" => $userGuildInfo,
|
|
|
-// ));
|
|
|
-// }
|
|
|
-// }
|
|
|
-// }
|
|
|
-// }
|
|
|
-// }
|
|
|
-// }
|
|
|
-// }
|
|
|
-// }
|
|
|
-// return $resp;
|
|
|
-// }
|
|
|
-//
|
|
|
-// /**
|
|
|
-// * [7022] 捐献
|
|
|
-// * @param Req $req Description
|
|
|
-// */
|
|
|
-// static function donate($req) {
|
|
|
-// $resp = new Resp();
|
|
|
-// $mem = $req->mem;
|
|
|
-//
|
|
|
-// //客户端参数解析
|
|
|
-// $uid = $req->uid; //捐献者
|
|
|
-// $index = $req->paras[0]; // 要捐献的索引号 uid+ts
|
|
|
-// $segmentNum = $req->paras[1]; //要捐献的数量
|
|
|
-// $zoneid = $req->zoneid;
|
|
|
-// $game = $req->userInfo->game;
|
|
|
-//
|
|
|
-//#卡牌数量是否允许捐献, 是不是珍惜度一样(颜色一样),是否是一个公会,记得玩家数据里的卡牌+ -
|
|
|
-// $userGuildInfo = self::getMemUserGuildInfo($mem, $uid, $zoneid);
|
|
|
-// if ($userGuildInfo == null || $userGuildInfo->guildId <= 0) {
|
|
|
-// $resp = Resp::err(ErrCode::err_guild_usernotguildmember);
|
|
|
-// } else {
|
|
|
-// $guildInfo = self::getMemGuildInfo($mem, $userGuildInfo->guildId, $zoneid);
|
|
|
-// if ($guildInfo == null) {
|
|
|
-// $resp = Resp::err(ErrCode::err_guild_guildinfono);
|
|
|
-// } else {
|
|
|
-// $guildId = $guildInfo->guildId;
|
|
|
-// $journalInfo = self::getOneGuildRequestDonateInfo($mem, $guildId, $zoneid, $index);
|
|
|
-// $segmentId = $journalInfo->datas[2];
|
|
|
-// $segmentInfo = GameConfig::segment_getItem($segmentId);
|
|
|
-// if ($segmentInfo == null) {
|
|
|
-// $resp = Resp::err(ErrCode::err_guild_nosegmentconst);
|
|
|
-// } else {
|
|
|
-// $noOpenArr = CommUtil::split(glc()->Guild_NotOpenChipType, ',');
|
|
|
-// if (in_array($segmentInfo->quailty, $noOpenArr)) {
|
|
|
-// $resp = Resp::err(ErrCode::err_guild_thiscardcannotrequestordonate);
|
|
|
-// } else {
|
|
|
-// $guildReward = GameConfig::guilddonatereward_getItem($segmentInfo->quailty);
|
|
|
-// if (!CommUtil::isPropertyExists($userGuildInfo->donateCount, $index)) {
|
|
|
-// $userGuildInfo->donateCount->$index = $journalInfo;
|
|
|
-// $userGuildInfo->donateCount->$index->datas[4] = 0;
|
|
|
-// }
|
|
|
-// $donateCountObj = $userGuildInfo->donateCount;
|
|
|
-// if ($donateCountObj->$index->datas[4] >= $guildReward->maxDonateNum || $userGuildInfo->allDonateCount >= glc()->Guild_EveryDayDonateTotalNumMax) {//
|
|
|
-// $resp = Resp::err(ErrCode::err_guild_donatecardnumreachlimit);
|
|
|
-// } else {
|
|
|
-// if (glc()->Guild_DonateCoolingTime < now() - $journalInfo->ts) {
|
|
|
-// $resp = Resp::err(ErrCode::err_guild_overdonatetime);
|
|
|
-// } else {
|
|
|
-// $segement = $game->store->segement;
|
|
|
-// $reward = false;
|
|
|
-// if (CommUtil::isPropertyExists($segement, $segmentId) && $segement->$segmentId >= $segmentNum) {
|
|
|
-// $reward = true;
|
|
|
-// } else {
|
|
|
-// $resp = Resp::err(ErrCode::err_guild_noenoughcardinfo);
|
|
|
-// }
|
|
|
-//
|
|
|
-// if ($reward) {
|
|
|
-// #捐献的人扣卡牌 +奖励
|
|
|
-// UserGameModel::Consume_HeroSegment($game, $segmentId, $segmentNum); //扣卡牌
|
|
|
-// UserGameModel::Add_Gold($game->baseInfo, $guildReward->gold * $segmentNum); #加金币奖励
|
|
|
-// UserGameModel::Add_Exp($req->userInfo->game->baseInfo, $guildReward->exp * $segmentNum); #加经验
|
|
|
-// $userGuildInfo->contribute += $guildReward->contribution * $segmentNum; #加贡献度
|
|
|
-// #计算所在公会总贡献度
|
|
|
-// $guildInfo->allContribute += $userGuildInfo->contribute;
|
|
|
-// #公会贡献度推算公会等级
|
|
|
-// $guildLevel = self::getGuildLevel($guildInfo->allContribute);
|
|
|
-// $guildInfo->level = $guildInfo->level == $guildLevel ? $guildInfo->level : $guildLevel;
|
|
|
-// #记录捐献人id
|
|
|
-// GuildProc::setUserDonateRecordList($mem, $guildId, $zoneid, $index, $uid);
|
|
|
-// #个人公会记录自己向谁捐献了捐献的数量
|
|
|
-// $userGuildInfo->donateCount->$index->datas[4] += $segmentNum;
|
|
|
-// $userGuildInfo->allDonateCount += $segmentNum;
|
|
|
-//
|
|
|
-// $count = GuildProc::gainUserDonateRecordlistLength($mem, $guildId, $zoneid, $index);
|
|
|
-// if ($journalInfo->datas[3] <= $count) {//已经捐献足够了
|
|
|
-// #结算
|
|
|
-// self::donateSettle($mem, $journalInfo, $index, $count, $guildId, $zoneid);
|
|
|
-// #将捐献者个人公会信息中该捐献信息删除
|
|
|
-// unset($userGuildInfo->donateCount->$index);
|
|
|
-// } //还没有捐献满不做任何处理
|
|
|
-// self::updateGuildInfo($mem, $guildId, $guildInfo, $zoneid);
|
|
|
-// self::updateUserGuildInfo($mem, $uid, $userGuildInfo, $zoneid);
|
|
|
-// UserProc::updateUserInfo();
|
|
|
-// $resp = Resp::ok(array(
|
|
|
-// "guildInfo" => $guildInfo,
|
|
|
-// "userGuildInfo" => $userGuildInfo,
|
|
|
-// ));
|
|
|
-// }
|
|
|
-// }
|
|
|
-// }
|
|
|
-// }
|
|
|
-// }
|
|
|
-// }
|
|
|
-// }
|
|
|
-// return $resp;
|
|
|
-// }
|
|
|
-//
|
|
|
-// /**
|
|
|
-// * [7023]刷新
|
|
|
-// * @param type $req
|
|
|
-// */
|
|
|
-// static function donateInfoRefresh($req) {
|
|
|
-// $resp = new Resp();
|
|
|
-// $mem = $req->mem;
|
|
|
-//
|
|
|
-// //客户端参数解析
|
|
|
-// $uid = $req->uid; //审批者
|
|
|
-// $zoneid = $req->zoneid;
|
|
|
-//
|
|
|
-// $userGuildInfo = self::getMemUserGuildInfo($mem, $uid, $zoneid);
|
|
|
-// if ($userGuildInfo == null || $userGuildInfo->guildId <= 0) {
|
|
|
-// $resp = Resp::err(ErrCode::err_guild_usernotguildmember);
|
|
|
-// } else {
|
|
|
-// $guildInfo = self::getMemGuildInfo($mem, $userGuildInfo->guildId, $zoneid);
|
|
|
-// if ($guildInfo == null) {
|
|
|
-// $resp = Resp::err(ErrCode::err_guild_guildinfono);
|
|
|
-// } else {
|
|
|
-// $guildId = $guildInfo->guildId;
|
|
|
-// #弹劾有效时间到期 捐献有效冷却时间到期 公会编辑下一条数据后 刷新
|
|
|
-// self::RefreshAnnouncement($mem, $guildId, $guildInfo, $zoneid);
|
|
|
-// self::RefreshAccuseInfo($mem, $guildId, $guildInfo, $zoneid);
|
|
|
-// self::RefreshDonate($mem, $guildId, $guildInfo, $zoneid);
|
|
|
-//
|
|
|
-// #将捐献信息下发
|
|
|
-// $donateInfo = self::splitGuildDonateInfo($mem, $guildId, $zoneid);
|
|
|
-// #下发公会日志信息
|
|
|
-// $journal = self::splitGuildJournalInfo($mem, $guildId, $zoneid);
|
|
|
-// #当前玩家个人公会信息
|
|
|
-// $userGuildInfo = self::getMemUserGuildInfo($mem, $uid, $zoneid);
|
|
|
-// $resp = Resp::ok(array(
|
|
|
-// "guildInfo" => $guildInfo,
|
|
|
-// "donateInfo" => $donateInfo,
|
|
|
-// "journalInfo" => $journal,
|
|
|
-// "userGuildInfo" => $userGuildInfo,
|
|
|
-// ));
|
|
|
-// }
|
|
|
-// }
|
|
|
-// return $resp;
|
|
|
-// }
|
|
|
-//
|
|
|
-// /**
|
|
|
-// * 刷新公会信息
|
|
|
-// */
|
|
|
-// static function RefreshAnnouncement($mem, $guildId, $guildInfo, $zoneID) {
|
|
|
-// #公会消息刷新
|
|
|
-// if (CommUtil::isPropertyExists($guildInfo, 'announcement_content') && is_array($guildInfo->announcement_content)) {
|
|
|
-// if (count($guildInfo->announcement_content) != 0) {
|
|
|
-// $announcement = $guildInfo->announcement_content[0];
|
|
|
-// if (now() - $announcement->ts > glc()->Guild_AnnouncementShowTime) {//过了显示时间,该清除
|
|
|
-// array_splice($guildInfo->announcement_content, 0, 1); //删除第一个元素并重新排序
|
|
|
-// }
|
|
|
-// }
|
|
|
-// self::updateGuildInfo($mem, $guildId, $guildInfo, $zoneID);
|
|
|
-// }
|
|
|
-// }
|
|
|
-//
|
|
|
-// /**
|
|
|
-// * 刷新捐献数据
|
|
|
-// */
|
|
|
-// static function RefreshDonate($mem, $guildId, $guildInfo, $zoneID) {
|
|
|
-//#聊天消息刷新
|
|
|
-// $donateInfo = self::getallGuildRequestDonateInfo($mem, $guildId, $zoneID);
|
|
|
-// foreach ($donateInfo as $index => $donateMsg) {
|
|
|
-// if (now() - $donateMsg->ts >= glc()->Guild_DonateCoolingTime) {//捐献冷却时间到了,该捐献数据撤下去
|
|
|
-// $count = GuildProc::gainUserDonateRecordlistLength($mem, $guildId, $zoneID, $index);
|
|
|
-// self::donateSettle($mem, $donateMsg, $index, $count, $guildId, $zoneID);
|
|
|
-// }
|
|
|
-// }
|
|
|
-// }
|
|
|
-//
|
|
|
-// /**
|
|
|
-// * 刷新弹劾信息
|
|
|
-// */
|
|
|
-// static function RefreshAccuseInfo($mem, $guildId, $guildInfo, $zoneID) {
|
|
|
-//
|
|
|
-// #判断是否在弹劾阶段
|
|
|
-// if ($guildInfo->accuseTs <= now() && $guildInfo->accuseTs > 0 && count($guildInfo->accuse_agreed) > 0 && count($guildInfo->accuse_refuse) < 2) {//存在弹劾,不在有效时间内了,更改会长职位
|
|
|
-// self::accuseSettle($mem, $guildInfo, $guildId, $zoneID);
|
|
|
-// self::updateGuildInfo($mem, $guildId, $guildInfo, $zoneID);
|
|
|
-// }
|
|
|
-// }
|
|
|
-//
|
|
|
-// /**
|
|
|
-// * 捐献结算
|
|
|
-// */
|
|
|
-// static function donateSettle($mem, $journalInfo, $index, $count, $guildId, $zoneid) {
|
|
|
-// #将卡牌碎片以邮件的形式发给玩家
|
|
|
-// $chipArr = ArrayInit();
|
|
|
-// $sendId = $journalInfo->datas[0];
|
|
|
-// $chipArr[] = $journalInfo->datas[2] == null ? 0 : $journalInfo->datas[2];
|
|
|
-// $chipArr[] = $count == null ? 0 : $count;
|
|
|
-// EmailProc::SendGuildDonateSettle($zoneid, $sendId, $chipArr);
|
|
|
-//
|
|
|
-// #同时将该捐献信息删除
|
|
|
-// GuildProc::deleteOneGuildRequestDonateInfo($mem, $guildId, $zoneid, $index);
|
|
|
-//
|
|
|
-// #将捐献者个人公会信息中该捐献信息删除
|
|
|
-//// $userIdlist = GuildProc::getallUserDonateRecordList($mem, $guildId, $index, $zoneid, $count);
|
|
|
-//// foreach ($userIdlist as $k => $userid) {
|
|
|
-//// $donateGuild = self::getMemUserGuildInfo($mem, $userid, $zoneid);
|
|
|
-//// if (CommUtil::isPropertyExists($donateGuild, 'donateCount') && CommUtil::isPropertyExists($donateGuild->donateCount, $index)) {
|
|
|
-//// unset($donateGuild->donateCount->$index);
|
|
|
-//// }
|
|
|
-//// self::updateUserGuildInfo($mem, $userid, $donateGuild, $zoneid);
|
|
|
-//// }
|
|
|
-// #删除捐献记录缓存
|
|
|
-// GuildProc::deleteUserDonateRecordList($mem, $guildId, $index, $zoneid);
|
|
|
-// }
|
|
|
-//
|
|
|
-// /**
|
|
|
-// * 弹劾时间过期数据清理
|
|
|
-// */
|
|
|
-// static function accuseSettle($mem, $guildInfo, $guildId, $zoneid) {
|
|
|
-// #成功后 会长降为会员 职位改变 弹劾数据清null 将发起弹劾 的 申请人 设为 会长。 改变数据库中会长id name
|
|
|
-// $chairId = $guildInfo->chairman_id;
|
|
|
-// $chairmanInfo = self::getMemUserGuildInfo($mem, $chairId, $zoneid);
|
|
|
-// $chairmanInfo->position = 'Member';
|
|
|
-// $accuseId = $guildInfo->accuse_agreed[0];
|
|
|
-// $accuseInfo = self::getMemUserGuildInfo($mem, $accuseId, $zoneid);
|
|
|
-// $accuseInfo->position = 'Chairman';
|
|
|
-// if (self::isViceChairman($accuseId, $guildInfo)) {
|
|
|
-// self::removeViceChairman($guildInfo, $accuseId);
|
|
|
-// } elseif (self::isOfficerChairman($accuseId, $guildInfo)) {
|
|
|
-// self::removeOfficerChairman($guildInfo, $accuseId);
|
|
|
-// }
|
|
|
-// self::pushNewJournal($mem, $guildId, GuildJournalModel::CreateChangeChairman($chairId, $guildInfo->chairman_name, $accuseId, $accuseInfo->name), $zoneid); //加入系统消息 更改会长
|
|
|
-//
|
|
|
-// $guildInfo->chairman_id = $accuseId;
|
|
|
-// $guildInfo->chairman_name = $accuseInfo->name;
|
|
|
-// $guildInfo->accuse_agreed = array();
|
|
|
-// $guildInfo->accuse_refuse = array();
|
|
|
-// $guildInfo->accuseTs = 0;
|
|
|
-// $guildInfo->accuse_coolTime = 0;
|
|
|
-//
|
|
|
-// self::updateGuildChairman($guildInfo, $zoneid);
|
|
|
-// self::updateUserGuildInfo($mem, $chairId, $chairmanInfo, $zoneid);
|
|
|
-// self::updateUserGuildInfo($mem, $accuseId, $accuseInfo, $zoneid);
|
|
|
-// }
|
|
|
-//
|
|
|
-// // const
|
|
|
-//// </editor-fold>
|
|
|
-//// <editor-fold defaultstate="collapsed" desc="公会礼包">
|
|
|
-//
|
|
|
-// /**
|
|
|
-// * [7024]购买 捐献度礼包
|
|
|
-// * @param req $req
|
|
|
-// */
|
|
|
-// static function buyDonateGift($req) {
|
|
|
-// $resp = new Resp();
|
|
|
-// $mem = $req->mem;
|
|
|
-//
|
|
|
-// //客户端参数解析
|
|
|
-// $uid = $req->uid; //审批者
|
|
|
-// $zoneid = $req->zoneid;
|
|
|
-// $libaoId = $req->paras[0]; //礼包id
|
|
|
-// $baseInfo = $req->userInfo->game->baseInfo;
|
|
|
-//
|
|
|
-// $userGuildInfo = self::getMemUserGuildInfo($mem, $uid, $zoneid);
|
|
|
-// if ($userGuildInfo == null || $userGuildInfo->guildId <= 0) {
|
|
|
-// $resp = Resp::err(ErrCode::err_guild_usernotguildmember);
|
|
|
-// } else {
|
|
|
-// $guildInfo = self::getMemGuildInfo($mem, $userGuildInfo->guildId, $zoneid);
|
|
|
-// if ($guildInfo == null) {
|
|
|
-// $resp = Resp::err(ErrCode::err_guild_guildinfono);
|
|
|
-// } else {
|
|
|
-// #该礼包是否开放,公会等级是否满足
|
|
|
-// $libaoInfo = GameConfig::guildlibao_getItem($libaoId);
|
|
|
-// if (!$libaoInfo->isOpen && $guildInfo->level < $libaoInfo->openguildlevel) {
|
|
|
-// $resp = Resp::err(ErrCode::err_guild_contributionGiftnoopen);
|
|
|
-// } else {
|
|
|
-// #贡献度是否满足
|
|
|
-// if ($libaoInfo->donaterequire > $userGuildInfo->contribute) {
|
|
|
-// $resp = Resp::err(ErrCode::err_guild_contributionnosatisfy);
|
|
|
-// } else {
|
|
|
-// $money = $libaoInfo->pricetype == 1 ? $baseInfo->gold - $libaoInfo->price : $baseInfo->cash - $libaoInfo->price;
|
|
|
-// $type = $libaoInfo->pricetype == 1 ? ErrCode::notenough_gold_msg : ErrCode::notenough_cash_msg;
|
|
|
-// if ($money < 0) {#钱不够
|
|
|
-// $resp = Resp::err($type);
|
|
|
-// } else {
|
|
|
-// #扣除花费
|
|
|
-// $libaoInfo->pricetype == 1 ? UserGameModel::Consume_Gold($baseInfo, $libaoInfo->price) : UserGameModel::Consume_Cash($baseInfo, $libaoInfo->price);
|
|
|
-// #回存礼包
|
|
|
-// $err = StoreProc::AddMultiItemInStore($req, $libaoInfo->libaocontent, 5);
|
|
|
-// if ($err == 0) {
|
|
|
-// #该礼包数量+1
|
|
|
-// self::guildGiftNumAdd($guildInfo, $libaoId);
|
|
|
-// if ($libaoInfo->isSendReward == 1) {
|
|
|
-// #1.公会豪华钻石礼包以消息的形式发布
|
|
|
-// self::pushNewJournal($mem, $guildInfo->guildId, GuildJournalModel::BuyGift($uid, $userGuildInfo->name), $zoneid);
|
|
|
-// #2.给该公会所有成员一个宝箱物品 (以邮件的形式)
|
|
|
-// $reward = $libaoInfo->sendRewardStr;
|
|
|
-// if ($reward == null) {
|
|
|
-// $resp = Resp::err(ErrCode::err_guild_noguildgiftconst);
|
|
|
-// } else {
|
|
|
-// $rewardArr = CommUtil::split($reward, ';');
|
|
|
-// $member = $guildInfo->members;
|
|
|
-// foreach ($member as $index => $memberId) {
|
|
|
-// foreach ($rewardArr as $key => $str) {
|
|
|
-// $arr = CommUtil::split($str, ',');
|
|
|
-// EmailProc::SendGuildCashGiftReward($zoneid, $memberId, $arr[0], $arr[1]);
|
|
|
-// }
|
|
|
-// }
|
|
|
-// }
|
|
|
-// }
|
|
|
-// self::updateGuildInfo($mem, $guildInfo->guildId, $guildInfo, $zoneid);
|
|
|
-// UserProc::updateUserInfo();
|
|
|
-// SystemProc::BuyGuildCashPack($zoneid, $baseInfo); # 插入系统消息
|
|
|
-// $resp = Resp::ok(array(
|
|
|
-// "result" => 0,
|
|
|
-// 'store' => $req->userInfo->game->store,
|
|
|
-// ));
|
|
|
-// }
|
|
|
-// }
|
|
|
-// }
|
|
|
-// }
|
|
|
-// }
|
|
|
-// }
|
|
|
-// return $resp;
|
|
|
-// }
|
|
|
-//
|
|
|
-// /**
|
|
|
-// * [7025]购买 公会钻石礼包 弃用
|
|
|
-// * @param req $req
|
|
|
-// */
|
|
|
-// static function buyGuildCashGift($req) {
|
|
|
-// $resp = new Resp();
|
|
|
-// $mem = $req->mem;
|
|
|
-//
|
|
|
-// //客户端参数解析
|
|
|
-// $uid = $req->uid;
|
|
|
-// $zoneid = $req->zoneid;
|
|
|
-// $libaoId = $req->paras[0]; //礼包id
|
|
|
-// $baseInfo = $req->userInfo->game->baseInfo;
|
|
|
-//
|
|
|
-// $userGuildInfo = self::getMemUserGuildInfo($mem, $uid, $zoneid);
|
|
|
-// if ($userGuildInfo == null || $userGuildInfo->guildId <= 0) {
|
|
|
-// $resp = Resp::err(ErrCode::err_guild_usernotguildmember);
|
|
|
-// } else {
|
|
|
-// $guildInfo = self::getMemGuildInfo($mem, $userGuildInfo->guildId, $zoneid);
|
|
|
-// if ($guildInfo == null) {
|
|
|
-// $resp = Resp::err(ErrCode::err_guild_guildinfono);
|
|
|
-// } else {
|
|
|
-// #该礼包是否开放,公会等级是否满足
|
|
|
-// $libaoInfo = GameConfig::guildlibao_getItem($libaoId);
|
|
|
-// if ($libaoInfo == null || !$libaoInfo->isOpen && $guildInfo->level < $libaoInfo->openguildlevel) {
|
|
|
-// $resp = Resp::err(ErrCode::err_guild_contributionGiftnoopen);
|
|
|
-// } else {
|
|
|
-// $money = $libaoInfo->pricetype == 1 ? $baseInfo->gold - $libaoInfo->price : $baseInfo->cash - $libaoInfo->price;
|
|
|
-// $type = $libaoInfo->pricetype == 1 ? ErrCode::notenough_gold_msg : ErrCode::notenough_cash_msg;
|
|
|
-// if ($money < 0) {#钱不够
|
|
|
-// $resp = Resp::err($type);
|
|
|
-// } else {
|
|
|
-// #扣除花费
|
|
|
-// $libaoInfo->pricetype == 1 ? UserGameModel::Consume_Gold($baseInfo, $libaoInfo->price) : UserGameModel::Consume_Cash($baseInfo, $libaoInfo->price);
|
|
|
-// #回存礼包
|
|
|
-// $err = StoreProc::AddMultiItemInStore($req, $libaoInfo->libaocontent, 5);
|
|
|
-// if ($err == 0) {
|
|
|
-// #该礼包数量+1
|
|
|
-// self::guildGiftNumAdd($guildInfo, $libaoId);
|
|
|
-// if ($libaoInfo->isSendReward == 1) {
|
|
|
-// #1.公会豪华钻石礼包以消息的形式发布
|
|
|
-// self::pushNewJournal($mem, $guildInfo->guildId, GuildJournalModel::BuyGift($uid, $userGuildInfo->name), $zoneid);
|
|
|
-// #2.给该公会所有成员一个宝箱物品 (以邮件的形式)
|
|
|
-// $reward = $libaoInfo->sendRewardStr;
|
|
|
-// if ($reward == null) {
|
|
|
-// $resp = Resp::err(ErrCode::err_guild_noguildgiftconst);
|
|
|
-// } else {
|
|
|
-// $rewardArr = CommUtil::split($reward, ';');
|
|
|
-// $member = $guildInfo->members;
|
|
|
-// foreach ($member as $index => $memberId) {
|
|
|
-// foreach ($rewardArr as $key => $str) {
|
|
|
-// $arr = CommUtil::split($str, ',');
|
|
|
-// EmailProc::SendGuildCashGiftReward($zoneid, $memberId, $arr[0], $arr[1]);
|
|
|
-// }
|
|
|
-// }
|
|
|
-// }
|
|
|
-// }
|
|
|
-// self::updateGuildInfo($mem, $guildInfo->guildId, $guildInfo, $zoneid);
|
|
|
-// UserProc::updateUserInfo();
|
|
|
-// SystemProc::BuyGuildCashPack($zoneid, $baseInfo); # 插入系统消息
|
|
|
-// $resp = Resp::ok(array(
|
|
|
-// "result" => 0,
|
|
|
-// 'store' => $req->userInfo->game->store,
|
|
|
-// ));
|
|
|
-// }
|
|
|
-// }
|
|
|
-// }
|
|
|
-// }
|
|
|
-// }
|
|
|
-// return $resp;
|
|
|
-// }
|
|
|
-//
|
|
|
-// // const
|
|
|
-//// </editor-fold>
|
|
|
-//// <editor-fold defaultstate="collapsed" desc="公会公告 邮件">
|
|
|
-//
|
|
|
-// /**
|
|
|
-// * [7026]公会公告
|
|
|
-// * @param type $req
|
|
|
-// */
|
|
|
-// static function announcement($req) {//会长的每条公告 1.显示时间的时间限制(针对玩家看到的时候) 2.编辑一条公告内容后有冷却时间在进行第二次编辑
|
|
|
-// $resp = new Resp();
|
|
|
-// $mem = $req->mem;
|
|
|
-//
|
|
|
-// //客户端参数解析
|
|
|
-// $uid = $req->uid; //审批者
|
|
|
-// $zoneid = $req->zoneid;
|
|
|
-// $title = $req->paras[0];
|
|
|
-// $content = $req->paras[1]; //公告内容
|
|
|
-// $game = $req->userInfo->game;
|
|
|
-//
|
|
|
-// if ($content == null && $title == null) {
|
|
|
-// $resp = Resp::err(ErrCode::err_guild_mailcontentcannotbenull);
|
|
|
-// } else {
|
|
|
-// $userGuildInfo = self::getMemUserGuildInfo($mem, $uid, $zoneid);
|
|
|
-// if ($userGuildInfo == null || $userGuildInfo->guildId <= 0) {
|
|
|
-// $resp = Resp::err(ErrCode::err_guild_usernotguildmember);
|
|
|
-// } else {
|
|
|
-// $guildInfo = self::getMemGuildInfo($mem, $userGuildInfo->guildId, $zoneid);
|
|
|
-// if ($guildInfo == null) {
|
|
|
-// $resp = Resp::err(ErrCode::err_guild_guildinfono);
|
|
|
-// } else {
|
|
|
-// if (!self::checkPermission($uid, $guildInfo)) {
|
|
|
-// $resp = Resp::err(ErrCode::err_guild_usernotchairman);
|
|
|
-// } else {
|
|
|
-// if (now() < $guildInfo->announcement_CoolingTs) {//还不到下次编辑的时间
|
|
|
-// $resp = Resp::err(ErrCode::err_guild_AnnouncementEditCooling);
|
|
|
-// } else {
|
|
|
-// if (count($guildInfo->announcement_content) != 0) {
|
|
|
-// array_splice($guildInfo->announcement_content, 0, 1); //删除第一个元素并重新排序
|
|
|
-// }
|
|
|
-// $guildAnnouncement = new GuildAnnouncementModel(null, now(), $title, $content);
|
|
|
-// $guildInfo->announcement_content[] = $guildAnnouncement;
|
|
|
-// $guildInfo->announcement_CoolingTs = now(glc()->Guild_AnnouncementEditCoolingTime);
|
|
|
-// self::updateGuildInfo($mem, $guildInfo->guildId, $guildInfo, $zoneid);
|
|
|
-// $resp = Resp::ok($guildInfo);
|
|
|
-// }
|
|
|
-// }
|
|
|
-// }
|
|
|
-// }
|
|
|
-// }
|
|
|
-// return $resp;
|
|
|
-// }
|
|
|
-//
|
|
|
-// /**
|
|
|
-// * [7027]公会邮件
|
|
|
-// * @param type $req
|
|
|
-// */
|
|
|
-// static function noticeMail($req) {
|
|
|
-// $resp = new Resp();
|
|
|
-// $mem = $req->mem;
|
|
|
-//
|
|
|
-// //客户端参数解析
|
|
|
-// $uid = $req->uid; //审批者
|
|
|
-// $zoneid = $req->zoneid;
|
|
|
-// $title = $req->paras[0];
|
|
|
-// $content = $req->paras[1]; //邮件内容
|
|
|
-// $game = $req->userInfo->game;
|
|
|
-// if ($content == null && $title == null) {
|
|
|
-// $resp = Resp::err(ErrCode::err_guild_mailcontentcannotbenull);
|
|
|
-// } else {
|
|
|
-// $userGuildInfo = self::getMemUserGuildInfo($mem, $uid, $zoneid);
|
|
|
-// if ($userGuildInfo == null || $userGuildInfo->guildId <= 0) {
|
|
|
-// $resp = Resp::err(ErrCode::err_guild_usernotguildmember);
|
|
|
-// } else {
|
|
|
-// $guildInfo = self::getMemGuildInfo($mem, $userGuildInfo->guildId, $zoneid);
|
|
|
-// if ($guildInfo == null) {
|
|
|
-// $resp = Resp::err(ErrCode::err_guild_guildinfono);
|
|
|
-// } else {
|
|
|
-// if (!self::checkPermission($uid, $guildInfo)) {
|
|
|
-// $resp = Resp::err(ErrCode::err_guild_usernotchairman);
|
|
|
-// } else {
|
|
|
-// $members = $guildInfo->members;
|
|
|
-// foreach ($members as $index => $memberId) {
|
|
|
-// EmailProc::SendGuildNoticeMail($zoneid, $memberId, $title, $content);
|
|
|
-// }
|
|
|
-// $resp = Resp::ok(array(
|
|
|
-// "result" => 0,
|
|
|
-// ));
|
|
|
-// }
|
|
|
-// }
|
|
|
-// }
|
|
|
-// }
|
|
|
-// return $resp;
|
|
|
-// }
|
|
|
-//
|
|
|
-// // const
|
|
|
-//// </editor-fold>
|
|
|
-////
|
|
|
-//// <editor-fold defaultstate="collapsed" desc="公会战">
|
|
|
-//
|
|
|
-// /**
|
|
|
-// * 【7028】 邀请战斗
|
|
|
-// * @param type $req
|
|
|
-// */
|
|
|
-// static function vsFightInvite($req) {
|
|
|
-// $resp = new Resp();
|
|
|
-// $mem = $req->mem;
|
|
|
-//
|
|
|
-// //客户端参数解析
|
|
|
-// $uid_invite = $req->uid;
|
|
|
-// $zoneid = $req->zoneid;
|
|
|
-//
|
|
|
-// $userGuildInfo = self::getMemUserGuildInfo($mem, $uid_invite, $zoneid);
|
|
|
-// if ($userGuildInfo == null || $userGuildInfo->guildId <= 0) {
|
|
|
-// $resp = Resp::err(ErrCode::err_guild_usernotguildmember);
|
|
|
-// } else {
|
|
|
-// $guildInfo = self::getMemGuildInfo($mem, $userGuildInfo->guildId, $zoneid);
|
|
|
-// if ($guildInfo == null) {
|
|
|
-// $resp = Resp::err(ErrCode::err_guild_guildinfono);
|
|
|
-// } else {
|
|
|
-// if (self::hexistsFightInviteInfo($mem, $guildInfo->guildId, $uid_invite, $zoneid)) {#已经存在邀请信息不能再次邀请
|
|
|
-// $resp = Resp::err(ErrCode::err_guild_fightInvitealreadyexisted);
|
|
|
-// } else {
|
|
|
-// $err = self::setFightInviteInfo($mem, $guildInfo->guildId, $uid_invite, array(), $zoneid);
|
|
|
-// $ret = $err == true ? array('result' => 0) : array('result' => 1);
|
|
|
-// $resp = Resp::ok($ret);
|
|
|
-// }
|
|
|
-// }
|
|
|
-// }
|
|
|
-// return $resp;
|
|
|
-// }
|
|
|
-//
|
|
|
-// /**
|
|
|
-// * 【7029】 取消邀请战斗
|
|
|
-// * @param type $req
|
|
|
-// */
|
|
|
-// static function cancelInvite($req) {
|
|
|
-// $resp = new Resp();
|
|
|
-// $mem = $req->mem;
|
|
|
-//
|
|
|
-// //客户端参数解析
|
|
|
-// $uid = $req->uid;
|
|
|
-// $zoneid = $req->zoneid;
|
|
|
-// $userGuildInfo = self::getMemUserGuildInfo($mem, $uid, $zoneid);
|
|
|
-// if ($userGuildInfo == null || $userGuildInfo->guildId <= 0) {
|
|
|
-// $resp = Resp::err(ErrCode::err_guild_usernotguildmember);
|
|
|
-// } else {
|
|
|
-// $guildInfo = self::getMemGuildInfo($mem, $userGuildInfo->guildId, $zoneid);
|
|
|
-// if ($guildInfo == null) {
|
|
|
-// $resp = Resp::err(ErrCode::err_guild_guildinfono);
|
|
|
-// } else {
|
|
|
-// if (!self::hexistsFightInviteInfo($mem, $guildInfo->guildId, $uid, $zoneid)) {#不存在邀请信息,报错
|
|
|
-// $resp = Resp::err(ErrCode::err_guild_fightInvitenoexisted);
|
|
|
-// } else {
|
|
|
-// self::deleteOneFightInviteInfo($mem, $guildInfo->guildId, $uid, $zoneid);
|
|
|
-// $ret = $err == true ? array('result' => 0) : array('result' => 1);
|
|
|
-// $resp = Resp::ok($ret);
|
|
|
-// }
|
|
|
-// }
|
|
|
-// }
|
|
|
-// return $resp;
|
|
|
-// }
|
|
|
-//
|
|
|
-// /**
|
|
|
-// * 【7030】 接受,战斗
|
|
|
-// * @param type $req
|
|
|
-// */
|
|
|
-// static function fight($req) {
|
|
|
-// $resp = new Resp();
|
|
|
-// $mem = $req->mem;
|
|
|
-//
|
|
|
-// //客户端参数解析
|
|
|
-// $uid_accept = $req->uid;
|
|
|
-// $zoneid = $req->zoneid;
|
|
|
-// $uid_invite = $req->paras[0]; #接受哪个邀请 邀请者uid
|
|
|
-// $userGuildInfo = self::getMemUserGuildInfo($mem, $uid_accept, $zoneid);
|
|
|
-// if ($userGuildInfo == null || $userGuildInfo->guildId <= 0) {
|
|
|
-// $resp = Resp::err(ErrCode::err_guild_usernotguildmember);
|
|
|
-// } else {
|
|
|
-// $guildInfo = self::getMemGuildInfo($mem, $userGuildInfo->guildId, $zoneid);
|
|
|
-// if ($guildInfo == null) {
|
|
|
-// $resp = Resp::err(ErrCode::err_guild_guildinfono);
|
|
|
-// } else {
|
|
|
-// $inviteArr = self::hgetFightInviteInfo($mem, $guildInfo->guildId, $uid_invite, $zoneid);
|
|
|
-// if (in_array($uid_accept, $inviteArr) || count($inviteArr) == 2) {#该玩家已经在战斗中不能再次接受 or 本次邀请已经存在两个成员战斗,你不能接受邀请
|
|
|
-// $resp = Resp::err(ErrCode::err_guild_fighting);
|
|
|
-// } else {
|
|
|
-// #将$uid_accept 存入邀请数据中
|
|
|
-// $inviteArr[] = $uid_accept;
|
|
|
-// $err = self::setFightInviteInfo($mem, $guildInfo->guildId, $uid_invite, $inviteArr, $zoneid);
|
|
|
-// #返回两个对战玩家战队信息
|
|
|
-// // $arr = $mem->getMulti($ids);
|
|
|
-// // $ret = $err == true ? array('result' => 0) : array('result' => 1);
|
|
|
-// // $resp = ResponseVo::ok($req, $ret);
|
|
|
-// }
|
|
|
-// }
|
|
|
-// }
|
|
|
-// return $resp;
|
|
|
-// }
|
|
|
-//
|
|
|
-// // const
|
|
|
-//// </editor-fold>
|
|
|
-//// <editor-fold defaultstate="collapsed" desc="公会封装函数集合">
|
|
|
-//
|
|
|
-// /**
|
|
|
-// * @deprecated since version 2020.5.9
|
|
|
-// * @param type $mem
|
|
|
-// * @param type $uid
|
|
|
-// * @param type $zoneid
|
|
|
-// * @return type
|
|
|
-// */
|
|
|
-// static function initFightTeamInfo($mem, $uid, $zoneid) {
|
|
|
-// $userGameInfo = new UserGameModel();
|
|
|
-// $userGameInfo->readDataFromMem(MemKey_User::Info_hash($zoneid, $uid));
|
|
|
-//// $userGameInfo = $mem->get(MemKey_User::Info_hash($zoneid, $uid));
|
|
|
-// $team = JsonUtil::decode('{"teamLeader": 0,"heros":{}}');
|
|
|
-// $teamConfig = JsonUtil::decode($userGameInfo->heroTeamConfig);
|
|
|
-// if ($teamConfig && $teamConfig->curUseTeamID > 0) {
|
|
|
-// $heros = ObjectInit();
|
|
|
-// $teamid = $teamConfig->curUseTeamID;
|
|
|
-// $heros_uid = $teamConfig->teamDic->$teamid->heros;
|
|
|
-// $m = 0;
|
|
|
-// foreach ($heros_uid as $heroid) {
|
|
|
-// $m++;
|
|
|
-//// $heros->$m = $heroid ? PVPProc::getHeroInfoForShare($userGameInfo, $heroid) : null;
|
|
|
-// }
|
|
|
-// $team = array(
|
|
|
-// 'teamLeader' => $teamConfig->teamDic->$teamid->teamLeader,
|
|
|
-// 'heros' => $heros
|
|
|
-// );
|
|
|
-// }
|
|
|
-//
|
|
|
-// $arr = array(
|
|
|
-// 'heroTeamConfig' => $team, # 战队配置
|
|
|
-// );
|
|
|
-// return $arr;
|
|
|
-// }
|
|
|
-//
|
|
|
-// /**
|
|
|
-// * 修改公会积分 弃用
|
|
|
-// */
|
|
|
-//// static function updateDbguildCupScore($cupScore, $guildId, $zoneid, $type = null)
|
|
|
-//// {
|
|
|
-//////#减去公会中开除成员的积分
|
|
|
-//// $paydb = CPayInit();
|
|
|
-//// $dbret = $paydb->query(sprintf(SQLUPDATEGUILDCUPSTORE, $sqlret[0]['cupScore'], $guildId, $zoneid));
|
|
|
-//// }
|
|
|
-//
|
|
|
-// /**
|
|
|
-// * 获取捐献消息格式整理
|
|
|
-// * @param type $mem
|
|
|
-// * @param type $guildId
|
|
|
-// * @param type $zoneid
|
|
|
-// * @return type
|
|
|
-// */
|
|
|
-// static function splitGuildDonateInfo($mem, $guildId, $zoneid) {
|
|
|
-// $journalDonate = GuildProc::getallGuildRequestDonateInfo($mem, $guildId, $zoneid);
|
|
|
-// foreach ($journalDonate as $index => $obj) {
|
|
|
-// $obj->datas[4] = GuildProc::gainUserDonateRecordlistLength($mem, $guildId, $zoneid, $index);
|
|
|
-// }
|
|
|
-// if (is_array($journalDonate) && count($journalDonate) == 0) {
|
|
|
-// $journalDonate = ObjectInit();
|
|
|
-// }
|
|
|
-// return $journalDonate;
|
|
|
-// }
|
|
|
-//
|
|
|
-// /**
|
|
|
-// * 获取消息格式整理
|
|
|
-// * @param type $mem
|
|
|
-// * @param type $guildId
|
|
|
-// * @param type $zoneid
|
|
|
-// * @return type
|
|
|
-// */
|
|
|
-// static function splitGuildJournalInfo($mem, $guildId, $zoneid) {
|
|
|
-// $journal = $mem->lrange(MemKey_Guild::constGuildJournal($guildId, $zoneid), 0, GUILDMAXJOURNALCOUNT);
|
|
|
-// $journalObj = ObjectInit();
|
|
|
-// foreach ($journal as $index => $obj) {
|
|
|
-// $ts = $obj->ts;
|
|
|
-// $journalObj->$ts = $obj;
|
|
|
-// }
|
|
|
-// return $journalObj;
|
|
|
-// }
|
|
|
-//
|
|
|
-// /**
|
|
|
-// * 查询推荐公会队列数据 弃用
|
|
|
-// * @param type $mem
|
|
|
-// * @return type
|
|
|
-// */
|
|
|
-// static function getRecommendataionData($mem, $zoneid) {
|
|
|
-// $recom = $mem->get(MemKey_Guild::constGuildRecommendationQueue($zoneid));
|
|
|
-// if ($recom == null) {
|
|
|
-// $recom = array();
|
|
|
-// }
|
|
|
-// return $recom;
|
|
|
-// }
|
|
|
-//
|
|
|
-// /**
|
|
|
-// * 查询并更新推荐公会列表信息 弃用
|
|
|
-// * @param type $mem
|
|
|
-// * @param type $recomm
|
|
|
-// * @return type
|
|
|
-// */
|
|
|
-// static function getRecommendationList($mem, $recomm, &$invalidGuild, $zoneid) {
|
|
|
-// $memList = array();
|
|
|
-// $recomm = array_slice($recomm, 0, 8);
|
|
|
-// $arrStr = implode(',', $recomm); // 把数组内容拼接为字符串
|
|
|
-// $md5 = md5($arrStr); // 计算一下md5
|
|
|
-// $cache = $mem->get(MemKey_Guild::guildRecommendationCache($zoneid)); // 取缓存
|
|
|
-// if ($cache == null) { // 如果是空的,初始化一下
|
|
|
-// $cache = ObjectInit();
|
|
|
-// $cache->md5 = "x";
|
|
|
-// $cache->memList = array();
|
|
|
-// }
|
|
|
-//
|
|
|
-//// 依据MD5判断是否需要更新缓存
|
|
|
-// if ($cache->md5 != null && $cache->md5 == $md5) {
|
|
|
-// $memList = $cache->memList; // md5相同,直接取缓存数据即可
|
|
|
-// } else { // 缓存已经失效
|
|
|
-// $invalidGuild = array();
|
|
|
-// foreach ($recomm as $guildId) {
|
|
|
-// $guildInfo = GuildProc::getMemGuildInfo($mem, $guildId, $zoneid);
|
|
|
-// if ($guildInfo != null) { // 防范公会已经解散
|
|
|
-//// 调整下公会内容
|
|
|
-// unset($guildInfo->applylist);
|
|
|
-// unset($guildInfo->dryad);
|
|
|
-// unset($guildInfo->journal);
|
|
|
-// unset($guildInfo->message_board);
|
|
|
-// $guildInfo->membercount = count($guildInfo->members);
|
|
|
-// unset($guildInfo->members);
|
|
|
-//
|
|
|
-// $chairman = UserProc::getUserInfo($mem, $zoneid, $guildInfo->chairman_id);
|
|
|
-// $guildInfo->chairman_name = $chairman->game->baseInfo->name;
|
|
|
-// $memList [] = $guildInfo;
|
|
|
-// } else { // 如果公会已经解散,添加到失效数组中
|
|
|
-// $invalidGuild[] = $guildId;
|
|
|
-// }
|
|
|
-// }
|
|
|
-// $cache->md5 = $md5; // 更新缓存对象
|
|
|
-// $cache->memList = $memList;
|
|
|
-// $mem->set(MemKey_Guild::guildRecommendationCache($zoneid), $cache);
|
|
|
-// }
|
|
|
-// return $memList;
|
|
|
-// }
|
|
|
-//
|
|
|
-// /**
|
|
|
-// * 读Cmem中玩家公会信息
|
|
|
-// * @param type $mem
|
|
|
-// * @param type $oid
|
|
|
-// * @return UserGuildModel
|
|
|
-// */
|
|
|
-// static function getMemUserGuildInfo($mem, $uid, $zoneid) {
|
|
|
-// return $mem->get(MemKey_Guild::getUserGuildInfo($uid, $zoneid));
|
|
|
-// }
|
|
|
-//
|
|
|
-// /**
|
|
|
-// * 取指定guildid的公会数据
|
|
|
-// * @param CMemUtil $mem
|
|
|
-// * @param int $guildId
|
|
|
-// * @return GuildModel
|
|
|
-// */
|
|
|
-// static function getMemGuildInfo($mem, $guildId, $zoneid) {
|
|
|
-// return $mem->get(MemKey_Guild::getGuildInfo($guildId, $zoneid));
|
|
|
-// }
|
|
|
-//
|
|
|
-// /**
|
|
|
-// * 回写玩家公会信息
|
|
|
-// */
|
|
|
-// static function updateUserGuildInfo($mem, $uid, $userGuildInfo, $zoneid) {
|
|
|
-// $mem->set(MemKey_Guild::getUserGuildInfo($uid, $zoneid), $userGuildInfo);
|
|
|
-// }
|
|
|
-//
|
|
|
-// /**
|
|
|
-// * 新添加公会信息
|
|
|
-// */
|
|
|
-// static function addGuildInfo($mem, $guildId, $guildInfo, $zoneid) {
|
|
|
-// $mem->add(MemKey_Guild:: getGuildInfo($guildId, $zoneid), $guildInfo);
|
|
|
-// }
|
|
|
-//
|
|
|
-// /**
|
|
|
-// * 回写公会信息
|
|
|
-// * @param int $guildID
|
|
|
-// * @param int $guildInfo
|
|
|
-// */
|
|
|
-// static function updateGuildInfo($mem, $guildId, $guildInfo, $zoneid) {
|
|
|
-// $mem->set(MemKey_Guild:: getGuildInfo($guildId, $zoneid), $guildInfo);
|
|
|
-// }
|
|
|
-//
|
|
|
-// /**
|
|
|
-// * 检察公会最大人数
|
|
|
-// * @param type $mem
|
|
|
-// * @param type $guildInfo
|
|
|
-// * @return type
|
|
|
-// */
|
|
|
-// static function checkmemberfull($guildInfo) { //根据成员的 贡献度
|
|
|
-// $levelInfo = GameConfig::guildlevel_getItem($guildInfo->level);
|
|
|
-// return count($guildInfo->members) >= $levelInfo->maxPersoNum;
|
|
|
-// }
|
|
|
-//
|
|
|
-// /**
|
|
|
-// * 获取公会列表缓存信息 ok
|
|
|
-// * @param type $mem
|
|
|
-// * @param type $page
|
|
|
-// * @param type $zoneid
|
|
|
-// * @return type
|
|
|
-// */
|
|
|
-// static function getGuildListCache($mem, $page, $zoneid) {
|
|
|
-// return $mem->get(MemKey_Guild::guildListCache($page, $zoneid));
|
|
|
-// }
|
|
|
-//
|
|
|
-// static function updateGuildMemberCount($guildInfo, $zoneid) {
|
|
|
-// $paydb = CPayInit();
|
|
|
-// $paydb->query(sprintf(SQLUPDATEGUILDMEMBERCOUNT, count($guildInfo->members), $guildInfo->guildId, $zoneid));
|
|
|
-// $paydb->close();
|
|
|
-// }
|
|
|
-//
|
|
|
-// static function updateGuildChairman($guildInfo, $zoneid) {
|
|
|
-// $paydb = CPayInit();
|
|
|
-// $paydb->query(sprintf(SQLUPDATECHAIRMAN, $guildInfo->chairman_id, $guildInfo->chairman_name, $guildInfo->guildId, $zoneid));
|
|
|
-// $paydb->close();
|
|
|
-// }
|
|
|
-//
|
|
|
-// /**
|
|
|
-// * 判断玩家是否公会成员
|
|
|
-// * @param type $userGuildInfo
|
|
|
-// * @param type $guildId
|
|
|
-// * @return type
|
|
|
-// */
|
|
|
-// static function isGuildMember($userGuildInfo, $guildId) {
|
|
|
-// return $userGuildInfo->guildId == $guildId;
|
|
|
-// }
|
|
|
-//
|
|
|
-// /**
|
|
|
-// * 检查权限
|
|
|
-// * @param string $oid
|
|
|
-// * @param GuildModel $guildInfo
|
|
|
-// */
|
|
|
-// static function checkPermission($uid, $guildInfo) {
|
|
|
-// $ret = false;
|
|
|
-// if (self::isGuildChairman($uid, $guildInfo) || self::isViceChairman($uid, $guildInfo)) {
|
|
|
-// $ret = true;
|
|
|
-// }
|
|
|
-// return $ret;
|
|
|
-// }
|
|
|
-//
|
|
|
-// /**
|
|
|
-// * 检查权限 干部
|
|
|
-// * @param string $oid
|
|
|
-// * @param GuildModel $guildInfo
|
|
|
-// */
|
|
|
-// static function checkPermissiona_addofficer($uid, $guildInfo) {
|
|
|
-// $ret = false;
|
|
|
-// if (self::isGuildChairman($uid, $guildInfo) || self::isViceChairman($uid, $guildInfo) || self::isOfficerChairman($uid, $guildInfo)) {
|
|
|
-// $ret = true;
|
|
|
-// }
|
|
|
-// return $ret;
|
|
|
-// }
|
|
|
-//
|
|
|
-// /**
|
|
|
-// * 判断玩家是否公会会长
|
|
|
-// * @param type $oid
|
|
|
-// * @param type $guildInfo
|
|
|
-// * @return type
|
|
|
-// */
|
|
|
-// static function isGuildChairman($uid, $guildInfo) {
|
|
|
-// return $guildInfo->chairman_id == $uid;
|
|
|
-// }
|
|
|
-//
|
|
|
-// /**
|
|
|
-// * 判断是否副会长
|
|
|
-// * @param type $oid
|
|
|
-// * @param type $guildInfo
|
|
|
-// * @return boolean
|
|
|
-// */
|
|
|
-// static function isViceChairman($uid, $guildInfo) {
|
|
|
-// $ret = false;
|
|
|
-// if (is_array($guildInfo->viceChairManArr) && in_array($uid, $guildInfo->viceChairManArr)) {
|
|
|
-// $ret = true;
|
|
|
-// }
|
|
|
-// return $ret;
|
|
|
-// }
|
|
|
-//
|
|
|
-// /**
|
|
|
-// * 判断是否 干部
|
|
|
-// * @param type $oid
|
|
|
-// * @param type $guildInfo
|
|
|
-// * @return boolean
|
|
|
-// */
|
|
|
-// static function isOfficerChairman($uid, $guildInfo) {
|
|
|
-// $ret = false;
|
|
|
-// if (is_array($guildInfo->officerManArr) && in_array($uid, $guildInfo->officerManArr)) {
|
|
|
-// $ret = true;
|
|
|
-// }
|
|
|
-// return $ret;
|
|
|
-// }
|
|
|
-//
|
|
|
-// /**
|
|
|
-// * 移除副会长
|
|
|
-// * @param GuildModel $guildInfo
|
|
|
-// * @param string $oid
|
|
|
-// */
|
|
|
-// static function removeViceChairman($guildInfo, $uid) {
|
|
|
-// if (self::isViceChairman($uid, $guildInfo)) {
|
|
|
-// StlUtil::arrayRemove($guildInfo->viceChairManArr, $uid);
|
|
|
-// }
|
|
|
-// }
|
|
|
-//
|
|
|
-// /**
|
|
|
-// * 移除干部
|
|
|
-// * @param GuildModel $guildInfo
|
|
|
-// * @param string $oid
|
|
|
-// */
|
|
|
-// static function removeOfficerChairman($guildInfo, $uid) {
|
|
|
-// if (self::isOfficerChairman($uid, $guildInfo)) {
|
|
|
-// StlUtil::arrayRemove($guildInfo->officerManArr, $uid);
|
|
|
-// }
|
|
|
-// }
|
|
|
-//
|
|
|
-// /**
|
|
|
-// * 追加一条公会日志
|
|
|
-// * @param array $guildJournal
|
|
|
-// * @param type $oid
|
|
|
-// * @param type $type
|
|
|
-// * @param type $tag
|
|
|
-// */
|
|
|
-// static function pushNewJournal($mem, $guildId, $journal, $zoneid) {
|
|
|
-// $journalLength = $mem->llen(MemKey_Guild::constGuildJournal($guildId, $zoneid));
|
|
|
-// if ($journalLength >= GUILDMAXJOURNALCOUNT) {
|
|
|
-// $mem->rpop(MemKey_Guild::constGuildJournal($guildId, $zoneid)); #移除队尾元素
|
|
|
-// }
|
|
|
-// return $mem->lpush(MemKey_Guild::constGuildJournal($guildId, $zoneid), $journal);
|
|
|
-// }
|
|
|
-//
|
|
|
-// /**
|
|
|
-// * 计算公会等级
|
|
|
-// * @param type $guildInfo
|
|
|
-// */
|
|
|
-// static function getGuildLevel($contribute) {
|
|
|
-// $level = 1;
|
|
|
-// $str = glc()->Guild_ContributeLevel;
|
|
|
-// $arr = CommUtil::split($str, ';');
|
|
|
-//
|
|
|
-// foreach ($arr as $key => $value) {
|
|
|
-// $valueArr = CommUtil::split($value, ',');
|
|
|
-// if ($contribute >= $valueArr[1]) {
|
|
|
-// $level = $valueArr[0];
|
|
|
-// }
|
|
|
-// }
|
|
|
-// return $level;
|
|
|
-// }
|
|
|
-//
|
|
|
-// /**
|
|
|
-// * 礼包数量增加
|
|
|
-// * @param type $guildInfo
|
|
|
-// * @param type $libaoId
|
|
|
-// */
|
|
|
-// static function guildGiftNumAdd($guildInfo, $libaoId) {
|
|
|
-// if (!CommUtil::isPropertyExists($guildInfo, 'giftnum_record')) {
|
|
|
-// $guildInfo->giftnum_record = ObjectInit();
|
|
|
-// }
|
|
|
-// if (!CommUtil::isPropertyExists($guildInfo->giftnum_record, $libaoId)) {
|
|
|
-// $guildInfo->giftnum_record->$libaoId = 1;
|
|
|
-// } else {
|
|
|
-// $guildInfo->giftnum_record->$libaoId += 1;
|
|
|
-// }
|
|
|
-// }
|
|
|
-//
|
|
|
-// // <editor-fold defaultstate="collapsed" desc="公会请求捐献函数集合 HASH">
|
|
|
-//
|
|
|
-// /**
|
|
|
-// * 捐献请求数据缓存
|
|
|
-// * @param type $mem
|
|
|
-// * @param type $guildId
|
|
|
-// * @param type $donateinfo
|
|
|
-// * @param type $zoneid
|
|
|
-// * @return type
|
|
|
-// */
|
|
|
-// static function hsetGuildRequestDonateInfo($mem, $guildId, $donateinfo, $uid, $zoneid) {
|
|
|
-// $ts = $donateinfo->ts;
|
|
|
-// return $mem->hset(MemKey_Guild::CacheGuildDonate($guildId, $zoneid), $uid . $ts, $donateinfo);
|
|
|
-// }
|
|
|
-//
|
|
|
-// /**
|
|
|
-// * 获取 捐献请求数据缓存
|
|
|
-// * @param type $mem
|
|
|
-// * @param type $guildId
|
|
|
-// * @param type $zoneid
|
|
|
-// * @return type
|
|
|
-// */
|
|
|
-// static function getallGuildRequestDonateInfo($mem, $guildId, $zoneid) {
|
|
|
-// return $mem->hgetall(MemKey_Guild::CacheGuildDonate($guildId, $zoneid));
|
|
|
-// }
|
|
|
-//
|
|
|
-// /**
|
|
|
-// * 获取一条请求捐献数据
|
|
|
-// * @param type $mem
|
|
|
-// * @param type $guildId
|
|
|
-// * @param type $zoneid
|
|
|
-// * @param type $index
|
|
|
-// * @return type
|
|
|
-// */
|
|
|
-// static function getOneGuildRequestDonateInfo($mem, $guildId, $zoneid, $index) {
|
|
|
-// return $mem->hget(MemKey_Guild::CacheGuildDonate($guildId, $zoneid), $index);
|
|
|
-// }
|
|
|
-//
|
|
|
-// /**
|
|
|
-// * 删除某一条捐献数据
|
|
|
-// * @param type $mem
|
|
|
-// * @param type $guildId
|
|
|
-// * @param type $zoneid
|
|
|
-// * @param type $ts
|
|
|
-// * @return type
|
|
|
-// */
|
|
|
-// static function deleteOneGuildRequestDonateInfo($mem, $guildId, $zoneid, $index) {
|
|
|
-// return $mem->hdel(MemKey_Guild::CacheGuildDonate($guildId, $zoneid), $index);
|
|
|
-// }
|
|
|
-//
|
|
|
-// // const
|
|
|
-// // </editor-fold>
|
|
|
-////---------------------------------------------------------------------------
|
|
|
-// // <editor-fold defaultstate="collapsed" desc="公会捐献函数集合 LIST">
|
|
|
-//
|
|
|
-// /**
|
|
|
-// * 存入元素值
|
|
|
-// */
|
|
|
-// static function setUserDonateRecordList($mem, $guildId, $zoneid, $index, $uid) {
|
|
|
-// return $mem->lpush(MemKey_Guild::UserDonateRecordList($guildId, $index, $zoneid), $uid);
|
|
|
-// }
|
|
|
-//
|
|
|
-// /**
|
|
|
-// * 获取捐献记录表的长度
|
|
|
-// */
|
|
|
-// static function gainUserDonateRecordlistLength($mem, $guildId, $zoneid, $index) {
|
|
|
-// return $mem->llen(MemKey_Guild::UserDonateRecordList($guildId, $index, $zoneid));
|
|
|
-// }
|
|
|
-//
|
|
|
-// /**
|
|
|
-// * 删除记录捐献id的 key
|
|
|
-// * @param type $mem
|
|
|
-// * @param type $guildId
|
|
|
-// * @param type $ts
|
|
|
-// * @param type $zoneid
|
|
|
-// */
|
|
|
-// static function deleteUserDonateRecordList($mem, $guildId, $index, $zoneid) {
|
|
|
-// $mem->delete(MemKey_Guild::UserDonateRecordList($guildId, $index, $zoneid));
|
|
|
-// }
|
|
|
-//
|
|
|
-// /**
|
|
|
-// * 得到捐献的所有玩家id
|
|
|
-// * @param type $mem
|
|
|
-// * @param type $guildId
|
|
|
-// * @param type $ts
|
|
|
-// * @param type $zoneid
|
|
|
-// * @param type $endIndex
|
|
|
-// * @return type
|
|
|
-// */
|
|
|
-// static function getallUserDonateRecordList($mem, $guildId, $index, $zoneid, $endIndex) {
|
|
|
-// return $mem->lrange(MemKey_Guild::UserDonateRecordList($guildId, $index, $zoneid), 0, $endIndex);
|
|
|
-// }
|
|
|
-//
|
|
|
-// // const
|
|
|
-// // </editor-fold>
|
|
|
-////-----------------------------------------------------------------
|
|
|
-// // <editor-fold defaultstate="collapsed" desc="公会战封装函数">
|
|
|
-//
|
|
|
-// /**
|
|
|
-// * 邀请战斗
|
|
|
-// * @param type $mem
|
|
|
-// * @param type $uid_invite
|
|
|
-// * @param type $zoneid
|
|
|
-// */
|
|
|
-// static function setFightInviteInfo($mem, $guildId, $uid_invite, $array, $zoneid) {
|
|
|
-// return $mem->hset(MemKey_Guild::constvsFightInvite($guildId, $zoneid), $uid_invite, $array);
|
|
|
-// }
|
|
|
-//
|
|
|
-// /**
|
|
|
-// * 获取某个人的邀请信息
|
|
|
-// * @param type $mem
|
|
|
-// * @param type $guildId
|
|
|
-// * @param type $uid_invite
|
|
|
-// * @param type $zoneid
|
|
|
-// * @return type
|
|
|
-// */
|
|
|
-// static function hgetFightInviteInfo($mem, $guildId, $uid_invite, $zoneid) {
|
|
|
-// return $mem->hget(MemKey_Guild::constvsFightInvite($guildId, $zoneid), $uid_invite);
|
|
|
-// }
|
|
|
-//
|
|
|
-// /**
|
|
|
-// * 该成员是否存在邀请战斗信息
|
|
|
-// * @param type $mem
|
|
|
-// * @param type $guildId
|
|
|
-// * @param type $uid_invite
|
|
|
-// * @param type $zoneid
|
|
|
-// */
|
|
|
-// static function hexistsFightInviteInfo($mem, $guildId, $uid_invite, $zoneid) {
|
|
|
-// return $mem->hexists(MemKey_Guild::constvsFightInvite($guildId, $zoneid), $uid_invite);
|
|
|
-// }
|
|
|
-//
|
|
|
-// /**
|
|
|
-// * 取消本次邀请战斗
|
|
|
-// * @param type $mem
|
|
|
-// * @param type $guildId
|
|
|
-// * @param type $uid_invite
|
|
|
-// * @param type $zoneid
|
|
|
-// * @return type
|
|
|
-// */
|
|
|
-// static function deleteOneFightInviteInfo($mem, $guildId, $uid_invite, $zoneid) {
|
|
|
-// return $mem->hdel(MemKey_Guild::constvsFightInvite($guildId, $zoneid), $uid_invite);
|
|
|
-// }
|
|
|
-//
|
|
|
-// // const
|
|
|
-//// </editor-fold>
|
|
|
-//// const
|
|
|
-//// </editor-fold>
|
|
|
-//}
|