Merge branch 'develop' of http://47.244.231.31:8099/zhl/globalso-v6 into develop
正在显示
14 个修改的文件
包含
184 行增加
和
65 行删除
| 1 | <?php | 1 | <?php |
| 2 | 2 | ||
| 3 | -namespace App\Http\Controllers\Aside\Drainage; | 3 | +namespace App\Http\Controllers\Aside\GoogleSeoIps; |
| 4 | 4 | ||
| 5 | use App\Enums\Common\Code; | 5 | use App\Enums\Common\Code; |
| 6 | use App\Http\Controllers\Aside\BaseController; | 6 | use App\Http\Controllers\Aside\BaseController; |
| 7 | use App\Http\Logic\Aside\Projects\ProjectsLogic; | 7 | use App\Http\Logic\Aside\Projects\ProjectsLogic; |
| 8 | +use App\Models\GoogleSeoIps\Country; | ||
| 8 | 9 | ||
| 9 | /** | 10 | /** |
| 10 | * @remark :谷歌流量系统 | 11 | * @remark :谷歌流量系统 |
| @@ -45,6 +46,7 @@ class ProjectsController extends BaseController | @@ -45,6 +46,7 @@ class ProjectsController extends BaseController | ||
| 45 | 'id.required' => 'ID不能为空' | 46 | 'id.required' => 'ID不能为空' |
| 46 | ]); | 47 | ]); |
| 47 | } | 48 | } |
| 49 | + //参数验证 | ||
| 48 | $this->verifyParam(); | 50 | $this->verifyParam(); |
| 49 | $projectsLogic->projectsSave(); | 51 | $projectsLogic->projectsSave(); |
| 50 | $this->response('success'); | 52 | $this->response('success'); |
| @@ -86,6 +88,7 @@ class ProjectsController extends BaseController | @@ -86,6 +88,7 @@ class ProjectsController extends BaseController | ||
| 86 | 'seo_type.required' => '引流方式不能为空', | 88 | 'seo_type.required' => '引流方式不能为空', |
| 87 | ]); | 89 | ]); |
| 88 | } | 90 | } |
| 91 | + | ||
| 89 | /** | 92 | /** |
| 90 | * @remark :删除记录 | 93 | * @remark :删除记录 |
| 91 | * @name :del | 94 | * @name :del |
| @@ -102,4 +105,20 @@ class ProjectsController extends BaseController | @@ -102,4 +105,20 @@ class ProjectsController extends BaseController | ||
| 102 | $projectsLogic->projectsDel(); | 105 | $projectsLogic->projectsDel(); |
| 103 | $this->response('success'); | 106 | $this->response('success'); |
| 104 | } | 107 | } |
| 108 | + | ||
| 109 | + | ||
| 110 | + /** | ||
| 111 | + * @remark :获取国家 | ||
| 112 | + * @name :getCountry | ||
| 113 | + * @author :lyh | ||
| 114 | + * @method :post | ||
| 115 | + * @time :2023/7/18 11:08 | ||
| 116 | + */ | ||
| 117 | + public function getCountry(ProjectsLogic $projectsLogic){ | ||
| 118 | + if(isset($this->map['cname']) && !empty( $this->map['cname'])){ | ||
| 119 | + $this->map['cname'] = ['like','%'.$this->map['cname'].'%']; | ||
| 120 | + } | ||
| 121 | + $lists = $projectsLogic->getCountryList($this->map); | ||
| 122 | + $this->response('success',Code::SUCCESS,$lists); | ||
| 123 | + } | ||
| 105 | } | 124 | } |
| 1 | <?php | 1 | <?php |
| 2 | 2 | ||
| 3 | -namespace App\Http\Controllers\Aside\Drainage; | 3 | +namespace App\Http\Controllers\Aside\GoogleSeoIps; |
| 4 | 4 | ||
| 5 | use App\Enums\Common\Code; | 5 | use App\Enums\Common\Code; |
| 6 | use App\Http\Controllers\Aside\BaseController; | 6 | use App\Http\Controllers\Aside\BaseController; |
| @@ -30,4 +30,25 @@ class ProjectsLogController extends BaseController | @@ -30,4 +30,25 @@ class ProjectsLogController extends BaseController | ||
| 30 | $lists = $projectsLogLogic->projectsLogLists($this->map,$this->page,$this->row,$this->order); | 30 | $lists = $projectsLogLogic->projectsLogLists($this->map,$this->page,$this->row,$this->order); |
| 31 | $this->response('success',Code::SUCCESS,$lists); | 31 | $this->response('success',Code::SUCCESS,$lists); |
| 32 | } | 32 | } |
| 33 | + | ||
| 34 | + /** | ||
| 35 | + * @remark :日志注释 | ||
| 36 | + * @name :setLog | ||
| 37 | + * @author :lyh | ||
| 38 | + * @method :post | ||
| 39 | + * @time :2023/7/18 11:00 | ||
| 40 | + */ | ||
| 41 | + public function getLog($param){ | ||
| 42 | + $data = [ | ||
| 43 | + 'domain'=>$param['domain'],//域名 | ||
| 44 | + 'seo_at'=>date('Y-m-d'),//日期 | ||
| 45 | + 'ips_num'=>$param['ips_num'],//当天引流的IP数 | ||
| 46 | + 'ips_ok'=>$param['ips_ok'],//当天已引流的IP数 | ||
| 47 | + 'is_ok'=>$param['is_ok'],//是否跑完 | ||
| 48 | + 'created_at'=>date('Y-m-d H:i:s'), | ||
| 49 | + 'ok_at'=>$param['ok_at'],//任务完成时间 | ||
| 50 | + 'updated_at'=>date('Y-m-d H:i:s'), | ||
| 51 | + 'is_pushredis'=>$param['is_pushredis'],//是否推送redis | ||
| 52 | + ]; | ||
| 53 | + } | ||
| 33 | } | 54 | } |
| @@ -7,6 +7,7 @@ use App\Models\File\File; | @@ -7,6 +7,7 @@ use App\Models\File\File; | ||
| 7 | use App\Models\File\Image as ImageModel; | 7 | use App\Models\File\Image as ImageModel; |
| 8 | use Illuminate\Http\Exceptions\HttpResponseException; | 8 | use Illuminate\Http\Exceptions\HttpResponseException; |
| 9 | use Illuminate\Http\JsonResponse; | 9 | use Illuminate\Http\JsonResponse; |
| 10 | +use Illuminate\Support\Facades\Cache; | ||
| 10 | 11 | ||
| 11 | class FileController | 12 | class FileController |
| 12 | { | 13 | { |
| @@ -21,20 +22,42 @@ class FileController | @@ -21,20 +22,42 @@ class FileController | ||
| 21 | 'Content-Description' => 'File Transfer', | 22 | 'Content-Description' => 'File Transfer', |
| 22 | ], | 23 | ], |
| 23 | ]; | 24 | ]; |
| 24 | - public $path = ''; | ||
| 25 | 25 | ||
| 26 | - public $config = ''; | 26 | + public $path = '';//路径 |
| 27 | 27 | ||
| 28 | - public $uploads = ''; | 28 | + public $config = '';//存储默认配置 |
| 29 | 29 | ||
| 30 | - public $request = ''; | 30 | + public $request = '';//request |
| 31 | 31 | ||
| 32 | + public $param = '';//参数 | ||
| 33 | + | ||
| 34 | + public $token = '';//token | ||
| 35 | + | ||
| 36 | + public $cache = '';//缓存数据 | ||
| 37 | + | ||
| 38 | + public $image_type = [ | ||
| 39 | + 1 => 'file_other', | ||
| 40 | + ]; | ||
| 32 | public function __construct() | 41 | public function __construct() |
| 33 | { | 42 | { |
| 34 | $this->request = request(); | 43 | $this->request = request(); |
| 44 | + $this->param = $this->request->all(); | ||
| 35 | $this->config = config('filesystems.disks.upload'); | 45 | $this->config = config('filesystems.disks.upload'); |
| 36 | $this->uploads = config('upload.default_file'); | 46 | $this->uploads = config('upload.default_file'); |
| 37 | - $this->path = $this->config['root'].$this->uploads['path'].'/'; | 47 | + $this->token = $this->request->header('token'); |
| 48 | + $this->cache = Cache::get($this->token); | ||
| 49 | + if(!isset($this->token) || empty($this->cache)){ | ||
| 50 | + $this->response('请登录后上传',Code::USER_LOGIN_ERROE); | ||
| 51 | + } | ||
| 52 | + //上传路径设置 | ||
| 53 | + if(!isset($this->param['image_type'])){ | ||
| 54 | + $this->response('类型不能为空',Code::USER_ERROR); | ||
| 55 | + } | ||
| 56 | + if(isset($this->param['refer_type']) && $this->param['refer_type'] == 1){ | ||
| 57 | + $this->path = $this->uploads['path_a'].'/'.$this->image_type[$this->param['file_type']].'/'.date('Y-m'); | ||
| 58 | + }else{ | ||
| 59 | + $this->path = $this->uploads['path_b'].'/'.$this->cache['project_id'].'/'.$this->image_type[$this->param['file_type']].'/'.date('Y-m'); | ||
| 60 | + } | ||
| 38 | } | 61 | } |
| 39 | 62 | ||
| 40 | /** | 63 | /** |
| @@ -44,7 +67,7 @@ class FileController | @@ -44,7 +67,7 @@ class FileController | ||
| 44 | * @method :post | 67 | * @method :post |
| 45 | * @time :2023/5/9 9:15 | 68 | * @time :2023/5/9 9:15 |
| 46 | */ | 69 | */ |
| 47 | - public function index($hash = '', $w = 1) | 70 | + public function index($hash = '') |
| 48 | { | 71 | { |
| 49 | // 检查是否有修改日期或ETag头部 | 72 | // 检查是否有修改日期或ETag头部 |
| 50 | if (isset($_SERVER['HTTP_IF_MODIFIED_SINCE']) || isset($_SERVER['HTTP_IF_NONE_MATCH'])) { | 73 | if (isset($_SERVER['HTTP_IF_MODIFIED_SINCE']) || isset($_SERVER['HTTP_IF_NONE_MATCH'])) { |
| @@ -56,7 +79,7 @@ class FileController | @@ -56,7 +79,7 @@ class FileController | ||
| 56 | if ($info === false) { | 79 | if ($info === false) { |
| 57 | $this->response('指定文件不存在!', Code::USER_ERROR); | 80 | $this->response('指定文件不存在!', Code::USER_ERROR); |
| 58 | } | 81 | } |
| 59 | - $path = $this->path.$info['path']; | 82 | + $path = $this->config['url'].'/'.$info['path']; |
| 60 | if (!is_file($path)) { | 83 | if (!is_file($path)) { |
| 61 | $this->response('指定文件已被系统删除!', Code::USER_ERROR); | 84 | $this->response('指定文件已被系统删除!', Code::USER_ERROR); |
| 62 | } | 85 | } |
| @@ -122,12 +145,12 @@ class FileController | @@ -122,12 +145,12 @@ class FileController | ||
| 122 | ],[ | 145 | ],[ |
| 123 | 'file.required'=>'必须填写', | 146 | 'file.required'=>'必须填写', |
| 124 | ]); | 147 | ]); |
| 125 | - $files = $this->request->file('file'); | 148 | + $files = $this->param['file']; |
| 126 | 149 | ||
| 127 | if (empty($files)) { | 150 | if (empty($files)) { |
| 128 | $this->response('没有上传的文件!', 400); | 151 | $this->response('没有上传的文件!', 400); |
| 129 | } | 152 | } |
| 130 | - $type = $this->request->post('type', 'single'); | 153 | + $type = $this->param['type']; |
| 131 | if ($type == 'multi') { | 154 | if ($type == 'multi') { |
| 132 | return $this->multi($files); | 155 | return $this->multi($files); |
| 133 | } else { | 156 | } else { |
| @@ -151,14 +174,14 @@ class FileController | @@ -151,14 +174,14 @@ class FileController | ||
| 151 | if($file_hash !== false){ | 174 | if($file_hash !== false){ |
| 152 | return $this->response('资源',Code::SUCCESS,['file'=>$hash]); | 175 | return $this->response('资源',Code::SUCCESS,['file'=>$hash]); |
| 153 | } | 176 | } |
| 154 | - $url = $this->path; | 177 | + $url = $this->config['url'].'/'.$this->path; |
| 155 | $fileName = uniqid().rand(10000,99999).'.'.$files->getClientOriginalExtension(); | 178 | $fileName = uniqid().rand(10000,99999).'.'.$files->getClientOriginalExtension(); |
| 156 | $res = $files->move($url,$fileName); | 179 | $res = $files->move($url,$fileName); |
| 157 | if ($res === false) { | 180 | if ($res === false) { |
| 158 | return $this->response($files->getError(), Code::USER_ERROR); | 181 | return $this->response($files->getError(), Code::USER_ERROR); |
| 159 | } | 182 | } |
| 160 | $data = [ | 183 | $data = [ |
| 161 | - 'path' => $fileName, | 184 | + 'path' => $this->path.'/'.$fileName, |
| 162 | 'created_at' => date('Y-m-d H:i:s',time()), | 185 | 'created_at' => date('Y-m-d H:i:s',time()), |
| 163 | 'size' => $res->getSize(), | 186 | 'size' => $res->getSize(), |
| 164 | 'hash' => $hash, | 187 | 'hash' => $hash, |
| @@ -193,14 +216,14 @@ class FileController | @@ -193,14 +216,14 @@ class FileController | ||
| 193 | $data[] = $hash; | 216 | $data[] = $hash; |
| 194 | continue; | 217 | continue; |
| 195 | } | 218 | } |
| 196 | - $url = $this->path; | 219 | + $url = $this->config['url'].'/'.$this->path; |
| 197 | $fileName = uniqid().rand(10000,99999).'.'.$files->getClientOriginalExtension(); | 220 | $fileName = uniqid().rand(10000,99999).'.'.$files->getClientOriginalExtension(); |
| 198 | $res = $file->move($url,$fileName); | 221 | $res = $file->move($url,$fileName); |
| 199 | if ($res === false) { | 222 | if ($res === false) { |
| 200 | return $this->response($file->getError(), Code::USER_ERROR); | 223 | return $this->response($file->getError(), Code::USER_ERROR); |
| 201 | } | 224 | } |
| 202 | $save_data[] = [ | 225 | $save_data[] = [ |
| 203 | - 'path' => $fileName, | 226 | + 'path' => $this->path.'/'.$fileName, |
| 204 | 'created_at' => date('Y-m-d H:i:s',time()), | 227 | 'created_at' => date('Y-m-d H:i:s',time()), |
| 205 | 'size' => $res->getSize(), | 228 | 'size' => $res->getSize(), |
| 206 | 'hash' => $hash, | 229 | 'hash' => $hash, |
| @@ -281,7 +304,7 @@ class FileController | @@ -281,7 +304,7 @@ class FileController | ||
| 281 | if ($info === false) { | 304 | if ($info === false) { |
| 282 | $this->response('指定文件不存在!', Code::USER_ERROR); | 305 | $this->response('指定文件不存在!', Code::USER_ERROR); |
| 283 | } | 306 | } |
| 284 | - $path = $info['path']; | 307 | + $path = $this->config['url'].'/'.$info['path']; |
| 285 | if (!is_file($path)) { | 308 | if (!is_file($path)) { |
| 286 | $this->response('指定文件已被系统删除!', Code::USER_ERROR); | 309 | $this->response('指定文件已被系统删除!', Code::USER_ERROR); |
| 287 | } | 310 | } |
| @@ -3,14 +3,16 @@ | @@ -3,14 +3,16 @@ | ||
| 3 | namespace App\Http\Controllers\File; | 3 | namespace App\Http\Controllers\File; |
| 4 | 4 | ||
| 5 | use App\Enums\Common\Code; | 5 | use App\Enums\Common\Code; |
| 6 | +use App\Http\Controllers\Controller; | ||
| 6 | use App\Http\Controllers\type; | 7 | use App\Http\Controllers\type; |
| 7 | use App\Models\File\Image as ImageModel; | 8 | use App\Models\File\Image as ImageModel; |
| 8 | use Illuminate\Http\Exceptions\HttpResponseException; | 9 | use Illuminate\Http\Exceptions\HttpResponseException; |
| 9 | use Illuminate\Http\JsonResponse; | 10 | use Illuminate\Http\JsonResponse; |
| 11 | +use Illuminate\Support\Facades\Cache; | ||
| 10 | use Illuminate\Support\Facades\Storage; | 12 | use Illuminate\Support\Facades\Storage; |
| 11 | use Intervention\Image\Facades\Image; | 13 | use Intervention\Image\Facades\Image; |
| 12 | 14 | ||
| 13 | -class ImageController | 15 | +class ImageController extends Controller |
| 14 | { | 16 | { |
| 15 | public $upload_img = [ | 17 | public $upload_img = [ |
| 16 | //设置静态缓存参数(304) | 18 | //设置静态缓存参数(304) |
| @@ -25,20 +27,45 @@ class ImageController | @@ -25,20 +27,45 @@ class ImageController | ||
| 25 | ]; | 27 | ]; |
| 26 | const TYPE = 1; | 28 | const TYPE = 1; |
| 27 | 29 | ||
| 28 | - public $path = ''; | 30 | + public $path = '';//路径 |
| 29 | 31 | ||
| 30 | - public $config = ''; | 32 | + public $config = '';//存储默认配置 |
| 31 | 33 | ||
| 32 | - public $thr_path = ''; | 34 | + public $request = '';//request |
| 33 | 35 | ||
| 34 | - public $request = ''; | 36 | + public $param = '';//参数 |
| 37 | + | ||
| 38 | + public $token = '';//token | ||
| 39 | + | ||
| 40 | + public $cache = '';//缓存数据 | ||
| 41 | + | ||
| 42 | + public $image_type = [ | ||
| 43 | + 1 => 'image_product', | ||
| 44 | + 2 => 'image_news', | ||
| 45 | + 3 => 'image_blog', | ||
| 46 | + 4 => 'image_other', | ||
| 47 | + ]; | ||
| 35 | 48 | ||
| 36 | public function __construct() | 49 | public function __construct() |
| 37 | { | 50 | { |
| 38 | $this->request = request(); | 51 | $this->request = request(); |
| 52 | + $this->token = $this->request->header('token'); | ||
| 53 | + $this->cache = Cache::get($this->token); | ||
| 54 | + if(!isset($this->token) || empty($this->cache)){ | ||
| 55 | + $this->response('请登录后上传',Code::USER_LOGIN_ERROE); | ||
| 56 | + } | ||
| 57 | + $this->param = $this->request->all(); | ||
| 39 | $this->config = config('filesystems.disks.upload'); | 58 | $this->config = config('filesystems.disks.upload'); |
| 40 | $this->uploads = config('upload.default_image'); | 59 | $this->uploads = config('upload.default_image'); |
| 41 | - $this->path = $this->config['root'].$this->uploads['path'].'/'; | 60 | + //上传路径设置 |
| 61 | + if(!isset($this->param['image_type'])){ | ||
| 62 | + $this->response('类型不能为空',Code::USER_ERROR); | ||
| 63 | + } | ||
| 64 | + if(isset($this->param['refer_type']) && $this->param['refer_type'] == 1){ | ||
| 65 | + $this->path = $this->uploads['path_a'].'/'.$this->image_type[$this->param['image_type']].'/'.date('Y-m'); | ||
| 66 | + }else{ | ||
| 67 | + $this->path = $this->uploads['path_b'].'/'.$this->cache['project_id'].'/'.$this->image_type[$this->param['image_type']].'/'.date('Y-m'); | ||
| 68 | + } | ||
| 42 | } | 69 | } |
| 43 | 70 | ||
| 44 | /** | 71 | /** |
| @@ -61,7 +88,7 @@ class ImageController | @@ -61,7 +88,7 @@ class ImageController | ||
| 61 | $this->response('指定图片不存在!', Code::USER_ERROR); | 88 | $this->response('指定图片不存在!', Code::USER_ERROR); |
| 62 | } | 89 | } |
| 63 | //查看缩略图是否存在 | 90 | //查看缩略图是否存在 |
| 64 | - $filename = $this->path . $info['hash'] . $w . '_' . $h; | 91 | + $filename = $this->config['url'].'/'.$this->path . '/' . $info['hash'] . $w . '_' . $h; |
| 65 | if(is_file($filename)){ | 92 | if(is_file($filename)){ |
| 66 | $last_modified_time = gmdate(time() + ((30 * 60 * 60 * 24))) . " GMT"; | 93 | $last_modified_time = gmdate(time() + ((30 * 60 * 60 * 24))) . " GMT"; |
| 67 | $header = str_replace(['%Expires%', "%etag%", '%Last-Modified%'], | 94 | $header = str_replace(['%Expires%', "%etag%", '%Last-Modified%'], |
| @@ -69,7 +96,7 @@ class ImageController | @@ -69,7 +96,7 @@ class ImageController | ||
| 69 | $content = file_get_contents($filename); | 96 | $content = file_get_contents($filename); |
| 70 | $header['Content-Length'] = strlen($content); | 97 | $header['Content-Length'] = strlen($content); |
| 71 | }else{ | 98 | }else{ |
| 72 | - $path = $this->path.$info['path']; | 99 | + $path = $this->config['url'].'/'.$info['path']; |
| 73 | if (!is_file($path)) { | 100 | if (!is_file($path)) { |
| 74 | $this->response('指定图片已被系统删除!', Code::USER_ERROR); | 101 | $this->response('指定图片已被系统删除!', Code::USER_ERROR); |
| 75 | } | 102 | } |
| @@ -106,7 +133,7 @@ class ImageController | @@ -106,7 +133,7 @@ class ImageController | ||
| 106 | if (empty($files)) { | 133 | if (empty($files)) { |
| 107 | $this->response('没有上传的文件!', 400); | 134 | $this->response('没有上传的文件!', 400); |
| 108 | } | 135 | } |
| 109 | - $type = $this->request->post('type', 'single'); | 136 | + $type = $this->param['type']; |
| 110 | if ($type == 'multi') { | 137 | if ($type == 'multi') { |
| 111 | return $this->multi($files); | 138 | return $this->multi($files); |
| 112 | } else { | 139 | } else { |
| @@ -130,19 +157,19 @@ class ImageController | @@ -130,19 +157,19 @@ class ImageController | ||
| 130 | if($image_hash !== false){ | 157 | if($image_hash !== false){ |
| 131 | return $this->response('图片资源',Code::SUCCESS,['image'=>$hash]); | 158 | return $this->response('图片资源',Code::SUCCESS,['image'=>$hash]); |
| 132 | } | 159 | } |
| 133 | - $url = $this->path; | 160 | + $url = $this->config['url'].$this->path; |
| 134 | $fileName = uniqid().rand(10000,99999).'.'.$files->getClientOriginalExtension(); | 161 | $fileName = uniqid().rand(10000,99999).'.'.$files->getClientOriginalExtension(); |
| 135 | $res = $files->move($url,$fileName); | 162 | $res = $files->move($url,$fileName); |
| 136 | if ($res === false) { | 163 | if ($res === false) { |
| 137 | return $this->response($files->getError(), Code::USER_ERROR); | 164 | return $this->response($files->getError(), Code::USER_ERROR); |
| 138 | } | 165 | } |
| 139 | $data = [ | 166 | $data = [ |
| 140 | - 'path' => $fileName, | 167 | + 'path' => $this->path.'/'.$fileName, |
| 141 | 'created_at' => date('Y-m-d H:i:s',time()), | 168 | 'created_at' => date('Y-m-d H:i:s',time()), |
| 142 | 'size' => $res->getSize(), | 169 | 'size' => $res->getSize(), |
| 143 | 'hash' => $hash, | 170 | 'hash' => $hash, |
| 144 | 'type'=>$files->getClientOriginalExtension(), | 171 | 'type'=>$files->getClientOriginalExtension(), |
| 145 | - 'refer'=>$this->request->post('refer') ?? '', | 172 | + 'refer'=>$this->param['refer'] ?? '', |
| 146 | ]; | 173 | ]; |
| 147 | $rs = $imageModel->add($data); | 174 | $rs = $imageModel->add($data); |
| 148 | if ($rs === false) { | 175 | if ($rs === false) { |
| @@ -163,7 +190,7 @@ class ImageController | @@ -163,7 +190,7 @@ class ImageController | ||
| 163 | */ | 190 | */ |
| 164 | private function cacheImage($info, $w, $h) { | 191 | private function cacheImage($info, $w, $h) { |
| 165 | $path = $info['path']; | 192 | $path = $info['path']; |
| 166 | - $filename = $this->path . $info['hash'] . $w . '_' . $h; | 193 | + $filename = $this->config['url'] . $this->path . $info['hash'] . $w . '_' . $h; |
| 167 | Image::make($path)->resize($w, $h)->save($filename); | 194 | Image::make($path)->resize($w, $h)->save($filename); |
| 168 | return $filename; | 195 | return $filename; |
| 169 | } | 196 | } |
| @@ -191,20 +218,20 @@ class ImageController | @@ -191,20 +218,20 @@ class ImageController | ||
| 191 | $data[] = ['image'=>$hash]; | 218 | $data[] = ['image'=>$hash]; |
| 192 | continue; | 219 | continue; |
| 193 | } | 220 | } |
| 194 | - $url = $this->path; | 221 | + $url = $this->config['url'].$this->path; |
| 195 | $fileName = uniqid().rand(10000,99999).'.'.$file->getClientOriginalExtension(); | 222 | $fileName = uniqid().rand(10000,99999).'.'.$file->getClientOriginalExtension(); |
| 196 | $res = $file->move($url,$fileName); | 223 | $res = $file->move($url,$fileName); |
| 197 | if ($res === false) { | 224 | if ($res === false) { |
| 198 | return $this->response($file->getError(), Code::USER_ERROR); | 225 | return $this->response($file->getError(), Code::USER_ERROR); |
| 199 | } | 226 | } |
| 200 | $save_data[] = [ | 227 | $save_data[] = [ |
| 201 | - 'path' => $fileName, | 228 | + 'path' => $this->path.'/'.$fileName, |
| 202 | 'created_at' => date('Y-m-d H:i:s',time()), | 229 | 'created_at' => date('Y-m-d H:i:s',time()), |
| 203 | 'updated_at'=>date('Y-m-d H:i:s',time()), | 230 | 'updated_at'=>date('Y-m-d H:i:s',time()), |
| 204 | 'size' => $res->getSize(), | 231 | 'size' => $res->getSize(), |
| 205 | 'hash' => $hash, | 232 | 'hash' => $hash, |
| 206 | 'type'=>$file->getClientOriginalExtension(), | 233 | 'type'=>$file->getClientOriginalExtension(), |
| 207 | - 'refer'=>$this->request->post('refer') ?? '', | 234 | + 'refer'=>$this->param['refer'] ?? '', |
| 208 | ]; | 235 | ]; |
| 209 | $data[] = ['image'=>$hash]; | 236 | $data[] = ['image'=>$hash]; |
| 210 | } | 237 | } |
| @@ -284,4 +311,5 @@ class ImageController | @@ -284,4 +311,5 @@ class ImageController | ||
| 284 | $lists = $imageModel->list([],$order = 'id',['id','hash','type','path','created_at']); | 311 | $lists = $imageModel->list([],$order = 'id',['id','hash','type','path','created_at']); |
| 285 | $this->response('success',Code::SUCCESS,$lists); | 312 | $this->response('success',Code::SUCCESS,$lists); |
| 286 | } | 313 | } |
| 314 | + | ||
| 287 | } | 315 | } |
| @@ -8,7 +8,7 @@ use App\Models\Inquiry\InquiryInfo; | @@ -8,7 +8,7 @@ use App\Models\Inquiry\InquiryInfo; | ||
| 8 | use App\Models\Inquiry\InquiryIP; | 8 | use App\Models\Inquiry\InquiryIP; |
| 9 | use App\Models\Project\DeployBuild; | 9 | use App\Models\Project\DeployBuild; |
| 10 | use App\Models\Project\Keywords; | 10 | use App\Models\Project\Keywords; |
| 11 | -use App\Models\Projects\InquiryUser; | 11 | +use App\Models\GoogleSeoIps\InquiryUser; |
| 12 | use Illuminate\Support\Facades\DB; | 12 | use Illuminate\Support\Facades\DB; |
| 13 | 13 | ||
| 14 | /** | 14 | /** |
| @@ -3,7 +3,7 @@ | @@ -3,7 +3,7 @@ | ||
| 3 | namespace App\Http\Logic\Aside\Projects; | 3 | namespace App\Http\Logic\Aside\Projects; |
| 4 | 4 | ||
| 5 | use App\Http\Logic\Aside\BaseLogic; | 5 | use App\Http\Logic\Aside\BaseLogic; |
| 6 | -use App\Models\Projects\ProjectsSeoTask; | 6 | +use App\Models\GoogleSeoIps\ProjectsSeoTask; |
| 7 | 7 | ||
| 8 | /** | 8 | /** |
| 9 | * @remark :谷歌流量日志记录 | 9 | * @remark :谷歌流量日志记录 |
| @@ -3,7 +3,8 @@ | @@ -3,7 +3,8 @@ | ||
| 3 | namespace App\Http\Logic\Aside\Projects; | 3 | namespace App\Http\Logic\Aside\Projects; |
| 4 | 4 | ||
| 5 | use App\Http\Logic\Aside\BaseLogic; | 5 | use App\Http\Logic\Aside\BaseLogic; |
| 6 | -use App\Models\Projects\Projects; | 6 | +use App\Models\GoogleSeoIps\Country as CountryModel; |
| 7 | +use App\Models\GoogleSeoIps\Projects; | ||
| 7 | 8 | ||
| 8 | /** | 9 | /** |
| 9 | * @remark :谷歌流量系统统计表 | 10 | * @remark :谷歌流量系统统计表 |
| @@ -87,4 +88,17 @@ class ProjectsLogic extends BaseLogic | @@ -87,4 +88,17 @@ class ProjectsLogic extends BaseLogic | ||
| 87 | } | 88 | } |
| 88 | return $this->success(); | 89 | return $this->success(); |
| 89 | } | 90 | } |
| 91 | + | ||
| 92 | + /** | ||
| 93 | + * @remark :获取国家列表 | ||
| 94 | + * @name :getCountryList | ||
| 95 | + * @author :lyh | ||
| 96 | + * @method :post | ||
| 97 | + * @time :2023/7/18 11:12 | ||
| 98 | + */ | ||
| 99 | + public function getCountryList($map){ | ||
| 100 | + $countryModel = new CountryModel(); | ||
| 101 | + $lists = $countryModel->list($map); | ||
| 102 | + return $this->success($lists); | ||
| 103 | + } | ||
| 90 | } | 104 | } |
| @@ -54,6 +54,7 @@ class CustomTemplateLogic extends BaseLogic | @@ -54,6 +54,7 @@ class CustomTemplateLogic extends BaseLogic | ||
| 54 | if(isset($this->param['id']) && !empty($this->param['id'])){ | 54 | if(isset($this->param['id']) && !empty($this->param['id'])){ |
| 55 | $rs = $this->model->edit($this->param,['id'=>$this->param['id']]); | 55 | $rs = $this->model->edit($this->param,['id'=>$this->param['id']]); |
| 56 | }else{ | 56 | }else{ |
| 57 | + $this->param['project_id'] = $this->user['project_id']; | ||
| 57 | $rs = $this->model->add($this->param); | 58 | $rs = $this->model->add($this->param); |
| 58 | } | 59 | } |
| 59 | if($rs === false){ | 60 | if($rs === false){ |
app/Models/GoogleSeoIps/Country.php
0 → 100644
| 1 | +<?php | ||
| 2 | + | ||
| 3 | +namespace App\Models\GoogleSeoIps; | ||
| 4 | + | ||
| 5 | +use App\Models\Base; | ||
| 6 | + | ||
| 7 | +/** | ||
| 8 | + * @remark :192.30.242.45引流国家设置 | ||
| 9 | + * @class :Country.php | ||
| 10 | + * @author :lyh | ||
| 11 | + * @time :2023/7/18 11:09 | ||
| 12 | + */ | ||
| 13 | +class Country extends Base | ||
| 14 | +{ | ||
| 15 | + //连接数据库 | ||
| 16 | + protected $connection = 'projects_mysql'; | ||
| 17 | + protected $table = 'country'; | ||
| 18 | +} |
| @@ -67,7 +67,20 @@ return [ | @@ -67,7 +67,20 @@ return [ | ||
| 67 | 'visibility' => 'public', | 67 | 'visibility' => 'public', |
| 68 | ], | 68 | ], |
| 69 | 69 | ||
| 70 | - | 70 | + //腾讯云对象存储 |
| 71 | + 'cos' => [ | ||
| 72 | + 'driver' => 'cosv5', | ||
| 73 | + 'region' => env('COS_REGION'), | ||
| 74 | + 'credentials' => [ | ||
| 75 | + 'appId' => env('COS_APP_ID'), | ||
| 76 | + 'secretId' => env('COS_SECRET_ID'), | ||
| 77 | + 'secretKey' => env('COS_SECRET_KEY'), | ||
| 78 | + ], | ||
| 79 | + 'bucket' => env('COS_BUCKET'), | ||
| 80 | + 'cdn' => env('COS_CDN'), | ||
| 81 | + 'timeout' => 60, | ||
| 82 | + 'connect_timeout' => 60, | ||
| 83 | + ], | ||
| 71 | 84 | ||
| 72 | 85 | ||
| 73 | ], | 86 | ], |
| @@ -19,34 +19,15 @@ return [ | @@ -19,34 +19,15 @@ return [ | ||
| 19 | 'size' => [ | 19 | 'size' => [ |
| 20 | 'max' => 1024*1024*2, // 2M | 20 | 'max' => 1024*1024*2, // 2M |
| 21 | ], | 21 | ], |
| 22 | - 'path' => '/images' | 22 | + 'path_b' => '/p', |
| 23 | + 'path_a' => '/m', | ||
| 23 | ], | 24 | ], |
| 24 | //默认视频 | 25 | //默认视频 |
| 25 | 'default_file' =>[ | 26 | 'default_file' =>[ |
| 26 | 'size' => [ | 27 | 'size' => [ |
| 27 | 'max' => 1024*1024*20, // 2M | 28 | 'max' => 1024*1024*20, // 2M |
| 28 | ], | 29 | ], |
| 29 | - 'path' => '/files' | ||
| 30 | - ], | ||
| 31 | - //博客图 | ||
| 32 | - 'blog' =>[ | ||
| 33 | - 'size' => [ | ||
| 34 | - 'max' => 1024*1024*2, // 2M | ||
| 35 | - ], | ||
| 36 | - 'path' => '/blog' | ||
| 37 | - ], | ||
| 38 | - //新闻图 | ||
| 39 | - 'news' =>[ | ||
| 40 | - 'size' => [ | ||
| 41 | - 'max' => 1024*1024*2, // 2M | ||
| 42 | - ], | ||
| 43 | - 'path' => '/news' | ||
| 44 | - ], | ||
| 45 | - //项目相关 | ||
| 46 | - 'project' =>[ | ||
| 47 | - 'size' => [ | ||
| 48 | - 'max' => 1024*1024*1024, // 2M | ||
| 49 | - ], | ||
| 50 | - 'path' => '/project' | 30 | + 'path_b' => '/p', |
| 31 | + 'path_a' => '/m', | ||
| 51 | ], | 32 | ], |
| 52 | ]; | 33 | ]; |
| @@ -191,12 +191,13 @@ Route::middleware(['aloginauth'])->group(function () { | @@ -191,12 +191,13 @@ Route::middleware(['aloginauth'])->group(function () { | ||
| 191 | }); | 191 | }); |
| 192 | //谷歌流量系统 | 192 | //谷歌流量系统 |
| 193 | Route::prefix('projects')->group(function () { | 193 | Route::prefix('projects')->group(function () { |
| 194 | - Route::post('/', [Aside\Drainage\ProjectsController::class, 'lists'])->name('projects_lists'); | ||
| 195 | - Route::post('/save', [Aside\Drainage\ProjectsController::class, 'save'])->name('projects_save'); | ||
| 196 | - Route::post('/del', [Aside\Drainage\ProjectsController::class, 'del'])->name('projects_del'); | 194 | + Route::post('/', [Aside\GoogleSeoIps\ProjectsController::class, 'lists'])->name('projects_lists'); |
| 195 | + Route::post('/save', [Aside\GoogleSeoIps\ProjectsController::class, 'save'])->name('projects_save'); | ||
| 196 | + Route::post('/getCountry', [Aside\GoogleSeoIps\ProjectsController::class, 'getCountry'])->name('projects_getCountry'); | ||
| 197 | + Route::post('/del', [Aside\GoogleSeoIps\ProjectsController::class, 'del'])->name('projects_del'); | ||
| 197 | //谷歌流量系统日志 | 198 | //谷歌流量系统日志 |
| 198 | Route::prefix('log')->group(function () { | 199 | Route::prefix('log')->group(function () { |
| 199 | - Route::post('/', [Aside\Drainage\ProjectsLogController::class, 'lists'])->name('projectsLog_lists'); | 200 | + Route::post('/', [Aside\GoogleSeoIps\ProjectsLogController::class, 'lists'])->name('projectsLog_lists'); |
| 200 | }); | 201 | }); |
| 201 | //优化gsc账号记录表 | 202 | //优化gsc账号记录表 |
| 202 | Route::prefix('gsc')->group(function () { | 203 | Route::prefix('gsc')->group(function () { |
-
请 注册 或 登录 后发表评论