作者 zhl

u

@@ -57,14 +57,16 @@ public function handle() @@ -57,14 +57,16 @@ public function handle()
57 echo $start_at . ', empty event.' . PHP_EOL; 57 echo $start_at . ', empty event.' . PHP_EOL;
58 sleep(30); 58 sleep(30);
59 } else { 59 } else {
60 - foreach ($events as $val) {  
61 -  
62 - } 60 + $this->expend($events);
63 } 61 }
64 } 62 }
65 return true; 63 return true;
66 } 64 }
67 65
  66 + /**
  67 + * @param $data
  68 + * @return bool
  69 + */
68 public function expend($data) 70 public function expend($data)
69 { 71 {
70 foreach ($data as $val) { 72 foreach ($data as $val) {
@@ -76,11 +78,21 @@ public function expend($data) @@ -76,11 +78,21 @@ public function expend($data)
76 case BtEvents::TYPE_DELETE_SITE: 78 case BtEvents::TYPE_DELETE_SITE:
77 $result = $this->deleteSiteEvent($val->id, $param); 79 $result = $this->deleteSiteEvent($val->id, $param);
78 break; 80 break;
  81 + case BtEvents::TYPE_CREATE_SSL:
  82 + $result = $this->createSiteSsl($val->id, $param);
  83 + break;
  84 + case BtEvents::TYPE_RENEWAL_SSL:
  85 + $result = $this->renewalSiteSsl($val->id, $param);
  86 + break;
  87 + case BtEvents::TYPE_EVENT_CALLBACK:
  88 + $result = $this->callbackEvent($val->id, $param);
  89 + break;
79 default: 90 default:
80 $result = false; 91 $result = false;
81 break; 92 break;
82 } 93 }
83 } 94 }
  95 + return true;
84 } 96 }
85 97
86 /** 98 /**
@@ -263,6 +275,7 @@ public function callbackEvent($id, $param) @@ -263,6 +275,7 @@ public function callbackEvent($id, $param)
263 $array = [ 275 $array = [
264 'status' => $status, 276 'status' => $status,
265 'message' => $message, 277 'message' => $message,
  278 + 'data' => [],
266 'param' => $param 279 'param' => $param
267 ]; 280 ];
268 list($code, $result) = app(ToolRepository::class)->curlRequest($callback, $array); 281 list($code, $result) = app(ToolRepository::class)->curlRequest($callback, $array);
@@ -74,7 +74,7 @@ public function createSsl(Request $request) @@ -74,7 +74,7 @@ public function createSsl(Request $request)
74 if (empty($host)) 74 if (empty($host))
75 return $this->error('请提交有效host信息'); 75 return $this->error('请提交有效host信息');
76 76
77 - $result = app(BtRepository::class)->deleteBtSite($host); 77 + $result = app(BtRepository::class)->applySsl($host);
78 return $result ? $this->success() : $this->error('创建ssl失败,提交异步任务!'); 78 return $result ? $this->success() : $this->error('创建ssl失败,提交异步任务!');
79 } catch (\Exception $e) { 79 } catch (\Exception $e) {
80 return $this->error($e->getMessage()); 80 return $this->error($e->getMessage());
@@ -50,7 +50,7 @@ public function createBtSite($domain, $ssl_open, $ssl_auto, $ssl_auto_day, $ssl_ @@ -50,7 +50,7 @@ public function createBtSite($domain, $ssl_open, $ssl_auto, $ssl_auto_day, $ssl_
50 'path' => env('PROJECT_PATH') ? env('PROJECT_PATH') : dirname(dirname(app_path())) . DIRECTORY_SEPARATOR . $domain, 50 'path' => env('PROJECT_PATH') ? env('PROJECT_PATH') : dirname(dirname(app_path())) . DIRECTORY_SEPARATOR . $domain,
51 'type_id' => 0, 51 'type_id' => 0,
52 'type' => 'PHP', 52 'type' => 'PHP',
53 - 'version' => '73', 53 + 'version' => '74',
54 'port' => '80', 54 'port' => '80',
55 'ps' => $host, 55 'ps' => $host,
56 'ftp' => false, 56 'ftp' => false,
@@ -67,7 +67,7 @@ @@ -67,7 +67,7 @@
67 | 67 |
68 */ 68 */
69 69
70 - 'timezone' => 'UTC', 70 + 'timezone' => 'PRC',
71 71
72 /* 72 /*
73 |-------------------------------------------------------------------------- 73 |--------------------------------------------------------------------------