<ruby id="bdb3f"></ruby>

    <p id="bdb3f"><cite id="bdb3f"></cite></p>

      <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
        <p id="bdb3f"><cite id="bdb3f"></cite></p>

          <pre id="bdb3f"></pre>
          <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

          <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
          <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

          <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                <ruby id="bdb3f"></ruby>

                # 服務層基類源碼 >[danger] 在服務層的析構函數中 我對任何的操作進行了入庫處理 ~~~ <?php /** * Created by PhpStorm. * User: Mikkle * QQ:776329498 * Date: 2017/11/18 * Time: 16:22 */ namespace app\base\service\base; use app\base\service\center\OptionsCenter; use app\base\service\center\RandNumCenter; use think\Db; use think\Request; abstract class ServiceBase { protected $model; protected $error; protected $optionNum; protected $timeString; protected $className; protected $functionName; protected $args; public function __construct() { $this->className =get_called_class(); $this->optionNum = RandNumCenter::createOperateSerialNumber(); $this->timeString = RandNumCenter::getTimeString(); $this->_initialize(); } abstract public function _initialize(); protected function getInfoArray($map=[]){ if (!isset($map["status"])){ $map["status"] = 1 ; } $result = $this->model->where($map)->find(); if ($result){ return $result->toArray(); }else{ return []; } } protected function getInfoObject($map=[]){ if (!isset($map["status"])){ $map["status"] = 1 ; } return $this->model->where($map)->find(); } public function addError($error){ $this->error = is_string($error) ? $error : json_encode($error); } protected function getError(){ return $this->error; } public function __destruct() { $operateData = [ "number" => $this->optionNum, "class" => $this->className, "function" => $this->functionName, "args" => is_string($this->args) ? $this->args : json_encode($this->args), "error" => $this->error ? $this->error : null, "ip" => Request::instance()->ip(), "time" => $this->timeString, ]; Db::table(OptionsCenter::$logServiceOperate)->insert($operateData); } } ~~~ ### 操作數據庫結構 ~~~ SET FOREIGN_KEY_CHECKS=0; -- ---------------------------- -- Table structure for mk_log_service_operate -- ---------------------------- DROP TABLE IF EXISTS `mk_log_service_operate`; CREATE TABLE `mk_log_service_operate` ( `id` int(11) NOT NULL AUTO_INCREMENT, `number` varchar(30) DEFAULT NULL, `class` varchar(100) DEFAULT NULL, `function` varchar(50) DEFAULT NULL, `error` varchar(100) DEFAULT NULL, `ip` varchar(20) DEFAULT NULL, `args` varchar(1000) DEFAULT NULL, `time` varchar(20) DEFAULT NULL, PRIMARY KEY (`id`) ) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8; ~~~
                  <ruby id="bdb3f"></ruby>

                  <p id="bdb3f"><cite id="bdb3f"></cite></p>

                    <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
                      <p id="bdb3f"><cite id="bdb3f"></cite></p>

                        <pre id="bdb3f"></pre>
                        <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

                        <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
                        <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

                        <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                              <ruby id="bdb3f"></ruby>

                              哎呀哎呀视频在线观看