NRank merge to Rank

This commit is contained in:
aozhiwei 2021-11-18 19:41:58 +08:00
parent cba7e7616a
commit 1be6450d5a
5 changed files with 118 additions and 138 deletions

View File

@ -1,42 +0,0 @@
# -*- coding: utf-8 -*-
import _common
class NRank(object):
def __init__(self):
self.apis = [
{
'desc': 'getGunInfo',
'group': 'NRank',
'url': 'webapp/index.php?c=NRank&a=getGunInfo',
'params': [
_common.ReqHead(),
],
'response': [
_common.RspHead(),
]
},
{
'desc': 'getRankInfo',
'group': 'NRank',
'url': 'webapp/index.php?c=NRank&a=getRankInfo',
'params': [
_common.ReqHead(),
],
'response': [
_common.RspHead(),
]
},
{
'desc': 'mailTest',
'group': 'NRank',
'url': 'webapp/index.php?c=NRank&a=mailTest',
'params': [
_common.ReqHead(),
],
'response': [
_common.RspHead(),
]
},
]

View File

@ -17,4 +17,37 @@ class Rank(object):
_common.RspHead(),
]
},
{
'desc': 'getGunInfo',
'group': 'NRank',
'url': 'webapp/index.php?c=NRank&a=getGunInfo',
'params': [
_common.ReqHead(),
],
'response': [
_common.RspHead(),
]
},
{
'desc': 'getRankInfo',
'group': 'NRank',
'url': 'webapp/index.php?c=NRank&a=getRankInfo',
'params': [
_common.ReqHead(),
],
'response': [
_common.RspHead(),
]
},
{
'desc': 'mailTest',
'group': 'NRank',
'url': 'webapp/index.php?c=NRank&a=mailTest',
'params': [
_common.ReqHead(),
],
'response': [
_common.RspHead(),
]
},
]

View File

@ -1,96 +0,0 @@
<?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);
}
}

View File

@ -271,4 +271,88 @@ class RankController extends BaseAuthedController {
'integral_list' => $integral_list,
));
}
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);
}
}

View File

@ -29,6 +29,7 @@ $rewriteRule = array(
'NBag' => 'Bag',
'NHero' => 'Hero',
'NPlayer' => 'NPlayerInfo',
'NRank' => 'Rank',
);
function getRewriteClass($oldC)