作者 lyh

gx

@@ -28,6 +28,7 @@ class Count extends Command @@ -28,6 +28,7 @@ class Count extends Command
28 * @var string 28 * @var string
29 */ 29 */
30 protected $description = '统计昨日数据'; 30 protected $description = '统计昨日数据';
  31 +
31 /** 32 /**
32 * @name :(定时执行生成昨日数据统计)handle 33 * @name :(定时执行生成昨日数据统计)handle
33 * @author :lyh 34 * @author :lyh
@@ -39,36 +40,41 @@ class Count extends Command @@ -39,36 +40,41 @@ class Count extends Command
39 $list = DB::table('gl_project')->where('gl_project.extend_type','!=',5) 40 $list = DB::table('gl_project')->where('gl_project.extend_type','!=',5)
40 ->leftJoin('gl_project_deploy_build', 'gl_project.id', '=', 'gl_project_deploy_build.project_id') 41 ->leftJoin('gl_project_deploy_build', 'gl_project.id', '=', 'gl_project_deploy_build.project_id')
41 ->leftJoin('gl_project_deploy_optimize', 'gl_project.id', '=', 'gl_project_deploy_optimize.project_id') 42 ->leftJoin('gl_project_deploy_optimize', 'gl_project.id', '=', 'gl_project_deploy_optimize.project_id')
42 - ->select($this->selectParam())->get()->toArray();  
43 - if(!empty($list)){  
44 - $data = [];  
45 - $yesterday = Carbon::yesterday()->toDateString();  
46 - foreach ($list as $v){  
47 - $v = (array)$v;  
48 - if($v['domain'] != ''){  
49 - $v['test_domain'] = $v['domain']; 43 + ->select($this->selectParam())->get();
  44 + try {
  45 + if(!empty($list)){
  46 + $list = $list->toArray();
  47 + $data = [];
  48 + $yesterday = Carbon::yesterday()->toDateString();
  49 + foreach ($list as $v){
  50 + $v = (array)$v;
  51 + if($v['domain'] != ''){
  52 + $v['test_domain'] = $v['domain'];
  53 + }
  54 + $arr = [];
  55 + //统计时间
  56 + $arr['date'] = $yesterday;
  57 + //pv统计
  58 + $arr['pv_num'] = $this->pv_num($yesterday,$v['test_domain']);
  59 + //ip统计
  60 + $arr['ip_num'] = $this->ip_num($yesterday,$v['test_domain']);
  61 + //服务达标天数
  62 + $arr['compliance_day'] = $this->compliance_day($v['test_domain']);
  63 + //剩余服务时常
  64 + $arr['service_day'] = ((int)$v['service_duration'] - (int)$arr['compliance_day']) > 0 ? ((int)$v['service_duration'] - (int)$arr['compliance_day']) : 0;
  65 + //项目id
  66 + $arr['project_id'] = $v['project_id'];
  67 + $arr['created_at'] = date('Y-m-d H:i:s');
  68 + $arr['updated_at'] = date('Y-m-d H:i:s');
  69 + //询盘统计
  70 + $arr = $this->inquiry($arr,$v['test_domain']);
  71 + $data[] = $arr;
50 } 72 }
51 - $arr = [];  
52 - //统计时间  
53 - $arr['date'] = $yesterday;  
54 - //pv统计  
55 - $arr['pv_num'] = $this->pv_num($yesterday,$v['test_domain']);  
56 - //ip统计  
57 - $arr['ip_num'] = $this->ip_num($yesterday,$v['test_domain']);  
58 - //服务达标天数  
59 - $arr['compliance_day'] = $this->compliance_day($v['test_domain']);  
60 - //剩余服务时常  
61 - $arr['service_day'] = ((int)$v['service_duration'] - (int)$arr['compliance_day']) > 0 ? ((int)$v['service_duration'] - (int)$arr['compliance_day']) : 0;  
62 - //项目id  
63 - $arr['project_id'] = $v['project_id'];  
64 - $arr['created_at'] = date('Y-m-d H:i:s');  
65 - $arr['updated_at'] = date('Y-m-d H:i:s');  
66 - //询盘统计  
67 - $arr = $this->inquiry($arr,$v['test_domain']);  
68 - $data[] = $arr; 73 + //判断数据是否存在
  74 + DB::table('gl_count')->insert($data);
69 } 75 }
70 - //判断数据是否存在  
71 - DB::table('gl_count')->insert($data); 76 + }catch (\Exception $e){
  77 +
72 } 78 }
73 echo $this->error; 79 echo $this->error;
74 } 80 }
@@ -46,6 +46,8 @@ class Demo extends Command @@ -46,6 +46,8 @@ class Demo extends Command
46 */ 46 */
47 public function handle() 47 public function handle()
48 { 48 {
  49 + $domain = parse_url('https//:dev.golbalso.site/');
  50 + dd($domain);
49 echo time() . PHP_EOL; 51 echo time() . PHP_EOL;
50 $blogModel = new Image(); 52 $blogModel = new Image();
51 $list = $blogModel->list(); 53 $list = $blogModel->list();
@@ -31,9 +31,6 @@ class DomainInfoLogic extends BaseLogic @@ -31,9 +31,6 @@ class DomainInfoLogic extends BaseLogic
31 */ 31 */
32 public function saveDomain() 32 public function saveDomain()
33 { 33 {
34 - if (!preg_match('/http/', $this->param['domain'])) {  
35 - $this->param['domain'] = 'https://'.trim($this->param['domain'],'/').'/';  
36 - }  
37 //验证域名 34 //验证域名
38 $this->verifyDomain($this->param['domain'],isset($this->param['id']) ?? ''); 35 $this->verifyDomain($this->param['domain'],isset($this->param['id']) ?? '');
39 if(isset($this->param['id']) && !empty($this->param['id'])){ 36 if(isset($this->param['id']) && !empty($this->param['id'])){
@@ -179,9 +179,6 @@ class ProjectLogic extends BaseLogic @@ -179,9 +179,6 @@ class ProjectLogic extends BaseLogic
179 protected function saveProjectDeployOptimize($deploy_optimize){ 179 protected function saveProjectDeployOptimize($deploy_optimize){
180 $deployOptimizeModel = new DeployOptimize(); 180 $deployOptimizeModel = new DeployOptimize();
181 if(isset($deploy_optimize['domain']) && !empty($deploy_optimize['domain'])){ 181 if(isset($deploy_optimize['domain']) && !empty($deploy_optimize['domain'])){
182 - if (!preg_match('/http/', $deploy_optimize['domain'])) {  
183 - $deploy_optimize['domain'] = 'https://'.trim($deploy_optimize['domain'],'/').'/';  
184 - }  
185 //更改域名 182 //更改域名
186 if(isset($deploy_optimize['domain']) && !empty($deploy_optimize['domain'])){ 183 if(isset($deploy_optimize['domain']) && !empty($deploy_optimize['domain'])){
187 $this->editDomainStatus($deploy_optimize['domain'],$deploy_optimize['project_id']); 184 $this->editDomainStatus($deploy_optimize['domain'],$deploy_optimize['project_id']);
@@ -372,10 +369,10 @@ class ProjectLogic extends BaseLogic @@ -372,10 +369,10 @@ class ProjectLogic extends BaseLogic
372 //先清空上一次所绑定的域名 369 //先清空上一次所绑定的域名
373 $info = $domainModel->read(['project_id'=>$project_id]); 370 $info = $domainModel->read(['project_id'=>$project_id]);
374 if($info !== false){ 371 if($info !== false){
375 - $domainModel->edit(['project_id'=>'','status'=>DomainInfo::STATUS_ZERO]); 372 + $domainModel->edit(['project_id'=>'','status'=>DomainInfo::STATUS_ZERO],['id'=>$info['id']]);
376 } 373 }
377 //重新设置域名 374 //重新设置域名
378 - $rs = $domainModel->edit(['status'=>DomainInfo::STATUS_ONE,'project_id'=>$project_id],['domain'=>$domain]); 375 + $domainModel->edit(['status'=>DomainInfo::STATUS_ONE,'project_id'=>$project_id],['id'=>$domain]);
379 return $this->success(); 376 return $this->success();
380 } 377 }
381 378
@@ -9,6 +9,8 @@ @@ -9,6 +9,8 @@
9 9
10 namespace App\Models\ASide; 10 namespace App\Models\ASide;
11 11
  12 +use App\Helper\AyrShare as AyrShareHelper;
  13 +use App\Models\AyrShare\AyrShare as AyrShareModel;
12 use App\Models\Base; 14 use App\Models\Base;
13 use App\Services\ProjectServer; 15 use App\Services\ProjectServer;
14 use Illuminate\Support\Facades\DB; 16 use Illuminate\Support\Facades\DB;
@@ -38,5 +40,4 @@ class APublicModel extends Base @@ -38,5 +40,4 @@ class APublicModel extends Base
38 return ['product'=>$productNumber,'blog'=>$blogNumber,'news'=>$newsNumber]; 40 return ['product'=>$productNumber,'blog'=>$blogNumber,'news'=>$newsNumber];
39 } 41 }
40 42
41 -  
42 } 43 }
@@ -7,7 +7,4 @@ use App\Models\Base; @@ -7,7 +7,4 @@ use App\Models\Base;
7 class AyrRelease extends Base 7 class AyrRelease extends Base
8 { 8 {
9 protected $table = 'gl_ayr_release'; 9 protected $table = 'gl_ayr_release';
10 - //连接数据库  
11 - protected $connection = 'custom_mysql';  
12 -  
13 } 10 }
@@ -7,9 +7,6 @@ use App\Models\Base; @@ -7,9 +7,6 @@ use App\Models\Base;
7 class AyrShare extends Base 7 class AyrShare extends Base
8 { 8 {
9 protected $table = 'gl_ayr_share'; 9 protected $table = 'gl_ayr_share';
10 - //连接数据库  
11 - protected $connection = 'custom_mysql';  
12 -  
13 10
14 const COUNT = 3; 11 const COUNT = 3;
15 12