/** *获取游戏列表 */ public function rebuildAction() { //基础元素,必须参与验证 $Config['Time'] = abs(intval($this->request->Time)); $Config['ReturnType'] = $this->request->ReturnType ? $this->request->ReturnType : 2; //URL验证码 $sign = trim($this->request->sign); //私钥,以后要移开到数据库存储 $p_sign = 'lm'; $sign_to_check = Base_common::check_sign($Config, $p_sign); //不参与验证的元素 //验证URL是否来自可信的发信方 if ($sign_to_check == $sign) { //验证时间戳,时差超过600秒即认为非法 if (abs($Config['Time'] - time()) <= 600) { $oApp = new Config_App(); $oPartner = new Config_Partner(); $oServer = new Config_Server(); $oPartnerApp = new Config_Partner_App(); $oSocketType = new Config_SocketType(); $oApp->reBuildAppConfig(); $oPartner->reBuildPartnerConfig(); $oServer->reBuildServerConfig(); $oPartnerApp->reBuildPartnerAppConfig(); $oSocketType->reBuildSocketTypeConfig(); } else { $result = array('return' => 0, 'comment' => "时间有误"); } } else { $result = array('return' => 0, 'comment' => "验证失败,请检查URL"); } if ($Config['ReturnType']) { echo json_encode($result); } }
public static function newInstance($prefix) { $frontMcConf = Config_Server::getInstance()->getServerConfig('front.dev.mc'); $mcObj = self::Factory($frontMcConf['ips'], $prefix); $mcObj->setTypePrefix($prefix); self::$_instances[$prefix] = $mcObj; return $mcObj; }
protected function init_setting() { $setting_file = DATA_PATH . '/cache/settings_varname.cache'; if (IS_FRONT === false) { if (count($_SERVER['argv']) > 1) { global $argv; foreach ($_SERVER['argv'] as $key => $arg) { if (strpos($arg, "host=") !== false) { $tmp_file = DATA_PATH . '/cache/' . str_replace('host=', '', $arg) . '.cache'; if (is_file($tmp_file)) { $setting_file = $tmp_file; } unset($_SERVER['argv'][$key]); } } $argv = $_SERVER['argv'] = array_values($_SERVER['argv']); } } require $setting_file; self::setInstance('Config', new Com_Config()); Config_Server::load_settings($settings_varname); $this->session_start(UUZU_AUTH); }
/** * 获取指定用户组允许查看游戏的合作商 * @param integer $data_groups * @param integer $AppId * @return array */ public function getServer($data_groups, $AppId, $PartnerId, $fields) { $returnArr = array(); $oServerData = new Config_Server(); $AppId = abs(intval($AppId)); $PartnerId = abs(intval($PartnerId)); $data_groups = trim($data_groups); $app_list = $this->getApp($data_groups, "AppId"); if (isset($app_list[$AppId])) { $partner_list = $this->getPartner($data_groups, $AppId, 'PartnerId'); if (isset($partner_list[$PartnerId])) { // if($partner_list[$PartnerId]['mixed_sign']!='') // { // $PartnerId = 1; // } $server_list = $oServerData->getByAppPartner($AppId, $PartnerId, $fields); if (isset($server_list)) { foreach ($server_list as $key => $value) { $returnArr[$value['ServerId']] = $value; } } } } return $returnArr; }
public function createExchangeQueueByUser($UserId, $ServerId, $Coin) { $oServer = new Config_Server(); $oApp = new Config_App(); $ServerInfo = $oServer->getRow($ServerId); //服务器存在 if ($ServerInfo['ServerId']) { $AppInfo = $oApp->getRow($ServerInfo['AppId']); if ($AppInfo['AppId']) { $oUser = new Lm_User(); $UserInfo = $oUser->GetUserById($UserId); //用户存在 if ($UserInfo['UserId']) { $time = time(); //初始化兑换信息 $ExchangeInfo = array('OrderId' => 0, 'AppId' => $ServerInfo['AppId'], 'PartnerId' => $ServerInfo['PartnerId'], 'Coin' => $Coin, 'ServerId' => $ServerInfo['ServerId'], 'UserId' => $UserInfo['UserId'], 'AppCoin' => $Coin * $AppInfo['exchange_rate'], 'UserSourceId' => $UserInfo['UserSourceId'], 'UserSourceDetail' => $UserInfo['UserSourceDetail'], 'UserSourceProjectId' => $UserInfo['UserSourceProjectId'], 'UserSourceActionId' => $UserInfo['UserSourceActionId'], 'UserRegTime' => $UserInfo['UserRegTime'], 'ExchangeStatus' => 0, 'ReTryCount' => 0, 'ExchangeType' => 3, 'CreateExchangeTime' => $time, 'ExchangeId' => date("YmdHis", $time) . sprintf("%04d", rand(1, 9999)), 'ToSendTime' => $time); $this->db->begin(); $queueTable = Base_Widget::getDbTable($this->table_exchange_queue); //添加兑换队列 $addQueue = $this->db->insert($queueTable, $ExchangeInfo); $coinUpdate = $oUser->updateUserCoin($UserInfo['UserId'], $Coin * -1); //扣款 if ($addQueue && $coinUpdate) { //执行 $this->db->commit(); return $ExchangeInfo['ExchangeId']; } else { $this->db->rollBack(); return false; } } else { return false; } } else { return false; } } else { return false; } }
public function SocketGetServerInfo($buff) { $oUser = new Lm_User(); $oLogin = new Lm_Login(); $oServer = new Config_Server(); $arrIP = ""; $format = "V1uLength/V1uID/v1Type/C1MsgLevel/C1Line/C*"; $unpackArr = @unpack($format, $buff); foreach ($unpackArr as $key => $value) { if (is_int($key)) { $arrIP .= chr($value); } } if ($arrIP) { $ServerInfo = $oServer->getByIp(trim($arrIP)); if ($ServerInfo['ServerId']) { $result = array('return' => 1, 'ServerInfo' => $ServerInfo, 'comment' => '找到服务器'); } else { $result = array('return' => 2, 'comment' => '你所查询的IP不属于任何服务器'); } } else { $result = array('return' => 0, 'comment' => "请输入服务器IP"); } $tmpArr = explode('|', $allMsg); $resArr['uLength'] = 17; $resArr['uID'] = $unpackArr['uID']; $resArr['uType'] = 60207; $resArr['uMsgLevel'] = $unpackArr['MsgLevel']; $resArr['uLine'] = $unpackArr['Line']; $resArr['m_ucResultID'] = $result['return']; $resArr['m_uiZoneID'] = $result['ServerInfo']['ServerId']; //重新封包 $format = "V2vC3V"; $resMsg = pack($format, $resArr['uLength'], $resArr['uID'], $resArr['uType'], $resArr['uMsgLevel'], $resArr['uLine'], $resArr['m_ucResultID'], $resArr['m_uiZoneID']); return $resMsg; }
public function productQueueSendDetailAction() { $oArea = new Config_Area(); $oPartnerApp = new Config_Partner_App(); $oServer = new Config_Server(); $oPermission = new Config_Permission(); $oUser = new Lm_User(); $ProductSendTypeArr = $this->config->ProductSendTypeArr; $ProductTypeArr = $this->config->ProductTypeArr; //获取用户可以查看的游戏列表 $permitted_app = $oPermission->getApp($this->manager->data_groups, 'AppId,name'); $AreaList = $oArea->getAll(); set_time_limit(0); $page = intval(max($this->request->page, 1)); //检查当前页面权限 $sign = '?ctl=config/product/product&ac=product.queue.send.detail'; $this->manager->checkMenuPermission($sign, Widget_Manager::MENU_PURVIEW_SELECT); //页面输入变量 $AppId = intval($this->request->AppId); $PartnerId = intval($this->request->PartnerId); $PassageId = intval($this->request->PassageId); $AreaId = intval($this->request->AreaId) ? intval($this->request->AreaId) : 0; $UserName = $this->request->UserName; $app_type = intval($this->request->app_type); $partner_type = intval($this->request->partner_type); $is_abroad = intval($this->request->is_abroad) ? intval($this->request->is_abroad) : 0; //页面输入变量 $ProductSendType = $this->request->ProductSendType; $ProductType = $this->request->ProductType; //是否导出当前页面表格 $export = $this->request->export ? intval($this->request->export) : 0; $pagesize = $export ? 0 : 20; //初始化图表配置 $Input = array('UserName' => urlencode($UserName), 'AppId' => $AppId, 'PartnerId' => $PartnerId, 'ServerId' => $ServerId, 'ProductSendType' => $ProductSendType, 'export' => 1); $export_var = "<a href =" . Base_Common::getUrl('', 'config/product/product', 'product.queue.send.detail', $Input) . "><导出表格></a>"; //初始化合作商列表 $permitted_partner = array(); //获取当前地区列表 $AreaList = $oArea->getAbroad($is_abroad, $AreaList); //生成允许的地区id数组 if ($app_type > 0) { //筛选是否平台产品 $permitted_app = $this->oApp->getApp($app_type, $permitted_app); } if ($AppId > 0) { //获取可查看的权限总表 $permitted_partner = $oPermission->getPartner($this->manager->data_groups, $AppId, 'PartnerId,name,AreaId'); //根据合作方式筛选 $permitted_partner = $oPartnerApp->getPermittedPartnerByPartnerType($partner_type, $permitted_partner); //根据所在地区筛选 $permitted_partner = $oPartnerApp->getPermittedPartnerByPartnerArea($AreaList, $permitted_partner); if ($PartnerId > 0) { //获取服务器列表 $permitted_server = $oPermission->getServer($this->manager->data_groups, $AppId, $PartnerId, 'ServerId,name'); } } if ($UserName) { $UserInfo = $oUser->getUserByName($UserName); if ($UserInfo['UserId']) { $UserId = $UserInfo['UserId']; } else { $UserId = -1; } } else { $UserId = 0; } $ProductSendQueueDetailArr = $this->oProduct->getProductSendQueueDetail($UserId, $ProductSendType, $ProductType, $ServerId, ($page - 1) * $pagesize, $pagesize); $UserInfoList = array(); if (is_array($ProductSendQueueDetailArr['ProductSendQueueDetail'])) { foreach ($ProductSendQueueDetailArr['ProductSendQueueDetail'] as $key => $value) { if ($value['UserId']) { if (!isset($UserInfoList[$value['UserId']])) { $UserInfo = $oUser->getUserById($value['UserId']); $UserInfoList[$value['UserId']] = $UserInfo; } } if (!isset($ServerInfo[$value['ServerId']])) { $ServerInfo[$value['ServerId']] = $oServer->getRow($value['ServerId']); } $Comment = json_decode($value['Comment'], true); $ProductSendQueueDetailArr['ProductSendQueueDetail'][$key]['UserName'] = $value['UserId'] ? $UserInfoList[$value['UserId']]['UserName'] : "******"; $ProductSendQueueDetailArr['ProductSendQueueDetail'][$key]['ProductSendTypeName'] = $ProductSendTypeArr[$value['SendType']]; $ProductSendQueueDetailArr['ProductSendQueueDetail'][$key]['ProductTypeName'] = $ProductTypeArr[$value['ProductType']]; $ProductSendQueueDetailArr['ProductSendQueueDetail'][$key]['ServerName'] = $ServerInfo[$value['ServerId']]['name']; } } $page_title = "道具发送队列详情"; $page_form_action = $sign; //调取模板 include $this->tpl('Config_Product_ProductSendQueueDetail'); }