正在显示
18 个修改的文件
包含
264 行增加
和
36 行删除
| @@ -14,7 +14,13 @@ class AyrShare | @@ -14,7 +14,13 @@ class AyrShare | ||
| 14 | public $api_key = 'G8GQW3X-XBTMGXW-QPDDZ9A-WE1Z5SB'; | 14 | public $api_key = 'G8GQW3X-XBTMGXW-QPDDZ9A-WE1Z5SB'; |
| 15 | //系统设置 | 15 | //系统设置 |
| 16 | public $config = [ | 16 | public $config = [ |
| 17 | - | 17 | + 'facebook'=>'#best https://www.facebook.com', |
| 18 | + 'google'=>'#best https://www.google.com', | ||
| 19 | + 'instagram'=>'#best https://www.instagram.com', | ||
| 20 | + 'linkedin'=>'#best https://www.linkedin.com', | ||
| 21 | + 'twitter'=>'#best https://www.twitter.com', | ||
| 22 | + 'telegram'=>'#best https://www.telegram.com', | ||
| 23 | + 'tiktok'=>'#bestvideo', | ||
| 18 | ]; | 24 | ]; |
| 19 | //profile_key | 25 | //profile_key |
| 20 | public $profile_key = ''; | 26 | public $profile_key = ''; |
| @@ -86,42 +92,57 @@ zFePUMXy1bFghAfzNKlrc5XgH4ixeeMh3cDtU97K | @@ -86,42 +92,57 @@ zFePUMXy1bFghAfzNKlrc5XgH4ixeeMh3cDtU97K | ||
| 86 | } | 92 | } |
| 87 | 93 | ||
| 88 | /** | 94 | /** |
| 89 | - * @name :(获取当前用户的配置文件)get_profiles | 95 | + * @name :(获取指定api_key的配置文件)get_profiles_users |
| 90 | * @author :lyh | 96 | * @author :lyh |
| 91 | * @method :post | 97 | * @method :post |
| 92 | - * @time :2023/5/6 16:01 | 98 | + * @time :2023/5/6 16:44 |
| 93 | */ | 99 | */ |
| 94 | - public function get_profiles(){ | ||
| 95 | - $url = $this->path.'/api/profiles'; | ||
| 96 | - return $this->http_click('get',$url,[]); | 100 | + public function get_profiles_users($api_key){ |
| 101 | + $this->headers['Authorization'] = $this->headers['Authorization'].$api_key; | ||
| 102 | + $url = $this->path.'/api/user'; | ||
| 103 | + return $this->http_click('get',$url,[],$this->headers); | ||
| 97 | } | 104 | } |
| 98 | 105 | ||
| 99 | /** | 106 | /** |
| 100 | - * @name :(获取所有用户的配置文件)get_profiles_users | 107 | + * @name :(发帖)post_send_msg |
| 101 | * @author :lyh | 108 | * @author :lyh |
| 102 | * @method :post | 109 | * @method :post |
| 103 | - * @time :2023/5/6 16:44 | 110 | + * @time :2023/5/8 9:22 |
| 111 | + * @param :platforms: "facebook", "fbg", "twitter", | ||
| 112 | + * "linkedin", "instagram","youtube", "reddit" ,"telegram"" | ||
| 104 | */ | 113 | */ |
| 105 | - public function get_profiles_users($api_key){ | ||
| 106 | - $this->headers['Authorization'] = $this->headers['Authorization'].$api_key; | ||
| 107 | - $url = $this->path.'/api/user'; | ||
| 108 | - return $this->http_click('get',$url,[],$this->headers); | 114 | + public function post_send_msg($param){ |
| 115 | + $param = [ | ||
| 116 | + 'post'=>$param['post'],//内容(帖子文本) | ||
| 117 | + 'platforms'=>$param['platforms'],//平台 | ||
| 118 | + 'idempotencyKey'=>$param['idempotencyKey'],//帖子唯一id | ||
| 119 | + 'mediaUrls'=>$param['mediaUrls'], | ||
| 120 | + ]; | ||
| 121 | + //平台参数处理 | ||
| 122 | + $this->headers['Accept-Encoding'] = 'gzip'; | ||
| 123 | + $this->headers['Authorization'] = $this->headers['Authorization'].$param['profile_key']; | ||
| 124 | + $url = $this->path.'/api/post'; | ||
| 125 | + return $this->http_click('posts',$url,$param,$this->headers); | ||
| 109 | } | 126 | } |
| 127 | + | ||
| 110 | /** | 128 | /** |
| 111 | - * @name :(通过用户名获取社交账号)get_brand_user | ||
| 112 | - * @author :lyh https://app.ayrshare.com/api/brand/byUser | 129 | + * @name :(上传图片或视频到ayr_share)post_media_upload |
| 130 | + * @author :lyh | ||
| 113 | * @method :post | 131 | * @method :post |
| 114 | - * @time :2023/5/5 17:32 | 132 | + * @time :2023/5/8 9:47 |
| 133 | + * https://app.ayrshare.com/api/media/upload | ||
| 115 | */ | 134 | */ |
| 116 | - public function get_brand_user($param){ | ||
| 117 | - //[[platforms=>'instagram','instagramUser'=>'user']] | ||
| 118 | - $str = ''; | ||
| 119 | - foreach ($param as $k =>$v){ | ||
| 120 | - //platforms[0]=instagram&platforms[1]=twitter&twitterUser=ayrshare&instagramUser=nygiants', | ||
| 121 | - } | ||
| 122 | - $url = $this->path.'/api/brand/byUser?'.$str; | ||
| 123 | - return $this->http_click('get',$url); | 135 | + public function post_media_upload($data){ |
| 136 | + $param = [ | ||
| 137 | + 'file'=>$data['file'],//base64编码 | ||
| 138 | + 'fileName'=>$data['file_name'],//生成图片名称 | ||
| 139 | + 'description'=>$data['description'],//描述 | ||
| 140 | + ]; | ||
| 141 | + $this->headers['Authorization'] = $this->headers['Authorization'].$data['profile_key']; | ||
| 142 | + $url = $this->path.'/api/media/upload'; | ||
| 143 | + return $this->http_click('posts',$url,$param,$this->headers); | ||
| 124 | } | 144 | } |
| 145 | + | ||
| 125 | /** | 146 | /** |
| 126 | * @name :获取过去30天发布的历史记录(1-30) | 147 | * @name :获取过去30天发布的历史记录(1-30) |
| 127 | * @author :lyh | 148 | * @author :lyh |
| @@ -127,4 +127,28 @@ class AyrShareController extends BaseController | @@ -127,4 +127,28 @@ class AyrShareController extends BaseController | ||
| 127 | } | 127 | } |
| 128 | $this->response('success',Code::SUCCESS,$res); | 128 | $this->response('success',Code::SUCCESS,$res); |
| 129 | } | 129 | } |
| 130 | + | ||
| 131 | + /** | ||
| 132 | + * @name :(上传图片到第三方)post_uploads | ||
| 133 | + * @author :lyh | ||
| 134 | + * @method :post | ||
| 135 | + * @time :2023/5/8 13:45 | ||
| 136 | + */ | ||
| 137 | + public function post_uploads(){ | ||
| 138 | + | ||
| 139 | + } | ||
| 140 | + /** | ||
| 141 | + * @name :(发布推文到第三方平台)send_api_post | ||
| 142 | + * @author :lyh | ||
| 143 | + * @method :post | ||
| 144 | + * @time :2023/5/8 13:37 | ||
| 145 | + */ | ||
| 146 | + public function send_api_post(AyrShareLogic $ayrShareLogic){ | ||
| 147 | + $this->request->validate([ | ||
| 148 | + 'id'=>['required'] | ||
| 149 | + ],[ | ||
| 150 | + 'id.required' => 'ID不能为空' | ||
| 151 | + ]); | ||
| 152 | + $info = $ayrShareLogic->ayr_share_info(); | ||
| 153 | + } | ||
| 130 | } | 154 | } |
| 1 | +<?php | ||
| 2 | + | ||
| 3 | +namespace App\Http\Controllers\Bside\Setting; | ||
| 4 | + | ||
| 5 | +use App\Http\Controllers\Bside\BaseController; | ||
| 6 | +use App\Http\Logic\Bside\Setting\WebSettingTextLogic; | ||
| 7 | + | ||
| 8 | +class WebSettingTextController extends BaseController | ||
| 9 | +{ | ||
| 10 | + /** | ||
| 11 | + * @name :lists | ||
| 12 | + * @author :lyh | ||
| 13 | + * @method :post | ||
| 14 | + * @time :2023/5/4 11:28 | ||
| 15 | + */ | ||
| 16 | + public function lists(WebSettingTextLogic $webSettingTextLogic){ | ||
| 17 | + $anchor_text = config('setting.anchor_text'); | ||
| 18 | + $lists = $webSettingTextLogic->setting_text_lists(); | ||
| 19 | + $lists['anchor_text'] = $anchor_text; | ||
| 20 | + $this->response('success',Code::SUCCESS,$lists); | ||
| 21 | + } | ||
| 22 | + /** | ||
| 23 | + * @name :save | ||
| 24 | + * @author :lyh | ||
| 25 | + * @method :post | ||
| 26 | + * @time :2023/4/28 14:46 | ||
| 27 | + */ | ||
| 28 | + public function save(WebSettingTextLogic $webSettingTextLogic){ | ||
| 29 | + $webSettingTextLogic->setting_text_save(); | ||
| 30 | + $this->response('success'); | ||
| 31 | + } | ||
| 32 | +} |
app/Http/Controllers/file/FileController.php
0 → 100644
| 1 | +<?php | ||
| 2 | + | ||
| 3 | +namespace App\Http\Controllers\file; | ||
| 4 | + | ||
| 5 | +use App\Enums\Common\Code; | ||
| 6 | +use App\Models\File\File; | ||
| 7 | + | ||
| 8 | +class FileController | ||
| 9 | +{ | ||
| 10 | + public $upload_img = [ | ||
| 11 | + //设置静态缓存参数(304) | ||
| 12 | + 'header' => [ | ||
| 13 | + 'Cache-Control' => 'max-age=2592000', | ||
| 14 | + 'Pragma' => 'cache', | ||
| 15 | + 'Expires' => "%Expires%", // cache 1 month | ||
| 16 | + 'etag' => "%etag%", | ||
| 17 | + 'Last-Modified' => "%Last-Modified%", | ||
| 18 | + 'Content-Description' => 'File Transfer', | ||
| 19 | + ], | ||
| 20 | + ]; | ||
| 21 | + public $path = ''; | ||
| 22 | + | ||
| 23 | + public $config = ''; | ||
| 24 | + | ||
| 25 | + public $thr_path = ''; | ||
| 26 | + | ||
| 27 | + public $request = ''; | ||
| 28 | + | ||
| 29 | + public function __construct() | ||
| 30 | + { | ||
| 31 | + $this->request = request(); | ||
| 32 | + $this->config = config('filesystems.disks.upload'); | ||
| 33 | + $this->path = $this->config['root']; | ||
| 34 | + } | ||
| 35 | + | ||
| 36 | + public function index($hash = '', $w = 0 ,$h = 0){ | ||
| 37 | + if (isset($_SERVER['HTTP_IF_MODIFIED_SINCE']) || isset($_SERVER['HTTP_IF_NONE_MATCH'])) { | ||
| 38 | + header("HTTP/1.1 304 Not Modified"); | ||
| 39 | + exit; | ||
| 40 | + } | ||
| 41 | + $file_model = new File(); | ||
| 42 | + $info = $file_model->read(['hash'=>$hash]); | ||
| 43 | + if ($info === false) { | ||
| 44 | + $this->response('指定文件不存在!', Code::USER_ERROR); | ||
| 45 | + } | ||
| 46 | + $path = $info['path']; | ||
| 47 | + if (!is_file($path)) { | ||
| 48 | + $this->response('指定文件已被系统删除!', Code::USER_ERROR); | ||
| 49 | + } | ||
| 50 | + $content = file_get_contents($path); | ||
| 51 | + $header['Content-Length'] = $info['size']; | ||
| 52 | + return response($content, 200, $header); | ||
| 53 | + } | ||
| 54 | +} |
| 1 | <?php | 1 | <?php |
| 2 | 2 | ||
| 3 | -namespace App\Http\Controllers; | 3 | +namespace App\Http\Controllers\file; |
| 4 | 4 | ||
| 5 | use App\Enums\Common\Code; | 5 | use App\Enums\Common\Code; |
| 6 | -use App\Models\Image as ImageModel; | 6 | +use App\Http\Controllers\type; |
| 7 | +use App\Http\Controllers\统一返回参数; | ||
| 8 | +use App\Models\File\Image as ImageModel; | ||
| 7 | use Illuminate\Http\Exceptions\HttpResponseException; | 9 | use Illuminate\Http\Exceptions\HttpResponseException; |
| 8 | use Illuminate\Http\JsonResponse; | 10 | use Illuminate\Http\JsonResponse; |
| 9 | use Illuminate\Support\Facades\Storage; | 11 | use Illuminate\Support\Facades\Storage; |
| @@ -114,12 +116,12 @@ class ImageController | @@ -114,12 +116,12 @@ class ImageController | ||
| 114 | } | 116 | } |
| 115 | $url = $this->path; | 117 | $url = $this->path; |
| 116 | $filename = date('ymdHis').rand(10000,99999); | 118 | $filename = date('ymdHis').rand(10000,99999); |
| 117 | - $res = $this->request->file('image')->move($url,$filename); | 119 | + $res = $this->request->file('image')->move($url); |
| 118 | if ($res === false) { | 120 | if ($res === false) { |
| 119 | return $this->response($files->getError(), Code::USER_ERROR); | 121 | return $this->response($files->getError(), Code::USER_ERROR); |
| 120 | } | 122 | } |
| 121 | $data = [ | 123 | $data = [ |
| 122 | - 'path' => $url.'/'.$filename, | 124 | + 'path' => $url.'/'.$res->getClientOriginalName(), |
| 123 | 'created_at' => date('Y-m-d H:i:s',time()), | 125 | 'created_at' => date('Y-m-d H:i:s',time()), |
| 124 | 'size' => $res->getSize(), | 126 | 'size' => $res->getSize(), |
| 125 | 'hash' => $hash, | 127 | 'hash' => $hash, |
| @@ -3,6 +3,7 @@ | @@ -3,6 +3,7 @@ | ||
| 3 | namespace App\Http\Logic\Bside\AyrShare; | 3 | namespace App\Http\Logic\Bside\AyrShare; |
| 4 | 4 | ||
| 5 | use App\Helper\AyrShare as AyrShareHelper; | 5 | use App\Helper\AyrShare as AyrShareHelper; |
| 6 | +use App\Http\Controllers\file\ImageController; | ||
| 6 | use App\Http\Logic\Bside\BaseLogic; | 7 | use App\Http\Logic\Bside\BaseLogic; |
| 7 | use App\Models\AyrShare\AyrShare; | 8 | use App\Models\AyrShare\AyrShare; |
| 8 | 9 | ||
| @@ -67,6 +68,27 @@ class AyrShareLogic extends BaseLogic | @@ -67,6 +68,27 @@ class AyrShareLogic extends BaseLogic | ||
| 67 | } | 68 | } |
| 68 | return $this->success(); | 69 | return $this->success(); |
| 69 | } | 70 | } |
| 71 | + | ||
| 72 | + /** | ||
| 73 | + * @name :(向第三方平台发布帖子)api_public_msg | ||
| 74 | + * @author :lyh | ||
| 75 | + * @method :post | ||
| 76 | + * @time :2023/5/8 9:11 | ||
| 77 | + */ | ||
| 78 | + public function send_public_post($param){ | ||
| 79 | + //获取图片 | ||
| 80 | + $image_c = new ImageController(); | ||
| 81 | + $image_info = $image_c->index($param['hash']); | ||
| 82 | + $param = [ | ||
| 83 | + 'post'=>$param['text'], | ||
| 84 | + 'mediaUrls'=>$image_info, | ||
| 85 | + 'platforms'=>$this->param['platforms'], | ||
| 86 | + ]; | ||
| 87 | + //发布帖子 | ||
| 88 | + $ayrShareHelper = new AyrShareHelper(); | ||
| 89 | + $res = $ayrShareHelper->post_send_msg($param); | ||
| 90 | + $this->success($res); | ||
| 91 | + } | ||
| 70 | } | 92 | } |
| 71 | 93 | ||
| 72 | 94 |
| @@ -5,7 +5,7 @@ namespace App\Http\Logic\Bside; | @@ -5,7 +5,7 @@ namespace App\Http\Logic\Bside; | ||
| 5 | 5 | ||
| 6 | use App\Enums\Common\Common; | 6 | use App\Enums\Common\Common; |
| 7 | use App\Exceptions\BsideGlobalException; | 7 | use App\Exceptions\BsideGlobalException; |
| 8 | -use App\Http\Controllers\ImageController; | 8 | +use App\Http\Controllers\file\ImageController; |
| 9 | use App\Http\Logic\Logic; | 9 | use App\Http\Logic\Logic; |
| 10 | use Illuminate\Support\Facades\Cache; | 10 | use Illuminate\Support\Facades\Cache; |
| 11 | 11 |
| @@ -7,7 +7,6 @@ use App\Helper\Common; | @@ -7,7 +7,6 @@ use App\Helper\Common; | ||
| 7 | use App\Http\Logic\Bside\BaseLogic; | 7 | use App\Http\Logic\Bside\BaseLogic; |
| 8 | use App\Models\Blog\Blog; | 8 | use App\Models\Blog\Blog; |
| 9 | use App\Models\Blog\BlogCategory as BlogCategoryModel; | 9 | use App\Models\Blog\BlogCategory as BlogCategoryModel; |
| 10 | -use App\Models\Image; | ||
| 11 | use App\Models\RouteMap; | 10 | use App\Models\RouteMap; |
| 12 | use Illuminate\Support\Facades\DB; | 11 | use Illuminate\Support\Facades\DB; |
| 13 | 12 |
| @@ -5,7 +5,6 @@ namespace App\Http\Logic\Bside\News; | @@ -5,7 +5,6 @@ namespace App\Http\Logic\Bside\News; | ||
| 5 | use App\Enums\Common\Code; | 5 | use App\Enums\Common\Code; |
| 6 | use App\Helper\Common; | 6 | use App\Helper\Common; |
| 7 | use App\Http\Logic\Bside\BaseLogic; | 7 | use App\Http\Logic\Bside\BaseLogic; |
| 8 | -use App\Models\Image; | ||
| 9 | use App\Models\News\News; | 8 | use App\Models\News\News; |
| 10 | use App\Models\News\NewsCategory as NewsCategoryModel; | 9 | use App\Models\News\NewsCategory as NewsCategoryModel; |
| 11 | use App\Models\RouteMap; | 10 | use App\Models\RouteMap; |
| @@ -3,7 +3,7 @@ | @@ -3,7 +3,7 @@ | ||
| 3 | namespace App\Http\Logic\Bside\Setting; | 3 | namespace App\Http\Logic\Bside\Setting; |
| 4 | 4 | ||
| 5 | use App\Http\Logic\Bside\BaseLogic; | 5 | use App\Http\Logic\Bside\BaseLogic; |
| 6 | -use App\Models\Image; | 6 | +use App\Models\File\Image; |
| 7 | use App\Models\WebSetting\WebSettingService; | 7 | use App\Models\WebSetting\WebSettingService; |
| 8 | use Illuminate\Support\Facades\DB; | 8 | use Illuminate\Support\Facades\DB; |
| 9 | 9 |
| 1 | +<?php | ||
| 2 | + | ||
| 3 | +namespace App\Http\Logic\Bside\Setting; | ||
| 4 | + | ||
| 5 | +use App\Http\Logic\Bside\BaseLogic; | ||
| 6 | +use App\Models\WebSetting\WebSettingText; | ||
| 7 | + | ||
| 8 | +class WebSettingTextLogic extends BaseLogic | ||
| 9 | +{ | ||
| 10 | + public function __construct() | ||
| 11 | + { | ||
| 12 | + parent::__construct(); | ||
| 13 | + | ||
| 14 | + $this->model = new WebSettingText(); | ||
| 15 | + $this->param = $this->requestAll; | ||
| 16 | + } | ||
| 17 | + | ||
| 18 | + /** | ||
| 19 | + * @name :(描文本详情)setting_text_lists | ||
| 20 | + * @author :lyh | ||
| 21 | + * @method :post | ||
| 22 | + * @time :2023/5/8 14:18 | ||
| 23 | + */ | ||
| 24 | + public function setting_text_lists(){ | ||
| 25 | + $lists = $this->model->list(['project_id'=>$this->user['project_id']]); | ||
| 26 | + $this->success($lists); | ||
| 27 | + } | ||
| 28 | +} |
| @@ -3,9 +3,7 @@ | @@ -3,9 +3,7 @@ | ||
| 3 | namespace App\Http\Logic\Bside\User; | 3 | namespace App\Http\Logic\Bside\User; |
| 4 | 4 | ||
| 5 | use App\Enums\Common\Code; | 5 | use App\Enums\Common\Code; |
| 6 | -use App\Helper\Common; | ||
| 7 | use App\Http\Logic\Bside\BaseLogic; | 6 | use App\Http\Logic\Bside\BaseLogic; |
| 8 | -use App\Models\Image; | ||
| 9 | use App\Models\User\User; | 7 | use App\Models\User\User; |
| 10 | 8 | ||
| 11 | class UserLogic extends BaseLogic | 9 | class UserLogic extends BaseLogic |
app/Models/AyrShare/AyrRelease.php
0 → 100644
app/Models/File/File.php
0 → 100644
app/Models/WebSetting/WebSettingText.php
0 → 100644
config/setting.php
0 → 100644
| @@ -180,7 +180,7 @@ Route::middleware(['bloginauth'])->group(function () { | @@ -180,7 +180,7 @@ Route::middleware(['bloginauth'])->group(function () { | ||
| 180 | }); | 180 | }); |
| 181 | //图片操作 | 181 | //图片操作 |
| 182 | Route::prefix('images')->group(function () { | 182 | Route::prefix('images')->group(function () { |
| 183 | - Route::post('/upload', [\App\Http\Controllers\ImageController::class, 'upload'])->name('image_upload'); | 183 | + Route::post('/upload', [\App\Http\Controllers\file\ImageController::class, 'upload'])->name('image_upload'); |
| 184 | }); | 184 | }); |
| 185 | 185 | ||
| 186 | //精准询盘 | 186 | //精准询盘 |
| @@ -209,5 +209,5 @@ Route::group([], function () { | @@ -209,5 +209,5 @@ Route::group([], function () { | ||
| 209 | Route::any('/login', [\App\Http\Controllers\Bside\ComController::class, 'login'])->name('login'); | 209 | Route::any('/login', [\App\Http\Controllers\Bside\ComController::class, 'login'])->name('login'); |
| 210 | Route::any('/', [\App\Http\Controllers\Bside\ComController::class, 'get_country'])->name('get_country'); | 210 | Route::any('/', [\App\Http\Controllers\Bside\ComController::class, 'get_country'])->name('get_country'); |
| 211 | Route::get('/file/download', [\App\Http\Controllers\Bside\FileController::class, 'download'])->name('file_download'); | 211 | Route::get('/file/download', [\App\Http\Controllers\Bside\FileController::class, 'download'])->name('file_download'); |
| 212 | - Route::any('/image/{hash}/{w?}/{h?}', [\App\Http\Controllers\ImageController::class,'index'])->name('image_show'); | 212 | + Route::any('/image/{hash}/{w?}/{h?}', [\App\Http\Controllers\file\ImageController::class,'index'])->name('image_show'); |
| 213 | }); | 213 | }); |
-
请 注册 或 登录 后发表评论