123456789101112131415161718192021222324252627282930313233343536373839404142 |
- <?php
- namespace Spider\Lib;
- use Dever;
- class Project
- {
- private $config;
- public function __construct($id)
- {
- if (!$id) {
- Dever::alert('id不存在');
- }
- $this->config = Dever::db('spider/project')->one($id);
- $this->check();
- }
- public function get()
- {
- $this->setting();
- return $this->config;
- }
- private function check()
- {
- if (!$this->config) {
- Dever::alert('项目未定义');
- }
- if ($this->config['status'] != 1) {
- //Dever::alert('项目不是待机状态');
- }
- }
- private function setting()
- {
- Dever::db('spider/project')->update(['status' => 2, 'where_id' => $this->config['id']]);
- $this->config['url'] = explode("\r\n", $this->config['site']);
- }
- }
|