开启事务
@return int
355609
public function begin()
    {
        $this->beginId++;
        $this->nowAffairId = $this->beginId;
        $this->startBeginTime = getMillisecond();
        return $this->beginId;
    }
1181402
public function count()
    {

        $query = $this->query();

        // Remove unsupported count query keys

        unset(
            $query["size"],
            $query["from"],
            $query["body"]["_source"],
            $query["body"]["sort"]
        );

        return $this->connection->count($query)["count"];
    }
21825
public function notify()
    {
        $err_no = [
            '1'    => '登入成功',
            '-21'  => '查無此 AuthCode',
            '-22'  => '此 AuthCode 已逾時',
            '-23'  => '查無相關之金流服務',
            '-24'  => '查無相關之廠商 ID',
            '-31'  => 'MyCard 系統發生錯誤',
            '-39'  => 'MyCard 系統發生錯誤',
            '-40'  => 'MyCard 系統發生錯誤',
            '-41'  => 'MyCard 系統發生錯誤',
            '-99'  => 'MyCard 系統發生錯誤',
            '-101' => '使用者登入失敗',
            '-102' => '儲值超出每天上限',
            '-103' => '儲值超出每月上限',
            '-104' => '檢查系統上限出錯',
            '-111' => '此 ip 會黑名單',
            '-987' => '簡易會員',
        ];
        $code = $_REQUEST['ReturnMsgNo'];
        $transactionId = $_REQUEST['FactorySeq'];
        $OTP = $_REQUEST['OTP'];
        $auth_code = $_REQUEST['AuthCode'];
        if ($code != 1) {
            $msg = $err_no[$code];
            throw new \Exception($msg);
        }


        // 确认交易
        $err_no = [
            '1'    => '要求成功',
            '-801' => '取得扣點資料時發生例外',
            '-802' => '取得扣點資料時發生錯誤',
            '-803' => '扣點發生例外',
            '-804' => '扣點發生錯誤',
            '-805' => '內部更新資料發生錯誤',
        ];
        if ($this->config['sandbox']) {
            $this->endpoint_confirm = $this->sandbox_endpoint_confirm;
        }
        $param = ['AuthCode' => $auth_code, 'OneTimePassword' => $OTP];
        $this->endpoint_confirm .= '?' . http_build_query($param);
        $response = file_get_contents($this->endpoint_confirm);
        $response = $this->xml2array($response);

        if ($response['ReturnMsgNo'] != 1) {
            $msg = $err_no[$code];
            throw new \Exception($msg);
        }


        $result = [
            'isSuccessful'         => true,
            'message'              => 'success',
            'transactionId'        => $transactionId,
            'transactionReference' => '',
            'amount'               => '',
            'currency'             => '',
            'raw'                  => '',
        ];
        return $result;
    }
1104181
protected function matchEventClick()
    {
        // 触发作为关键字处理
        if (array_key_exists('EventKey', $this->message)) {
            $this->message['Content'] = $this->message['EventKey']; // EventKey作为关键字Content
            return $this->matchText();
        }
        return [];
    }
11602
private function listenAfter()
    {
        //监听器结束
        //$_listeners=array_reverse($this->m_listeners);
        $_listeners=$this->m_listeners;
        foreach ($_listeners as $listener){
            $listener->listenAfter($this->m_context);
        }
    }
186096
public function getImpact()
    {
        if (!$this->impact) {
            $this->impact = 0;
            foreach ($this->events as $event) {
                $this->impact += $event->getImpact();
            }
        }

        return $this->impact;
    }
1140683
public function delete() : int
    {
        $table = $this->definition->getName();
        $sql = 'DELETE FROM '.$table.' ';
        $par = [];
        if (count($this->where)) {
            $sql .= 'WHERE ';
            $tmp = [];
            foreach ($this->where as $v) {
                $tmp[] = $v[0];
                $par = array_merge($par, $v[1]);
            }
            $sql .= implode(' AND ', $tmp) . ' ';
        }
        if (count($this->order)) {
            $sql .= $this->order[0];
            $par = array_merge($par, $this->order[1]);
        }
        return $this->db->query($sql, $par)->affected();
    }
1374676
final public function count()
    {
        if(!isset($this->_count))
        {
            $context = $this->getContext();
            $context->count = null;

            if ($this->invokeCommand('before.count', $context) !== false)
            {
                $context->count = $this->_actionCount($context);
                $this->invokeCommand('after.count', $context);
            }

            $this->_count = KObjectConfig::unbox($context->count);
        }

        return $this->_count;
    }
356386
public function count()
    {
        $events = $this->_entity->getEventManager();
        $event = new SelectEvent(
            [
                'sqlQuery' => $this,
                'params' => [],
                'action' => SelectEvent::FIND_COUNT,
                'singleItem' => true
            ]
        );
        $events->trigger(SelectEvent::BEFORE_COUNT, $this->_entity, $event);
        $rows = parent::count();
        return $rows;
    }
790236
public function getCount()
    {
        if (is_string($this->countable)) {
            return strlen($this->countable);
        }

        return count($this->countable);
    }
1315656
public function count(): int
    {
        $amount = 0;
        // iterate with $key so the key consumer from peek() can have a look
        foreach ($this->elements as $key => $element) {
            $amount++;
        }

        return $amount;
    }
610229
public function count()
    {
        if ($this->action() !== self::ACTION_READ) {
            return 0;
        }

        if (!$this->__resultSet) {
            $this->_execute();
        }

        if ($this->__resultSet) {
            return $this->__resultSet->total();
        }

        return 0;
    }
1085598
function stop(): int {
        if($this->timer === null) {
            return 0;
        }
        
        if($this->nativeHrtime) {
            $elapsed = (int) (\hrtime(true) - $this->timer);
        } elseif($this->hrtime) {
            $this->timer->stop();
            $elapsed = (int) $this->timer->getElapsedTime(\HRTime\Unit::NANOSECOND);
        } else {
            $elapsed = \microtime(true) - $this->timer;
            $elapsed = \ceil(($elapsed * 1000000000));
        }
        
        return ((int) $elapsed);
    }
827829
public function count(): int
    {
        $this->flags['count'] = true;
        $pdoStatement = $this->provideStatement();
        $pdoStatement = $this->execute($pdoStatement);
        return $pdoStatement->fetchColumn();
    }
993082
public function int()
    {
        return $this->markErrorIf(!is_numeric($this->value) || strval(intval($this->value)) != strval($this->value) );
    }
737706
final public function begin()
    {
        if (!$this->pdo) {
            throw  new Exception('您还没有连接数据库', Exception::CODE_DATABASE_ERROR);
        }
        if ($this->_begintransaction) {
            throw new Exception("已经开启了一个事务，请勿重新开启", Exception::CODE_DATABASE_ERROR);
        }
        $this->pdo->beginTransaction();
        $this->_begintransaction = true;
        return $this;
    }
272378
public function count()
    {
        $_table_name = $this->_get_table_name();
        $_where = ($this->where != '') ? ' WHERE '. $this->where : '';
        $_field = $this->field;
        $_join  = $this->join;

        //清理使用过的变量
        $this->where = '';
        $this->field = '*';
        $this->join = '';

        $this->conn('slave');//连接从数据库
        $this->sql = 'SELECT count('. $_field .') AS count FROM '.$_table_name.$_join.$_where;
        return $this->db->fetch_object( $this->sql )->count;
    }