正在显示
9 个修改的文件
包含
944 行增加
和
0 行删除
| 1 | +<?php | ||
| 2 | + | ||
| 3 | +namespace App\Http\Controllers\Aside; | ||
| 4 | + | ||
| 5 | +use App\Models\Template\AHeadFoot; | ||
| 6 | + | ||
| 7 | +/** | ||
| 8 | + * 模板 | ||
| 9 | + * @author:dc | ||
| 10 | + * @time 2023/5/4 17:10 | ||
| 11 | + * Class TemplateController | ||
| 12 | + * @package App\Http\Controllers\Aside | ||
| 13 | + */ | ||
| 14 | +class TemplateController extends BaseController | ||
| 15 | +{ | ||
| 16 | + | ||
| 17 | + | ||
| 18 | + /** | ||
| 19 | + * 列表 | ||
| 20 | + * @author:dc | ||
| 21 | + * @time 2023/5/4 17:10 | ||
| 22 | + */ | ||
| 23 | + public function index(){ | ||
| 24 | + | ||
| 25 | + $data = AHeadFoot::all(); | ||
| 26 | + $lists = []; | ||
| 27 | + // 以名字为单位区分 | ||
| 28 | + foreach ($data as $datum){ | ||
| 29 | + if(empty($lists[$datum['name']])) $lists[$datum['name']] = []; | ||
| 30 | + $lists[$datum['name']]['name'] = $datum['name']; | ||
| 31 | + $lists[$datum['name']]['default'] = $datum['is_default']; | ||
| 32 | + $lists[$datum['name']]['sort'] = $datum['sort']; | ||
| 33 | + $lists[$datum['name']]['status'] = $datum['status']; | ||
| 34 | + $lists[$datum['name']]['created_at'] = $datum['created_at']; | ||
| 35 | +// $lists[$datum['name']]['tags'] = $datum['tags']; | ||
| 36 | + $lists[$datum['name']][$datum['type']==AHeadFoot::TYPE_HEADER?'header':'footer'] = $datum['html']; | ||
| 37 | + } | ||
| 38 | + | ||
| 39 | + return $this->success($lists); | ||
| 40 | + | ||
| 41 | + } | ||
| 42 | + | ||
| 43 | + | ||
| 44 | + /** | ||
| 45 | + * 编辑 | ||
| 46 | + * @author:dc | ||
| 47 | + * @time 2023/5/4 16:19 | ||
| 48 | + */ | ||
| 49 | + public function edit(){ | ||
| 50 | + | ||
| 51 | + } | ||
| 52 | + | ||
| 53 | + /** | ||
| 54 | + * 新增 | ||
| 55 | + * @author:dc | ||
| 56 | + * @time 2023/5/5 9:30 | ||
| 57 | + */ | ||
| 58 | + public function insert(){ | ||
| 59 | + | ||
| 60 | + } | ||
| 61 | + | ||
| 62 | + | ||
| 63 | + private function save($name = ''){ | ||
| 64 | + | ||
| 65 | + } | ||
| 66 | + | ||
| 67 | + | ||
| 68 | + /** | ||
| 69 | + * 删除 | ||
| 70 | + * @author:dc | ||
| 71 | + * @time 2023/5/4 17:10 | ||
| 72 | + */ | ||
| 73 | + public function delete(){ | ||
| 74 | + | ||
| 75 | + | ||
| 76 | + } | ||
| 77 | + | ||
| 78 | + | ||
| 79 | + | ||
| 80 | + | ||
| 81 | + | ||
| 82 | +} |
| 1 | +<?php | ||
| 2 | + | ||
| 3 | +namespace App\Http\Controllers\Bside\AyrShare; | ||
| 4 | + | ||
| 5 | +use App\Enums\Common\Code; | ||
| 6 | +use App\Helper\AyrShare as AyrShareHelper; | ||
| 7 | +use App\Http\Controllers\Bside\BaseController; | ||
| 8 | +use App\Http\Logic\Bside\AyrShare\AyrReleaseLogic; | ||
| 9 | +use App\Http\Logic\Bside\AyrShare\AyrShareLogic; | ||
| 10 | +use App\Models\AyrShare\AyrShare as AyrShareModel; | ||
| 11 | +use Illuminate\Support\Facades\DB; | ||
| 12 | + | ||
| 13 | +/** | ||
| 14 | + * @name:社交发布 | ||
| 15 | + */ | ||
| 16 | +class AyrReleaseController extends BaseController | ||
| 17 | +{ | ||
| 18 | + /** | ||
| 19 | + * @name :(获取当前用户已绑定的社交链接)info | ||
| 20 | + * @author :lyh | ||
| 21 | + * @method :post | ||
| 22 | + * @time :2023/5/9 16:00 | ||
| 23 | + */ | ||
| 24 | + public function info(AyrShareLogic $ayrShareLogic){ | ||
| 25 | + $info = $ayrShareLogic->ayr_share_info(); | ||
| 26 | + $this->response('success',Code::SUCCESS,$info); | ||
| 27 | + } | ||
| 28 | + /** | ||
| 29 | + * @name :(发布社交)send_post | ||
| 30 | + * @author :lyh | ||
| 31 | + * @method :post | ||
| 32 | + * @time :2023/5/9 9:36 | ||
| 33 | + */ | ||
| 34 | + public function send_post(AyrReleaseLogic $ayrReleaseLogic,AyrShareLogic $ayrShareLogic){ | ||
| 35 | + DB::beginTransaction(); | ||
| 36 | + try { | ||
| 37 | + //获取发送账号详情 | ||
| 38 | + $share_info = $ayrShareLogic->ayr_share_info(); | ||
| 39 | + $data = [ | ||
| 40 | + 'image'=>explode(',',$this->param['image']), | ||
| 41 | + 'file'=>explode(',',$this->param['file']) | ||
| 42 | + ]; | ||
| 43 | + //参数处理 | ||
| 44 | + $image_file = $this->_extents($data); | ||
| 45 | + $this->param['mediaUrls'] = $image_file; | ||
| 46 | + //统一生成链接 | ||
| 47 | + $param = [ | ||
| 48 | + 'post'=>$this->param['content'], | ||
| 49 | + 'platforms'=>$this->param['platforms'], | ||
| 50 | + 'mediaUrls'=>$this->param['mediaUrls'],//参数处理 | ||
| 51 | + ]; | ||
| 52 | + //发送请求注册社交用户 | ||
| 53 | + $ayrShareHelper = new AyrShareHelper(); | ||
| 54 | + $res = $ayrShareHelper->post_send_msg($param,$share_info['profile_key']); | ||
| 55 | + $this->response('success',Code::SUCCESS,$res); | ||
| 56 | + //保存数据库 | ||
| 57 | + $ayrReleaseLogic->release_add(); | ||
| 58 | + DB::commit(); | ||
| 59 | + }catch (\Exception $e){ | ||
| 60 | + DB::rollBack(); | ||
| 61 | + $this->response('error',Code::USER_ERROR); | ||
| 62 | + } | ||
| 63 | + } | ||
| 64 | + | ||
| 65 | +} |
app/Http/Controllers/Bside/NavController.php
0 → 100644
| 1 | +<?php | ||
| 2 | + | ||
| 3 | +namespace App\Http\Controllers\Bside; | ||
| 4 | + | ||
| 5 | + | ||
| 6 | +use App\Enums\Common\Code; | ||
| 7 | +use App\Models\BNav; | ||
| 8 | + | ||
| 9 | +/** | ||
| 10 | + * 导航栏目 b端编辑 c端显示 | ||
| 11 | + * @author:dc | ||
| 12 | + * @time 2023/5/8 16:31 | ||
| 13 | + * Class NavController | ||
| 14 | + * @package App\Http\Controllers\Bside | ||
| 15 | + */ | ||
| 16 | +class NavController extends BaseController | ||
| 17 | +{ | ||
| 18 | + | ||
| 19 | + /** | ||
| 20 | + * 验证规则 | ||
| 21 | + * @var array[] | ||
| 22 | + */ | ||
| 23 | + private $verify = [ | ||
| 24 | + 'role' => [ | ||
| 25 | + 'pid' => ['required','integer','gte:0'], | ||
| 26 | + 'name' => ['required','max:100'], | ||
| 27 | + 'location' => ['required','in:header,footer'], | ||
| 28 | + 'url' => ['required','max:200'], | ||
| 29 | + 'status' => ['required','in:0,1'], | ||
| 30 | + 'target' => ['required','in:0,1'], | ||
| 31 | + 'sort' => ['required','integer','gte:0'] | ||
| 32 | + ], | ||
| 33 | + 'message' => [ | ||
| 34 | + 'pid.required' => '上级选择错误', | ||
| 35 | + 'pid.gte' => '上级选择错误', | ||
| 36 | + 'pid.integer' => '上级选择错误', | ||
| 37 | + 'name.required' => '名称必须', | ||
| 38 | + 'name.max' => '名称不能超过100个字符', | ||
| 39 | + 'location.required' => '位置选择错误', | ||
| 40 | + 'location.in' => '位置选择错误', | ||
| 41 | + 'url.required' => '链接必须', | ||
| 42 | + 'url.max' => '链接不能超过200个字符', | ||
| 43 | + 'status.required' => '状态选择错误', | ||
| 44 | + 'status.in' => '状态必须是显示/隐藏', | ||
| 45 | + 'target.required' => '打开方式必须', | ||
| 46 | + 'target.in' => '打开方式选择错误', | ||
| 47 | + 'sort.required' => '排序必须', | ||
| 48 | + 'sort.integer' => '排序必须是一个数字', | ||
| 49 | + 'sort.gte' => '排序必须大于等于0', | ||
| 50 | + ], | ||
| 51 | + 'attr' => [ | ||
| 52 | + | ||
| 53 | + ] | ||
| 54 | + ]; | ||
| 55 | + | ||
| 56 | + /** | ||
| 57 | + * 列表数据 | ||
| 58 | + * @throws \Psr\Container\ContainerExceptionInterface | ||
| 59 | + * @throws \Psr\Container\NotFoundExceptionInterface | ||
| 60 | + * @author:dc | ||
| 61 | + * @time 2023/5/8 16:37 | ||
| 62 | + */ | ||
| 63 | + public function index(){ | ||
| 64 | + | ||
| 65 | + $isTree = $this->param['tree']??false; | ||
| 66 | + // 显示位置 | ||
| 67 | + $location = $this->param['location']??''; | ||
| 68 | + | ||
| 69 | + $lists = BNav::_all($this->user['project_id'],$location)->toArray(); | ||
| 70 | + | ||
| 71 | + if($isTree){ | ||
| 72 | + $lists = list_to_tree($lists); | ||
| 73 | + } | ||
| 74 | + | ||
| 75 | + return $this->success($lists); | ||
| 76 | + | ||
| 77 | + } | ||
| 78 | + | ||
| 79 | + | ||
| 80 | + | ||
| 81 | + /** | ||
| 82 | + * 创建导航栏 | ||
| 83 | + * @author:dc | ||
| 84 | + * @time 2023/5/8 16:39 | ||
| 85 | + */ | ||
| 86 | + public function create(){ | ||
| 87 | + return $this->save(); | ||
| 88 | + } | ||
| 89 | + | ||
| 90 | + | ||
| 91 | + /** | ||
| 92 | + * 修改 | ||
| 93 | + * @return \Illuminate\Http\JsonResponse | ||
| 94 | + * @throws \Illuminate\Validation\ValidationException | ||
| 95 | + * @throws \Psr\Container\ContainerExceptionInterface | ||
| 96 | + * @throws \Psr\Container\NotFoundExceptionInterface | ||
| 97 | + * @author:dc | ||
| 98 | + * @time 2023/5/8 17:06 | ||
| 99 | + */ | ||
| 100 | + public function update(){ | ||
| 101 | + $this->verify['role']['id'] = ['required','integer','gt:0']; | ||
| 102 | + $this->verify['message']['id.gt'] = $this->verify['message']['id.integer'] = $this->verify['message']['id.required'] = '编辑导航数据不存在'; | ||
| 103 | + return $this->save(); | ||
| 104 | + } | ||
| 105 | + | ||
| 106 | + /** | ||
| 107 | + * 新增修改 | ||
| 108 | + * @return \Illuminate\Http\JsonResponse | ||
| 109 | + * @throws \Illuminate\Validation\ValidationException | ||
| 110 | + * @throws \Psr\Container\ContainerExceptionInterface | ||
| 111 | + * @throws \Psr\Container\NotFoundExceptionInterface | ||
| 112 | + * @author:dc | ||
| 113 | + * @time 2023/5/8 17:06 | ||
| 114 | + */ | ||
| 115 | + private function save(){ | ||
| 116 | + $data = $this->validate(request() ,$this->verify['role'],$this->verify['message']); | ||
| 117 | + | ||
| 118 | + if($data['pid']){ | ||
| 119 | + // 验证是否存在上级 | ||
| 120 | + $all = BNav::_all($this->user['project_id'],$data['location']); | ||
| 121 | + if(!$all->where('id',$data['pid'])->count()){ | ||
| 122 | + return $this->response('上级栏目不存在','B_NAV_PID_NOTFOUND'); | ||
| 123 | + } | ||
| 124 | + // 上级不允许是自己的下级 | ||
| 125 | + if(!empty($data['id'])){ | ||
| 126 | + $all = list_to_tree($all->toArray(),$data['id']); | ||
| 127 | + $all = tree_to_list($all); | ||
| 128 | + if(in_array($data['pid'],array_column($all,'id'))){ | ||
| 129 | + return $this->response('上级栏目不允许为本身的下级','B_NAV_PID_IS_CHILD'); | ||
| 130 | + } | ||
| 131 | + } | ||
| 132 | + } | ||
| 133 | + | ||
| 134 | + // 保存 | ||
| 135 | + $id = BNav::_save($this->user['project_id'],$data,$data['id']??0); | ||
| 136 | + | ||
| 137 | + if($id===-1){ | ||
| 138 | + return $this->response('导航菜单不存在','B_NAV_NOTFOUND'); | ||
| 139 | + } | ||
| 140 | + | ||
| 141 | + return $this->success(BNav::_find($this->user['project_id'],$id,true)); | ||
| 142 | + } | ||
| 143 | + | ||
| 144 | + | ||
| 145 | + /** | ||
| 146 | + * 删除数据 | ||
| 147 | + * @return \Illuminate\Http\JsonResponse | ||
| 148 | + * @author:dc | ||
| 149 | + * @time 2023/5/9 9:20 | ||
| 150 | + */ | ||
| 151 | + public function delete(){ | ||
| 152 | + $id = $this->param['id']??0; | ||
| 153 | + $data = BNav::_find($this->user['project_id'],$id); | ||
| 154 | + | ||
| 155 | + if(empty($data)){ | ||
| 156 | + return $this->response('导航菜单不存在','B_NAV_NOTFOUND'); | ||
| 157 | + } | ||
| 158 | + | ||
| 159 | + | ||
| 160 | + if(BNav::isChild($data['id'],$this->user['project_id'])){ | ||
| 161 | + return $this->response('存在下级无法删除','B_NAV_DELETE_CHILD'); | ||
| 162 | + } | ||
| 163 | + | ||
| 164 | + | ||
| 165 | + if($data->delete()){ | ||
| 166 | + return $this->response('删除成功',Code::SUCCESS); | ||
| 167 | + } | ||
| 168 | + | ||
| 169 | + } | ||
| 170 | + | ||
| 171 | + | ||
| 172 | + | ||
| 173 | + | ||
| 174 | + | ||
| 175 | + | ||
| 176 | + | ||
| 177 | + | ||
| 178 | +} |
| 1 | +<?php | ||
| 2 | + | ||
| 3 | +namespace App\Http\Controllers\Bside; | ||
| 4 | + | ||
| 5 | +use App\Enums\Common\Code; | ||
| 6 | +use App\Exceptions\BsideGlobalException; | ||
| 7 | +use App\Models\Template\AHeadFoot; | ||
| 8 | +use App\Models\Template\BCustom; | ||
| 9 | +use App\Models\Template\BHeadFoot; | ||
| 10 | +use App\Models\Template\BTemplate; | ||
| 11 | +use Illuminate\Support\Facades\DB; | ||
| 12 | + | ||
| 13 | +/** | ||
| 14 | + * 自定义 页面 | ||
| 15 | + * @author:dc | ||
| 16 | + * @time 2023/5/4 15:59 | ||
| 17 | + * Class TemplateController | ||
| 18 | + * @package App\Http\Controllers\Bside | ||
| 19 | + */ | ||
| 20 | +class TemplateController extends BaseController | ||
| 21 | +{ | ||
| 22 | + | ||
| 23 | + | ||
| 24 | + /** | ||
| 25 | + * 头部底部的 html | ||
| 26 | + * @return \Illuminate\Http\JsonResponse | ||
| 27 | + * @throws \Psr\Container\ContainerExceptionInterface | ||
| 28 | + * @throws \Psr\Container\NotFoundExceptionInterface | ||
| 29 | + * @author:dc | ||
| 30 | + * @time 2023/5/4 16:15 | ||
| 31 | + */ | ||
| 32 | + public function index(){ | ||
| 33 | + | ||
| 34 | + $data = BTemplate::_get($this->user['project_id']); | ||
| 35 | + | ||
| 36 | + // todo::这里要进行html的替换 | ||
| 37 | + | ||
| 38 | + | ||
| 39 | + | ||
| 40 | + return $this->success($data); | ||
| 41 | + } | ||
| 42 | + | ||
| 43 | + | ||
| 44 | + /** | ||
| 45 | + * 读取编辑的html | ||
| 46 | + * @author:dc | ||
| 47 | + * @time 2023/5/4 16:19 | ||
| 48 | + */ | ||
| 49 | + public function edit_html(){ | ||
| 50 | + $data = BHeadFoot::_get($this->user['project_id']); | ||
| 51 | + | ||
| 52 | + if(!$data){ | ||
| 53 | + $data = AHeadFoot::_bDefault(); | ||
| 54 | + } | ||
| 55 | + | ||
| 56 | + return $this->success([ | ||
| 57 | + 'header' => $data[BHeadFoot::TYPE_HEADER]??'', | ||
| 58 | + 'footer' => $data[BHeadFoot::TYPE_FOOTER]??'', | ||
| 59 | + ]); | ||
| 60 | + } | ||
| 61 | + | ||
| 62 | + /** | ||
| 63 | + * 保存 | ||
| 64 | + * @author:dc | ||
| 65 | + * @time 2023/5/4 17:42 | ||
| 66 | + */ | ||
| 67 | + public function edit_save(){ | ||
| 68 | + | ||
| 69 | + $header = $this->param['header']??''; | ||
| 70 | + | ||
| 71 | + $footer = $this->param['footer']??''; | ||
| 72 | + | ||
| 73 | + if(!$header && !$footer){ | ||
| 74 | + throw new BsideGlobalException('B01024','不能为空'); | ||
| 75 | + } | ||
| 76 | + | ||
| 77 | + DB::beginTransaction(); | ||
| 78 | + | ||
| 79 | + try { | ||
| 80 | + if($header){ | ||
| 81 | + BHeadFoot::_save($this->user['project_id'],BHeadFoot::TYPE_HEADER,$header); | ||
| 82 | + } | ||
| 83 | + | ||
| 84 | + if($footer){ | ||
| 85 | + BHeadFoot::_save($this->user['project_id'],BHeadFoot::TYPE_FOOTER,$footer); | ||
| 86 | + } | ||
| 87 | + }catch (\Throwable $e){ | ||
| 88 | + DB::rollBack(); | ||
| 89 | + | ||
| 90 | + throw new BsideGlobalException('B01024','保存失败'); | ||
| 91 | + } | ||
| 92 | + | ||
| 93 | + DB::commit(); | ||
| 94 | + | ||
| 95 | + | ||
| 96 | + $this->success([]); | ||
| 97 | + | ||
| 98 | + } | ||
| 99 | + | ||
| 100 | + | ||
| 101 | + /** | ||
| 102 | + * 获取系统的模板 | ||
| 103 | + * @author:dc | ||
| 104 | + * @time 2023/5/4 16:21 | ||
| 105 | + */ | ||
| 106 | + public function system_all_html(){ | ||
| 107 | + | ||
| 108 | + $data = AHeadFoot::_ball(); | ||
| 109 | + | ||
| 110 | + $lists = []; | ||
| 111 | + // 以名字为单位区分 | ||
| 112 | + foreach ($data as $datum){ | ||
| 113 | + if(empty($lists[$datum['name']])) $lists[$datum['name']] = []; | ||
| 114 | + $lists[$datum['name']]['name'] = $datum['name']; | ||
| 115 | + $lists[$datum['name']]['default'] = $datum['is_default']; | ||
| 116 | + $lists[$datum['name']][$datum['type']==AHeadFoot::TYPE_HEADER?'header':'footer'] = $datum['html']; | ||
| 117 | + } | ||
| 118 | + | ||
| 119 | + | ||
| 120 | + return $this->success(array_values($lists)); | ||
| 121 | + | ||
| 122 | + } | ||
| 123 | + | ||
| 124 | + | ||
| 125 | + | ||
| 126 | + | ||
| 127 | + | ||
| 128 | + | ||
| 129 | + | ||
| 130 | + | ||
| 131 | + /** | ||
| 132 | + * 自定义 列表 | ||
| 133 | + * @author:dc | ||
| 134 | + * @time 2023/5/4 17:13 | ||
| 135 | + */ | ||
| 136 | + public function custom(){ | ||
| 137 | + | ||
| 138 | + $data = BCustom::_all($this->user['project_id']); | ||
| 139 | + | ||
| 140 | + | ||
| 141 | + return $this->success($data->toArray()); | ||
| 142 | + } | ||
| 143 | + | ||
| 144 | + | ||
| 145 | + public function custom_create(){ | ||
| 146 | + | ||
| 147 | + } | ||
| 148 | + | ||
| 149 | + public function custom_edit($id){ | ||
| 150 | + | ||
| 151 | + } | ||
| 152 | + | ||
| 153 | + public function custom_delete($id){ | ||
| 154 | + | ||
| 155 | + } | ||
| 156 | + | ||
| 157 | + | ||
| 158 | + | ||
| 159 | + | ||
| 160 | + | ||
| 161 | + | ||
| 162 | +} |
| 1 | +<?php | ||
| 2 | + | ||
| 3 | +namespace App\Http\Logic\Bside\AyrShare; | ||
| 4 | + | ||
| 5 | +use App\Http\Logic\Bside\BaseLogic; | ||
| 6 | +use App\Models\AyrShare\AyrRelease; | ||
| 7 | + | ||
| 8 | +class AyrReleaseLogic extends BaseLogic | ||
| 9 | +{ | ||
| 10 | + | ||
| 11 | + | ||
| 12 | + public function __construct() | ||
| 13 | + { | ||
| 14 | + parent::__construct(); | ||
| 15 | + $this->model = new AyrRelease(); | ||
| 16 | + $this->param = $this->requestAll; | ||
| 17 | + } | ||
| 18 | + | ||
| 19 | + /** | ||
| 20 | + * @name :()release_info | ||
| 21 | + * @author :lyh | ||
| 22 | + * @method :post | ||
| 23 | + * @time :2023/5/9 16:27 | ||
| 24 | + */ | ||
| 25 | + public function release_info(){ | ||
| 26 | + $info = $this->model->read($this->param); | ||
| 27 | + if($info === false){ | ||
| 28 | + $this->fail('error'); | ||
| 29 | + } | ||
| 30 | + return $this->success($info); | ||
| 31 | + } | ||
| 32 | + /** | ||
| 33 | + * @name :(发布社交写入数据库)release_add | ||
| 34 | + * @author :lyh | ||
| 35 | + * @method :post | ||
| 36 | + * @time :2023/5/9 9:38 | ||
| 37 | + */ | ||
| 38 | + public function release_add(){ | ||
| 39 | + $rs = $this->model->add($this->param); | ||
| 40 | + if($rs === false){ | ||
| 41 | + $this->fail('error'); | ||
| 42 | + } | ||
| 43 | + return $this->success(); | ||
| 44 | + } | ||
| 45 | + | ||
| 46 | + /** | ||
| 47 | + * @name :(上传第三方平台)0ayr_release_add | ||
| 48 | + * @author :lyh | ||
| 49 | + * @method :post | ||
| 50 | + * @time :2023/5/9 10:02 | ||
| 51 | + */ | ||
| 52 | + public function ayr_release_add($param){ | ||
| 53 | + $param = [ | ||
| 54 | + 'post'=>$this->param['content'], | ||
| 55 | + 'platforms'=>$this->param['platforms'], | ||
| 56 | + 'mediaUrls'=>$this->param['mediaUrls'], | ||
| 57 | + ]; | ||
| 58 | + return $this->success($param); | ||
| 59 | + } | ||
| 60 | + | ||
| 61 | + /** | ||
| 62 | + * @name :(发布到推特)post_twitter | ||
| 63 | + * @author :lyh | ||
| 64 | + * @method :post | ||
| 65 | + * @time :2023/5/9 13:42 | ||
| 66 | + */ | ||
| 67 | + public function post_twitter($param){ | ||
| 68 | + $param['post'] = '描述'; | ||
| 69 | + $param['platforms'] = ['twitter']; | ||
| 70 | + $param['twitterOptions'] = [ | ||
| 71 | + 'thread'=> true, | ||
| 72 | + 'threadNumber'=> true, | ||
| 73 | + 'mediaUrls'=>[ | ||
| 74 | + //图片地址 | ||
| 75 | + ], | ||
| 76 | + ]; | ||
| 77 | + return $this->success($param); | ||
| 78 | + } | ||
| 79 | + /** | ||
| 80 | + * @name :(发布到youtube)post_facebook | ||
| 81 | + * @author :lyh | ||
| 82 | + * @method :post | ||
| 83 | + * @time :2023/5/9 10:05 | ||
| 84 | + */ | ||
| 85 | + public function post_facebook(){ | ||
| 86 | + $param['post'] = '视频描述'; | ||
| 87 | + $param['platforms'] = ['facebook']; | ||
| 88 | + $param['faceBookOptions'] = [ | ||
| 89 | + 'reels'=> true, | ||
| 90 | + 'title'=>'Super title for the Reel' | ||
| 91 | + ]; | ||
| 92 | + return $this->success($param); | ||
| 93 | + } | ||
| 94 | + | ||
| 95 | + /** | ||
| 96 | + * @name :(发布到fbg,)post_youtube | ||
| 97 | + * @author :lyh | ||
| 98 | + * @method :post | ||
| 99 | + * @time :2023/5/9 10:22 | ||
| 100 | + * @TODO::只能发布一张图片和一张视频 | ||
| 101 | + */ | ||
| 102 | + public function post_gmb(){ | ||
| 103 | + $param['post'] = '描述'; | ||
| 104 | + $param['platforms'] = ['gmb']; | ||
| 105 | + $param['mediaUrls'] = [];//图片链接 | ||
| 106 | + $param['gmbOptions'] = [ | ||
| 107 | + //视屏设置 | ||
| 108 | + 'isPhotoVideo' => true, | ||
| 109 | + 'category'=> 'cate',//分类 | ||
| 110 | + ]; | ||
| 111 | + return $this->success($param); | ||
| 112 | + } | ||
| 113 | + | ||
| 114 | + /** | ||
| 115 | + * @name :(发布到instagram)post_google | ||
| 116 | + * @author :lyh | ||
| 117 | + * @method :post | ||
| 118 | + * @time :2023/5/9 11:54 | ||
| 119 | + */ | ||
| 120 | + public function post_instagram(){ | ||
| 121 | + $param['post'] = '视频描述'; | ||
| 122 | + $param['platforms'] = ['instagram']; | ||
| 123 | + $param['faceBookOptions'] = [ | ||
| 124 | + 'reels'=> true, | ||
| 125 | + 'title'=>'Super title for the Reel' | ||
| 126 | + ]; | ||
| 127 | + return $this->success(); | ||
| 128 | + } | ||
| 129 | + | ||
| 130 | + /** | ||
| 131 | + * @name :(领英)post_linkedin | ||
| 132 | + * @author :lyh | ||
| 133 | + * @method :post | ||
| 134 | + * @time :2023/5/9 11:56 | ||
| 135 | + */ | ||
| 136 | + public function post_linkedin(){ | ||
| 137 | + return $this->success(); | ||
| 138 | + } | ||
| 139 | + | ||
| 140 | + /** | ||
| 141 | + * @name :(红迪网)post_reddit | ||
| 142 | + * @author :lyh | ||
| 143 | + * @method :post | ||
| 144 | + * @time :2023/5/9 13:40 | ||
| 145 | + */ | ||
| 146 | + public function post_reddit(){ | ||
| 147 | + return $this->success(); | ||
| 148 | + } | ||
| 149 | + | ||
| 150 | + /** | ||
| 151 | + * @name :(抖音)post_tiktok | ||
| 152 | + * @author :lyh | ||
| 153 | + * @method :post | ||
| 154 | + * @time :2023/5/9 13:44 | ||
| 155 | + */ | ||
| 156 | + public function post_tiktok(){ | ||
| 157 | + | ||
| 158 | + } | ||
| 159 | +} |
app/Models/BNav.php
0 → 100644
| 1 | +<?php | ||
| 2 | + | ||
| 3 | +namespace App\Models; | ||
| 4 | + | ||
| 5 | +use Illuminate\Database\Eloquent\SoftDeletes; | ||
| 6 | + | ||
| 7 | +/** | ||
| 8 | + * b端控制, c端显示的导航 | ||
| 9 | + * @author:dc | ||
| 10 | + * @time 2023/5/8 16:14 | ||
| 11 | + * Class BNav | ||
| 12 | + * @package App\Models | ||
| 13 | + */ | ||
| 14 | +class BNav extends Base | ||
| 15 | +{ | ||
| 16 | + | ||
| 17 | + protected $table = 'gl_bside_nav'; | ||
| 18 | + | ||
| 19 | + use SoftDeletes; | ||
| 20 | + | ||
| 21 | + public $hidden = ['deleted_at','project_id']; | ||
| 22 | + | ||
| 23 | + | ||
| 24 | + /** | ||
| 25 | + * 显示 | ||
| 26 | + */ | ||
| 27 | + const STATUS_ACTIVE = 1; | ||
| 28 | + | ||
| 29 | + /** | ||
| 30 | + * 隐藏 | ||
| 31 | + */ | ||
| 32 | + const STATUS_DISABLED = 0; | ||
| 33 | + | ||
| 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 | + | ||
| 82 | + /** | ||
| 83 | + * 查询当前项目下的所有栏目信息 | ||
| 84 | + * @param int $project_id | ||
| 85 | + * @return mixed | ||
| 86 | + * @author:dc | ||
| 87 | + * @time 2023/5/8 16:29 | ||
| 88 | + */ | ||
| 89 | + public static function _all(int $project_id, string $location = null) | ||
| 90 | + { | ||
| 91 | + return static::where(function ($query) use ($project_id,$location){ | ||
| 92 | + // 那个公司 | ||
| 93 | + $query->where('project_id',$project_id); | ||
| 94 | + // 显示位置 | ||
| 95 | + $location && $query->where('location',$location); | ||
| 96 | + }) | ||
| 97 | + ->orderBy('sort') | ||
| 98 | + ->get(); | ||
| 99 | + } | ||
| 100 | + | ||
| 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 | + | ||
| 118 | + | ||
| 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 | + | ||
| 132 | + /** | ||
| 133 | + * 是否有下级 | ||
| 134 | + * @param int $id | ||
| 135 | + * @param int $project_id | ||
| 136 | + * @return mixed | ||
| 137 | + * @author:dc | ||
| 138 | + * @time 2023/5/9 9:23 | ||
| 139 | + */ | ||
| 140 | + public static function isChild(int $id,int $project_id=0) | ||
| 141 | + { | ||
| 142 | + return static::where(['pid'=>$id,'project_id'=>$project_id])->limit(1)->count(); | ||
| 143 | + } | ||
| 144 | +} |
app/Models/Template/AHeadFoot.php
0 → 100644
| 1 | +<?php | ||
| 2 | + | ||
| 3 | +namespace App\Models\Template; | ||
| 4 | + | ||
| 5 | +/** | ||
| 6 | + * 头部底部 | ||
| 7 | + * @author:dc | ||
| 8 | + * @time 2023/5/4 15:52 | ||
| 9 | + * Class AHeadFoot | ||
| 10 | + * @package App\Models\Template | ||
| 11 | + */ | ||
| 12 | +class AHeadFoot extends \App\Models\Base{ | ||
| 13 | + | ||
| 14 | + protected $table = 'gl_aside_template_header_footer'; | ||
| 15 | + | ||
| 16 | +// 分开存 头底 为了方便后期可能会 改版为 随意搭配 头底部 | ||
| 17 | + const TYPE_HEADER = 'H'; | ||
| 18 | + const TYPE_FOOTER = 'F'; | ||
| 19 | + | ||
| 20 | + const STATUS_ACTIVE = 1; | ||
| 21 | + const STATUS_DISABLED = 0; | ||
| 22 | + | ||
| 23 | + const IS_DEFAULT = 1; | ||
| 24 | + | ||
| 25 | + | ||
| 26 | + /** | ||
| 27 | + * b 端 查询 | ||
| 28 | + * @return mixed | ||
| 29 | + * @author:dc | ||
| 30 | + * @time 2023/5/4 16:24 | ||
| 31 | + */ | ||
| 32 | + public static function _ball(){ | ||
| 33 | + return static::where('status',static::STATUS_ACTIVE)->orderBy('sort')->get(['id','name','type','html','is_default']); | ||
| 34 | + } | ||
| 35 | + | ||
| 36 | + /** | ||
| 37 | + * b 端 读取默认的一个头部底部 | ||
| 38 | + * @return mixed | ||
| 39 | + * @author:dc | ||
| 40 | + * @time 2023/5/4 16:51 | ||
| 41 | + */ | ||
| 42 | + public static function _bDefault(){ | ||
| 43 | + return static::where(['status'=>static::STATUS_ACTIVE,'is_default'=>static::IS_DEFAULT]) | ||
| 44 | + ->get(['type','html']) | ||
| 45 | + ->pluck('html','type') | ||
| 46 | + ->toArray(); | ||
| 47 | + } | ||
| 48 | + | ||
| 49 | + | ||
| 50 | + | ||
| 51 | + | ||
| 52 | +} |
app/Models/Template/BCustom.php
0 → 100644
| 1 | +<?php | ||
| 2 | + | ||
| 3 | +namespace App\Models\Template; | ||
| 4 | + | ||
| 5 | +use Illuminate\Database\Eloquent\SoftDeletes; | ||
| 6 | + | ||
| 7 | +/** | ||
| 8 | + * 自定义 页面 | ||
| 9 | + * @author:dc | ||
| 10 | + * @time 2023/5/4 17:18 | ||
| 11 | + * Class BCustom | ||
| 12 | + * @package App\Models\Template | ||
| 13 | + */ | ||
| 14 | +class BCustom extends \App\Models\Base{ | ||
| 15 | + | ||
| 16 | + protected $table = 'gl_bside_template_custom'; | ||
| 17 | + | ||
| 18 | + use SoftDeletes; | ||
| 19 | + | ||
| 20 | + | ||
| 21 | + const STATUS_ACTIVE = 1; | ||
| 22 | + | ||
| 23 | + const STATUS_DISABLED = 0; | ||
| 24 | + | ||
| 25 | + | ||
| 26 | + /** | ||
| 27 | + * 读取列表 | ||
| 28 | + * @param $project_id | ||
| 29 | + * @return mixed | ||
| 30 | + * @author:dc | ||
| 31 | + * @time 2023/5/4 17:22 | ||
| 32 | + */ | ||
| 33 | + public static function _all($project_id){ | ||
| 34 | + return static::where([ | ||
| 35 | + 'project_id' => $project_id | ||
| 36 | + ])->paginate(20); | ||
| 37 | + } | ||
| 38 | + | ||
| 39 | + | ||
| 40 | + | ||
| 41 | + | ||
| 42 | + | ||
| 43 | + | ||
| 44 | +} |
app/Models/Template/BTemplate.php
0 → 100644
| 1 | +<?php | ||
| 2 | + | ||
| 3 | +namespace App\Models\Template; | ||
| 4 | + | ||
| 5 | +/** | ||
| 6 | + * 自定义 界面 | ||
| 7 | + * @author:dc | ||
| 8 | + * @time 2023/5/8 13:52 | ||
| 9 | + * Class BTemplate | ||
| 10 | + * @package App\Models\Template | ||
| 11 | + */ | ||
| 12 | +class BTemplate extends \App\Models\Base{ | ||
| 13 | + | ||
| 14 | + protected $table = 'gl_bside_template_html'; | ||
| 15 | + | ||
| 16 | + | ||
| 17 | + | ||
| 18 | + /** | ||
| 19 | + * @param $project_id | ||
| 20 | + * @return mixed | ||
| 21 | + * @author:dc | ||
| 22 | + * @time 2023/5/4 16:13 | ||
| 23 | + */ | ||
| 24 | + public static function _get($project_id){ | ||
| 25 | + return static::where(['project_id'=>$project_id])->get(['html','type'])->pluck('html','type')->toArray(); | ||
| 26 | + } | ||
| 27 | + | ||
| 28 | + | ||
| 29 | + public static function _all($project_id){ | ||
| 30 | + return static::where(['project_id'=>$project_id])->get(); | ||
| 31 | + } | ||
| 32 | + | ||
| 33 | + | ||
| 34 | + /** | ||
| 35 | + * 保存 | ||
| 36 | + * @param $project_id | ||
| 37 | + * @param $type | ||
| 38 | + * @param $html | ||
| 39 | + * @author:dc | ||
| 40 | + * @time 2023/5/4 17:50 | ||
| 41 | + */ | ||
| 42 | + public static function _save($project_id,$type,$html){ | ||
| 43 | + $data = static::where(['project_id'=>$project_id,'type'=>$type])->first(); | ||
| 44 | + if(!$data){ | ||
| 45 | + $data = new static(); | ||
| 46 | + $data->project_id = $project_id; | ||
| 47 | + $data->type = $type; | ||
| 48 | + } | ||
| 49 | + $data->html = $html; | ||
| 50 | + | ||
| 51 | + $data->save(); | ||
| 52 | + | ||
| 53 | + return $data->id; | ||
| 54 | + } | ||
| 55 | + | ||
| 56 | + | ||
| 57 | + | ||
| 58 | +} |
-
请 注册 或 登录 后发表评论