|
@@ -3,6 +3,7 @@ |
|
@@ -3,6 +3,7 @@ |
|
3
|
namespace App\Http\Controllers\Api;
|
3
|
namespace App\Http\Controllers\Api;
|
|
4
|
|
4
|
|
|
5
|
use App\Exceptions\InquiryFilterException;
|
5
|
use App\Exceptions\InquiryFilterException;
|
|
|
|
6
|
+use App\Models\Domain\DomainInfo;
|
|
6
|
use App\Models\Mail\Mail;
|
7
|
use App\Models\Mail\Mail;
|
|
7
|
use App\Models\Project\DeployBuild;
|
8
|
use App\Models\Project\DeployBuild;
|
|
8
|
use App\Models\Project\Project;
|
9
|
use App\Models\Project\Project;
|
|
@@ -69,7 +70,7 @@ class SelfSiteController extends BaseController |
|
@@ -69,7 +70,7 @@ class SelfSiteController extends BaseController |
|
69
|
$cos = new CosService();
|
70
|
$cos = new CosService();
|
|
70
|
$fileName = uniqid() . rand(10000, 99999) . '.' . $file['ext'];
|
71
|
$fileName = uniqid() . rand(10000, 99999) . '.' . $file['ext'];
|
|
71
|
$file_data = base64_decode($file['data']);
|
72
|
$file_data = base64_decode($file['data']);
|
|
72
|
- $path = $cos->uploadFile($file_data, '/inquiry/' . date('Ymd'), $fileName,true);
|
73
|
+ $path = $cos->uploadFile($file_data, '/inquiry/' . date('Ymd'), $fileName, true);
|
|
73
|
$data[$key] = [
|
74
|
$data[$key] = [
|
|
74
|
'path' => $path,
|
75
|
'path' => $path,
|
|
75
|
'original_name' => $file['name'],
|
76
|
'original_name' => $file['name'],
|
|
@@ -191,4 +192,50 @@ class SelfSiteController extends BaseController |
|
@@ -191,4 +192,50 @@ class SelfSiteController extends BaseController |
|
191
|
|
192
|
|
|
192
|
return $this->success([]);
|
193
|
return $this->success([]);
|
|
193
|
}
|
194
|
}
|
|
|
|
195
|
+
|
|
|
|
196
|
+ /**
|
|
|
|
197
|
+ * 自建站获取通配符证书接口
|
|
|
|
198
|
+ * @param Request $request
|
|
|
|
199
|
+ * @return false|string
|
|
|
|
200
|
+ * @author Akun
|
|
|
|
201
|
+ * @date 2025/09/02 16:55
|
|
|
|
202
|
+ */
|
|
|
|
203
|
+ public function selfSiteSsl(Request $request)
|
|
|
|
204
|
+ {
|
|
|
|
205
|
+ $token = $request->header('token');//token
|
|
|
|
206
|
+ $pid = $request->header('pid');//项目id
|
|
|
|
207
|
+
|
|
|
|
208
|
+ if (empty($token) || empty($pid)) {
|
|
|
|
209
|
+ return $this->error('token无效', 401);
|
|
|
|
210
|
+ }
|
|
|
|
211
|
+
|
|
|
|
212
|
+ //判断token是否有效
|
|
|
|
213
|
+ $project_model = new Project();
|
|
|
|
214
|
+ $project_info = $project_model->read(['id' => $pid, 'site_token' => $token]);
|
|
|
|
215
|
+ if (!$project_info) {
|
|
|
|
216
|
+ return $this->error('token无效', 401);
|
|
|
|
217
|
+ }
|
|
|
|
218
|
+
|
|
|
|
219
|
+ //获取域名信息
|
|
|
|
220
|
+ $domain_model = new DomainInfo();
|
|
|
|
221
|
+ $domain_info = $domain_model->read(['project_id' => $pid]);
|
|
|
|
222
|
+ if (!$domain_info) {
|
|
|
|
223
|
+ return $this->error('获取域名失败', 401);
|
|
|
|
224
|
+ }
|
|
|
|
225
|
+
|
|
|
|
226
|
+ //获取通配符证书
|
|
|
|
227
|
+ $top_domain = getTopDomain($domain_info['domain']);
|
|
|
|
228
|
+ $ssl_re = httpGetSsl($top_domain);
|
|
|
|
229
|
+ $return = [
|
|
|
|
230
|
+ 'ssl_key' => '',
|
|
|
|
231
|
+ 'ssl_cert' => ''
|
|
|
|
232
|
+ ];
|
|
|
|
233
|
+ if (isset($ssl_re['status']) && $ssl_re['status'] == 2) {
|
|
|
|
234
|
+ //获取成功
|
|
|
|
235
|
+ $return['ssl_key'] = $ssl_re['ssl_key'];
|
|
|
|
236
|
+ $return['ssl_cert'] = $ssl_re['ssl_cert'];
|
|
|
|
237
|
+ }
|
|
|
|
238
|
+
|
|
|
|
239
|
+ return $this->success($return);
|
|
|
|
240
|
+ }
|
|
194
|
} |
241
|
} |