CNoticeController.php
1.7 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
<?php
/**
* @remark :
* @name :CNoticeController.php
* @author :lyh
* @method :post
* @time :2023/9/12 10:04
*/
namespace App\Http\Controllers\Aside\Com;
use App\Http\Controllers\Aside\BaseController;
use App\Models\Domain\DomainInfo;
use App\Models\Project\DeployBuild;
use Illuminate\Http\Request;
/**
* @remark :通知C端
* @name :CNoticeController
* @author :lyh
* @method :post
* @time :2023/9/12 10:38
*/
class CNoticeController extends BaseController
{
/**
* 更新通知C端
* @param Request $request
* @return \Illuminate\Http\JsonResponse
*/
public function sendNotify(Request $request)
{
//获取当前项目的域名
$domainModel = new DomainInfo();
$domainInfo = $domainModel->read(['project_id'=>$this->param['project_id']]);
if($domainInfo === false){
//获取测试域名
$deployBuildModel = new DeployBuild();
$buildInfo = $deployBuildModel->read(['project_id'=>$this->param['project_id']]);
$this->param['domain'] = $buildInfo['test_domain'];
}else{
$this->param['domain'] = 'https://'.$domainInfo['domain'].'/';
}
$url = $this->param['domain'].'api/update_page/';
$param = [
'project_id' => $this->param['project_id'],
'type' => intval($request->input('type', 1)),
'route' => intval($request->input('page', 1)),
'url' => $request->input('url', []),
'language'=> $request->input('language', []),
];
http_post($url, json_encode($param));
$this->response('更新中请稍后, 更新完成将会发送站内信通知更新结果!');
}
}