添加后台代理代码

This commit is contained in:
2026-03-15 01:27:05 +08:00
parent 11f9ac4dc1
commit ea08c9366a
5254 changed files with 721042 additions and 0 deletions

View File

@@ -0,0 +1,77 @@
<?php
/**
* Created by PhpStorm.
* User: abcdefg
* Date: 2017/7/10
* Time: 15:19
*/
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 changelog extends BaseMethod
{
/**
* @note 写入流水日志
* @param RequestParameter $request
* @param ReturnParameter $return
* @return bool
*/
public function writelog($request, &$return)
{
$type = isset($request->biz_content['type']) ? intval($request->biz_content['type']) : 0;
$data = isset($request->biz_content['data']) ? (array)$request->biz_content['data'] : null;
if (!is_array($data) || empty($data))
{
$return->SetErrors(ERRORCODE_INVALIDPARAMETER, sprintf(ERRORINFO_INVALIDPARAMETER, 'data'));
return false;
}
$cmd = $this->NewMasterCommand();
$count = count($data);
$this->PDO_BeginTransaction();
$source = '';
for ($index = 0; $index < $count; $index++)
{
$item = $data[$index];
$source .= sprintf('select %s agentid, %s channelid, %s playerid, %d datatype, %d changeamount, %d changetime',
//$source .= sprintf('select %s, %s, %s, %d, %d, %d',
$cmd->GetIdentifiers($item['agentid'], true),
$cmd->GetIdentifiers($item['channelid'], true),
$cmd->GetIdentifiers($item['playerid'], true),
$type,
intval($item['amount']),
intval($item['time'])
);
if (($index > 0 && (0 == $index % 100)) || $index == $count - 1)
{
/** @noinspection PhpIncludeInspection */
$command = /** @lang text */ 'insert into ct_change_log(agentid, channelid, playerid, datatype, changeamount, changetime)' . PHP_EOL .
'select agentid, channelid, playerid, datatype, changeamount, changetime from (' . PHP_EOL . $source . ') t';
$this->PDO_Execute($command);
if (!$this->PDO_IsDone())
{
$return->SetErrors($this->GetErrorCode(), $this->GetErrorInfo());
$this->PDO_Rollback();
return false;
}
$source = '';
}
else
{
$source .= PHP_EOL . 'union all' . PHP_EOL;
}
}
$this->PDO_Commit();
$return->biz_content = array('count' => count($data));
return true;
}
}