Merge branch 'hjb' of git.kingsome.cn:server/game2006api into hjb
This commit is contained in:
commit
2f20bf619c
@ -8,6 +8,7 @@ $g_conf_relation_mysql_cluster = require('../config/game2006relation.mysql.clust
|
|||||||
$g_conf_mail_mysql_cluster = require('../config/mail.mysql.cluster.php');
|
$g_conf_mail_mysql_cluster = require('../config/mail.mysql.cluster.php');
|
||||||
$g_conf_log_mysql_cluster = require('../config/log.mysql.cluster.php');
|
$g_conf_log_mysql_cluster = require('../config/log.mysql.cluster.php');
|
||||||
$g_conf_redis_cluster = require('../config/game2006api.redis.cluster.php');
|
$g_conf_redis_cluster = require('../config/game2006api.redis.cluster.php');
|
||||||
|
$g_conf_confdb_mysql_cluster = require('../config/confdb.mysql.cluster.php');
|
||||||
$g_metatables = array();
|
$g_metatables = array();
|
||||||
|
|
||||||
function checkMysqlConfig()
|
function checkMysqlConfig()
|
||||||
@ -89,6 +90,12 @@ function getLogMysqlConfig()
|
|||||||
return $g_conf_log_mysql_cluster;
|
return $g_conf_log_mysql_cluster;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function getConfDbMysqlConfig()
|
||||||
|
{
|
||||||
|
global $g_conf_confdb_mysql_cluster;
|
||||||
|
return $g_conf_confdb_mysql_cluster;
|
||||||
|
}
|
||||||
|
|
||||||
function getServerSwitchConfig()
|
function getServerSwitchConfig()
|
||||||
{
|
{
|
||||||
global $g_conf_server_switch_cluster;
|
global $g_conf_server_switch_cluster;
|
||||||
|
@ -1,10 +1,28 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
|
use phpcommon\SqlHelper;
|
||||||
class AnncController extends BaseController {
|
class AnncController extends BaseController {
|
||||||
|
|
||||||
public function getAnnc()
|
public function getAnnc()
|
||||||
{
|
{
|
||||||
myself()->_rspData(require('../config/annc.php'));
|
// myself()->_rspData(require('../config/annc.php'));
|
||||||
|
$data = array();
|
||||||
|
$row = myself()->_getConfDbMysql()->execQueryOne(
|
||||||
|
'SELECT * FROM t_game_annc WHERE begin_time < :star_time AND end_time > :end_time AND is_open = :open_state',
|
||||||
|
array(
|
||||||
|
':star_time' => myself()->_getNowTime(),
|
||||||
|
':end_time' => myself()->_getNowTime(),
|
||||||
|
':open_state' => 1,
|
||||||
|
)
|
||||||
|
);
|
||||||
|
if ($row){
|
||||||
|
$data = array(
|
||||||
|
'id' => $row['uniid'],
|
||||||
|
'title' => $row['title'],
|
||||||
|
'content' => $row['content']
|
||||||
|
);
|
||||||
|
}
|
||||||
|
myself()->_rspData($data);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -10,6 +10,7 @@ class BaseController {
|
|||||||
private $relationDbConn = null;
|
private $relationDbConn = null;
|
||||||
private $mailDbConn = null;
|
private $mailDbConn = null;
|
||||||
private $logDbConn = null;
|
private $logDbConn = null;
|
||||||
|
private $confDbConn = null;
|
||||||
private $timeOffset = 0;
|
private $timeOffset = 0;
|
||||||
private $moduleHash = array();
|
private $moduleHash = array();
|
||||||
|
|
||||||
@ -208,6 +209,22 @@ class BaseController {
|
|||||||
return $this->logDbConn;
|
return $this->logDbConn;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function _getConfDbMysql()
|
||||||
|
{
|
||||||
|
if ($this->confDbConn) {
|
||||||
|
return $this->confDbConn;
|
||||||
|
}
|
||||||
|
$mysql_conf = getConfDbMysqlConfig();
|
||||||
|
$this->confDbConn = new phpcommon\Mysql(array(
|
||||||
|
'host' => $mysql_conf['host'],
|
||||||
|
'port' => $mysql_conf['port'],
|
||||||
|
'user' => $mysql_conf['user'],
|
||||||
|
'passwd' => $mysql_conf['passwd'],
|
||||||
|
'dbname' => $mysql_conf['dbname'],
|
||||||
|
));
|
||||||
|
return $this->confDbConn;
|
||||||
|
}
|
||||||
|
|
||||||
public function _getRelationDbMysql()
|
public function _getRelationDbMysql()
|
||||||
{
|
{
|
||||||
if ($this->relationDbConn) {
|
if ($this->relationDbConn) {
|
||||||
|
@ -106,12 +106,13 @@ class HeroController extends BaseAuthedController {
|
|||||||
$this->_decItems($costItems);
|
$this->_decItems($costItems);
|
||||||
$propertyChgService = new services\PropertyChgService();
|
$propertyChgService = new services\PropertyChgService();
|
||||||
$awardService = new services\AwardService();
|
$awardService = new services\AwardService();
|
||||||
|
|
||||||
$propertyChgService->addBagChg();
|
$propertyChgService->addBagChg();
|
||||||
for ($i=0; $i<$number; $i++){
|
for ($i=0; $i<$number; $i++){
|
||||||
$res= Hero::addSyntheticHero($heroMeta,2);
|
$res= Hero::addSyntheticHero($heroMeta,2);
|
||||||
if ($res){
|
if ($res){
|
||||||
$lastIdx = SqlHelper::getLastInsertId( myself()->_getSelfMysql());
|
$lastIdx = SqlHelper::getLastInsertId( myself()->_getSelfMysql());
|
||||||
$awardService->addChip($itemId,$lastIdx);
|
$awardService->addHero($heroMeta['id'],$lastIdx);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
$propertyChgService->addHeroChg();
|
$propertyChgService->addHeroChg();
|
||||||
|
@ -16,6 +16,18 @@ use models\Avatar;
|
|||||||
use phpcommon\SqlHelper;
|
use phpcommon\SqlHelper;
|
||||||
class AddItemsService extends BaseService
|
class AddItemsService extends BaseService
|
||||||
{
|
{
|
||||||
|
|
||||||
|
private function _isAddAwardItem($itemId){
|
||||||
|
if (!in_array($itemId,array(
|
||||||
|
Item::HERO_TYPE,
|
||||||
|
Item::CHIP_TYPE,
|
||||||
|
Item::APPOINT_PROP_TYPE
|
||||||
|
))){
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
public function addItems($items, $awardService, $propertyService){
|
public function addItems($items, $awardService, $propertyService){
|
||||||
myself()->_checkS();
|
myself()->_checkS();
|
||||||
$heads = array();
|
$heads = array();
|
||||||
@ -23,7 +35,7 @@ class AddItemsService extends BaseService
|
|||||||
foreach ($items as $item) {
|
foreach ($items as $item) {
|
||||||
//道具产出埋点
|
//道具产出埋点
|
||||||
LogService::productItem($item);
|
LogService::productItem($item);
|
||||||
if ($awardService){
|
if ($awardService && !$this->_isAddAwardItem($item['item_id'])){
|
||||||
$awardService->addItem($item['item_id'], $item['item_num']);
|
$awardService->addItem($item['item_id'], $item['item_num']);
|
||||||
}
|
}
|
||||||
if (myself()->_isVirtualItem($item['item_id'])) {
|
if (myself()->_isVirtualItem($item['item_id'])) {
|
||||||
|
@ -237,7 +237,7 @@ class HashRateService extends BaseService
|
|||||||
':account' => myself()->_getAccountId(),
|
':account' => myself()->_getAccountId(),
|
||||||
':address' => myself()->_getAddress(),
|
':address' => myself()->_getAddress(),
|
||||||
':type' => 0,
|
':type' => 0,
|
||||||
':star_time' => $task['createtime'],
|
':star_time' => $task['modifytime'],
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
$taskDto['current'] = $row[0];
|
$taskDto['current'] = $row[0];
|
||||||
@ -280,7 +280,7 @@ class HashRateService extends BaseService
|
|||||||
array(
|
array(
|
||||||
':account' => myself()->_getAccountId(),
|
':account' => myself()->_getAccountId(),
|
||||||
':activated' => 1,
|
':activated' => 1,
|
||||||
':star_time' => $task['createtime'],
|
':star_time' => $task['modifytime'],
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
$taskDto['current'] = $row[0];
|
$taskDto['current'] = $row[0];
|
||||||
@ -408,6 +408,7 @@ class HashRateService extends BaseService
|
|||||||
foreach ($taskList as &$task){
|
foreach ($taskList as &$task){
|
||||||
if ($task['task_id'] == $taskMate['id']){
|
if ($task['task_id'] == $taskMate['id']){
|
||||||
$task['current'] = 0;
|
$task['current'] = 0;
|
||||||
|
$task['modifytime'] = myself()->_getNowTime();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
$this->hashRateTask['task'.$taskMate['task_type']] = $taskList;
|
$this->hashRateTask['task'.$taskMate['task_type']] = $taskList;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user