1
This commit is contained in:
parent
38bd4ee265
commit
21d7085817
@ -1729,3 +1729,21 @@ CREATE TABLE `t_global_data` (
|
||||
PRIMARY KEY (`idx`),
|
||||
UNIQUE KEY `name` (`name`)
|
||||
) ENGINE=InnoDB AUTO_INCREMENT=10001 DEFAULT CHARSET=utf8 COLLATE=utf8_bin;
|
||||
|
||||
|
||||
--
|
||||
-- Table structure for table `t_sub_user_bind`
|
||||
--
|
||||
|
||||
DROP TABLE IF EXISTS `t_sub_user_bind`;
|
||||
/*!40101 SET @saved_cs_client = @@character_set_client */;
|
||||
/*!40101 SET character_set_client = utf8 */;
|
||||
CREATE TABLE `t_sub_user_bind` (
|
||||
`idx` bigint NOT NULL AUTO_INCREMENT COMMENT '自增id',
|
||||
`org_account_id` varchar(60) NOT NULL DEFAULT '' COMMENT '初始账号id',
|
||||
`cur_account_id` varchar(60) NOT NULL DEFAULT '' COMMENT '最新账号id',
|
||||
`createtime` int(11) NOT NULL DEFAULT '0' COMMENT '创建时间',
|
||||
`modifytime` int(11) NOT NULL DEFAULT '0' COMMENT '修改时间',
|
||||
PRIMARY KEY (`idx`),
|
||||
UNIQUE KEY `org_account_id` (`org_account_id`)
|
||||
) ENGINE=InnoDB AUTO_INCREMENT=10001 DEFAULT CHARSET=utf8 COLLATE=utf8_bin;
|
16
sql/gamedb2006_migrate_240508_01.sql
Normal file
16
sql/gamedb2006_migrate_240508_01.sql
Normal file
@ -0,0 +1,16 @@
|
||||
begin;
|
||||
|
||||
CREATE TABLE `t_sub_user_bind` (
|
||||
`idx` bigint NOT NULL AUTO_INCREMENT COMMENT '自增id',
|
||||
`org_account_id` varchar(60) NOT NULL DEFAULT '' COMMENT '初始账号id',
|
||||
`cur_account_id` varchar(60) NOT NULL DEFAULT '' COMMENT '最新账号id',
|
||||
`createtime` int(11) NOT NULL DEFAULT '0' COMMENT '创建时间',
|
||||
`modifytime` int(11) NOT NULL DEFAULT '0' COMMENT '修改时间',
|
||||
PRIMARY KEY (`idx`),
|
||||
UNIQUE KEY `org_account_id` (`org_account_id`)
|
||||
) ENGINE=InnoDB AUTO_INCREMENT=10001 DEFAULT CHARSET=utf8 COLLATE=utf8_bin;
|
||||
|
||||
|
||||
insert into version (version) values(2024050801);
|
||||
|
||||
commit;
|
@ -69,6 +69,7 @@ define('TN_DAILY_BUY_LEVEL_STATE', 9018);
|
||||
define('TN_DAILY_RESET_HERO_LEVEL_STATE', 9019);
|
||||
define('TN_DAILY_REFRESH_MISSION_TIMES', 9020);
|
||||
define('TN_DAILY_GOLD_MODE_BATTLE_TIMES', 9021);
|
||||
define('TN_DAILY_GATHER_GOLD', 9022);
|
||||
|
||||
define('TN_WEEKLY_BEGIN', 10001);
|
||||
define('TN_WEEKLY_ACTIVE', 10002);
|
||||
|
@ -247,4 +247,34 @@ class BaseController {
|
||||
return $ret;
|
||||
}
|
||||
|
||||
public function _getGameId() {
|
||||
return 2006;
|
||||
}
|
||||
|
||||
public function _isSubAccountId($accountId) {
|
||||
$str_list = explode('_', $accountId);
|
||||
if (count($str_list) < 4) {
|
||||
return false;
|
||||
}
|
||||
$channel = $str_list[0];
|
||||
$gameId = $str_list[1];
|
||||
if ($channel != BC_CHANNEL) {
|
||||
return false;
|
||||
}
|
||||
if ($gameId != $this->_getGameId()) {
|
||||
return false;
|
||||
}
|
||||
return $str_list[2][0] == 's';
|
||||
}
|
||||
|
||||
public function _getShortAccountId($accountId) {
|
||||
if (!$this->_isSubAccountId($accountId)) {
|
||||
return $accountId;
|
||||
}
|
||||
//
|
||||
$str_list = explode('_', $accountId);
|
||||
unset($str_list[2]);
|
||||
return implode("_",$str_list);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -1,8 +1,10 @@
|
||||
<?php
|
||||
use phpcommon\SqlHelper;
|
||||
require_once('models/Nft.php');
|
||||
require_once('models/User.php');
|
||||
|
||||
use models\Nft;
|
||||
use models\User;
|
||||
class OutAppNftController extends BaseController {
|
||||
|
||||
public function getNftList(){
|
||||
@ -38,5 +40,82 @@ class OutAppNftController extends BaseController {
|
||||
));
|
||||
|
||||
}
|
||||
|
||||
public function getOpenIdInfo(){
|
||||
$channel = getReqVal('channel', '');
|
||||
$openId = getReqVal('openId', '');
|
||||
$accountId = BC_CHANNEL.'_'.$this->_getGameId().'_'.$channel.'_'.$openId;
|
||||
$userDb = User::find($accountId);
|
||||
if (!$userDb){
|
||||
$this->_rspErr(1, 'user not found');
|
||||
return;
|
||||
}
|
||||
|
||||
$info = array(
|
||||
'loginVal' => 0,
|
||||
'battleTimes' => 0,
|
||||
'winTimes' => 0,
|
||||
'kills' => 0,
|
||||
'getGoldVal' => 0,
|
||||
);
|
||||
$accountBindDb = SqlHelper::ormSelectOne(
|
||||
myself()->_getMysql($openId),
|
||||
't_sub_user_bind',
|
||||
array(
|
||||
'org_account_id' => $accountId,
|
||||
)
|
||||
);
|
||||
$accountId = $accountBindDb ? $accountBindDb['cur_account_id'] : $accountId ;
|
||||
$loginDyn = SqlHelper::ormSelectOne(
|
||||
myself()->_getMysql($openId),
|
||||
't_dyndata',
|
||||
array(
|
||||
'account_id' => $accountId,
|
||||
'x' => TN_DAILY_LOGINS,
|
||||
'y' => 0,
|
||||
)
|
||||
);
|
||||
if ($loginDyn){
|
||||
$info['loginVal'] = $loginDyn['val'];
|
||||
if (myself()->_getDaySeconds($loginDyn['modifytime']) < myself()->_getNowDaySeconds()) {
|
||||
$info['loginVal'] = 0;
|
||||
}
|
||||
}
|
||||
|
||||
$battleDb = SqlHelper::ormSelectOne(
|
||||
myself()->_getMysql($openId),
|
||||
't_battle',
|
||||
array(
|
||||
'account_id' => $accountId,
|
||||
)
|
||||
);
|
||||
if ($battleDb){
|
||||
$hisBattleData = json_decode($battleDb['battle_data'], true);
|
||||
$todayBattleData = getXVal($hisBattleData, 'today_data', array());
|
||||
if (myself()->_getDaySeconds(getXVal($todayBattleData, 'modifytime', 0)) == myself()->_getNowDaySeconds()) {
|
||||
$info['battleTimes'] = getXVal($todayBattleData, "total_battle_times", 0);
|
||||
$info['winTimes'] = getXVal($todayBattleData, "total_win_times", 0);
|
||||
$info['kills'] = getXVal($todayBattleData, "total_kills_times", 0);
|
||||
}
|
||||
}
|
||||
$getGoldDyn = SqlHelper::ormSelectOne(
|
||||
myself()->_getMysql($openId),
|
||||
't_dyndata',
|
||||
array(
|
||||
'account_id' => $accountId,
|
||||
'x' => TN_DAILY_GATHER_GOLD,
|
||||
'y' => 0,
|
||||
)
|
||||
);
|
||||
if ($getGoldDyn){
|
||||
$info['getGoldVal'] = $getGoldDyn['val'];
|
||||
if (myself()->_getDaySeconds($getGoldDyn['modifytime']) < myself()->_getNowDaySeconds()) {
|
||||
$info['getGoldVal'] = 0;
|
||||
}
|
||||
}
|
||||
$this->_rspData(array(
|
||||
'info' => $info,
|
||||
));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -72,6 +72,7 @@ class UserController extends BaseAuthedController {
|
||||
$userInfo['address'] = $this->_getOpenId();
|
||||
}
|
||||
$this->_updateLastSeason($userInfo);
|
||||
$this->_updateSubUserAccount();
|
||||
$this->_sign();
|
||||
$event = array(
|
||||
'ID' => 'luck',
|
||||
@ -1168,6 +1169,29 @@ class UserController extends BaseAuthedController {
|
||||
}
|
||||
}
|
||||
|
||||
private function _updateSubUserAccount() {
|
||||
if ($this->_getChannel() == BC_CHANNEL) {
|
||||
$shortAccountId = $this->_getShortAccountId(myself()->_getAccountId());
|
||||
SqlHelper::upsert
|
||||
($this->_getSelfMysql(),
|
||||
't_sub_user_bind',
|
||||
array(
|
||||
'org_account_id' => $shortAccountId
|
||||
),
|
||||
array(
|
||||
'cur_account_id' => myself()->_getAccountId(),
|
||||
'modifytime' => myself()->_getNowTime(),
|
||||
),
|
||||
array(
|
||||
'org_account_id' => myself()->_getAccountId(),
|
||||
'cur_account_id' => myself()->_getAccountId(),
|
||||
'createtime' => myself()->_getNowTime(),
|
||||
'modifytime' => myself()->_getNowTime(),
|
||||
)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
private function _sign(){
|
||||
//用户是否有签到记录
|
||||
if (SignLog::isSignRecord()){
|
||||
|
@ -221,6 +221,7 @@ class RoomBattleDataService extends BaseService {
|
||||
"item_id" => V_ITEM_GOLD,
|
||||
"item_num" => floor($gold),
|
||||
));
|
||||
myself()->_incDailyV(TN_DAILY_GATHER_GOLD,0,floor($gold));
|
||||
}
|
||||
}
|
||||
|
||||
@ -240,6 +241,10 @@ class RoomBattleDataService extends BaseService {
|
||||
|
||||
public function _calBattleScore($battleInfo){
|
||||
$paramMeta = mt\Parameter::getVal('performance_score_range',0);
|
||||
$paramMetaMoba = mt\Parameter::getVal('performance_score_weight_4V4',0);
|
||||
$paramMetaPvp = mt\Parameter::getVal('performance_score_weight_BR',0);
|
||||
$weightMoba = explode("|",$paramMetaMoba);
|
||||
$weightPvp = explode("|",$paramMetaPvp);
|
||||
$scoreParam = explode("|",$paramMeta);
|
||||
if (count($scoreParam) < 2){
|
||||
error_log('Parameter table error');
|
||||
@ -284,10 +289,24 @@ class RoomBattleDataService extends BaseService {
|
||||
}
|
||||
switch ($room_mode){
|
||||
case self::ROOM_MODE_PVP: {
|
||||
if (count($weightPvp) == 5){
|
||||
$killSco *= $weightPvp[0];
|
||||
$assistSco *= $weightPvp[1];
|
||||
$damageSco *= $weightPvp[2];
|
||||
$recoverSco *= $weightPvp[3];
|
||||
$aliveSco *= $weightPvp[4];
|
||||
}
|
||||
$battleScore = round($killSco + $assistSco + $damageSco + $recoverSco + $aliveSco , 2);
|
||||
}
|
||||
break;
|
||||
case self::ROOM_MODE_MOBA :{
|
||||
if (count($weightMoba) == 5){
|
||||
$killSco *= $weightMoba[0];
|
||||
$assistSco *= $weightMoba[1];
|
||||
$damageSco *= $weightMoba[2];
|
||||
$recoverSco *= $weightMoba[3];
|
||||
$levelSco *= $weightMoba[4];
|
||||
}
|
||||
$battleScore = round($killSco + $assistSco + $damageSco + $recoverSco + $levelSco , 2);
|
||||
}
|
||||
break;
|
||||
|
Loading…
x
Reference in New Issue
Block a user