RenewProjectController.php
2.6 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
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
<?php
/**
* @remark :
* @name :RenewProjectController.php
* @author :lyh
* @method :post
* @time :2023/8/11 10:22
*/
namespace App\Http\Controllers\Aside\Project;
use App\Enums\Common\Code;
use App\Http\Controllers\Aside\BaseController;
use App\Http\Logic\Aside\Project\ProjectLogic;
use App\Http\Logic\Aside\Project\RenewLogic;
use App\Models\HomeCount\Count;
use App\Models\Project\DeployOptimize;
use Carbon\Carbon;
class RenewProjectController extends BaseController
{
/**
* @remark :获取所有服务天数小于15天的项目
* @name :lists
* @author :lyh
* @method :post
* @time :2023/8/11 10:22
*/
public function lists(ProjectLogic $logic){
$count = new Count();
$yesterday = Carbon::yesterday()->toDateString();
$count_list = $count->list(['date'=>$yesterday,'service_day'=>['<=',15]],'id',['project_id']);
$arr = [];
foreach ($count_list as $v){
$arr[] = $v['project_id'];
}
$sort = ['id' => 'desc'];
//按类型搜索
$map[] = ['id', 'in', $arr];
if(!empty($this->param['search']) && !empty($this->param['search_type'])){
if($this->param['search_type'] == 'domain'){
//搜索域名
$map[] = ['id', 'in', DeployOptimize::where('domain', 'like', "%{$this->param['search']}%")->where('id','in',$arr)->pluck('project_id')->toArray()];
}else{
$map[] = [$this->param['search_type'], 'like', "%{$this->param['search']}%"];
}
}
$data = $logic->getList($map, $sort,['*'],$this->row);
$this->response('success',Code::SUCCESS,$data);
}
/**
* @remark :续费记录单
* @name :renewLists
* @author :lyh
* @method :post
* @time :2023/8/11 17:28
*/
public function renewLists(RenewLogic $logic){
if(isset($this->map['company']) && !empty($this->map['company'])){
$this->map['company'] = ['like','%'.$this->map['company'].'%'];
}
$lists = $logic->renewListsLog($this->map,$this->page,$this->row,$this->order);
$this->response('success',Code::SUCCESS,$lists);
}
/**
* @remark :获取续费单详情
* @name :info
* @author :lyh
* @method :post
* @time :2023/8/14 9:08
*/
public function info(RenewLogic $logic){
$this->request->validate([
'id'=>'required',
],[
'id.required' => 'ID不能为空'
]);
$info = $logic->renewRead();
$this->response('success',Code::SUCCESS,$info);
}
}