正在显示
12 个修改的文件
包含
347 行增加
和
28 行删除
| @@ -39,7 +39,7 @@ class ProjectController extends BaseController | @@ -39,7 +39,7 @@ class ProjectController extends BaseController | ||
| 39 | 'id.required' => 'ID不能为空' | 39 | 'id.required' => 'ID不能为空' |
| 40 | ]); | 40 | ]); |
| 41 | $data = $logic->getInfo($this->param['id']); | 41 | $data = $logic->getInfo($this->param['id']); |
| 42 | - return $this->success(Arr::twoKeepKeys($data, ['id', 'pid', 'title', 'manager_uids', 'remark'])); | 42 | + return $this->success($data); |
| 43 | } | 43 | } |
| 44 | 44 | ||
| 45 | public function save(ProjectRequest $request, ProjectLogic $logic) | 45 | public function save(ProjectRequest $request, ProjectLogic $logic) |
| @@ -47,16 +47,4 @@ class ProjectController extends BaseController | @@ -47,16 +47,4 @@ class ProjectController extends BaseController | ||
| 47 | $data = $logic->save($this->param); | 47 | $data = $logic->save($this->param); |
| 48 | return $this->success($data); | 48 | return $this->success($data); |
| 49 | } | 49 | } |
| 50 | - | ||
| 51 | - public function delete(Request $request, ProjectLogic $logic) | ||
| 52 | - { | ||
| 53 | - $request->validate([ | ||
| 54 | - 'ids'=>['required', new Ids()] | ||
| 55 | - ],[ | ||
| 56 | - 'ids.required' => 'ID不能为空' | ||
| 57 | - ]); | ||
| 58 | - | ||
| 59 | - $data = $logic->delete($this->param['ids']); | ||
| 60 | - return $this->success($data); | ||
| 61 | - } | ||
| 62 | } | 50 | } |
| @@ -7,7 +7,7 @@ namespace App\Http\Logic\Aside\Devops; | @@ -7,7 +7,7 @@ namespace App\Http\Logic\Aside\Devops; | ||
| 7 | use App\Http\Logic\Aside\BaseLogic; | 7 | use App\Http\Logic\Aside\BaseLogic; |
| 8 | use App\Http\Logic\Aside\Project\ProjectLogic; | 8 | use App\Http\Logic\Aside\Project\ProjectLogic; |
| 9 | use App\Models\Devops\DevopsTask; | 9 | use App\Models\Devops\DevopsTask; |
| 10 | -use App\Models\Project; | 10 | +use App\Models\Project\Project; |
| 11 | use App\Models\Devops\ServerConfig; | 11 | use App\Models\Devops\ServerConfig; |
| 12 | use App\Services\ProjectServer; | 12 | use App\Services\ProjectServer; |
| 13 | use Illuminate\Support\Facades\DB; | 13 | use Illuminate\Support\Facades\DB; |
| 1 | +<?php | ||
| 2 | + | ||
| 3 | +namespace App\Http\Logic\Aside\Project; | ||
| 4 | + | ||
| 5 | + | ||
| 6 | +use App\Http\Logic\Aside\BaseLogic; | ||
| 7 | +use App\Models\Project\DeployBuild; | ||
| 8 | + | ||
| 9 | +class DeployBuildLogic extends BaseLogic | ||
| 10 | +{ | ||
| 11 | + public function __construct() | ||
| 12 | + { | ||
| 13 | + parent::__construct(); | ||
| 14 | + | ||
| 15 | + $this->model = new DeployBuild(); | ||
| 16 | + } | ||
| 17 | +} |
| 1 | +<?php | ||
| 2 | + | ||
| 3 | +namespace App\Http\Logic\Aside\Project; | ||
| 4 | + | ||
| 5 | + | ||
| 6 | +use App\Http\Logic\Aside\BaseLogic; | ||
| 7 | +use App\Models\Project\DeployOptimize; | ||
| 8 | + | ||
| 9 | +class DeployOptimizeLogic extends BaseLogic | ||
| 10 | +{ | ||
| 11 | + public function __construct() | ||
| 12 | + { | ||
| 13 | + parent::__construct(); | ||
| 14 | + | ||
| 15 | + $this->model = new DeployOptimize(); | ||
| 16 | + } | ||
| 17 | +} |
| 1 | +<?php | ||
| 2 | + | ||
| 3 | +namespace App\Http\Logic\Aside\Project; | ||
| 4 | + | ||
| 5 | + | ||
| 6 | +use App\Http\Logic\Aside\BaseLogic; | ||
| 7 | +use App\Models\Project\Payment; | ||
| 8 | + | ||
| 9 | +class PaymentLogic extends BaseLogic | ||
| 10 | +{ | ||
| 11 | + public function __construct() | ||
| 12 | + { | ||
| 13 | + parent::__construct(); | ||
| 14 | + | ||
| 15 | + $this->model = new Payment(); | ||
| 16 | + } | ||
| 17 | +} |
| @@ -3,9 +3,20 @@ | @@ -3,9 +3,20 @@ | ||
| 3 | namespace App\Http\Logic\Aside\Project; | 3 | namespace App\Http\Logic\Aside\Project; |
| 4 | 4 | ||
| 5 | 5 | ||
| 6 | +use App\Helper\Arr; | ||
| 6 | use App\Http\Logic\Aside\BaseLogic; | 7 | use App\Http\Logic\Aside\BaseLogic; |
| 7 | -use App\Models\Project; | 8 | +use App\Models\Project\DeployBuild; |
| 9 | +use App\Models\Project\DeployOptimize; | ||
| 10 | +use App\Models\Project\Payment; | ||
| 11 | +use App\Models\Project\Project; | ||
| 12 | +use Illuminate\Support\Facades\DB; | ||
| 8 | 13 | ||
| 14 | +/** | ||
| 15 | + * Class ProjectLogic | ||
| 16 | + * @package App\Http\Logic\Aside\Project | ||
| 17 | + * @author zbj | ||
| 18 | + * @date 2023/4/26 | ||
| 19 | + */ | ||
| 9 | class ProjectLogic extends BaseLogic | 20 | class ProjectLogic extends BaseLogic |
| 10 | { | 21 | { |
| 11 | public function __construct() | 22 | public function __construct() |
| @@ -15,4 +26,85 @@ class ProjectLogic extends BaseLogic | @@ -15,4 +26,85 @@ class ProjectLogic extends BaseLogic | ||
| 15 | $this->model = new Project(); | 26 | $this->model = new Project(); |
| 16 | } | 27 | } |
| 17 | 28 | ||
| 29 | + public function getList(array $map = [], array $sort = ['id' => 'desc'], array $columns = ['*'], int $limit = 20) | ||
| 30 | + { | ||
| 31 | + parent::setWith(['payment', 'deploy_build', 'deploy_optimize']); | ||
| 32 | + return parent::getList($map, $sort, $columns, $limit); | ||
| 33 | + } | ||
| 34 | + | ||
| 35 | + public function getInfo($id) | ||
| 36 | + { | ||
| 37 | + parent::setWith(['payment', 'deploy_build', 'deploy_optimize']); //删除缓存要添加带with的cache_key | ||
| 38 | + return parent::getInfo($id); | ||
| 39 | + } | ||
| 40 | + | ||
| 41 | + public function save($param){ | ||
| 42 | + DB::beginTransaction(); | ||
| 43 | + try { | ||
| 44 | + parent::save($param); | ||
| 45 | + $this->savePayment($param); | ||
| 46 | + $this->saveDeployBuild($param); | ||
| 47 | + $this->saveDeployOptimize($param); | ||
| 48 | + | ||
| 49 | + DB::commit(); | ||
| 50 | + }catch (\Exception $e){ | ||
| 51 | + DB::rollBack(); | ||
| 52 | + $this->fail('保存失败'); | ||
| 53 | + } | ||
| 54 | + return $this->success(); | ||
| 55 | + } | ||
| 56 | + | ||
| 57 | + /** | ||
| 58 | + * 保存付款续费 | ||
| 59 | + * @author zbj | ||
| 60 | + * @date 2023/4/26 | ||
| 61 | + */ | ||
| 62 | + protected function savePayment($param){ | ||
| 63 | + if(empty($param['payment'])){ | ||
| 64 | + return true; | ||
| 65 | + } | ||
| 66 | + $data = $param['payment']; | ||
| 67 | + $data['project_id'] = $param['id']; | ||
| 68 | + $data['id'] = Payment::where('project_id', $param['id'])->value('id'); | ||
| 69 | + Arr::forget($data, ['amount']); | ||
| 70 | + return (new PaymentLogic)->save($data); | ||
| 71 | + } | ||
| 72 | + | ||
| 73 | + /** | ||
| 74 | + * 保存建站部署 | ||
| 75 | + * @author zbj | ||
| 76 | + * @date 2023/4/26 | ||
| 77 | + */ | ||
| 78 | + protected function saveDeployBuild($param){ | ||
| 79 | + if(empty($param['deploy_build'])){ | ||
| 80 | + return true; | ||
| 81 | + } | ||
| 82 | + $data = $param['deploy_build']; | ||
| 83 | + $data['project_id'] = $param['id']; | ||
| 84 | + $data['id'] = DeployBuild::where('project_id', $param['id'])->value('id'); | ||
| 85 | + Arr::forget($data, ['test_domain', 'plan']); | ||
| 86 | + return (new DeployBuildLogic)->save($data); | ||
| 87 | + } | ||
| 88 | + | ||
| 89 | + /** | ||
| 90 | + * 保存优化部署 | ||
| 91 | + * @author zbj | ||
| 92 | + * @date 2023/4/26 | ||
| 93 | + */ | ||
| 94 | + protected function saveDeployOptimize($param){ | ||
| 95 | + if(empty($param['deploy_optimize'])){ | ||
| 96 | + return true; | ||
| 97 | + } | ||
| 98 | + $data = $param['deploy_optimize']; | ||
| 99 | + $data['project_id'] = $param['id']; | ||
| 100 | + $data['id'] = DeployOptimize::where('project_id', $param['id'])->value('id'); | ||
| 101 | + return (new DeployOptimizeLogic)->save($data); | ||
| 102 | + } | ||
| 103 | + | ||
| 104 | + public function clearCache($id) | ||
| 105 | + { | ||
| 106 | + parent::clearCache($id); | ||
| 107 | + parent::setWith(['payment', 'deploy_build', 'deploy_optimize']); | ||
| 108 | + parent::clearCache($id); | ||
| 109 | + } | ||
| 18 | } | 110 | } |
| @@ -21,6 +21,8 @@ class Logic | @@ -21,6 +21,8 @@ class Logic | ||
| 21 | 21 | ||
| 22 | protected $is_cache = true; //是否缓存数据 | 22 | protected $is_cache = true; //是否缓存数据 |
| 23 | 23 | ||
| 24 | + protected $with = []; //预加载多个关联 | ||
| 25 | + | ||
| 24 | /** | 26 | /** |
| 25 | * @notes: 请简要描述方法功能 | 27 | * @notes: 请简要描述方法功能 |
| 26 | * @param array $data | 28 | * @param array $data |
| @@ -69,9 +71,9 @@ class Logic | @@ -69,9 +71,9 @@ class Logic | ||
| 69 | 71 | ||
| 70 | // 数据分页设置 | 72 | // 数据分页设置 |
| 71 | if ($limit) { | 73 | if ($limit) { |
| 72 | - $result = $query->select($columns)->paginate($limit); | 74 | + $result = $query->with($this->with)->select($columns)->paginate($limit); |
| 73 | }else{ | 75 | }else{ |
| 74 | - $result = $query->select($columns)->get(); | 76 | + $result = $query->with($this->with)->select($columns)->get(); |
| 75 | } | 77 | } |
| 76 | if($this->side == Common::A){ | 78 | if($this->side == Common::A){ |
| 77 | return $result; | 79 | return $result; |
| @@ -107,13 +109,13 @@ class Logic | @@ -107,13 +109,13 @@ class Logic | ||
| 107 | if($this->is_cache){ | 109 | if($this->is_cache){ |
| 108 | $info = Cache::get($this->getInfoCacheKey($id)); | 110 | $info = Cache::get($this->getInfoCacheKey($id)); |
| 109 | if (!$info) { | 111 | if (!$info) { |
| 110 | - $info = $this->model->find($id); | 112 | + $info = $this->model->with($this->with)->find($id); |
| 111 | if($info){ | 113 | if($info){ |
| 112 | Cache::put($this->getInfoCacheKey($id), $info); | 114 | Cache::put($this->getInfoCacheKey($id), $info); |
| 113 | } | 115 | } |
| 114 | } | 116 | } |
| 115 | }else{ | 117 | }else{ |
| 116 | - $info = $this->model->find($id); | 118 | + $info = $this->model->with($this->with)->find($id); |
| 117 | } | 119 | } |
| 118 | return $info; | 120 | return $info; |
| 119 | } | 121 | } |
| @@ -132,6 +134,8 @@ class Logic | @@ -132,6 +134,8 @@ class Logic | ||
| 132 | if(!$this->model){ | 134 | if(!$this->model){ |
| 133 | $this->fail('数据不存在或者已经删除'); | 135 | $this->fail('数据不存在或者已经删除'); |
| 134 | } | 136 | } |
| 137 | + }else{ | ||
| 138 | + Arr::forget($param, ['id']); | ||
| 135 | } | 139 | } |
| 136 | $columns = Schema::getColumnListing($this->model->getTable()); | 140 | $columns = Schema::getColumnListing($this->model->getTable()); |
| 137 | foreach ($param as $name => $value){ | 141 | foreach ($param as $name => $value){ |
| @@ -145,7 +149,7 @@ class Logic | @@ -145,7 +149,7 @@ class Logic | ||
| 145 | if($res){ | 149 | if($res){ |
| 146 | //清缓存 | 150 | //清缓存 |
| 147 | if($this->is_cache && !empty($param['id'])){ | 151 | if($this->is_cache && !empty($param['id'])){ |
| 148 | - Cache::forget($this->getInfoCacheKey($param['id'])); | 152 | + $this->clearCache($param['id']); |
| 149 | } | 153 | } |
| 150 | return $this->success(['id' => $this->model->id]); //返回保存的数据id | 154 | return $this->success(['id' => $this->model->id]); //返回保存的数据id |
| 151 | }else{ | 155 | }else{ |
| @@ -175,7 +179,7 @@ class Logic | @@ -175,7 +179,7 @@ class Logic | ||
| 175 | } | 179 | } |
| 176 | $model->delete(); | 180 | $model->delete(); |
| 177 | if($this->is_cache){ | 181 | if($this->is_cache){ |
| 178 | - Cache::forget($this->getInfoCacheKey($id)); | 182 | + $this->clearCache($id); |
| 179 | } | 183 | } |
| 180 | } | 184 | } |
| 181 | 185 | ||
| @@ -189,7 +193,33 @@ class Logic | @@ -189,7 +193,33 @@ class Logic | ||
| 189 | * @date 2023/4/13 | 193 | * @date 2023/4/13 |
| 190 | */ | 194 | */ |
| 191 | public function getInfoCacheKey($id){ | 195 | public function getInfoCacheKey($id){ |
| 192 | - return $this->model->getTable() . '_info_' . $id; | 196 | + $key = $this->model->getTable() . '_info_' . $id; |
| 197 | + if($this->with){ | ||
| 198 | + $key .= '_' . implode('_', $this->with); | ||
| 199 | + } | ||
| 200 | + return $key; | ||
| 201 | + } | ||
| 202 | + | ||
| 203 | + /** | ||
| 204 | + * @param $id | ||
| 205 | + * @return string | ||
| 206 | + * @author zbj | ||
| 207 | + * @date 2023/4/13 | ||
| 208 | + */ | ||
| 209 | + public function clearCache($id){ | ||
| 210 | + Cache::forget($this->getInfoCacheKey($id)); | ||
| 211 | + } | ||
| 212 | + | ||
| 213 | + /** | ||
| 214 | + * 设置关联查询表 | ||
| 215 | + * @param $with | ||
| 216 | + * @return $this | ||
| 217 | + * @author zbj | ||
| 218 | + * @date 2023/4/26 | ||
| 219 | + */ | ||
| 220 | + public function setWith($with){ | ||
| 221 | + $this->with = $with; | ||
| 222 | + return $this; | ||
| 193 | } | 223 | } |
| 194 | 224 | ||
| 195 | /** | 225 | /** |
| @@ -2,6 +2,7 @@ | @@ -2,6 +2,7 @@ | ||
| 2 | 2 | ||
| 3 | namespace App\Http\Requests\Aside\Project; | 3 | namespace App\Http\Requests\Aside\Project; |
| 4 | 4 | ||
| 5 | +use App\Rules\Mobile; | ||
| 5 | use Illuminate\Foundation\Http\FormRequest; | 6 | use Illuminate\Foundation\Http\FormRequest; |
| 6 | 7 | ||
| 7 | /** | 8 | /** |
| @@ -30,17 +31,29 @@ class ProjectRequest extends FormRequest | @@ -30,17 +31,29 @@ class ProjectRequest extends FormRequest | ||
| 30 | public function rules() | 31 | public function rules() |
| 31 | { | 32 | { |
| 32 | return [ | 33 | return [ |
| 33 | - 'title'=>'required|max:50', | ||
| 34 | - 'remark'=>'max:200', | 34 | +// 'id' => 'required', |
| 35 | +// 'title' => 'max:100', | ||
| 36 | +// 'company' => 'max:100', | ||
| 37 | +// 'lead_name' => 'max:20', | ||
| 38 | +// 'mobile' => [new Mobile()], | ||
| 39 | +// 'qq' => 'max:20', | ||
| 40 | +// 'cooperate_date' => 'date_format:Y-m-d', | ||
| 41 | +// 'province' => 'max:20', | ||
| 42 | +// 'city' => 'max:20', | ||
| 35 | ]; | 43 | ]; |
| 36 | } | 44 | } |
| 37 | 45 | ||
| 38 | public function messages() | 46 | public function messages() |
| 39 | { | 47 | { |
| 40 | return [ | 48 | return [ |
| 41 | - 'title.required' => '请输入部门名称', | ||
| 42 | - 'title.max' => '部门名称不能超过50个字符', | ||
| 43 | - 'remark.max' => '备注不能超过200个字符', | 49 | + 'id.required' => 'ID不能为空', |
| 50 | + 'title.max' => '项目名称不能超过100个字符', | ||
| 51 | + 'company.max' => '公司名不能超过100个字符', | ||
| 52 | + 'lead_name.max' => '联系人不能超过20个字符', | ||
| 53 | + 'qq.max' => 'QQ号不能超过20个字符', | ||
| 54 | + 'cooperate_date.date_format' => '合作时间格式不正确', | ||
| 55 | + 'province.max' => '省份不能超过20个字符', | ||
| 56 | + 'city.max' => '城市不能超过20个字符', | ||
| 44 | ]; | 57 | ]; |
| 45 | } | 58 | } |
| 46 | 59 |
app/Models/Project/DeployBuild.php
0 → 100644
| 1 | +<?php | ||
| 2 | + | ||
| 3 | +namespace App\Models\Project; | ||
| 4 | + | ||
| 5 | +use App\Helper\Arr; | ||
| 6 | +use App\Models\Base; | ||
| 7 | + | ||
| 8 | +class DeployBuild extends Base | ||
| 9 | +{ | ||
| 10 | + //设置关联表名 | ||
| 11 | + protected $table = 'gl_project_deploy_build'; | ||
| 12 | + | ||
| 13 | + | ||
| 14 | + public function setPlanAttribute($value){ | ||
| 15 | + $this->attributes['plan'] = Arr::arrToSet($value); | ||
| 16 | + } | ||
| 17 | + | ||
| 18 | + public function getPlanAttribute($value){ | ||
| 19 | + return Arr::setToArr($value); | ||
| 20 | + } | ||
| 21 | + | ||
| 22 | +} |
app/Models/Project/DeployOptimize.php
0 → 100644
| 1 | +<?php | ||
| 2 | + | ||
| 3 | +namespace App\Models\Project; | ||
| 4 | + | ||
| 5 | +use App\Helper\Arr; | ||
| 6 | +use App\Models\Base; | ||
| 7 | + | ||
| 8 | +class DeployOptimize extends Base | ||
| 9 | +{ | ||
| 10 | + //设置关联表名 | ||
| 11 | + protected $table = 'gl_project_deploy_optimize'; | ||
| 12 | + | ||
| 13 | + | ||
| 14 | + public function setMinorLanguagesAttribute($value){ | ||
| 15 | + $this->attributes['minor_languages'] = Arr::a2s($value); | ||
| 16 | + } | ||
| 17 | + | ||
| 18 | + public function getMinorLanguagesAttribute($value){ | ||
| 19 | + return Arr::s2a($value); | ||
| 20 | + } | ||
| 21 | + | ||
| 22 | +} |
app/Models/Project/Payment.php
0 → 100644
| 1 | +<?php | ||
| 2 | + | ||
| 3 | +namespace App\Models\Project; | ||
| 4 | + | ||
| 5 | +use App\Helper\Arr; | ||
| 6 | +use App\Models\Base; | ||
| 7 | + | ||
| 8 | +class Payment extends Base | ||
| 9 | +{ | ||
| 10 | + //设置关联表名 | ||
| 11 | + protected $table = 'gl_project_payment'; | ||
| 12 | + | ||
| 13 | + | ||
| 14 | + public function setRenewalRecordAttribute($value){ | ||
| 15 | + $this->attributes['renewal_record'] = Arr::a2s($value); | ||
| 16 | + } | ||
| 17 | + | ||
| 18 | + public function getRenewalRecordAttribute($value){ | ||
| 19 | + return Arr::s2a($value); | ||
| 20 | + } | ||
| 21 | + | ||
| 22 | +} |
| 1 | <?php | 1 | <?php |
| 2 | 2 | ||
| 3 | -namespace App\Models; | 3 | +namespace App\Models\Project; |
| 4 | 4 | ||
| 5 | +use App\Helper\Arr; | ||
| 6 | +use App\Models\Base; | ||
| 5 | use App\Models\Devops\ServerConfig; | 7 | use App\Models\Devops\ServerConfig; |
| 6 | 8 | ||
| 7 | class Project extends Base | 9 | class Project extends Base |
| @@ -29,6 +31,25 @@ class Project extends Base | @@ -29,6 +31,25 @@ class Project extends Base | ||
| 29 | } | 31 | } |
| 30 | 32 | ||
| 31 | /** | 33 | /** |
| 34 | + * 项目分类 | ||
| 35 | + * @return string[] | ||
| 36 | + * @author zbj | ||
| 37 | + * @date 2023/4/26 | ||
| 38 | + */ | ||
| 39 | + public static function typeMap() | ||
| 40 | + { | ||
| 41 | + return [ | ||
| 42 | + 1 => '建站进程中', | ||
| 43 | + 2 => '已完成–推广进程中', | ||
| 44 | + 3 => '已完成-建站用户', | ||
| 45 | + 4 => '续费记录单', | ||
| 46 | + 5 => '推广续网站', | ||
| 47 | + 6 => '未续费项目', | ||
| 48 | + 7 => '特殊推广项目' | ||
| 49 | + ]; | ||
| 50 | + } | ||
| 51 | + | ||
| 52 | + /** | ||
| 32 | * 项目部署服务器信息 | 53 | * 项目部署服务器信息 |
| 33 | * @return \Illuminate\Database\Eloquent\Relations\HasOne | 54 | * @return \Illuminate\Database\Eloquent\Relations\HasOne |
| 34 | */ | 55 | */ |
| @@ -65,4 +86,62 @@ class Project extends Base | @@ -65,4 +86,62 @@ class Project extends Base | ||
| 65 | { | 86 | { |
| 66 | return self::DATABASE_NAME_FIX . $this->id; | 87 | return self::DATABASE_NAME_FIX . $this->id; |
| 67 | } | 88 | } |
| 89 | + | ||
| 90 | + /** | ||
| 91 | + * 付款续费信息 | ||
| 92 | + * @return \Illuminate\Database\Eloquent\Relations\HasOne | ||
| 93 | + * @author zbj | ||
| 94 | + * @date 2023/4/26 | ||
| 95 | + */ | ||
| 96 | + public function payment() | ||
| 97 | + { | ||
| 98 | + return self::hasOne(Payment::class, 'project_id', 'id'); | ||
| 99 | + } | ||
| 100 | + | ||
| 101 | + /** | ||
| 102 | + * 建站部署信息 | ||
| 103 | + * @return \Illuminate\Database\Eloquent\Relations\HasOne | ||
| 104 | + * @author zbj | ||
| 105 | + * @date 2023/4/26 | ||
| 106 | + */ | ||
| 107 | + public function deploy_build() | ||
| 108 | + { | ||
| 109 | + return self::hasOne(DeployBuild::class, 'project_id', 'id'); | ||
| 110 | + } | ||
| 111 | + | ||
| 112 | + /** | ||
| 113 | + * 建站部署信息 | ||
| 114 | + * @return \Illuminate\Database\Eloquent\Relations\HasOne | ||
| 115 | + * @author zbj | ||
| 116 | + * @date 2023/4/26 | ||
| 117 | + */ | ||
| 118 | + public function deploy_optimize() | ||
| 119 | + { | ||
| 120 | + return self::hasOne(DeployOptimize::class, 'project_id', 'id'); | ||
| 121 | + } | ||
| 122 | + | ||
| 123 | + public function setLevelAttribute($value){ | ||
| 124 | + $this->attributes['level'] = Arr::arrToSet($value); | ||
| 125 | + } | ||
| 126 | + | ||
| 127 | + public function getLevelAttribute($value){ | ||
| 128 | + return Arr::setToArr($value); | ||
| 129 | + } | ||
| 130 | + | ||
| 131 | + public function setChannelAttribute($value){ | ||
| 132 | + $this->attributes['channel'] = Arr::a2s($value); | ||
| 133 | + } | ||
| 134 | + | ||
| 135 | + public function getChannelAttribute($value){ | ||
| 136 | + return Arr::s2a($value); | ||
| 137 | + } | ||
| 138 | + | ||
| 139 | + public function setNoticeAttribute($value){ | ||
| 140 | + $this->attributes['notice'] = Arr::a2s($value); | ||
| 141 | + } | ||
| 142 | + | ||
| 143 | + public function getNoticeAttribute($value){ | ||
| 144 | + return Arr::s2a($value); | ||
| 145 | + } | ||
| 146 | + | ||
| 68 | } | 147 | } |
-
请 注册 或 登录 后发表评论