| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051 | <?phpdefined('BASEPATH') OR exit('No direct script access allowed');/** * 由于钉釘现在接口限流了 没办法这边写一个接收器 作为接收需要监听信息的日志记录 */class Errorlog extends Start_Controller {    public function __construct(){		parent::__construct();        $this->load->_model("Model_logic_tools","logic_tools");        $this->load->_model("Model_logic_ding","logic_ding");        $this->load->_model("Model_zzerrlog","zzerrlog");    }    //定义方法的调用规则 获取URI第二段值    public function _remap($arg,$arg_array)    {		if($arg == 'ding')//添加        {             $this->_ding();        }		else		{			 die('No direct script access allowed');		}    }    public function _ding(){        //$ip = $_SERVER['REMOTE_ADDR'];  后期仅仅限制部署服务器的ip就好        $param = json_decode(file_get_contents('php://input'), true);        $key = $param['bs'];//核验秘钥                $key = $this->logic_tools->toolsjiemi($key);              $check_key = $this->logic_ding->getKey();            if($check_key != $key){            die('No direct script access allowed');        }        $content = $param['content'];        if(!is_string( $content)){             $content = json_encode($content);        }        //保存要监听的数据到日志表中        $this->zzerrlog->insert([            'content'=>$content,            'created_time'=>date("Y-m-d H:i:s"),            'time'=>time(),        ]);    }}
 |