Merge branch 'dev' of http://47.244.231.31:8099/zhl/globalso-v6 into dev
正在显示
20 个修改的文件
包含
460 行增加
和
282 行删除
| @@ -41,6 +41,7 @@ class ShareConfig extends Command | @@ -41,6 +41,7 @@ class ShareConfig extends Command | ||
| 41 | $ayrShareHelper = new AyrShareHelper(); | 41 | $ayrShareHelper = new AyrShareHelper(); |
| 42 | $share_info = $ayrShareHelper->get_profiles_users($v['profile_key']); | 42 | $share_info = $ayrShareHelper->get_profiles_users($v['profile_key']); |
| 43 | if(!isset($share_info['activeSocialAccounts'])){ | 43 | if(!isset($share_info['activeSocialAccounts'])){ |
| 44 | + $ayrShareModel->edit(['bind_plat_from'=>''],['id'=>$v['id']]); | ||
| 44 | continue; | 45 | continue; |
| 45 | } | 46 | } |
| 46 | $str = json_encode($share_info['activeSocialAccounts']); | 47 | $str = json_encode($share_info['activeSocialAccounts']); |
| @@ -31,7 +31,7 @@ class ShareUser extends Command | @@ -31,7 +31,7 @@ class ShareUser extends Command | ||
| 31 | */ | 31 | */ |
| 32 | public function handle() | 32 | public function handle() |
| 33 | { | 33 | { |
| 34 | - $this->user_operator_record(); | 34 | + echo $this->user_operator_record(); |
| 35 | } | 35 | } |
| 36 | 36 | ||
| 37 | /** | 37 | /** |
| @@ -62,7 +62,11 @@ class ShareUser extends Command | @@ -62,7 +62,11 @@ class ShareUser extends Command | ||
| 62 | } | 62 | } |
| 63 | //删除用户第三方配置 | 63 | //删除用户第三方配置 |
| 64 | $ayr_share_helper = new AyrShareHelper(); | 64 | $ayr_share_helper = new AyrShareHelper(); |
| 65 | - $res = $ayr_share_helper->deleted_profiles(); | 65 | + $data_profiles = [ |
| 66 | + 'title'=>$v['title'], | ||
| 67 | + 'profileKey'=>$v['profile_key'] | ||
| 68 | + ]; | ||
| 69 | + $res = $ayr_share_helper->deleted_profiles($data_profiles); | ||
| 66 | if($res['status'] == 'fail'){ | 70 | if($res['status'] == 'fail'){ |
| 67 | $this->error++; | 71 | $this->error++; |
| 68 | continue; | 72 | continue; |
| @@ -27,29 +27,19 @@ class TemplateController extends BaseController | @@ -27,29 +27,19 @@ class TemplateController extends BaseController | ||
| 27 | */ | 27 | */ |
| 28 | public function index(){ | 28 | public function index(){ |
| 29 | 29 | ||
| 30 | - $lists = (new ATemplate)->lists($this->map,$this->page,$this->row,$this->order,['id','name','status','is_default','sort','thumb','url','created_at','updated_at']); | 30 | + $lists = (new ATemplate)->lists( |
| 31 | + $this->map, | ||
| 32 | + $this->page, | ||
| 33 | + $this->row, | ||
| 34 | + $this->order, | ||
| 35 | + ['id','name','status','is_default','sort','thumb','url','created_at','updated_at'] | ||
| 36 | + ); | ||
| 37 | + | ||
| 31 | $this->response('success',Code::SUCCESS,$lists); | 38 | $this->response('success',Code::SUCCESS,$lists); |
| 32 | 39 | ||
| 33 | } | 40 | } |
| 34 | 41 | ||
| 35 | 42 | ||
| 36 | - /** | ||
| 37 | - * 编辑 | ||
| 38 | - * @author:dc | ||
| 39 | - * @time 2023/5/4 16:19 | ||
| 40 | - */ | ||
| 41 | - public function edit(TemplateRequest $request){ | ||
| 42 | - $this->save($request->validated()); | ||
| 43 | - } | ||
| 44 | - | ||
| 45 | - /** | ||
| 46 | - * 新增 | ||
| 47 | - * @author:dc | ||
| 48 | - * @time 2023/5/5 9:30 | ||
| 49 | - */ | ||
| 50 | - public function insert(TemplateRequest $request){ | ||
| 51 | - $this->save($request->validated()); | ||
| 52 | - } | ||
| 53 | 43 | ||
| 54 | 44 | ||
| 55 | /** | 45 | /** |
| @@ -61,9 +51,9 @@ class TemplateController extends BaseController | @@ -61,9 +51,9 @@ class TemplateController extends BaseController | ||
| 61 | * @author:dc | 51 | * @author:dc |
| 62 | * @time 2023/5/11 10:13 | 52 | * @time 2023/5/11 10:13 |
| 63 | */ | 53 | */ |
| 64 | - private function save($data){ | 54 | + public function save(TemplateRequest $request){ |
| 65 | 55 | ||
| 66 | - TemplateLogic::instance()->save($data); | 56 | + TemplateLogic::instance()->save($request->validated()); |
| 67 | 57 | ||
| 68 | 58 | ||
| 69 | } | 59 | } |
| @@ -95,7 +85,7 @@ class TemplateController extends BaseController | @@ -95,7 +85,7 @@ class TemplateController extends BaseController | ||
| 95 | */ | 85 | */ |
| 96 | public function html_index($template_id){ | 86 | public function html_index($template_id){ |
| 97 | 87 | ||
| 98 | - $lists = (new ATemplate)->list($this->map,$this->order,['id','name','status','is_default','sort','thumb','url','created_at','updated_at']); | 88 | + $lists = (new ATemplateHtml)->list([['template_id','=',$template_id]],$this->order,['id','name','status','is_default','sort','thumb','url','created_at','updated_at']); |
| 99 | $this->response('success',Code::SUCCESS,$lists); | 89 | $this->response('success',Code::SUCCESS,$lists); |
| 100 | 90 | ||
| 101 | } | 91 | } |
| @@ -5,13 +5,9 @@ namespace App\Http\Controllers\Bside\AyrShare; | @@ -5,13 +5,9 @@ namespace App\Http\Controllers\Bside\AyrShare; | ||
| 5 | use App\Enums\Common\Code; | 5 | use App\Enums\Common\Code; |
| 6 | use App\Helper\AyrShare as AyrShareHelper; | 6 | use App\Helper\AyrShare as AyrShareHelper; |
| 7 | use App\Http\Controllers\Bside\BaseController; | 7 | use App\Http\Controllers\Bside\BaseController; |
| 8 | -use App\Http\Controllers\Bside\FileController; | ||
| 9 | -use App\Http\Controllers\File\ImageController; | ||
| 10 | use App\Http\Logic\Bside\AyrShare\AyrReleaseLogic; | 8 | use App\Http\Logic\Bside\AyrShare\AyrReleaseLogic; |
| 11 | use App\Http\Logic\Bside\AyrShare\AyrShareLogic; | 9 | use App\Http\Logic\Bside\AyrShare\AyrShareLogic; |
| 12 | use App\Http\Requests\Bside\AyrRelease\AyrReleaseRequest; | 10 | use App\Http\Requests\Bside\AyrRelease\AyrReleaseRequest; |
| 13 | -use App\Models\File\Image; | ||
| 14 | -use App\Models\File\Image as ImageModel; | ||
| 15 | 11 | ||
| 16 | /** | 12 | /** |
| 17 | * @name:社交发布 | 13 | * @name:社交发布 |
| @@ -61,9 +57,10 @@ class AyrReleaseController extends BaseController | @@ -61,9 +57,10 @@ class AyrReleaseController extends BaseController | ||
| 61 | public function send_post(AyrReleaseRequest $ayrReleaseRequest,AyrReleaseLogic $ayrReleaseLogic, | 57 | public function send_post(AyrReleaseRequest $ayrReleaseRequest,AyrReleaseLogic $ayrReleaseLogic, |
| 62 | AyrShareLogic $ayrShareLogic,AyrShareHelper $ayrShare){ | 58 | AyrShareLogic $ayrShareLogic,AyrShareHelper $ayrShare){ |
| 63 | $ayrReleaseRequest->validated(); | 59 | $ayrReleaseRequest->validated(); |
| 64 | - //验证发送平台 | ||
| 65 | //获取发送账号详情 | 60 | //获取发送账号详情 |
| 66 | $share_info = $ayrShareLogic->ayr_share_info(); | 61 | $share_info = $ayrShareLogic->ayr_share_info(); |
| 62 | + //验证发送平台 | ||
| 63 | + $ayrShareLogic->verify_param($share_info); | ||
| 67 | $data = [ | 64 | $data = [ |
| 68 | 'images'=>$this->param['images'], | 65 | 'images'=>$this->param['images'], |
| 69 | 'files'=>$this->param['video'], | 66 | 'files'=>$this->param['video'], |
| @@ -25,20 +25,22 @@ class AyrShareController extends BaseController | @@ -25,20 +25,22 @@ class AyrShareController extends BaseController | ||
| 25 | public function lists(AyrShareModel $ayrShareModel,AyrShareLogic $ayrShareLogic){ | 25 | public function lists(AyrShareModel $ayrShareModel,AyrShareLogic $ayrShareLogic){ |
| 26 | //授权配置列表 | 26 | //授权配置列表 |
| 27 | $share_list = $ayrShareModel->platforms; | 27 | $share_list = $ayrShareModel->platforms; |
| 28 | - $lists = $ayrShareModel->lists($this->map,$this->page,$this->row,'id',['id','name','title','profile_key','bind_plat_from','operator_id','created_at','updated_at']); | 28 | + $lists = $ayrShareModel->lists($this->map,$this->page,$this->row,'id',['id','name','title','profile_key','bind_platforms','operator_id','created_at','updated_at']); |
| 29 | foreach ($lists['list'] as $k => $v){ | 29 | foreach ($lists['list'] as $k => $v){ |
| 30 | if(!empty($v['profile_key'])){ | 30 | if(!empty($v['profile_key'])){ |
| 31 | $ayrShareHelper = new AyrShareHelper(); | 31 | $ayrShareHelper = new AyrShareHelper(); |
| 32 | $share_info = $ayrShareHelper->get_profiles_users($v['profile_key']); | 32 | $share_info = $ayrShareHelper->get_profiles_users($v['profile_key']); |
| 33 | if(isset($share_info['activeSocialAccounts'])){ | 33 | if(isset($share_info['activeSocialAccounts'])){ |
| 34 | $str = json_encode($share_info['activeSocialAccounts']); | 34 | $str = json_encode($share_info['activeSocialAccounts']); |
| 35 | - if($str != $v['bind_plat_from']){ | ||
| 36 | - $ayrShareLogic->ayr_share_edit(['bind_plat_from'=>$str]); | 35 | + if($str != $v['bind_platforms']){ |
| 36 | + $ayrShareLogic->ayr_share_edit(['bind_platforms'=>$str],$v['id']); | ||
| 37 | } | 37 | } |
| 38 | + }else{ | ||
| 39 | + $ayrShareLogic->ayr_share_edit(['bind_platforms'=>''],$v['id']); | ||
| 38 | } | 40 | } |
| 39 | } | 41 | } |
| 40 | } | 42 | } |
| 41 | - $lists['share_list'] = $share_list; | 43 | + $lists['list']['share_list'] = $share_list; |
| 42 | $this->response('列表',Code::SUCCESS,$lists); | 44 | $this->response('列表',Code::SUCCESS,$lists); |
| 43 | } | 45 | } |
| 44 | 46 | ||
| @@ -59,11 +61,13 @@ class AyrShareController extends BaseController | @@ -59,11 +61,13 @@ class AyrShareController extends BaseController | ||
| 59 | $share_info = $ayrShareHelper->get_profiles_users($info['profile_key']); | 61 | $share_info = $ayrShareHelper->get_profiles_users($info['profile_key']); |
| 60 | if(isset($share_info['activeSocialAccounts'])){ | 62 | if(isset($share_info['activeSocialAccounts'])){ |
| 61 | $str = json_encode($share_info['activeSocialAccounts']); | 63 | $str = json_encode($share_info['activeSocialAccounts']); |
| 62 | - if($str != $info['bind_plat_from']){ | ||
| 63 | - $res = $ayrShareLogic->ayr_share_edit(['bind_plat_from'=>$str]); | 64 | + if($str != $info['bind_platforms']){ |
| 65 | + $res = $ayrShareLogic->ayr_share_edit(['bind_platforms'=>$str],$this->param['share_id']); | ||
| 64 | }else{ | 66 | }else{ |
| 65 | $res = false; | 67 | $res = false; |
| 66 | } | 68 | } |
| 69 | + }else{ | ||
| 70 | + $res = $ayrShareLogic->ayr_share_edit(['bind_platforms'=>''],$this->param['share_id']); | ||
| 67 | } | 71 | } |
| 68 | $this->response('success',Code::SUCCESS,['is_true'=>$res]); | 72 | $this->response('success',Code::SUCCESS,['is_true'=>$res]); |
| 69 | } | 73 | } |
| @@ -4,6 +4,8 @@ namespace App\Http\Controllers\Bside; | @@ -4,6 +4,8 @@ namespace App\Http\Controllers\Bside; | ||
| 4 | 4 | ||
| 5 | 5 | ||
| 6 | use App\Enums\Common\Code; | 6 | use App\Enums\Common\Code; |
| 7 | +use App\Http\Logic\Bside\CustomLogic; | ||
| 8 | +use App\Http\Requests\Bside\Custom\CustomRequest; | ||
| 7 | use App\Models\BCustom; | 9 | use App\Models\BCustom; |
| 8 | 10 | ||
| 9 | /** | 11 | /** |
| @@ -17,41 +19,6 @@ class CustomController extends BaseController | @@ -17,41 +19,6 @@ class CustomController extends BaseController | ||
| 17 | { | 19 | { |
| 18 | 20 | ||
| 19 | /** | 21 | /** |
| 20 | - * 验证规则 | ||
| 21 | - * @var array[] | ||
| 22 | - */ | ||
| 23 | - private $verify = [ | ||
| 24 | - 'role' => [ | ||
| 25 | - 'name' => ['required','max:100'], | ||
| 26 | - 'title' => ['required','max:200'], | ||
| 27 | - 'keywords' => ['required','max:200'], | ||
| 28 | - 'description' => ['required','max:250'], | ||
| 29 | -// 'html' => ['required'], | ||
| 30 | - 'url' => ['required','max:200'], | ||
| 31 | - 'status' => ['required','in:0,1'], | ||
| 32 | - ], | ||
| 33 | - 'message' => [ | ||
| 34 | - 'name.required' => '名称必须', | ||
| 35 | - 'name.max' => '名称不能超过100个字符', | ||
| 36 | - 'title.required' => '网页标题必须', | ||
| 37 | - 'title.max' => '网页标题不能超过200个字符', | ||
| 38 | - 'keywords.required' => '网页关键字必须', | ||
| 39 | - 'keywords.max' => '网页关键字不能超过200个字符', | ||
| 40 | - 'description.required' => '网页描述必须', | ||
| 41 | - 'description.max' => '网页描述不能超过250个字符', | ||
| 42 | - | ||
| 43 | - 'url.required' => '链接必须', | ||
| 44 | - 'url.max' => '链接不能超过200个字符', | ||
| 45 | - | ||
| 46 | - 'status.required' => '状态选择错误', | ||
| 47 | - 'status.in' => '状态必须是显示/隐藏' | ||
| 48 | - ], | ||
| 49 | - 'attr' => [ | ||
| 50 | - | ||
| 51 | - ] | ||
| 52 | - ]; | ||
| 53 | - | ||
| 54 | - /** | ||
| 55 | * 列表数据 | 22 | * 列表数据 |
| 56 | * @throws \Psr\Container\ContainerExceptionInterface | 23 | * @throws \Psr\Container\ContainerExceptionInterface |
| 57 | * @throws \Psr\Container\NotFoundExceptionInterface | 24 | * @throws \Psr\Container\NotFoundExceptionInterface |
| @@ -64,40 +31,18 @@ class CustomController extends BaseController | @@ -64,40 +31,18 @@ class CustomController extends BaseController | ||
| 64 | $limit = intval($this->param['limit']??20); | 31 | $limit = intval($this->param['limit']??20); |
| 65 | 32 | ||
| 66 | 33 | ||
| 67 | - $lists = BCustom::_all($this->user['project_id'],$limit)->toArray(); | ||
| 68 | - | 34 | + $lists = CustomLogic::instance()->getList( |
| 35 | + [], | ||
| 36 | + [], | ||
| 37 | + ['id','name','title','status','url','keywords','description','created_at','updated_at'], | ||
| 38 | + $limit | ||
| 39 | + ); | ||
| 69 | 40 | ||
| 70 | return $this->success($lists); | 41 | return $this->success($lists); |
| 71 | 42 | ||
| 72 | } | 43 | } |
| 73 | 44 | ||
| 74 | 45 | ||
| 75 | - | ||
| 76 | - /** | ||
| 77 | - * 创建数据 | ||
| 78 | - * @author:dc | ||
| 79 | - * @time 2023/5/8 16:39 | ||
| 80 | - */ | ||
| 81 | - public function create(){ | ||
| 82 | - return $this->save(); | ||
| 83 | - } | ||
| 84 | - | ||
| 85 | - | ||
| 86 | - /** | ||
| 87 | - * 修改 | ||
| 88 | - * @return \Illuminate\Http\JsonResponse | ||
| 89 | - * @throws \Illuminate\Validation\ValidationException | ||
| 90 | - * @throws \Psr\Container\ContainerExceptionInterface | ||
| 91 | - * @throws \Psr\Container\NotFoundExceptionInterface | ||
| 92 | - * @author:dc | ||
| 93 | - * @time 2023/5/8 17:06 | ||
| 94 | - */ | ||
| 95 | - public function update(){ | ||
| 96 | - $this->verify['role']['id'] = ['required','integer','gt:0']; | ||
| 97 | - $this->verify['message']['id.gt'] = $this->verify['message']['id.integer'] = $this->verify['message']['id.required'] = '编辑导航数据不存在'; | ||
| 98 | - return $this->save(); | ||
| 99 | - } | ||
| 100 | - | ||
| 101 | /** | 46 | /** |
| 102 | * 新增修改 | 47 | * 新增修改 |
| 103 | * @return \Illuminate\Http\JsonResponse | 48 | * @return \Illuminate\Http\JsonResponse |
| @@ -107,17 +52,9 @@ class CustomController extends BaseController | @@ -107,17 +52,9 @@ class CustomController extends BaseController | ||
| 107 | * @author:dc | 52 | * @author:dc |
| 108 | * @time 2023/5/8 17:06 | 53 | * @time 2023/5/8 17:06 |
| 109 | */ | 54 | */ |
| 110 | - private function save(){ | ||
| 111 | - $data = $this->validate(request() ,$this->verify['role'],$this->verify['message']); | ||
| 112 | - | ||
| 113 | - // 保存 | ||
| 114 | - $id = BCustom::_save($this->user['project_id'],$data,$data['id']??0); | 55 | + public function save(CustomRequest $request){ |
| 115 | 56 | ||
| 116 | - if($id===-1){ | ||
| 117 | - return $this->response('数据不存在',Code::SYSTEM_ERROR); | ||
| 118 | - } | ||
| 119 | - | ||
| 120 | - return $this->success(BCustom::_find($this->user['project_id'],$id,true)); | 57 | + return $this->success(CustomLogic::instance()->save($request->validated())); |
| 121 | } | 58 | } |
| 122 | 59 | ||
| 123 | 60 | ||
| @@ -127,18 +64,11 @@ class CustomController extends BaseController | @@ -127,18 +64,11 @@ class CustomController extends BaseController | ||
| 127 | * @author:dc | 64 | * @author:dc |
| 128 | * @time 2023/5/9 9:20 | 65 | * @time 2023/5/9 9:20 |
| 129 | */ | 66 | */ |
| 130 | - public function delete(){ | ||
| 131 | - $id = $this->param['id']??0; | ||
| 132 | - $data = BCustom::_find($this->user['project_id'],$id); | ||
| 133 | - | ||
| 134 | - if(empty($data)){ | ||
| 135 | - return $this->response('数据不存在',Code::SYSTEM_ERROR); | ||
| 136 | - } | 67 | + public function delete(CustomRequest $request){ |
| 137 | 68 | ||
| 69 | + CustomLogic::instance()->delete($request->validated()['id']); | ||
| 138 | 70 | ||
| 139 | - if($data->delete()){ | ||
| 140 | - return $this->response('删除成功',Code::SUCCESS); | ||
| 141 | - } | 71 | + return $this->response('删除成功'); |
| 142 | 72 | ||
| 143 | } | 73 | } |
| 144 | 74 |
| @@ -29,7 +29,7 @@ class WebSettingReceivingController extends BaseController | @@ -29,7 +29,7 @@ class WebSettingReceivingController extends BaseController | ||
| 29 | * @time :2023/5/8 16:23 | 29 | * @time :2023/5/8 16:23 |
| 30 | */ | 30 | */ |
| 31 | public function save(WebSettingReceivingLogic $webSettingReceivingLogic){ | 31 | public function save(WebSettingReceivingLogic $webSettingReceivingLogic){ |
| 32 | - $lists = $webSettingReceivingLogic->setting_receiving_save(); | 32 | + $webSettingReceivingLogic->setting_receiving_save(); |
| 33 | $this->response('success'); | 33 | $this->response('success'); |
| 34 | } | 34 | } |
| 35 | } | 35 | } |
| @@ -4,9 +4,12 @@ namespace App\Http\Controllers\Bside; | @@ -4,9 +4,12 @@ namespace App\Http\Controllers\Bside; | ||
| 4 | 4 | ||
| 5 | 5 | ||
| 6 | use App\Enums\Common\Code; | 6 | use App\Enums\Common\Code; |
| 7 | +use App\Http\Logic\Bside\TemplateLogic; | ||
| 8 | +use App\Http\Requests\Bside\TemplateRequest; | ||
| 7 | use App\Models\Template\ATemplate; | 9 | use App\Models\Template\ATemplate; |
| 8 | use App\Models\Template\ATemplateHtml; | 10 | use App\Models\Template\ATemplateHtml; |
| 9 | use App\Models\Template\BSetting; | 11 | use App\Models\Template\BSetting; |
| 12 | +use App\Models\Template\BTemplate; | ||
| 10 | use App\Models\Template\BTemplateData; | 13 | use App\Models\Template\BTemplateData; |
| 11 | use Illuminate\Validation\Rule; | 14 | use Illuminate\Validation\Rule; |
| 12 | 15 | ||
| @@ -117,9 +120,10 @@ class TemplateController extends BaseController | @@ -117,9 +120,10 @@ class TemplateController extends BaseController | ||
| 117 | $source = $this->param['source']??''; | 120 | $source = $this->param['source']??''; |
| 118 | $source_id = $this->param['source_id']??0; | 121 | $source_id = $this->param['source_id']??0; |
| 119 | 122 | ||
| 123 | + $data = TemplateLogic::instance()->first($source,$source_id); | ||
| 120 | 124 | ||
| 121 | 125 | ||
| 122 | - return $this->success(); | 126 | + return $this->response('',Code::SUCCESS,$data['html']); |
| 123 | 127 | ||
| 124 | } | 128 | } |
| 125 | 129 | ||
| @@ -128,13 +132,38 @@ class TemplateController extends BaseController | @@ -128,13 +132,38 @@ class TemplateController extends BaseController | ||
| 128 | * @author:dc | 132 | * @author:dc |
| 129 | * @time 2023/5/11 11:00 | 133 | * @time 2023/5/11 11:00 |
| 130 | */ | 134 | */ |
| 131 | - public function save_html(){ | 135 | + public function save_html(TemplateRequest $request){ |
| 132 | 136 | ||
| 133 | - $source = $this->param['source']??''; | ||
| 134 | - $source_id = $this->param['source_id']??0; | 137 | + $data = $request->validated(); |
| 138 | + | ||
| 139 | + $data['data_source'] = $data['source']; | ||
| 140 | + $data['data_source_id'] = $data['source_id']; | ||
| 141 | + | ||
| 142 | + unset($data['source']); | ||
| 143 | + unset($data['source_id']); | ||
| 144 | + | ||
| 145 | + TemplateLogic::instance()->save($data); | ||
| 146 | + | ||
| 147 | + return $this->response('保存成功'); | ||
| 148 | + | ||
| 149 | + } | ||
| 150 | + | ||
| 151 | + /** | ||
| 152 | + * 状态修改 | ||
| 153 | + * @param TemplateRequest $request | ||
| 154 | + * @return \Illuminate\Http\JsonResponse | ||
| 155 | + * @throws \App\Exceptions\AsideGlobalException | ||
| 156 | + * @throws \App\Exceptions\BsideGlobalException | ||
| 157 | + * @author:dc | ||
| 158 | + * @time 2023/5/15 14:43 | ||
| 159 | + */ | ||
| 160 | + public function status(TemplateRequest $request){ | ||
| 161 | + | ||
| 162 | + $data = $request->validated(); | ||
| 135 | 163 | ||
| 136 | - $html = $this->param['html']??''; | 164 | + TemplateLogic::instance()->status($data['source'],$data['source_id'],$data['status']); |
| 137 | 165 | ||
| 166 | + return $this->response('保存成功'); | ||
| 138 | 167 | ||
| 139 | } | 168 | } |
| 140 | 169 |
| @@ -56,7 +56,8 @@ class AyrReleaseLogic extends BaseLogic | @@ -56,7 +56,8 @@ class AyrReleaseLogic extends BaseLogic | ||
| 56 | $arr = []; | 56 | $arr = []; |
| 57 | foreach ($data as $k => $v){ | 57 | foreach ($data as $k => $v){ |
| 58 | if($k == 'images'){ | 58 | if($k == 'images'){ |
| 59 | - $images = explode(',',$v); | 59 | +// $images = explode(',',$v); |
| 60 | + $images = $v; | ||
| 60 | $imageModel = new Image(); | 61 | $imageModel = new Image(); |
| 61 | $list = $imageModel->list(['hash'=>['in',$images]],'id'); | 62 | $list = $imageModel->list(['hash'=>['in',$images]],'id'); |
| 62 | foreach ($list as $v1){ | 63 | foreach ($list as $v1){ |
| @@ -6,10 +6,32 @@ use App\Http\Logic\Bside\BaseLogic; | @@ -6,10 +6,32 @@ use App\Http\Logic\Bside\BaseLogic; | ||
| 6 | use App\Models\AyrShare\AyrShare; | 6 | use App\Models\AyrShare\AyrShare; |
| 7 | use App\Models\File\File as FileModel; | 7 | use App\Models\File\File as FileModel; |
| 8 | use App\Models\File\Image as ImageModel; | 8 | use App\Models\File\Image as ImageModel; |
| 9 | - | 9 | +/** |
| 10 | + * @name:社交发布图片数量 | ||
| 11 | + * Facebook Pages and Groups: 10 images, including a carousel post. | ||
| 12 | + * Instagram: 10 images. | ||
| 13 | + * Google : 1 image. | ||
| 14 | + * LinkedIn: 9 images. | ||
| 15 | + * Pinterest: 1 image. | ||
| 16 | + * Reddit: 1 image. | ||
| 17 | + * Telegram: 1 image. | ||
| 18 | + * Twitter:4 image | ||
| 19 | + */ | ||
| 10 | class AyrShareLogic extends BaseLogic | 20 | class AyrShareLogic extends BaseLogic |
| 11 | { | 21 | { |
| 12 | - | 22 | + /** |
| 23 | + * @var :发布图片数量 | ||
| 24 | + */ | ||
| 25 | + public $send_num = [ | ||
| 26 | + 'facebook' => 10, | ||
| 27 | + 'instagram' => 10, | ||
| 28 | + 'google' => 1, | ||
| 29 | + 'linkedin'=>9, | ||
| 30 | + 'reddit'=>1, | ||
| 31 | + 'pinterest'=>1, | ||
| 32 | + 'telegram'=>1, | ||
| 33 | + 'Twitter'=>1, | ||
| 34 | + ]; | ||
| 13 | 35 | ||
| 14 | public function __construct() | 36 | public function __construct() |
| 15 | { | 37 | { |
| @@ -61,8 +83,8 @@ class AyrShareLogic extends BaseLogic | @@ -61,8 +83,8 @@ class AyrShareLogic extends BaseLogic | ||
| 61 | * @method :post | 83 | * @method :post |
| 62 | * @time :2023/5/9 14:44 | 84 | * @time :2023/5/9 14:44 |
| 63 | */ | 85 | */ |
| 64 | - public function ayr_share_edit($param){ | ||
| 65 | - $rs = $this->model->edit($param,['id'=>$this->param['id']]); | 86 | + public function ayr_share_edit($param,$id = ''){ |
| 87 | + $rs = $this->model->edit($param,['id'=>$id]); | ||
| 66 | if($rs === false){ | 88 | if($rs === false){ |
| 67 | $this->fail('error'); | 89 | $this->fail('error'); |
| 68 | } | 90 | } |
| @@ -83,7 +105,7 @@ class AyrShareLogic extends BaseLogic | @@ -83,7 +105,7 @@ class AyrShareLogic extends BaseLogic | ||
| 83 | return $this->success(); | 105 | return $this->success(); |
| 84 | } | 106 | } |
| 85 | /** | 107 | /** |
| 86 | - * @name :(更新图片库)save_info_info | 108 | + * @name :(根据hash获取图片详情)save_info_info |
| 87 | * @author :lyh | 109 | * @author :lyh |
| 88 | * @method :post | 110 | * @method :post |
| 89 | * @time :2023/5/10 15:01 | 111 | * @time :2023/5/10 15:01 |
| @@ -98,7 +120,7 @@ class AyrShareLogic extends BaseLogic | @@ -98,7 +120,7 @@ class AyrShareLogic extends BaseLogic | ||
| 98 | } | 120 | } |
| 99 | 121 | ||
| 100 | /** | 122 | /** |
| 101 | - * @name :(更新图片库)save_info_info | 123 | + * @name :(根据hash视频详情)save_info_info |
| 102 | * @author :lyh | 124 | * @author :lyh |
| 103 | * @method :post | 125 | * @method :post |
| 104 | * @time :2023/5/10 15:01 | 126 | * @time :2023/5/10 15:01 |
| @@ -171,6 +193,33 @@ class AyrShareLogic extends BaseLogic | @@ -171,6 +193,33 @@ class AyrShareLogic extends BaseLogic | ||
| 171 | } | 193 | } |
| 172 | return $this->success(); | 194 | return $this->success(); |
| 173 | } | 195 | } |
| 196 | + | ||
| 197 | + /** | ||
| 198 | + * @name :(验证平台参数)verify_param | ||
| 199 | + * @author :lyh | ||
| 200 | + * @method :post | ||
| 201 | + * @time :2023/5/16 9:19 | ||
| 202 | + * ["facebook","fbg","gmb","instagram","linkedin","pinterest","reddit","telegram","tiktok","twitter","youtube"] | ||
| 203 | + */ | ||
| 204 | + public function verify_param($info){ | ||
| 205 | + //验证发送平台 | ||
| 206 | + foreach ($this->param['platforms'] as $k => $v){ | ||
| 207 | + if(!in_array($v,json_decode($info['bind_platforms']))){ | ||
| 208 | + $this->fail('未绑定平台'); | ||
| 209 | + } | ||
| 210 | + //验证图片数 | ||
| 211 | + $img_num = count($this->param['images']); | ||
| 212 | + if($img_num > $this->send_num[$v]){ | ||
| 213 | + $this->fail('发布图片数量超过最大限制,'.$v.'只允许'.$this->send_num[$v].'张图'); | ||
| 214 | + } | ||
| 215 | + //验证图片数 | ||
| 216 | + $img_num = count($this->param['video']); | ||
| 217 | + if($img_num > 1){ | ||
| 218 | + $this->fail('发布视频数量超过最大限制,'.$v.'只允许'.$this->send_num[$v].'个视频'); | ||
| 219 | + } | ||
| 220 | + } | ||
| 221 | + return $this->success(); | ||
| 222 | + } | ||
| 174 | } | 223 | } |
| 175 | 224 | ||
| 176 | 225 |
app/Http/Logic/Bside/CustomLogic.php
0 → 100644
| 1 | +<?php | ||
| 2 | + | ||
| 3 | +namespace App\Http\Logic\Bside; | ||
| 4 | + | ||
| 5 | +use App\Helper\Arr; | ||
| 6 | +use App\Models\BCustom; | ||
| 7 | +use App\Models\Inquiry; | ||
| 8 | +use App\Models\RouteMap; | ||
| 9 | + | ||
| 10 | +/** | ||
| 11 | + * 自定义页面 | ||
| 12 | + * @author:dc | ||
| 13 | + * @time 2023/5/12 9:47 | ||
| 14 | + * Class CustomLogic | ||
| 15 | + * @package App\Http\Logic\Bside | ||
| 16 | + */ | ||
| 17 | +class CustomLogic extends BaseLogic | ||
| 18 | +{ | ||
| 19 | + public function __construct() | ||
| 20 | + { | ||
| 21 | + parent::__construct(); | ||
| 22 | + | ||
| 23 | + $this->model = new BCustom(); | ||
| 24 | + } | ||
| 25 | + | ||
| 26 | + | ||
| 27 | + /** | ||
| 28 | + * @param $param | ||
| 29 | + * @return array | ||
| 30 | + * @throws \App\Exceptions\AsideGlobalException | ||
| 31 | + * @throws \App\Exceptions\BsideGlobalException | ||
| 32 | + * @author:dc | ||
| 33 | + * @time 2023/5/12 9:54 | ||
| 34 | + */ | ||
| 35 | + public function save($param) | ||
| 36 | + { | ||
| 37 | + $id = parent::save($param); | ||
| 38 | + | ||
| 39 | + $data = $this->getInfo($id['id']); | ||
| 40 | + | ||
| 41 | + try { | ||
| 42 | + RouteMap::setRoute($data['url'],RouteMap::SOURCE_CUSTOM,$data['id'],$this->user['project_id']); | ||
| 43 | + }catch (\Throwable $e){ | ||
| 44 | + | ||
| 45 | + } | ||
| 46 | + | ||
| 47 | + return $data; | ||
| 48 | + } | ||
| 49 | + | ||
| 50 | + | ||
| 51 | + /** | ||
| 52 | + * 删除 | ||
| 53 | + * @param $ids | ||
| 54 | + * @param array $map | ||
| 55 | + * @return array|void | ||
| 56 | + * @author:dc | ||
| 57 | + * @time 2023/5/12 9:58 | ||
| 58 | + */ | ||
| 59 | + public function delete($ids, $map = []) | ||
| 60 | + { | ||
| 61 | + | ||
| 62 | + parent::delete($ids, $map); // TODO: Change the autogenerated stub | ||
| 63 | + | ||
| 64 | + // 删除路由 | ||
| 65 | + RouteMap::delRoute(RouteMap::SOURCE_CUSTOM,$ids,$this->user['project_id']); | ||
| 66 | + | ||
| 67 | + } | ||
| 68 | + | ||
| 69 | + | ||
| 70 | + | ||
| 71 | + | ||
| 72 | +} |
app/Http/Logic/Bside/TemplateLogic.php
0 → 100644
| 1 | +<?php | ||
| 2 | + | ||
| 3 | +namespace App\Http\Logic\Bside; | ||
| 4 | + | ||
| 5 | +use App\Models\RouteMap; | ||
| 6 | +use App\Models\Template\BTemplate; | ||
| 7 | + | ||
| 8 | +/** | ||
| 9 | + * @author:dc | ||
| 10 | + * @time 2023/5/15 13:57 | ||
| 11 | + * Class TemplateLogic | ||
| 12 | + * @package App\Http\Logic\Bside | ||
| 13 | + */ | ||
| 14 | +class TemplateLogic extends BaseLogic | ||
| 15 | +{ | ||
| 16 | + public function __construct() | ||
| 17 | + { | ||
| 18 | + parent::__construct(); | ||
| 19 | + | ||
| 20 | + $this->model = new BTemplate(); | ||
| 21 | + } | ||
| 22 | + | ||
| 23 | + | ||
| 24 | + /** | ||
| 25 | + * @param $param | ||
| 26 | + * @return array | ||
| 27 | + * @throws \App\Exceptions\AsideGlobalException | ||
| 28 | + * @throws \App\Exceptions\BsideGlobalException | ||
| 29 | + * @author:dc | ||
| 30 | + * @time 2023/5/12 9:54 | ||
| 31 | + */ | ||
| 32 | + public function save($param) | ||
| 33 | + { | ||
| 34 | + | ||
| 35 | + // 查询 | ||
| 36 | + $data = $this->first($param['data_source'],$param['data_source_id']); | ||
| 37 | + if($data){ | ||
| 38 | + $param['id'] = $data['id']; | ||
| 39 | + } | ||
| 40 | + | ||
| 41 | + parent::save($param); | ||
| 42 | + | ||
| 43 | + } | ||
| 44 | + | ||
| 45 | + | ||
| 46 | + /** | ||
| 47 | + * 状态修改 | ||
| 48 | + * @param $source | ||
| 49 | + * @param $source_id | ||
| 50 | + * @param $status | ||
| 51 | + * @return mixed | ||
| 52 | + * @throws \App\Exceptions\AsideGlobalException | ||
| 53 | + * @throws \App\Exceptions\BsideGlobalException | ||
| 54 | + * @author:dc | ||
| 55 | + * @time 2023/5/15 14:41 | ||
| 56 | + */ | ||
| 57 | + public function status($source,$source_id,$status){ | ||
| 58 | + | ||
| 59 | + $data = $this->first($source,$source_id); | ||
| 60 | + | ||
| 61 | + if(!$data){ | ||
| 62 | + $this->fail('数据不存在'); | ||
| 63 | + } | ||
| 64 | + | ||
| 65 | + $data->status = $status; | ||
| 66 | + | ||
| 67 | + return $data->save(); | ||
| 68 | + | ||
| 69 | + } | ||
| 70 | + | ||
| 71 | + | ||
| 72 | + /** | ||
| 73 | + * @param $source | ||
| 74 | + * @param $source_id | ||
| 75 | + * @return mixed | ||
| 76 | + * @author:dc | ||
| 77 | + * @time 2023/5/15 14:49 | ||
| 78 | + */ | ||
| 79 | + public function first($source,$source_id) | ||
| 80 | + { | ||
| 81 | + return $data = BTemplate::where([ | ||
| 82 | + 'project_id'=>$this->user['project_id'], | ||
| 83 | + 'data_source' => $source, | ||
| 84 | + 'data_source_id' => $source_id, | ||
| 85 | + ])->first(); | ||
| 86 | + } | ||
| 87 | + | ||
| 88 | + | ||
| 89 | +} |
| @@ -24,11 +24,11 @@ class AyrReleaseRequest extends FormRequest | @@ -24,11 +24,11 @@ class AyrReleaseRequest extends FormRequest | ||
| 24 | { | 24 | { |
| 25 | return [ | 25 | return [ |
| 26 | 'title'=>'required', | 26 | 'title'=>'required', |
| 27 | - 'images'=>'required', | 27 | + 'images'=>'required|array', |
| 28 | 'video'=>'required', | 28 | 'video'=>'required', |
| 29 | 'content'=>'required', | 29 | 'content'=>'required', |
| 30 | 'share_id'=>'required', | 30 | 'share_id'=>'required', |
| 31 | - 'platforms'=>'required', | 31 | + 'platforms'=>'required|array', |
| 32 | 'idempotency_key'=>'required', | 32 | 'idempotency_key'=>'required', |
| 33 | ]; | 33 | ]; |
| 34 | } | 34 | } |
| @@ -23,7 +23,7 @@ class AyrShareRequest extends FormRequest | @@ -23,7 +23,7 @@ class AyrShareRequest extends FormRequest | ||
| 23 | public function rules() | 23 | public function rules() |
| 24 | { | 24 | { |
| 25 | return [ | 25 | return [ |
| 26 | - 'name'=>'required||unique:gl_ayr_share,name', | 26 | + 'name'=>'required|unique:gl_ayr_share,name', |
| 27 | ]; | 27 | ]; |
| 28 | } | 28 | } |
| 29 | 29 | ||
| @@ -31,6 +31,7 @@ class AyrShareRequest extends FormRequest | @@ -31,6 +31,7 @@ class AyrShareRequest extends FormRequest | ||
| 31 | { | 31 | { |
| 32 | return [ | 32 | return [ |
| 33 | 'name.required'=>'请填写名称', | 33 | 'name.required'=>'请填写名称', |
| 34 | + | ||
| 34 | ]; | 35 | ]; |
| 35 | } | 36 | } |
| 36 | } | 37 | } |
| 1 | +<?php | ||
| 2 | + | ||
| 3 | +namespace App\Http\Requests\Bside\Custom; | ||
| 4 | + | ||
| 5 | +use Illuminate\Foundation\Http\FormRequest; | ||
| 6 | + | ||
| 7 | +/** | ||
| 8 | + * @author:dc | ||
| 9 | + * @time 2023/5/12 9:45 | ||
| 10 | + * Class CustomRequest | ||
| 11 | + * @package App\Http\Requests\Bside\Custom | ||
| 12 | + */ | ||
| 13 | +class CustomRequest extends FormRequest | ||
| 14 | +{ | ||
| 15 | + | ||
| 16 | + /** | ||
| 17 | + * Determine if the user is authorized to make this request. | ||
| 18 | + * | ||
| 19 | + * @return bool | ||
| 20 | + */ | ||
| 21 | + public function authorize() | ||
| 22 | + { | ||
| 23 | + return true; | ||
| 24 | + } | ||
| 25 | + | ||
| 26 | + /** | ||
| 27 | + * Get the validation rules that apply to the request. | ||
| 28 | + * | ||
| 29 | + * @return array | ||
| 30 | + */ | ||
| 31 | + public function rules() | ||
| 32 | + { | ||
| 33 | + $rule = [ | ||
| 34 | + 'name' => ['required','max:100'], | ||
| 35 | + 'title' => ['required','max:200'], | ||
| 36 | + 'keywords' => ['required','max:200'], | ||
| 37 | + 'description' => ['required','max:250'], | ||
| 38 | +// 'html' => ['required'], | ||
| 39 | + 'url' => ['required','max:200'], | ||
| 40 | + 'status' => ['required','in:0,1'], | ||
| 41 | + ]; | ||
| 42 | + | ||
| 43 | + // 修改 | ||
| 44 | + if($this->is('b/custom/update')){ | ||
| 45 | + $rule['id'] = ['required','integer']; | ||
| 46 | + } | ||
| 47 | + | ||
| 48 | + // 删除 | ||
| 49 | + if($this->is('b/custom/delete')){ | ||
| 50 | + $rule = ['id' => ['required','integer']]; | ||
| 51 | + } | ||
| 52 | + | ||
| 53 | + return $rule; | ||
| 54 | + } | ||
| 55 | + | ||
| 56 | + public function messages() | ||
| 57 | + { | ||
| 58 | + return [ | ||
| 59 | + 'id.required' => '数据不存在', | ||
| 60 | + 'id.integer' => '数据不存在', | ||
| 61 | + | ||
| 62 | + 'name.required' => '名称必须', | ||
| 63 | + 'name.max' => '名称不能超过100个字符', | ||
| 64 | + 'title.required' => '网页标题必须', | ||
| 65 | + 'title.max' => '网页标题不能超过200个字符', | ||
| 66 | + 'keywords.required' => '网页关键字必须', | ||
| 67 | + 'keywords.max' => '网页关键字不能超过200个字符', | ||
| 68 | + 'description.required' => '网页描述必须', | ||
| 69 | + 'description.max' => '网页描述不能超过250个字符', | ||
| 70 | + | ||
| 71 | + 'url.required' => '链接必须', | ||
| 72 | + 'url.max' => '链接不能超过200个字符', | ||
| 73 | + | ||
| 74 | + 'status.required' => '状态选择错误', | ||
| 75 | + 'status.in' => '状态必须是显示/隐藏' | ||
| 76 | + ]; | ||
| 77 | + } | ||
| 78 | +} |
app/Http/Requests/Bside/TemplateRequest.php
0 → 100644
| 1 | +<?php | ||
| 2 | + | ||
| 3 | +namespace App\Http\Requests\Bside; | ||
| 4 | + | ||
| 5 | +use App\Models\Template\ATemplateHtml; | ||
| 6 | +use Illuminate\Foundation\Http\FormRequest; | ||
| 7 | +use Illuminate\Validation\Rule; | ||
| 8 | + | ||
| 9 | +/** | ||
| 10 | + * @author:dc | ||
| 11 | + * @time 2023/5/15 14:04 | ||
| 12 | + * Class TemplateRequest | ||
| 13 | + * @package App\Http\Requests\Bside\Nav | ||
| 14 | + */ | ||
| 15 | +class TemplateRequest extends FormRequest | ||
| 16 | +{ | ||
| 17 | + | ||
| 18 | + /** | ||
| 19 | + * Determine if the user is authorized to make this request. | ||
| 20 | + * | ||
| 21 | + * @return bool | ||
| 22 | + */ | ||
| 23 | + public function authorize() | ||
| 24 | + { | ||
| 25 | + return true; | ||
| 26 | + } | ||
| 27 | + | ||
| 28 | + /** | ||
| 29 | + * Get the validation rules that apply to the request. | ||
| 30 | + * | ||
| 31 | + * @return array | ||
| 32 | + */ | ||
| 33 | + public function rules() | ||
| 34 | + { | ||
| 35 | + $rule = [ | ||
| 36 | + 'css' => [], | ||
| 37 | + 'script' => [], | ||
| 38 | + 'html' => ['required'], | ||
| 39 | + 'source' => ['required',Rule::in(array_column(ATemplateHtml::$sourceMap,'template'))], | ||
| 40 | + 'source_id' => ['required','integer','gte:0'], | ||
| 41 | + 'status' => ['required',Rule::in([0,1])] | ||
| 42 | + ]; | ||
| 43 | + | ||
| 44 | + | ||
| 45 | + // 删除 | ||
| 46 | + if(!$this->is('b/template/status')){ | ||
| 47 | + unset($rule['css']); | ||
| 48 | + unset($rule['script']); | ||
| 49 | + unset($rule['html']); | ||
| 50 | + } | ||
| 51 | + | ||
| 52 | + return $rule; | ||
| 53 | + } | ||
| 54 | + | ||
| 55 | + | ||
| 56 | + public function messages() | ||
| 57 | + { | ||
| 58 | + return [ | ||
| 59 | + | ||
| 60 | + 'html.required' => '自定义内容必须', | ||
| 61 | + | ||
| 62 | + 'source.required' => '数据错误', | ||
| 63 | + 'source.in' => '数据错误', | ||
| 64 | + | ||
| 65 | + 'source_id.required' => '数据错误', | ||
| 66 | + 'source_id.integer' => '数据错误', | ||
| 67 | + 'source_id.gte' => '数据错误', | ||
| 68 | + | ||
| 69 | + 'status.required' => '状态错误', | ||
| 70 | + 'status.in' => '状态错误', | ||
| 71 | + | ||
| 72 | + ]; | ||
| 73 | + } | ||
| 74 | + | ||
| 75 | + | ||
| 76 | +} |
| @@ -32,78 +32,7 @@ class BCustom extends Base | @@ -32,78 +32,7 @@ class BCustom extends Base | ||
| 32 | const STATUS_DISABLED = 0; | 32 | const STATUS_DISABLED = 0; |
| 33 | 33 | ||
| 34 | 34 | ||
| 35 | - /** | ||
| 36 | - * 创建或者新增导航栏 | ||
| 37 | - * @param int $project_id | ||
| 38 | - * @param array $data | ||
| 39 | - * @param int $id | ||
| 40 | - * @return int | ||
| 41 | - * @author:dc | ||
| 42 | - * @time 2023/5/8 16:24 | ||
| 43 | - */ | ||
| 44 | - public static function _save(int $project_id, array $data, int $id = 0):int { | ||
| 45 | - if($id){ | ||
| 46 | - $model = static::where('id',$id)->where('project_id', $project_id)->first(); | ||
| 47 | - if(!$model){ | ||
| 48 | - return -1; | ||
| 49 | - } | ||
| 50 | - }else{ | ||
| 51 | - $model = new static(); | ||
| 52 | - $model->project_id = $project_id; | ||
| 53 | - | ||
| 54 | - } | ||
| 55 | - | ||
| 56 | - $model->name = $data['name']; | ||
| 57 | - $model->title = $data['title']; | ||
| 58 | - $model->keywords = $data['keywords']; | ||
| 59 | - $model->description = $data['description']; | ||
| 60 | - $model->url = $data['url']; | ||
| 61 | - $model->status = $data['status']; | ||
| 62 | - $model->html = $data['html']??''; | ||
| 63 | - | ||
| 64 | - $model->save(); | ||
| 65 | - | ||
| 66 | - // 创建路由标识 | ||
| 67 | - try { | ||
| 68 | - RouteMap::setRoute($model->url,RouteMap::SOURCE_CUSTOM,$model->id,$project_id); | ||
| 69 | - }catch (\Throwable $e){ | ||
| 70 | - | ||
| 71 | - } | ||
| 72 | - | ||
| 73 | - | ||
| 74 | - return $model->id; | ||
| 75 | - } | ||
| 76 | - | ||
| 77 | 35 | ||
| 78 | - /** | ||
| 79 | - * 删除 | ||
| 80 | - * @param int $project_id | ||
| 81 | - * @param int $id | ||
| 82 | - * @return mixed | ||
| 83 | - * @author:dc | ||
| 84 | - * @time 2023/5/8 16:27 | ||
| 85 | - */ | ||
| 86 | - public static function _del(int $project_id, int $id){ | ||
| 87 | - return static::where(['project_id'=>$project_id,'id'=>$id])->delete(); | ||
| 88 | - } | ||
| 89 | - | ||
| 90 | - | ||
| 91 | - /** | ||
| 92 | - * 查询当前项目下的所有信息 | ||
| 93 | - * @param int $project_id | ||
| 94 | - * @return mixed | ||
| 95 | - * @author:dc | ||
| 96 | - * @time 2023/5/8 16:29 | ||
| 97 | - */ | ||
| 98 | - public static function _all(int $project_id, int $limit = 20) | ||
| 99 | - { | ||
| 100 | - return static::where(function ($query) use ($project_id){ | ||
| 101 | - // 那个公司 | ||
| 102 | - $query->where('project_id',$project_id); | ||
| 103 | - }) | ||
| 104 | - ->select(['id','name','title','status','url','keywords','description','created_at','updated_at']) | ||
| 105 | - ->paginate($limit); | ||
| 106 | - } | ||
| 107 | 36 | ||
| 108 | /** | 37 | /** |
| 109 | * 查询一条数据 | 38 | * 查询一条数据 |
| @@ -32,52 +32,6 @@ class BNav extends Base | @@ -32,52 +32,6 @@ class BNav extends Base | ||
| 32 | const STATUS_DISABLED = 0; | 32 | const STATUS_DISABLED = 0; |
| 33 | 33 | ||
| 34 | 34 | ||
| 35 | - /** | ||
| 36 | - * 创建或者新增导航栏 | ||
| 37 | - * @param int $project_id | ||
| 38 | - * @param array $data | ||
| 39 | - * @param int $id | ||
| 40 | - * @return int | ||
| 41 | - * @author:dc | ||
| 42 | - * @time 2023/5/8 16:24 | ||
| 43 | - */ | ||
| 44 | - public static function _save(int $project_id, array $data, int $id = 0):int { | ||
| 45 | - if($id){ | ||
| 46 | - $model = static::where('id',$id)->where('project_id', $project_id)->first(); | ||
| 47 | - if(!$model){ | ||
| 48 | - return -1; | ||
| 49 | - } | ||
| 50 | - }else{ | ||
| 51 | - $model = new static(); | ||
| 52 | - $model->project_id = $project_id; | ||
| 53 | - | ||
| 54 | - } | ||
| 55 | - | ||
| 56 | - $model->pid = $data['pid']; | ||
| 57 | - $model->name = $data['name']; | ||
| 58 | - $model->location = $data['location']; | ||
| 59 | - $model->url = $data['url']; | ||
| 60 | - $model->status = $data['status']; | ||
| 61 | - $model->target = $data['target']; | ||
| 62 | - $model->sort = $data['sort']; | ||
| 63 | - $model->save(); | ||
| 64 | - | ||
| 65 | - return $model->id; | ||
| 66 | - } | ||
| 67 | - | ||
| 68 | - | ||
| 69 | - /** | ||
| 70 | - * 删除 | ||
| 71 | - * @param int $project_id | ||
| 72 | - * @param int $id | ||
| 73 | - * @return mixed | ||
| 74 | - * @author:dc | ||
| 75 | - * @time 2023/5/8 16:27 | ||
| 76 | - */ | ||
| 77 | - public static function _del(int $project_id, int $id){ | ||
| 78 | - return static::where(['project_id'=>$project_id,'id'=>$id])->delete(); | ||
| 79 | - } | ||
| 80 | - | ||
| 81 | 35 | ||
| 82 | /** | 36 | /** |
| 83 | * 查询当前项目下的所有栏目信息 | 37 | * 查询当前项目下的所有栏目信息 |
| @@ -98,36 +52,8 @@ class BNav extends Base | @@ -98,36 +52,8 @@ class BNav extends Base | ||
| 98 | ->get(); | 52 | ->get(); |
| 99 | } | 53 | } |
| 100 | 54 | ||
| 101 | - /** | ||
| 102 | - * 查询一条数据 | ||
| 103 | - * @param int $project_id | ||
| 104 | - * @param int $id | ||
| 105 | - * @return mixed | ||
| 106 | - * @author:dc | ||
| 107 | - * @time 2023/5/8 17:04 | ||
| 108 | - */ | ||
| 109 | - public static function _find(int $project_id, int $id, $array = false) | ||
| 110 | - { | ||
| 111 | - $data = static::where(['id'=>$id,'project_id'=>$project_id])->first(); | ||
| 112 | - if($data){ | ||
| 113 | - return $array ? $data->toArray() : $data; | ||
| 114 | - } | ||
| 115 | - return []; | ||
| 116 | - } | ||
| 117 | 55 | ||
| 118 | 56 | ||
| 119 | - /** | ||
| 120 | - * 是否存在 | ||
| 121 | - * @param int $project_id | ||
| 122 | - * @param int $id | ||
| 123 | - * @return mixed | ||
| 124 | - * @author:dc | ||
| 125 | - * @time 2023/5/8 17:24 | ||
| 126 | - */ | ||
| 127 | - public static function _check(int $project_id, int $id) | ||
| 128 | - { | ||
| 129 | - return static::where(['id'=>$id,'project_id'=>$project_id])->count(); | ||
| 130 | - } | ||
| 131 | 57 | ||
| 132 | /** | 58 | /** |
| 133 | * 是否有下级 | 59 | * 是否有下级 |
| @@ -127,8 +127,8 @@ Route::middleware(['web'])->group(function (){ //admin用渲染默认要加上w | @@ -127,8 +127,8 @@ Route::middleware(['web'])->group(function (){ //admin用渲染默认要加上w | ||
| 127 | // 自定义页面 模板,头部底部 | 127 | // 自定义页面 模板,头部底部 |
| 128 | Route::prefix('template')->group(function () { | 128 | Route::prefix('template')->group(function () { |
| 129 | Route::get('/', [\App\Http\Controllers\Aside\TemplateController::class, 'index'])->name('admin.template'); | 129 | Route::get('/', [\App\Http\Controllers\Aside\TemplateController::class, 'index'])->name('admin.template'); |
| 130 | - Route::post('/edit', [\App\Http\Controllers\Aside\TemplateController::class, 'edit'])->name('admin.template_edit'); | ||
| 131 | - Route::post('/insert', [\App\Http\Controllers\Aside\TemplateController::class, 'insert'])->name('admin.template_insert'); | 130 | + Route::post('/edit', [\App\Http\Controllers\Aside\TemplateController::class, 'save'])->name('admin.template_edit'); |
| 131 | + Route::post('/insert', [\App\Http\Controllers\Aside\TemplateController::class, 'save'])->name('admin.template_insert'); | ||
| 132 | Route::delete('/delete/{id}', [\App\Http\Controllers\Aside\TemplateController::class, 'delete'])->where('id','\d+')->name('admin.template_delete'); | 132 | Route::delete('/delete/{id}', [\App\Http\Controllers\Aside\TemplateController::class, 'delete'])->where('id','\d+')->name('admin.template_delete'); |
| 133 | 133 | ||
| 134 | Route::get('/html/{template_id}', [\App\Http\Controllers\Aside\TemplateController::class, 'html_index'])->where('template_id','\d+')->name('admin.template.html'); | 134 | Route::get('/html/{template_id}', [\App\Http\Controllers\Aside\TemplateController::class, 'html_index'])->where('template_id','\d+')->name('admin.template.html'); |
| @@ -233,15 +233,17 @@ Route::middleware(['bloginauth'])->group(function () { | @@ -233,15 +233,17 @@ Route::middleware(['bloginauth'])->group(function () { | ||
| 233 | Route::get('/get_type', [\App\Http\Controllers\Bside\TemplateController::class, 'get_type'])->name('bside_template_type'); | 233 | Route::get('/get_type', [\App\Http\Controllers\Bside\TemplateController::class, 'get_type'])->name('bside_template_type'); |
| 234 | Route::get('/get_html', [\App\Http\Controllers\Bside\TemplateController::class, 'get_html'])->name('bside_template_get_html'); | 234 | Route::get('/get_html', [\App\Http\Controllers\Bside\TemplateController::class, 'get_html'])->name('bside_template_get_html'); |
| 235 | Route::get('/save_html', [\App\Http\Controllers\Bside\TemplateController::class, 'save_html'])->name('bside_template_save_html'); | 235 | Route::get('/save_html', [\App\Http\Controllers\Bside\TemplateController::class, 'save_html'])->name('bside_template_save_html'); |
| 236 | + Route::get('/status', [\App\Http\Controllers\Bside\TemplateController::class, 'status'])->name('bside_template_status'); | ||
| 236 | }); | 237 | }); |
| 237 | // 自定义页面,专题页 | 238 | // 自定义页面,专题页 |
| 238 | Route::prefix('custom')->group(function () { | 239 | Route::prefix('custom')->group(function () { |
| 239 | Route::get('/', [\App\Http\Controllers\Bside\CustomController::class, 'index'])->name('bside_custom'); | 240 | Route::get('/', [\App\Http\Controllers\Bside\CustomController::class, 'index'])->name('bside_custom'); |
| 240 | - Route::post('/create', [\App\Http\Controllers\Bside\CustomController::class, 'create'])->name('bside_custom_create'); | ||
| 241 | - Route::post('/update', [\App\Http\Controllers\Bside\CustomController::class, 'update'])->name('bside_custom_update'); | 241 | + Route::post('/create', [\App\Http\Controllers\Bside\CustomController::class, 'save'])->name('bside_custom_create'); |
| 242 | + Route::post('/update', [\App\Http\Controllers\Bside\CustomController::class, 'save'])->name('bside_custom_update'); | ||
| 242 | Route::delete('/delete', [\App\Http\Controllers\Bside\CustomController::class, 'delete'])->name('bside_custom_delete'); | 243 | Route::delete('/delete', [\App\Http\Controllers\Bside\CustomController::class, 'delete'])->name('bside_custom_delete'); |
| 243 | Route::any('/html/{id}', [\App\Http\Controllers\Bside\CustomController::class, 'html'])->where('id','\d+')->name('bside_custom_delete'); | 244 | Route::any('/html/{id}', [\App\Http\Controllers\Bside\CustomController::class, 'html'])->where('id','\d+')->name('bside_custom_delete'); |
| 244 | }); | 245 | }); |
| 246 | + | ||
| 245 | // 导航栏编辑 | 247 | // 导航栏编辑 |
| 246 | Route::prefix('nav')->group(function () { | 248 | Route::prefix('nav')->group(function () { |
| 247 | Route::get('/', [\App\Http\Controllers\Bside\NavController::class, 'index'])->name('bside_nav'); | 249 | Route::get('/', [\App\Http\Controllers\Bside\NavController::class, 'index'])->name('bside_nav'); |
-
请 注册 或 登录 后发表评论