Merge branch 'hjb' into james_bc
This commit is contained in:
commit
9907a11796
27
doc/Other.py
Normal file
27
doc/Other.py
Normal file
@ -0,0 +1,27 @@
|
||||
import _common
|
||||
|
||||
class Other(object):
|
||||
|
||||
def __init__(self):
|
||||
self.apis = [
|
||||
{
|
||||
'name': 'tag',
|
||||
'desc': '红点提示',
|
||||
'group': 'Other',
|
||||
'url': 'webapp/index.php?c=Other&a=tag',
|
||||
'params': [
|
||||
_common.ReqHead(),
|
||||
['param', '0', '1:任务 2:碎片'],
|
||||
],
|
||||
'response': [
|
||||
_common.RspHead(),
|
||||
['!data', [
|
||||
['mission',0,'任务: 1 提示, 0 不提示'],
|
||||
['piece',[
|
||||
['hero',0,'英雄碎片: 1 提示, 0 不提示'],
|
||||
['gun',0,'枪械碎片: 1 提示, 0 不提示'],
|
||||
],'碎片']
|
||||
], '提示信息'],
|
||||
]
|
||||
}
|
||||
]
|
12
doc/User.py
12
doc/User.py
@ -165,5 +165,17 @@ class User(object):
|
||||
_common.RspHead(),
|
||||
['property_chg', _common.PropertyChg(), '属性变更'],
|
||||
]
|
||||
},{
|
||||
'name': 'getFreeItemList',
|
||||
'desc': '获取免费英雄和武器列表',
|
||||
'group': 'User',
|
||||
'url': 'webapp/index.php?c=User&a=getFreeItemList',
|
||||
'params': [
|
||||
_common.ReqHead(),
|
||||
],
|
||||
'response': [
|
||||
_common.RspHead(),
|
||||
['!data', [], '列表'],
|
||||
]
|
||||
},
|
||||
]
|
||||
|
@ -58,6 +58,15 @@ class BaseAuthedController extends BaseController {
|
||||
|
||||
public function _handlePre()
|
||||
{
|
||||
// if (SERVER_ENV == _ONLINE) {
|
||||
// if (getReqVal('client_uuid', '') != '499af8a0-a1bc-0b0e-dc79-a42cb3f103dc') {
|
||||
// if ((getReqVal('c', '') != 'Battle')) {
|
||||
// phpcommon\sendError(1001, 'session expiration');
|
||||
// die();
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
|
||||
$this->accountId = getReqVal('account_id', '');
|
||||
$this->sessionId = getReqVal('session_id', '');
|
||||
if (!phpcommon\isValidSessionId($this->accountId,
|
||||
|
@ -53,8 +53,9 @@ class BaseController {
|
||||
public function _getZid()
|
||||
{
|
||||
$net = getReqVal('_net', '');
|
||||
$zid = $net && strlen($net) > 3 ? $net[2] : 3;
|
||||
return ($zid >= 1 && $zid <= 8) ? $zid : 3;
|
||||
$values = explode('-', $net);
|
||||
$zid = $values[1];
|
||||
return substr($zid, 1);
|
||||
}
|
||||
|
||||
public function _rspErr($errcode, $errmsg)
|
||||
|
58
webapp/controller/OtherController.class.php
Normal file
58
webapp/controller/OtherController.class.php
Normal file
@ -0,0 +1,58 @@
|
||||
<?php
|
||||
|
||||
require_once('services/MissionService.php');
|
||||
|
||||
require_once('models/Mission.php');
|
||||
require_once('models/Fragment.php');
|
||||
require_once('models/Season.php');
|
||||
|
||||
use phpcommon\SqlHelper;
|
||||
use models\Mission;
|
||||
use models\Fragment;
|
||||
use models\Season;
|
||||
class OtherController extends BaseAuthedController {
|
||||
const MISSION = 1;
|
||||
const PIECE = 2;
|
||||
|
||||
public function tag()
|
||||
{
|
||||
$param = getReqVal('param', 0);
|
||||
$req = array(
|
||||
'mission' => 0,
|
||||
'piece' => array(),
|
||||
);
|
||||
switch ($param){
|
||||
case self::MISSION : {
|
||||
$userInfo = $this->_safeGetOrmUserInfo();
|
||||
$currRankSeasonMeta = mt\RankSeason::getCurrentSeason();
|
||||
$seasonDb = Season::find($currRankSeasonMeta['id']);
|
||||
$missionService = new services\MissionService();
|
||||
$missionService->init($userInfo, $seasonDb);;
|
||||
$missionMetaList = mt\Task::getCustomTypeMetaList(1, $missionService);
|
||||
$missionHash = Mission::allToHash();
|
||||
foreach ($missionMetaList as $missionMeta) {
|
||||
$missionDb = getXVal($missionHash, $missionMeta['id'], null);
|
||||
$missionDto = $missionService->getMissionDto('', '', $missionDb, $missionMeta);
|
||||
if ($missionDto['state'] == Mission::RECEIVEABLE_STATE){
|
||||
$req['mission'] = 1;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
case self::PIECE : {
|
||||
$req['piece'] = Fragment::isSatisfy();
|
||||
}
|
||||
break;
|
||||
default:{
|
||||
$req = array(
|
||||
'mission' => 0,
|
||||
'piece' => array(),
|
||||
);
|
||||
}
|
||||
}
|
||||
$this->_rspData(array(
|
||||
'data'=>$req
|
||||
));
|
||||
}
|
||||
}
|
@ -150,6 +150,7 @@ class UserController extends BaseAuthedController {
|
||||
$this->_addItems($addItems, $awardService, $propertyChgService);
|
||||
}
|
||||
|
||||
|
||||
private function loginCheck($userInfo)
|
||||
{
|
||||
$seasonService = new services\SeasonService();
|
||||
@ -706,6 +707,21 @@ class UserController extends BaseAuthedController {
|
||||
]);
|
||||
}
|
||||
|
||||
public function getFreeItemList(){
|
||||
$data = array();
|
||||
$heroParam = mt\Parameter::getListValue('free_hero_list');
|
||||
$gunParam = mt\Parameter::getListValue('free_weapon_list');
|
||||
if ($heroParam){
|
||||
$data['hero'] = $heroParam;
|
||||
}
|
||||
if ($gunParam){
|
||||
$data['gun'] = $gunParam;
|
||||
}
|
||||
$this->_rspData([
|
||||
'data'=>$data
|
||||
]);
|
||||
}
|
||||
|
||||
public function selectFreeItem(){
|
||||
$hero_id = getReqVal('hero_id', '');
|
||||
$gun_id = getReqVal('gun_id', '');
|
||||
|
@ -79,5 +79,88 @@ class Fragment extends BaseModel
|
||||
return $dto;
|
||||
}
|
||||
|
||||
public static function getList($type=null){
|
||||
$itemList = array();
|
||||
$fragmentItem = self::getFragmentItem();
|
||||
$list1 = $fragmentItem['all'];
|
||||
$list2 = $fragmentItem['hero'];
|
||||
$list3 = $fragmentItem['gun'];
|
||||
switch ($type){
|
||||
case 1:{
|
||||
Bag::getItemList(function ($row) use(&$itemList,$list2) {
|
||||
if (in_array($row['item_id'],$list2) && $row['item_num'] > 0) {
|
||||
array_push($itemList, $row);
|
||||
}
|
||||
});
|
||||
}
|
||||
break;
|
||||
case 2:{
|
||||
Bag::getItemList(function ($row) use(&$itemList,$list3) {
|
||||
if (in_array($row['item_id'],$list3) && $row['item_num'] > 0) {
|
||||
array_push($itemList, $row);
|
||||
}
|
||||
});
|
||||
}
|
||||
break;
|
||||
default:{
|
||||
Bag::getItemList(function ($row) use(&$itemList,$list1) {
|
||||
if (in_array($row['item_id'],$list1) && $row['item_num'] > 0) {
|
||||
array_push($itemList, $row);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
return $itemList;
|
||||
}
|
||||
|
||||
public static function getFragmentItem(){
|
||||
$itemMetas = mt\Item::getMetaListByType(mt\Item::FRAGMENT_TYPE);
|
||||
$list1 = array();
|
||||
$list2 = array();
|
||||
$list3 = array();
|
||||
foreach ($itemMetas as $meta ){
|
||||
array_push($list1,$meta['id']);
|
||||
if ($meta['sub_type'] == mt\Item::HERO_FRAGMENT_SUBTYPE){
|
||||
array_push($list2,$meta['id']);
|
||||
}else if ($meta['sub_type'] == mt\Item::GUN_FRAGMENT_SUBTYPE){
|
||||
array_push($list3,$meta['id']);
|
||||
}
|
||||
}
|
||||
return array(
|
||||
'all'=>$list1,
|
||||
'hero'=>$list2,
|
||||
'gun'=>$list3,
|
||||
);
|
||||
}
|
||||
|
||||
public static function isSatisfy(){
|
||||
$data = array(
|
||||
'hero' => 0,
|
||||
'gun' => 0,
|
||||
);
|
||||
$heroFragmentList = self::getList(1);
|
||||
$heroFragmentListPro = array();
|
||||
foreach ($heroFragmentList as $value){
|
||||
array_push($heroFragmentListPro,$value['item_id']);
|
||||
}
|
||||
$fragmentItem = self::getFragmentItem();
|
||||
$heroFragmentItem = $fragmentItem['hero'];
|
||||
$heroDiff = array_diff($heroFragmentItem,$heroFragmentListPro);
|
||||
if (empty($heroDiff)){
|
||||
$data['hero'] = 1;
|
||||
}
|
||||
$gunFragmentList = self::getList(2);
|
||||
$gunFragmentListPro = array();
|
||||
foreach ($gunFragmentList as $value){
|
||||
array_push($gunFragmentListPro,$value['item_id']);
|
||||
}
|
||||
$gunFragmentItem = $fragmentItem['gun'];
|
||||
$gunDiff = array_diff($gunFragmentItem,$gunFragmentListPro);
|
||||
if (empty($gunDiff)){
|
||||
$data['gun'] = 1;
|
||||
}
|
||||
return $data;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
@ -358,7 +358,7 @@ class FormulaService extends BaseService {
|
||||
// ROUND(1-($weaponTopX*100/10-1)/9,2) * 0.02;
|
||||
|
||||
//表现分=f(个人存活时间排名TopX/4)*50%+f(队伍排名TopY)*50% f(TopX) = ROUND(1-(X-1)/9,2)
|
||||
$expreScore = (ROUND(1-($ranked-1)/9,2)/4)*0.5+ROUND(1-($teamRank-1)/9,2)*0.5;
|
||||
$expreScore = (ROUND(1-($ranked/4-1)/9,2))*0.5+ROUND(1-($teamRank-1)/9,2)*0.5;
|
||||
|
||||
//不同段位的及格分 = ROUND(1-(大段位排名-1)/(MAX(10)-1),2)
|
||||
$topRanking = mt\Rank::getRankById($userDb['rank'])?mt\Rank::getRankById($userDb['rank'])['rank_order']:0; //************** rankRank 参数表获取 ************
|
||||
|
Loading…
x
Reference in New Issue
Block a user