Merge branch 'develop' of http://47.244.231.31:8099/zhl/globalso-v6 into develop
正在显示
16 个修改的文件
包含
112 行增加
和
35 行删除
| @@ -137,4 +137,5 @@ class AyrReleaseController extends BaseController | @@ -137,4 +137,5 @@ class AyrReleaseController extends BaseController | ||
| 137 | $ayrShareLogic->save_file($param_data); | 137 | $ayrShareLogic->save_file($param_data); |
| 138 | $this->response('success'); | 138 | $this->response('success'); |
| 139 | } | 139 | } |
| 140 | + | ||
| 140 | } | 141 | } |
| @@ -242,12 +242,14 @@ class BaseController extends Controller | @@ -242,12 +242,14 @@ class BaseController extends Controller | ||
| 242 | $imageModel = new Image(); | 242 | $imageModel = new Image(); |
| 243 | $info = $imageModel->read(['hash'=>$hash]); | 243 | $info = $imageModel->read(['hash'=>$hash]); |
| 244 | $url = ''; | 244 | $url = ''; |
| 245 | + if($info !== false){ | ||
| 245 | if($info['is_cos'] == 1){ | 246 | if($info['is_cos'] == 1){ |
| 246 | $cos = new CosService(); | 247 | $cos = new CosService(); |
| 247 | $url = $cos->getImageUrl($info['path']); | 248 | $url = $cos->getImageUrl($info['path']); |
| 248 | }else{ | 249 | }else{ |
| 249 | $url = url('b/image/'.$info['hash']); | 250 | $url = url('b/image/'.$info['hash']); |
| 250 | } | 251 | } |
| 252 | + } | ||
| 251 | return $url; | 253 | return $url; |
| 252 | } | 254 | } |
| 253 | 255 |
| @@ -66,8 +66,7 @@ class ProductController extends BaseController | @@ -66,8 +66,7 @@ class ProductController extends BaseController | ||
| 66 | 'id.required' => 'ID不能为空' | 66 | 'id.required' => 'ID不能为空' |
| 67 | ]); | 67 | ]); |
| 68 | $data = $logic->getInfo($this->param['id']); | 68 | $data = $logic->getInfo($this->param['id']); |
| 69 | - return $this->success(Arr::twoKeepKeys($data, ['id', 'project_id', 'title', 'gallery', 'attrs', 'category_id', 'keyword_id', 'attr_id', 'describe_id', 'intro', 'content', | ||
| 70 | - 'describe', 'seo_mate', 'related_product_id', 'status', 'category_id_text', 'keyword_id_text', 'status_text', 'created_uid', 'created_uid_text', 'route', 'url'])); | 69 | + return $this->success($data); |
| 71 | } | 70 | } |
| 72 | 71 | ||
| 73 | public function save(ProductRequest $request, ProductLogic $logic) | 72 | public function save(ProductRequest $request, ProductLogic $logic) |
| @@ -24,7 +24,7 @@ class ProofreadingController extends BaseController | @@ -24,7 +24,7 @@ class ProofreadingController extends BaseController | ||
| 24 | $lists = $proofreadingLogic->proofreadingList($this->map,$this->page,$this->row); | 24 | $lists = $proofreadingLogic->proofreadingList($this->map,$this->page,$this->row); |
| 25 | if(!empty($lists['list']) && ($this->param['type'] == $this::TYPE_IMAGE)){ | 25 | if(!empty($lists['list']) && ($this->param['type'] == $this::TYPE_IMAGE)){ |
| 26 | foreach ($lists['list'] as $k => $v){ | 26 | foreach ($lists['list'] as $k => $v){ |
| 27 | - $lists['list'][$k]['image_link'] = url('/b/image/' . $v['translate']); | 27 | + $lists['list'][$k]['image_link'] = $this->getImageUrl($v['translate']); |
| 28 | } | 28 | } |
| 29 | } | 29 | } |
| 30 | $this->response('success',Code::SUCCESS,$lists); | 30 | $this->response('success',Code::SUCCESS,$lists); |
| @@ -22,7 +22,7 @@ class WebSettingServiceController extends BaseController | @@ -22,7 +22,7 @@ class WebSettingServiceController extends BaseController | ||
| 22 | $lists = $webSettingServiceLogic->setting_service_list(); | 22 | $lists = $webSettingServiceLogic->setting_service_list(); |
| 23 | foreach ($lists as $k => $v){ | 23 | foreach ($lists as $k => $v){ |
| 24 | if($v['type'] == self::TYPE_CODE){ | 24 | if($v['type'] == self::TYPE_CODE){ |
| 25 | - $v['values_link'] = url('/b/image/' . $v['values']); | 25 | + $v['values_link'] = $this->getImageUrl($v['values']); |
| 26 | $lists[$k] = $v; | 26 | $lists[$k] = $v; |
| 27 | } | 27 | } |
| 28 | } | 28 | } |
| @@ -320,7 +320,7 @@ class FileController | @@ -320,7 +320,7 @@ class FileController | ||
| 320 | $this->path = $this->uploads['path_a'].'/'.$this->file_type[$this->param['refer']].'/'.date('Y-m'); | 320 | $this->path = $this->uploads['path_a'].'/'.$this->file_type[$this->param['refer']].'/'.date('Y-m'); |
| 321 | }else{ | 321 | }else{ |
| 322 | //B端上传 | 322 | //B端上传 |
| 323 | - if(!isset($this->param['upload_method']) && $this->param['upload_method'] == 1){ | 323 | + if(isset($this->param['upload_method']) && $this->param['upload_method'] == 1){ |
| 324 | //强制上传本地配置 | 324 | //强制上传本地配置 |
| 325 | $this->upload_location = 0; | 325 | $this->upload_location = 0; |
| 326 | }else{ | 326 | }else{ |
| @@ -334,7 +334,7 @@ class FileController | @@ -334,7 +334,7 @@ class FileController | ||
| 334 | } | 334 | } |
| 335 | 335 | ||
| 336 | /** | 336 | /** |
| 337 | - * @remark :获取文件交接链接 | 337 | + * @remark :获取文件链接 |
| 338 | * @name :getImageUrl | 338 | * @name :getImageUrl |
| 339 | * @author :lyh | 339 | * @author :lyh |
| 340 | * @method :post | 340 | * @method :post |
| @@ -46,6 +46,8 @@ class ImageController extends Controller | @@ -46,6 +46,8 @@ class ImageController extends Controller | ||
| 46 | 1 => 'image_product', | 46 | 1 => 'image_product', |
| 47 | 2 => 'image_news', | 47 | 2 => 'image_news', |
| 48 | 3 => 'image_blog', | 48 | 3 => 'image_blog', |
| 49 | + 4 => 'image_product_icon', | ||
| 50 | + 5 => 'image_product_cate', | ||
| 49 | 0 => 'image_other', | 51 | 0 => 'image_other', |
| 50 | ]; | 52 | ]; |
| 51 | 53 | ||
| @@ -150,7 +152,7 @@ class ImageController extends Controller | @@ -150,7 +152,7 @@ class ImageController extends Controller | ||
| 150 | $imageModel = new ImageModel(); | 152 | $imageModel = new ImageModel(); |
| 151 | $image_hash = $imageModel->read(['hash'=>$hash]); | 153 | $image_hash = $imageModel->read(['hash'=>$hash]); |
| 152 | if($image_hash !== false){ | 154 | if($image_hash !== false){ |
| 153 | - return $this->response('图片资源',Code::SUCCESS,['image'=>$hash]); | 155 | + return $this->response('图片资源',Code::SUCCESS,['image'=>$hash,'image_link'=>$this->getImageUrl($hash)]); |
| 154 | } | 156 | } |
| 155 | $url = $this->config['root'].$this->path; | 157 | $url = $this->config['root'].$this->path; |
| 156 | $fileName = uniqid().rand(10000,99999).'.'.$image_type; | 158 | $fileName = uniqid().rand(10000,99999).'.'.$image_type; |
| @@ -295,9 +297,10 @@ class ImageController extends Controller | @@ -295,9 +297,10 @@ class ImageController extends Controller | ||
| 295 | */ | 297 | */ |
| 296 | public function getImageList(){ | 298 | public function getImageList(){ |
| 297 | $imageModel = new ImageModel(); | 299 | $imageModel = new ImageModel(); |
| 298 | - $lists = $imageModel->list([],$order = 'id',['id','hash','type','path','created_at']); | 300 | + $lists = $imageModel->list($this->param,$order = 'id',['id','hash','type','path','created_at']); |
| 299 | foreach ($lists as $k => $v){ | 301 | foreach ($lists as $k => $v){ |
| 300 | - $v['image_link'] = $this->getImageUrl($v['image']); | 302 | + $v['image_link'] = $this->getImageUrl($v['hash']); |
| 303 | + $lists[$k] = $v; | ||
| 301 | } | 304 | } |
| 302 | $this->response('success',Code::SUCCESS,$lists); | 305 | $this->response('success',Code::SUCCESS,$lists); |
| 303 | } | 306 | } |
| @@ -60,7 +60,6 @@ class AyrReleaseLogic extends BaseLogic | @@ -60,7 +60,6 @@ class AyrReleaseLogic extends BaseLogic | ||
| 60 | $arr = []; | 60 | $arr = []; |
| 61 | foreach ($data as $k => $v){ | 61 | foreach ($data as $k => $v){ |
| 62 | if($k == 'images'){ | 62 | if($k == 'images'){ |
| 63 | -// $images = explode(',',$v); | ||
| 64 | $images = $v; | 63 | $images = $v; |
| 65 | $imageModel = new Image(); | 64 | $imageModel = new Image(); |
| 66 | $list = $imageModel->list(['hash'=>['in',$images]],'id'); | 65 | $list = $imageModel->list(['hash'=>['in',$images]],'id'); |
| @@ -213,7 +213,6 @@ class BTemplateLogic extends BaseLogic | @@ -213,7 +213,6 @@ class BTemplateLogic extends BaseLogic | ||
| 213 | ], | 213 | ], |
| 214 | ], | 214 | ], |
| 215 | ]; | 215 | ]; |
| 216 | - | ||
| 217 | //产品,新闻,博客,一级分类数据 | 216 | //产品,新闻,博客,一级分类数据 |
| 218 | $productCategory = Category::where("pid",0)->get(); | 217 | $productCategory = Category::where("pid",0)->get(); |
| 219 | $newCategory = NewsCategory::where("pid",0)->get(); | 218 | $newCategory = NewsCategory::where("pid",0)->get(); |
| @@ -233,7 +232,6 @@ class BTemplateLogic extends BaseLogic | @@ -233,7 +232,6 @@ class BTemplateLogic extends BaseLogic | ||
| 233 | $data["blogs"]["category"][] =$item; | 232 | $data["blogs"]["category"][] =$item; |
| 234 | } | 233 | } |
| 235 | } | 234 | } |
| 236 | - | ||
| 237 | //返回 | 235 | //返回 |
| 238 | return $this->success($data); | 236 | return $this->success($data); |
| 239 | } | 237 | } |
| @@ -178,17 +178,17 @@ class CountLogic extends BaseLogic | @@ -178,17 +178,17 @@ class CountLogic extends BaseLogic | ||
| 178 | case 'images': | 178 | case 'images': |
| 179 | $arr = explode(',',$v['values']); | 179 | $arr = explode(',',$v['values']); |
| 180 | foreach ($arr as $k1 => $v1){ | 180 | foreach ($arr as $k1 => $v1){ |
| 181 | - $v['images_link'][$k1] = url('a/image/'.$v1); | 181 | + $v['images_link'][$k1] = url('b/image/'.$v1); |
| 182 | } | 182 | } |
| 183 | break; | 183 | break; |
| 184 | case 'android': | 184 | case 'android': |
| 185 | - $v['android_link'] = url('a/image/'.$v['values']); | 185 | + $v['android_link'] = url('b/image/'.$v['values']); |
| 186 | break; | 186 | break; |
| 187 | case 'official_account': | 187 | case 'official_account': |
| 188 | - $v['official_account_link'] = url('a/image/'.$v['values']); | 188 | + $v['official_account_link'] = url('b/image/'.$v['values']); |
| 189 | break; | 189 | break; |
| 190 | case 'ios': | 190 | case 'ios': |
| 191 | - $v['ios_link'] = url('a/image/'.$v['values']); | 191 | + $v['ios_link'] = url('b/image/'.$v['values']); |
| 192 | break; | 192 | break; |
| 193 | } | 193 | } |
| 194 | $lists[$k] = $v; | 194 | $lists[$k] = $v; |
| @@ -31,13 +31,14 @@ class ProductLogic extends BaseLogic | @@ -31,13 +31,14 @@ class ProductLogic extends BaseLogic | ||
| 31 | $data = parent::getList($map, $sort, $columns, $limit); | 31 | $data = parent::getList($map, $sort, $columns, $limit); |
| 32 | foreach ($data['list'] as &$v){ | 32 | foreach ($data['list'] as &$v){ |
| 33 | $v = $this->formatData($v); | 33 | $v = $this->formatData($v); |
| 34 | + $v['thumb']['image_link'] = $v['thumb']['url'];//图片统一 | ||
| 34 | } | 35 | } |
| 35 | return $this->success($data); | 36 | return $this->success($data); |
| 36 | } | 37 | } |
| 37 | 38 | ||
| 38 | public function getInfo($id) | 39 | public function getInfo($id) |
| 39 | { | 40 | { |
| 40 | - $info = parent::getInfo($id); | 41 | + $info = $this->model->read(['id'=>$id]); |
| 41 | $info = $this->formatData($info); | 42 | $info = $this->formatData($info); |
| 42 | return $this->success($info); | 43 | return $this->success($info); |
| 43 | } | 44 | } |
| @@ -54,6 +55,13 @@ class ProductLogic extends BaseLogic | @@ -54,6 +55,13 @@ class ProductLogic extends BaseLogic | ||
| 54 | $info['status_text'] = Product::statusMap()[$info['status']] ?? ''; | 55 | $info['status_text'] = Product::statusMap()[$info['status']] ?? ''; |
| 55 | $info['created_uid_text'] = (new UserLogic())->getCacheInfo($info['created_uid'])['name'] ?? ''; | 56 | $info['created_uid_text'] = (new UserLogic())->getCacheInfo($info['created_uid'])['name'] ?? ''; |
| 56 | $info['url'] = $this->getProjectDomain() . $info['route'] ; | 57 | $info['url'] = $this->getProjectDomain() . $info['route'] ; |
| 58 | + //统一图片链接 | ||
| 59 | + if(!empty($info['gallery'])){ | ||
| 60 | + foreach ($info['gallery'] as $k => $v){ | ||
| 61 | + $v['image_link'] = $v['url']; | ||
| 62 | + $info['gallery'][$k] = $v; | ||
| 63 | + } | ||
| 64 | + } | ||
| 57 | return $info; | 65 | return $info; |
| 58 | } | 66 | } |
| 59 | 67 |
| @@ -13,7 +13,6 @@ class WebSettingServiceLogic extends BaseLogic | @@ -13,7 +13,6 @@ class WebSettingServiceLogic extends BaseLogic | ||
| 13 | public function __construct() | 13 | public function __construct() |
| 14 | { | 14 | { |
| 15 | parent::__construct(); | 15 | parent::__construct(); |
| 16 | - | ||
| 17 | $this->model = new WebSettingService(); | 16 | $this->model = new WebSettingService(); |
| 18 | $this->param = $this->requestAll; | 17 | $this->param = $this->requestAll; |
| 19 | } | 18 | } |
| @@ -9,6 +9,8 @@ use App\Exceptions\AsideGlobalException; | @@ -9,6 +9,8 @@ use App\Exceptions\AsideGlobalException; | ||
| 9 | use App\Exceptions\BsideGlobalException; | 9 | use App\Exceptions\BsideGlobalException; |
| 10 | use App\Helper\Arr; | 10 | use App\Helper\Arr; |
| 11 | use App\Models\Devops\ServerInformationLog; | 11 | use App\Models\Devops\ServerInformationLog; |
| 12 | +use App\Models\File\Image; | ||
| 13 | +use App\Services\CosService; | ||
| 12 | use Illuminate\Database\Eloquent\Model; | 14 | use Illuminate\Database\Eloquent\Model; |
| 13 | use Illuminate\Support\Facades\Cache; | 15 | use Illuminate\Support\Facades\Cache; |
| 14 | use Illuminate\Support\Facades\DB; | 16 | use Illuminate\Support\Facades\DB; |
| @@ -380,7 +382,33 @@ class Logic | @@ -380,7 +382,33 @@ class Logic | ||
| 380 | return $this->success($info); | 382 | return $this->success($info); |
| 381 | } | 383 | } |
| 382 | 384 | ||
| 385 | + /** | ||
| 386 | + * @remark :获取图片链接 | ||
| 387 | + * @name :getImageUrl | ||
| 388 | + * @author :lyh | ||
| 389 | + * @method :post | ||
| 390 | + * @time :2023/7/20 16:46 | ||
| 391 | + */ | ||
| 392 | + public function getImageUrl($hash){ | ||
| 383 | 393 | ||
| 394 | + if(is_array($hash)){ | ||
| 395 | + $url = []; | ||
| 396 | + foreach ($hash as $k => $v){ | ||
| 397 | + $url['images_link'][$k] = $this->getImageUrl($v); | ||
| 398 | + } | ||
| 399 | + }else{ | ||
| 400 | + $imageModel = new Image(); | ||
| 401 | + $info = $imageModel->read(['hash'=>$hash]); | ||
| 402 | + if($info['is_cos'] == 1){ | ||
| 403 | + $cos = new CosService(); | ||
| 404 | + $url = $cos->getImageUrl($info['path']); | ||
| 405 | + }else{ | ||
| 406 | + $url = url('b/image/'.$info['hash']); | ||
| 407 | + } | ||
| 408 | + } | ||
| 409 | + | ||
| 410 | + return $url; | ||
| 411 | + } | ||
| 384 | 412 | ||
| 385 | /** | 413 | /** |
| 386 | * 获取实例 | 414 | * 获取实例 |
| @@ -38,16 +38,8 @@ class ProductRequest extends FormRequest | @@ -38,16 +38,8 @@ class ProductRequest extends FormRequest | ||
| 38 | return [ | 38 | return [ |
| 39 | 'title' => 'required|max:200', | 39 | 'title' => 'required|max:200', |
| 40 | 'route' => 'required|max:200', | 40 | 'route' => 'required|max:200', |
| 41 | - 'gallery' => ['required', 'array', function ($attribute, $value, $fail) { | ||
| 42 | - foreach ($value as $v) { | ||
| 43 | - if (empty($v['url'])) { | ||
| 44 | - $fail('图片链接不能为空'); | ||
| 45 | - } | ||
| 46 | - if (!Str::contains($v['url'], env('UPLOAD_LOCAL_URL') ?: env('APP_URL'))) { | ||
| 47 | - $fail('图片链接不正确'); | ||
| 48 | - } | ||
| 49 | - } | ||
| 50 | - }], | 41 | + 'gallery' => ['required', 'array'], |
| 42 | + 'icon' => 'required|array', | ||
| 51 | 'attrs' => ['array', function ($attribute, $value, $fail) { | 43 | 'attrs' => ['array', function ($attribute, $value, $fail) { |
| 52 | foreach ($value as $v) { | 44 | foreach ($value as $v) { |
| 53 | if (empty($v['key'])) { | 45 | if (empty($v['key'])) { |
| @@ -2,6 +2,8 @@ | @@ -2,6 +2,8 @@ | ||
| 2 | 2 | ||
| 3 | namespace App\Models; | 3 | namespace App\Models; |
| 4 | 4 | ||
| 5 | +use App\Models\File\Image; | ||
| 6 | +use App\Services\CosService; | ||
| 5 | use Illuminate\Database\Eloquent\Model; | 7 | use Illuminate\Database\Eloquent\Model; |
| 6 | class Base extends Model | 8 | class Base extends Model |
| 7 | { | 9 | { |
| @@ -209,5 +211,29 @@ class Base extends Model | @@ -209,5 +211,29 @@ class Base extends Model | ||
| 209 | }); | 211 | }); |
| 210 | return $query; | 212 | return $query; |
| 211 | } | 213 | } |
| 212 | - | 214 | + /** |
| 215 | + * @remark :获取图片链接 | ||
| 216 | + * @name :getImageUrl | ||
| 217 | + * @author :lyh | ||
| 218 | + * @method :post | ||
| 219 | + * @time :2023/7/20 16:46 | ||
| 220 | + */ | ||
| 221 | + public function getImageUrl($hash){ | ||
| 222 | + if(is_array($hash)){ | ||
| 223 | + $url = []; | ||
| 224 | + foreach ($hash as $k => $v){ | ||
| 225 | + $url['images_link'][$k] = $this->getImageUrl($v); | ||
| 226 | + } | ||
| 227 | + }else{ | ||
| 228 | + $imageModel = new Image(); | ||
| 229 | + $info = $imageModel->read(['hash'=>$hash]); | ||
| 230 | + if($info['is_cos'] == 1){ | ||
| 231 | + $cos = new CosService(); | ||
| 232 | + $url = $cos->getImageUrl($info['path']); | ||
| 233 | + }else{ | ||
| 234 | + $url = url('b/image/'.$info['hash']); | ||
| 235 | + } | ||
| 236 | + } | ||
| 237 | + return $url; | ||
| 238 | + } | ||
| 213 | } | 239 | } |
| @@ -33,27 +33,49 @@ class Product extends Base | @@ -33,27 +33,49 @@ class Product extends Base | ||
| 33 | } | 33 | } |
| 34 | 34 | ||
| 35 | public function setThumbAttribute($value){ | 35 | public function setThumbAttribute($value){ |
| 36 | - $value['url'] = Upload::url2path($value['url']); | ||
| 37 | $this->attributes['thumb'] = Arr::a2s($value); | 36 | $this->attributes['thumb'] = Arr::a2s($value); |
| 38 | } | 37 | } |
| 39 | 38 | ||
| 40 | public function getThumbAttribute($value){ | 39 | public function getThumbAttribute($value){ |
| 41 | $value = Arr::s2a($value); | 40 | $value = Arr::s2a($value); |
| 42 | - $value['url'] = Upload::path2url($value['url']); | 41 | + $value['url'] = $this->getImageUrl($value['url']); |
| 43 | return $value; | 42 | return $value; |
| 44 | } | 43 | } |
| 45 | 44 | ||
| 46 | public function setGalleryAttribute($value){ | 45 | public function setGalleryAttribute($value){ |
| 47 | - foreach ($value as &$v){ | ||
| 48 | - $v['url'] = Upload::url2path($v['url']); | ||
| 49 | - } | ||
| 50 | $this->attributes['gallery'] = Arr::a2s($value); | 46 | $this->attributes['gallery'] = Arr::a2s($value); |
| 51 | } | 47 | } |
| 52 | 48 | ||
| 53 | public function getGalleryAttribute($value){ | 49 | public function getGalleryAttribute($value){ |
| 54 | $value = Arr::s2a($value); | 50 | $value = Arr::s2a($value); |
| 55 | foreach ($value as &$v){ | 51 | foreach ($value as &$v){ |
| 56 | - $v['url'] = Upload::path2url($v['url']); | 52 | + $v['url'] = $this->getImageUrl($v['url']); |
| 53 | + } | ||
| 54 | + return $value; | ||
| 55 | + } | ||
| 56 | + | ||
| 57 | + /** | ||
| 58 | + * @remark :图标获取器 | ||
| 59 | + * @name :getGalleryAttribute | ||
| 60 | + * @author :lyh | ||
| 61 | + * @method :post | ||
| 62 | + * @time :2023/7/21 11:11 | ||
| 63 | + */ | ||
| 64 | + public function setIconAttribute($value){ | ||
| 65 | + $this->attributes['icon'] = Arr::a2s($value); | ||
| 66 | + } | ||
| 67 | + | ||
| 68 | + /** | ||
| 69 | + * @remark :图标获取器 | ||
| 70 | + * @name :getGalleryAttribute | ||
| 71 | + * @author :lyh | ||
| 72 | + * @method :post | ||
| 73 | + * @time :2023/7/21 11:11 | ||
| 74 | + */ | ||
| 75 | + public function getIconAttribute($value){ | ||
| 76 | + $value = Arr::s2a($value); | ||
| 77 | + foreach ($value as &$v){ | ||
| 78 | + $v = $this->getImageUrl($v); | ||
| 57 | } | 79 | } |
| 58 | return $value; | 80 | return $value; |
| 59 | } | 81 | } |
-
请 注册 或 登录 后发表评论