game2006api/webapp/controller/NRankController.class.php
2021-09-24 10:15:21 +08:00

96 lines
3.3 KiB
PHP

<?php
class NRankController extends BaseAuthedController {
public $m_testCnt = 0;
public function getGunInfo()
{
$account_id = $_REQUEST['account_id'];
$conn = $this->getMysql($account_id);
$sqlStr = "SELECT * FROM gun_intensify WHERE accountid=:accountid; ";
$row = $conn->execQuery($sqlStr,array(':accountid' => $account_id));
$this->sendDataToClient(0,"test02",$row);
}
public function getRankInfo()
{
$account_id = $_REQUEST['account_id'];
$conn = $this->getMysql($account_id);
$killResultArr = array();
$rankPointArr = array();
//获得自己的击杀排行榜
$sqlStr = "SELECT accountid,user_name,hi_id,head_kuang_id,kills,win_times FROM user WHERE accountid=:accountid";
$row = $conn->execQuery($sqlStr,array(':accountid' => $account_id));
if($row)
{
array_push($killResultArr,$row[0]);
}
//击杀排行榜
$sqlStr = "SELECT accountid,user_name,hi_id,head_kuang_id,kills,win_times FROM user order by win_times desc limit 50";
$row = $conn->execQuery($sqlStr);
if($row) {
$len = count($row);
for($i = 0 ; $i < $len ; $i ++)
{
array_push($killResultArr,$row[$i]);
}
}
//获得自己的排位积分
$sqlStr = "SELECT accountid,user_name,hi_id,head_kuang_id,integral FROM user WHERE accountid=:accountid";
$row = $conn->execQuery($sqlStr,array(':accountid' => $account_id));
if($row)
{
array_push($rankPointArr,$row[0]);
}
//积分排行榜
$sqlStr = "SELECT accountid,user_name,hi_id,head_kuang_id,integral FROM user order by integral desc limit 50";
$row = $conn->execQuery($sqlStr);
if($row) {
$len = count($row);
for($i = 0 ; $i < $len ; $i ++)
{
array_push($rankPointArr,$row[$i]);
}
}
//好友排行榜
$resultData = array();
array_push($resultData,$killResultArr);
array_push($resultData,$rankPointArr);
$this->sendDataToClient(100,"getRankInfo",$resultData);
}
public function mailTest()
{
$url = '';
$account_id = $_REQUEST['account_id'];
if (SERVER_ENV == _ONLINE) {
$url = 'https://gamemail.kingsome.cn/webapp/index.php?c=MailMgr&a=sendMail&';
} else {
$url = 'https://gamemail-test.kingsome.cn/webapp/index.php?c=MailMgr&a=sendMail&';
}
$params = array(
'gameid' => "1234",
'to' => $account_id,
'from' => $account_id,
'mailsubtype'=>12,
'content'=>"采蘑菇的小朋友",
'subject'=>"皮卡猪",
"attachments"=>"1001:10|1002:20",
"ext"=>"10"
);
if (!phpcommon\HttpClient::get($url, $params, $response)) {
phpcommon\sendError(ERR_RETRY, '系统繁忙');
return;
}
$data = json_decode($response, true);
//error_log("邮件测试=====".json_encode($data));
$this->sendDataToClient(100,"MailTest",$data);
}
}