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; } }