function manage_action() { if(!config::get('sms_username') || !config::get('sms_password')){ echo '<script>alert("您需要先设置用户名和密码才能使用短信管理功能!");window.location.href="'.url('config/system/set/sms').'";</script>'; exit; } include_once("phprpc/phprpc_client.php"); $client = new PHPRPC_Client(); $client->setProxy(NULL); $client->useService('http://pay.cmseasy.cn/sms.php'); $client->setKeyLength(128); $client->setEncryptMode(3); $info = $client->getInfo(config::get('sms_username'),md5(config::get('sms_password'))); $info[0] = intval($info[0]); $info[1] = intval($info[1]); $this->view->info = $info; if (front::post('submit')) { if (front::post('act') == 'test') { $rs = sendMsg(front::post('mobile'),'test'); if($rs->SendSMSResult == '0'){ front::flash('发送成功'); }else{ front::flash('发送失败,请检查用户名、密码或剩余条数'); } } }else{ if($info[0] < 50) front::flash('你的剩余短信不足50条,请及时充值'); } }
public function actionTest() { $serverList = $this->_getGlobalData('gameser_list'); $server = $serverList[$_REQUEST['server_id']]['server_url'] . 'rpc/user'; $phprpcPath = LIB_PATH . '/phprpc/phprpc_client.php'; if (!file_exists($phprpcPath)) { throw new Error('phprpc libs not exist'); } include_once $phprpcPath; $phpRpc = new PHPRPC_Client(); $phpRpc->useService($server); $phpRpc->setProxy(null); //设置代理 $phpRpc->setEncryptMode(0); $phpRpc->setCharset('UTF-8'); $phpRpc->setTimeout(10); $phpRpc->setPrivateKey('test'); $dataList = $phpRpc->getInfo('wcj'); print_r($dataList); }