Files
youlegames/codes/agent/game/dlweb/api/lib/1.0/game.php
2026-03-15 01:27:05 +08:00

203 lines
4.7 KiB
PHP
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
<?php
require_once dirname(dirname(__DIR__)) . '/common/ErrorType.php';
require_once dirname(dirname(__DIR__)) . '/common/common.inc.php';
require_once dirname(dirname(__DIR__)) . '/common/BaseMethodHelper.php';
class game extends BaseMethod
{
/**
* @note 返回主数据库连接信息
* @return ConnectParameter
*/
protected function GetMasterDatabaseConnectParameter()
{
if(!DEBUG_MODE) {
//最好使用只读实例 战绩数据库
//return new ConnectParameter('rr-bp1x2415jy37d8mu1o.mysql.rds.aliyuncs.com', 3306, 'game_db', 'games', 'Games2017@)!&', MASTER_PERSISTENT, MASTER_CHARSET);
return new ConnectParameter('rm-bp1749tfxu2rpq670lo.mysql.rds.aliyuncs.com', 3306, 'grade_db', 'games', 'Games0791!!', MASTER_PERSISTENT, MASTER_CHARSET);
}
else
return new ConnectParameter('rm-bp16sbf0l9cavp7h9o.mysql.rds.aliyuncs.com', 3306, 'youle_games', 'develop', 'develop123!@#', MASTER_PERSISTENT, MASTER_CHARSET);
}
/**
* 某一个玩家的金币变动记录
* @param $request
* @param $return
* @return bool
*/
public function goldRecord($request, &$return)
{
$params = (array)$request->biz_content;
$agentid = isset($params['agentid']) ? $params['agentid'] : '';
if (empty($agentid))
{
$return->seterrors(ERRORCODE_AGENTIDERROR, ERRORINFO_AGENTIDERROR);
return false;
}
$playerid = isset($params['playerid']) ? $params['playerid'] : '';
if (empty($playerid))
{
$return->seterrors(ERRORCODE_PLAYERIDERROR, ERRORINFO_PLAYERIDERROR);
return false;
}
$pageIndex = isset($params['page_index']) ? intval($params['page_index']) : 1;
$pageSize = isset($params['page_size']) ? intval($params['page_size']) : 10;
// 分页数据
$start = ($pageIndex-1) * $pageSize;
$cmd = /** @lang text */<<<EOL
SELECT
goac_agentid,
goac_asetcount,
goac_playerid,
goac_grade,
goac_rebatevalue,
#goac_createtime,
goac_time as goac_createtime,
goac_time,
goac_invitecode,
goac_inviteid
from
gold_account
where
goac_isrobot = 0 and
goac_rebateto = 0 and
goac_agentid = ? and
goac_playerid = ?
order by idx desc
limit
?, ?
EOL;
$res = $this->PDO_Request($cmd, $agentid, $playerid, $start, $pageSize);
$return->biz_content = (array)$res;
return true;
}
/**
* 修改需求
1推广员后台
1今日新增人数茶水费
2昨日新增人数茶水费
3近7日新增人数茶水费
4近30日新增人数茶水费
5按时间新增人数茶水费
,总代理后台(查某个推广员如下属性)
1今日新增人数茶水费
2昨日新增人数茶水费
3近7日新增人数茶水费
4近30日新增人数茶水费
5按时间新增人数茶水费
这些数据放第一页菜单
*/
public function goldIncrease($request, &$return)
{
$params = $request->biz_content;
$agentid = isset($params['agentid']) ? $params['agentid'] : '';
$channelid = isset($params['channelid']) ? $params['channelid'] : '';
$salesid = isset($params['salesid']) ? $params['salesid'] : '';
$type = isset($params['type']) ? intval($params['type']) : 1;
if (empty($agentid))
{
$return->SetErrors(ERRORCODE_AGENTIDERROR, ERRORINFO_AGENTIDERROR);
return false;
}
if (empty($channelid))
{
$return->SetErrors(ERRORCODE_CHANNELIDERROR, ERRORINFO_CHANNELIDERROR);
return false;
}
if (empty($salesid))
{
$return->SetErrors(ERRORCODE_SALESIDERROR, ERRORINFO_SALESIDERROR);
return false;
}
if($type === 888) {
$where = '';
} else {
$where = " and goac_invitecode={$salesid}";
}
$sql = <<<EOL
SELECT
'今日' AS `NAME`,
ifnull(sum(goac_rebatevalue), 0) AS `VALUE`
FROM
gold_account
WHERE
goac_agentid = '{$agentid}' and
goac_isrobot = 0 and
goac_rebateto = 0 and
date_format(goac_time, '%Y-%m-%d') = curdate()
{$where}
union
SELECT
'昨日' AS `NAME`,
ifnull(sum(goac_rebatevalue), 0) AS `VALUE`
FROM
gold_account
WHERE
(
TO_DAYS(now()) - TO_DAYS(goac_time) = 1
) and
goac_isrobot = 0 and
goac_rebateto = 0 and
goac_agentid = '{$agentid}'
{$where}
union
SELECT
'近7日' AS `NAME`,
ifnull(sum(goac_rebatevalue), 0) AS `VALUE`
FROM
gold_account
WHERE
(
TO_DAYS(now()) - TO_DAYS(goac_time) <= 7
) and
goac_isrobot = 0 and
goac_rebateto = 0 and
goac_agentid = '{$agentid}'
{$where}
union
SELECT
'近30日' AS `NAME`,
ifnull(sum(goac_rebatevalue), 0) AS `VALUE`
FROM
gold_account
WHERE
(
TO_DAYS(now()) - TO_DAYS(goac_time) <= 30
) and
goac_isrobot = 0 and
goac_rebateto = 0 and
goac_agentid = '{$agentid}'
{$where};
EOL;
$res = $this->PDO_Request($sql);
if (!$this->PDO_isdone())
{
$return->SetErrors($this->GetErrorCode(), $this->GetErrorInfo());
return false;
}
$return->biz_content = $res;
return true;
}
}