2
This commit is contained in:
parent
fd4df5d9fb
commit
a3a75e60a1
@ -8,6 +8,7 @@ require_once('models/Gun.php');
|
|||||||
require_once('models/Hero.php');
|
require_once('models/Hero.php');
|
||||||
require_once('models/HeroSkin.php');
|
require_once('models/HeroSkin.php');
|
||||||
require_once('models/GunSkin.php');
|
require_once('models/GunSkin.php');
|
||||||
|
require_once('models/User.php');
|
||||||
require_once('mt/Parameter.php');
|
require_once('mt/Parameter.php');
|
||||||
|
|
||||||
use phpcommon\SqlHelper;
|
use phpcommon\SqlHelper;
|
||||||
@ -17,6 +18,7 @@ use models\Hero;
|
|||||||
use models\Gun;
|
use models\Gun;
|
||||||
use models\HeroSkin;
|
use models\HeroSkin;
|
||||||
use models\GunSkin;
|
use models\GunSkin;
|
||||||
|
use models\User;
|
||||||
|
|
||||||
class BaseAuthedController extends BaseController {
|
class BaseAuthedController extends BaseController {
|
||||||
|
|
||||||
@ -299,7 +301,9 @@ class BaseAuthedController extends BaseController {
|
|||||||
case mt\Item::HERO_TYPE:
|
case mt\Item::HERO_TYPE:
|
||||||
{
|
{
|
||||||
Hero::addHero($itemMeta);
|
Hero::addHero($itemMeta);
|
||||||
|
User::upsertHeadList($itemMeta);
|
||||||
$propertyService->addHeroChg();
|
$propertyService->addHeroChg();
|
||||||
|
$propertyService->addUserChg();
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case mt\Item::HERO_SKIN_TYPE:
|
case mt\Item::HERO_SKIN_TYPE:
|
||||||
|
@ -398,7 +398,8 @@ class ChipController extends BaseAuthedController
|
|||||||
'lucky_temporary'=>0,
|
'lucky_temporary'=>0,
|
||||||
'strength_max' => $strength_max,
|
'strength_max' => $strength_max,
|
||||||
'strength' => $strength_max,
|
'strength' => $strength_max,
|
||||||
'upgrade_mint' => $mint_cost
|
'upgrade_mint' => $mint_cost,
|
||||||
|
'labour' => 0
|
||||||
];
|
];
|
||||||
$userObj = new User();
|
$userObj = new User();
|
||||||
$user=$userObj->find(myself()->_getAccountId());
|
$user=$userObj->find(myself()->_getAccountId());
|
||||||
|
@ -626,6 +626,7 @@ class GunController extends BaseAuthedController {
|
|||||||
'quality' => $gunDb['quality'] + 1,
|
'quality' => $gunDb['quality'] + 1,
|
||||||
'lock_type' => 0,
|
'lock_type' => 0,
|
||||||
'unlock_time' => 0,
|
'unlock_time' => 0,
|
||||||
|
'labour' => 0,
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
if ($gunDb['quality'] + 1 > myself()->_getV(TN_GUN_MAX_QUALITY, 0)) {
|
if ($gunDb['quality'] + 1 > myself()->_getV(TN_GUN_MAX_QUALITY, 0)) {
|
||||||
|
@ -424,6 +424,7 @@ class HeroController extends BaseAuthedController {
|
|||||||
'advanced_count' => $heroDb['advanced_count'] + 1,
|
'advanced_count' => $heroDb['advanced_count'] + 1,
|
||||||
'lock_type' => 0,
|
'lock_type' => 0,
|
||||||
'unlock_time' => 0,
|
'unlock_time' => 0,
|
||||||
|
'labour' => 0,
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
if ($heroDb['quality'] + 1 > myself()->_getV(TN_HERO_MAX_QUALITY, 0)) {
|
if ($heroDb['quality'] + 1 > myself()->_getV(TN_HERO_MAX_QUALITY, 0)) {
|
||||||
|
@ -450,12 +450,12 @@ class UserController extends BaseAuthedController {
|
|||||||
'val_func' => function ($val) {
|
'val_func' => function ($val) {
|
||||||
return $val;
|
return $val;
|
||||||
},
|
},
|
||||||
'valid_func' => function ($val, &$errCode, &$errMsg) use (&$heroId) {
|
'valid_func' => function ($val, &$errCode, &$errMsg) use ($userInfo) {
|
||||||
if (Hero::getValidHero($val)) {
|
if (User::isValidHeroId($userInfo, $val)) {
|
||||||
return true;
|
return true;
|
||||||
} else {
|
} else {
|
||||||
$errCode = 1;
|
$errCode = 1;
|
||||||
$errMsg = 'hero does not exist';
|
$errMsg = 'hero_id parameter error';
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -113,8 +113,14 @@ class User extends BaseModel {
|
|||||||
|
|
||||||
public static function isValidHeadId($userInfo, $headId)
|
public static function isValidHeadId($userInfo, $headId)
|
||||||
{
|
{
|
||||||
$headList = self::getHeadList($userInfo);
|
$headList = self::exportHeadList($userInfo);
|
||||||
return in_array($headId, $headList);
|
return in_array($headId, $headList['head_list']);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function isValidHeroId($userInfo, $heroId)
|
||||||
|
{
|
||||||
|
$heroList = self::exportHeadList($userInfo);
|
||||||
|
return in_array($heroId, $heroList['hero_list']);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function isValidHeadFrame($userInfo, $headFrame)
|
public static function isValidHeadFrame($userInfo, $headFrame)
|
||||||
@ -220,7 +226,7 @@ class User extends BaseModel {
|
|||||||
}
|
}
|
||||||
for ($i = 0; $i < $len - 1; $i++) {
|
for ($i = 0; $i < $len - 1; $i++) {
|
||||||
for ($j = $i + 1; $j < $len; $j++) {
|
for ($j = $i + 1; $j < $len; $j++) {
|
||||||
if ($users[$i]['idx'] < $users[$j]['idx']) {
|
if ($users[$i]['score'] < $users[$j]['score']) {
|
||||||
$tmp = $users[$i];
|
$tmp = $users[$i];
|
||||||
$users[$i] = $users[$j];
|
$users[$i] = $users[$j];
|
||||||
$users[$j] = $tmp;
|
$users[$j] = $tmp;
|
||||||
@ -230,4 +236,31 @@ class User extends BaseModel {
|
|||||||
return $users;
|
return $users;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static function allUser(){
|
||||||
|
$list = SqlHelper::ormSelect(
|
||||||
|
myself()->_getSelfMysql(),
|
||||||
|
't_user',
|
||||||
|
array(
|
||||||
|
)
|
||||||
|
);
|
||||||
|
return $list ? $list: array();
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function upsertHeadList($itemMeta){
|
||||||
|
$head = $itemMeta?$itemMeta['normal_gift']:'';
|
||||||
|
if (!$head){
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
$userInfo = myself()->_getOrmUserInfo();
|
||||||
|
$head_list = emptyReplace(json_decode($userInfo['head_list'], true), array());
|
||||||
|
if (in_array($head,$head_list)){
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
array_push($head_list,$head);
|
||||||
|
$fields = array(
|
||||||
|
'head_list' => json_encode($head_list),
|
||||||
|
);
|
||||||
|
self::update($fields);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user