作者 刘锟

Merge remote-tracking branch 'origin/master' into akun

@@ -55,7 +55,7 @@ class UpdateRoute extends Command @@ -55,7 +55,7 @@ class UpdateRoute extends Command
55 */ 55 */
56 public function handle(){ 56 public function handle(){
57 $projectModel = new Project(); 57 $projectModel = new Project();
58 - $list = $projectModel->list(['id'=>627]); 58 + $list = $projectModel->list(['is_upgrade'=>0]);
59 $data = []; 59 $data = [];
60 foreach ($list as $v){ 60 foreach ($list as $v){
61 echo date('Y-m-d H:i:s') . 'project_id:'.$v['id'] . PHP_EOL; 61 echo date('Y-m-d H:i:s') . 'project_id:'.$v['id'] . PHP_EOL;
@@ -115,11 +115,11 @@ class UpdateRoute extends Command @@ -115,11 +115,11 @@ class UpdateRoute extends Command
115 foreach ($lists as $v){ 115 foreach ($lists as $v){
116 if(!empty($v['route'])){ 116 if(!empty($v['route'])){
117 $tag = "-tag"; 117 $tag = "-tag";
118 - if (!(substr($v['route'], -strlen($tag)) === $tag)) { 118 + if ((substr($v['route'], -strlen($tag)) === $tag)) {
119 echo date('Y-m-d H:i:s') . '拼接 :'.$v['id'] . PHP_EOL; 119 echo date('Y-m-d H:i:s') . '拼接 :'.$v['id'] . PHP_EOL;
120 // $route = Translate::tran($v['route'], 'en').$tag; 120 // $route = Translate::tran($v['route'], 'en').$tag;
121 // 如果不是以 '-tag' 结尾,则拼接上 '-tag' 121 // 如果不是以 '-tag' 结尾,则拼接上 '-tag'
122 - $route = $v['route'].$tag; 122 + $route = trim($v['route'],'-tag');
123 $route = RouteMap::setRoute($route, RouteMap::SOURCE_PRODUCT_KEYWORD, $v['id'], $v['project_id']); 123 $route = RouteMap::setRoute($route, RouteMap::SOURCE_PRODUCT_KEYWORD, $v['id'], $v['project_id']);
124 $keywordModel->edit(['route'=>$route],['id'=>$v['id']]); 124 $keywordModel->edit(['route'=>$route],['id'=>$v['id']]);
125 // }else{ 125 // }else{
@@ -127,10 +127,10 @@ class UpdateRoute extends Command @@ -127,10 +127,10 @@ class UpdateRoute extends Command
127 // $route = RouteMap::setRoute($route, RouteMap::SOURCE_PRODUCT_KEYWORD, $v['id'], $v['project_id']); 127 // $route = RouteMap::setRoute($route, RouteMap::SOURCE_PRODUCT_KEYWORD, $v['id'], $v['project_id']);
128 // $keywordModel->edit(['route'=>$route],['id'=>$v['id']]); 128 // $keywordModel->edit(['route'=>$route],['id'=>$v['id']]);
129 } 129 }
130 - }else{  
131 - echo date('Y-m-d H:i:s') . 'id :'.$v['id'] . PHP_EOL;  
132 - $route = RouteMap::setRoute($v['title'], RouteMap::SOURCE_PRODUCT_KEYWORD, $v['id'], $v['project_id']);  
133 - $keywordModel->edit(['route'=>$route],['id'=>$v['id']]); 130 +// }else{
  131 +// echo date('Y-m-d H:i:s') . 'id :'.$v['id'] . PHP_EOL;
  132 +// $route = RouteMap::setRoute($v['title'], RouteMap::SOURCE_PRODUCT_KEYWORD, $v['id'], $v['project_id']);
  133 +// $keywordModel->edit(['route'=>$route],['id'=>$v['id']]);
134 } 134 }
135 echo date('Y-m-d H:i:s') . 'end :' . PHP_EOL; 135 echo date('Y-m-d H:i:s') . 'end :' . PHP_EOL;
136 } 136 }
@@ -477,7 +477,9 @@ if (!function_exists('getImageUrl')) { @@ -477,7 +477,9 @@ if (!function_exists('getImageUrl')) {
477 $cosCdn = ($storage_type == 0) ? $cos['cdn'] : $cos['cdn1']; 477 $cosCdn = ($storage_type == 0) ? $cos['cdn'] : $cos['cdn1'];
478 $url = $cosCdn.$path; 478 $url = $cosCdn.$path;
479 }else{ 479 }else{
480 - $url = url($path); 480 + $s3 = config('filesystems.disks.s3');
  481 + $cdn = $s3['cdn'];
  482 + $url = $cdn.$path;
481 } 483 }
482 } 484 }
483 return $url; 485 return $url;
@@ -513,7 +515,9 @@ if (!function_exists('getFileUrl')) { @@ -513,7 +515,9 @@ if (!function_exists('getFileUrl')) {
513 $cosCdn = ($storage_type == 0) ? $cos['cdn'] : $cos['cdn1']; 515 $cosCdn = ($storage_type == 0) ? $cos['cdn'] : $cos['cdn1'];
514 $url = $cosCdn.$path; 516 $url = $cosCdn.$path;
515 }else{ 517 }else{
516 - $url = url($path); 518 + $s3 = config('filesystems.disks.s3');
  519 + $cdn = $s3['cdn'];
  520 + $url = $cdn.$path;
517 } 521 }
518 } 522 }
519 return $url; 523 return $url;
@@ -102,8 +102,9 @@ class LoginController extends BaseController @@ -102,8 +102,9 @@ class LoginController extends BaseController
102 * @method :post 102 * @method :post
103 * @time :2023/8/19 9:13 103 * @time :2023/8/19 9:13
104 */ 104 */
105 - public function sendLoginSms($type = SmsLog::TYPE_LOGIN) 105 + public function sendLoginSms()
106 { 106 {
  107 + $type = $this->request->post('type',SmsLog::TYPE_LOGIN);
107 $this->request->validate([ 108 $this->request->validate([
108 'mobile'=>['required', 'regex:/^1[3-9]\d{9}$/'], 109 'mobile'=>['required', 'regex:/^1[3-9]\d{9}$/'],
109 ],[ 110 ],[
@@ -78,25 +78,25 @@ class ProductController extends BaseController @@ -78,25 +78,25 @@ class ProductController extends BaseController
78 public function getHandleFileImage($v){ 78 public function getHandleFileImage($v){
79 //ToDo::处理图片及文件 79 //ToDo::处理图片及文件
80 if(!empty($v['thumb']) && !empty($v['thumb']['url'])){ 80 if(!empty($v['thumb']) && !empty($v['thumb']['url'])){
81 - $v['thumb']['url'] = getImageUrl($v['thumb']['url'],$this->user['project_location'],$this->user['storage_type']); 81 + $v['thumb']['url'] = getImageUrl($v['thumb']['url'],$this->user['project_location'] ?? 0,$this->user['storage_type'] ?? 0);
82 } 82 }
83 if(!empty($v['gallery'])){ 83 if(!empty($v['gallery'])){
84 foreach ($v['gallery'] as $gallery_k => $gallery_v){ 84 foreach ($v['gallery'] as $gallery_k => $gallery_v){
85 - $gallery_v['url'] = getImageUrl($gallery_v['url'],$this->user['project_location'],$this->user['storage_type']); 85 + $gallery_v['url'] = getImageUrl($gallery_v['url'],$this->user['project_location'] ?? 0,$this->user['storage_type'] ?? 0);
86 $v['gallery'][$gallery_k] = $gallery_v; 86 $v['gallery'][$gallery_k] = $gallery_v;
87 } 87 }
88 } 88 }
89 if(!empty($v['icon'])){ 89 if(!empty($v['icon'])){
90 foreach ($v['icon'] as $icon_k => $icon_v){ 90 foreach ($v['icon'] as $icon_k => $icon_v){
91 - $icon_v = getImageUrl($icon_v,$this->user['project_location'],$this->user['storage_type']); 91 + $icon_v = getImageUrl($icon_v,$this->user['project_location'] ?? 0,$this->user['storage_type'] ?? 0);
92 $v['icon'][$icon_k] = $icon_v; 92 $v['icon'][$icon_k] = $icon_v;
93 } 93 }
94 } 94 }
95 if(!empty($v['video']) && !empty($v['video']['url'])){ 95 if(!empty($v['video']) && !empty($v['video']['url'])){
96 - $v['video']['url'] = getImageUrl($v['video']['url'],$this->user['project_location'],$this->user['storage_type']); 96 + $v['video']['url'] = getImageUrl($v['video']['url'],$this->user['project_location'] ?? 0,$this->user['storage_type'] ?? 0);
97 } 97 }
98 if(!empty($v['files']) && !empty($v['files']['url'])){ 98 if(!empty($v['files']) && !empty($v['files']['url'])){
99 - $v['files']['url'] = getImageUrl($v['files']['url'],$this->user['project_location'],$this->user['storage_type']); 99 + $v['files']['url'] = getImageUrl($v['files']['url'],$this->user['project_location'] ?? 0,$this->user['storage_type'] ?? 0);
100 } 100 }
101 return $this->success($v); 101 return $this->success($v);
102 } 102 }
@@ -16,6 +16,7 @@ use App\Models\Scoring\RatingQuestion; @@ -16,6 +16,7 @@ use App\Models\Scoring\RatingQuestion;
16 use App\Models\Scoring\ScoringSystem; 16 use App\Models\Scoring\ScoringSystem;
17 use App\Models\Sms\SmsLog; 17 use App\Models\Sms\SmsLog;
18 use App\Models\User\User; 18 use App\Models\User\User;
  19 +use Illuminate\Support\Facades\Cache;
19 use Mrgoon\AliSms\AliSms; 20 use Mrgoon\AliSms\AliSms;
20 21
21 /** 22 /**
@@ -27,22 +28,6 @@ use Mrgoon\AliSms\AliSms; @@ -27,22 +28,6 @@ use Mrgoon\AliSms\AliSms;
27 */ 28 */
28 class RatingController extends BaseController 29 class RatingController extends BaseController
29 { 30 {
30 - /**  
31 - * @remark :获取问卷调查记录(阶段记录)  
32 - * @name :getHistory  
33 - * @author :lyh  
34 - * @method :post  
35 - * @time :2024/1/20 15:03  
36 - */  
37 - public function getHistory(ScoringSystem $scoringSystem){  
38 - $this->request->validate([  
39 - 'type' => 'required',  
40 - ],[  
41 - 'type.required' => '问题类型不能为空',  
42 - ]);  
43 - $info = $scoringSystem->read($this->map);  
44 - $this->response('success',Code::SUCCESS,$info);  
45 - }  
46 31
47 /** 32 /**
48 * @remark :问卷调查详情 33 * @remark :问卷调查详情
@@ -72,9 +57,11 @@ class RatingController extends BaseController @@ -72,9 +57,11 @@ class RatingController extends BaseController
72 $this->request->validate([ 57 $this->request->validate([
73 'data' => 'required', 58 'data' => 'required',
74 'mobile' => 'required', 59 'mobile' => 'required',
  60 + 'type'=> 'required'
75 ],[ 61 ],[
76 'data.required' => '请填写完整', 62 'data.required' => '请填写完整',
77 'mobile.required' => '手机号码不能为空', 63 'mobile.required' => '手机号码不能为空',
  64 + 'type.required' => '阶段不能为空',
78 ]); 65 ]);
79 $ratingLogic->ratingSave(); 66 $ratingLogic->ratingSave();
80 $this->response('success'); 67 $this->response('success');
@@ -111,7 +111,7 @@ class FileController @@ -111,7 +111,7 @@ class FileController
111 //查看文件是否存在 111 //查看文件是否存在
112 $fileModel = new File(); 112 $fileModel = new File();
113 //查看图片是否已上传 113 //查看图片是否已上传
114 - $param = ['hash'=>$hash,'refer'=>$this->param['refer'] ?? 0]; 114 + $param = ['hash'=>$hash,'refer'=>$this->param['refer'] ?? 0,'is_cos'=>(($this->upload_location == 0) ? 1 : 0)];
115 if(isset($this->cache['project_id']) && !empty($this->cache['project_id'])){ 115 if(isset($this->cache['project_id']) && !empty($this->cache['project_id'])){
116 $param['project_id'] = $this->cache['project_id']; 116 $param['project_id'] = $this->cache['project_id'];
117 } 117 }
@@ -223,7 +223,7 @@ class FileController @@ -223,7 +223,7 @@ class FileController
223 $fileModel = new File(); 223 $fileModel = new File();
224 $name = $file->getClientOriginalName(); 224 $name = $file->getClientOriginalName();
225 $hash = hash_file('md5', $file->getPathname()); 225 $hash = hash_file('md5', $file->getPathname());
226 - $param = ['hash'=>$hash,'refer'=>$this->param['refer'] ?? 0]; 226 + $param = ['hash'=>$hash,'refer'=>$this->param['refer'] ?? 0,'is_cos'=>(($this->upload_location == 0) ? 1 : 0)];
227 if(isset($this->cache['project_id']) && !empty($this->cache['project_id'])){ 227 if(isset($this->cache['project_id']) && !empty($this->cache['project_id'])){
228 $param['project_id'] = $this->cache['project_id']; 228 $param['project_id'] = $this->cache['project_id'];
229 } 229 }
@@ -185,7 +185,7 @@ class ImageController extends Controller @@ -185,7 +185,7 @@ class ImageController extends Controller
185 //查看文件是否存在 185 //查看文件是否存在
186 $imageModel = new ImageModel(); 186 $imageModel = new ImageModel();
187 //查看图片是否已上传 187 //查看图片是否已上传
188 - $param = ['hash'=>$hash,'refer'=>$this->param['refer'] ?? 0]; 188 + $param = ['hash'=>$hash,'refer'=>$this->param['refer'] ?? 0,'is_cos'=>(($this->upload_location == 0) ? 1 : 0)];
189 if(isset($this->cache['project_id']) && !empty($this->cache['project_id'])){ 189 if(isset($this->cache['project_id']) && !empty($this->cache['project_id'])){
190 $param['project_id'] = $this->cache['project_id']; 190 $param['project_id'] = $this->cache['project_id'];
191 } 191 }
@@ -268,7 +268,7 @@ class ImageController extends Controller @@ -268,7 +268,7 @@ class ImageController extends Controller
268 $hash = hash_file('md5', $file->getPathname()); 268 $hash = hash_file('md5', $file->getPathname());
269 $name = $file->getClientOriginalName(); 269 $name = $file->getClientOriginalName();
270 //查看图片是否已上传 270 //查看图片是否已上传
271 - $param = ['hash'=>$hash,'refer'=>$this->param['refer'] ?? 0]; 271 + $param = ['hash'=>$hash,'refer'=>$this->param['refer'] ?? 0,'is_cos'=>(($this->upload_location == 0) ? 1 : 0)];
272 if(isset($this->cache['project_id']) && !empty($this->cache['project_id'])){ 272 if(isset($this->cache['project_id']) && !empty($this->cache['project_id'])){
273 $param['project_id'] = $this->cache['project_id']; 273 $param['project_id'] = $this->cache['project_id'];
274 } 274 }
@@ -277,7 +277,6 @@ class ImageController extends Controller @@ -277,7 +277,6 @@ class ImageController extends Controller
277 $data[] = $this->responseData($image_hash['path']); 277 $data[] = $this->responseData($image_hash['path']);
278 continue; 278 continue;
279 } 279 }
280 - $url = $this->config['root'].$this->path;  
281 $image_type = $file->getClientOriginalExtension(); 280 $image_type = $file->getClientOriginalExtension();
282 $fileName = uniqid().rand(10000,99999).'.'.$image_type; 281 $fileName = uniqid().rand(10000,99999).'.'.$image_type;
283 //同步数据到cos 282 //同步数据到cos
@@ -287,7 +286,7 @@ class ImageController extends Controller @@ -287,7 +286,7 @@ class ImageController extends Controller
287 }else{ 286 }else{
288 //TODO::上传亚马逊 287 //TODO::上传亚马逊
289 $amazonS3Service = new AmazonS3Service(); 288 $amazonS3Service = new AmazonS3Service();
290 - $amazonS3Service->uploadFiles($files,$this->path,$fileName); 289 + $amazonS3Service->uploadFiles($file,$this->path,$fileName);
291 } 290 }
292 //批量存储 291 //批量存储
293 $this->saveMysql($imageModel,$file->getSize(),$image_type,$fileName,$hash,$this->upload_location,$file->getMimeType(),$name); 292 $this->saveMysql($imageModel,$file->getSize(),$image_type,$fileName,$hash,$this->upload_location,$file->getMimeType(),$name);
@@ -66,7 +66,7 @@ class KeywordLogic extends BaseLogic @@ -66,7 +66,7 @@ class KeywordLogic extends BaseLogic
66 }else{ 66 }else{
67 $info = $this->model->read(['title'=>$this->param['title']]); 67 $info = $this->model->read(['title'=>$this->param['title']]);
68 if($info !== false){ 68 if($info !== false){
69 - $this->fail('当前title已存在'); 69 + return $this->success(['id'=>$info['id']]);
70 } 70 }
71 $this->param = $this->addHandleParam($this->param); 71 $this->param = $this->addHandleParam($this->param);
72 $id = $this->model->insertGetId($this->param); 72 $id = $this->model->insertGetId($this->param);
@@ -54,7 +54,29 @@ class RatingLogic extends BaseLogic @@ -54,7 +54,29 @@ class RatingLogic extends BaseLogic
54 'data'=>json_encode($this->param['data']), 54 'data'=>json_encode($this->param['data']),
55 'mobile'=>$this->param['mobile'], 55 'mobile'=>$this->param['mobile'],
56 'project_id'=>$this->user['project_id'], 56 'project_id'=>$this->user['project_id'],
  57 + 'type'=>$this->param['type']
57 ]; 58 ];
58 - return $this->scoringModel->add($param); 59 + $this->scoringModel->add($param);
  60 + return $this->httpSore($this->param['data'],$this->project['post_id'],$this->param['type']);
  61 + }
  62 +
  63 + /**
  64 + * @remark :同步数据
  65 + * @name :httpSore
  66 + * @author :lyh
  67 + * @method :post
  68 + * @time :2024/1/24 15:04
  69 + */
  70 + public function httpSore($data,$postId,$fType){
  71 + $fType = (int)($fType + 1);
  72 + $token = md5('qqs'.$postId.$fType.date("Y-m-d"));
  73 + //$ftype 2,3,4
  74 + $str = '';
  75 + foreach ($data as $k => $v){
  76 + $str .= 'name_'.(int)($k+1).'='.($v['level'] ?? 5).'&';
  77 + }
  78 + $str = trim($str,'&');
  79 + $url = "http://www.quanqiusou.cn/extend_api/api/service_score.php?postid=$postId&token=$token&ftype=$fType&$str";
  80 + return http_get($url,['charset=utf-8']);
59 } 81 }
60 } 82 }
@@ -8,6 +8,7 @@ use App\Exceptions\BsideGlobalException; @@ -8,6 +8,7 @@ use App\Exceptions\BsideGlobalException;
8 use App\Helper\Common; 8 use App\Helper\Common;
9 use App\Models\Domain\DomainInfo; 9 use App\Models\Domain\DomainInfo;
10 use App\Models\Project\Project; 10 use App\Models\Project\Project;
  11 +use App\Models\Scoring\ScoringSystem;
11 use App\Models\Sms\SmsLog; 12 use App\Models\Sms\SmsLog;
12 use App\Models\User\ProjectRole as ProjectRoleModel; 13 use App\Models\User\ProjectRole as ProjectRoleModel;
13 use App\Models\User\User; 14 use App\Models\User\User;
@@ -170,6 +171,7 @@ class UserLoginLogic @@ -170,6 +171,7 @@ class UserLoginLogic
170 $info['upload_config'] = $project['upload_config']; 171 $info['upload_config'] = $project['upload_config'];
171 $info['main_lang_id'] = $project['main_lang_id']; 172 $info['main_lang_id'] = $project['main_lang_id'];
172 $info['image_max'] = $project['image_max']; 173 $info['image_max'] = $project['image_max'];
  174 + $info['uptime_type'] = $this->getHistory($project);
173 $info['uptime'] = $project['uptime']; 175 $info['uptime'] = $project['uptime'];
174 $info['storage_type'] = $project['storage_type']; 176 $info['storage_type'] = $project['storage_type'];
175 $info['project_location'] = $project['project_location']; 177 $info['project_location'] = $project['project_location'];
@@ -180,10 +182,57 @@ class UserLoginLogic @@ -180,10 +182,57 @@ class UserLoginLogic
180 $info['is_visualization'] = json_decode($project['is_visualization']); 182 $info['is_visualization'] = json_decode($project['is_visualization']);
181 } 183 }
182 //保存项目缓存 184 //保存项目缓存
183 - Cache::put('user-'.$info['project_id'],$project,$minutes = null); 185 + Cache::put('user-'.$info['project_id'],$project,12 * 3600);
184 return $this->success($info); 186 return $this->success($info);
185 } 187 }
186 188
  189 + /**
  190 + * @remark :获取问卷调查记录(阶段记录)
  191 + * @name :getHistory
  192 + * @author :lyh
  193 + * @method :post
  194 + * @time :2024/1/20 15:03
  195 + */
  196 + public function getHistory($projectInfo){
  197 + if(!$projectInfo){
  198 + return $this->success(0);
  199 + }
  200 + //建站中直接返回
  201 + if($projectInfo['type'] == 1){
  202 + return $this->success(0);
  203 + }
  204 + //上线项目判断当前属于第几阶段
  205 + if(empty($projectInfo['uptime'])){
  206 + return $this->success(0);
  207 + }
  208 + //获取上线时间30天后
  209 + $after30Days = date('Y-m-d H:i:s', strtotime($projectInfo['uptime'] . ' +30 days'));
  210 + $afterThreeMonths = date('Y-m-d H:i:s', strtotime($projectInfo['uptime'] . ' +3 months'));
  211 + $afterSixMonths = date('Y-m-d H:i:s', strtotime($projectInfo['uptime'] . ' +6 months'));
  212 + $afterOneYear = date('Y-m-d H:i:s', strtotime($projectInfo['uptime'] . ' +1 year'));
  213 + //获取当前时间
  214 + $date = date('Y-m-d H:i:s');
  215 + $scoringSystem = new ScoringSystem();
  216 + if($date <= $after30Days){
  217 + $info = $scoringSystem->read(['type'=>1]);//第一阶段是否有值
  218 + if($info === false){
  219 + return $this->success(1);
  220 + }
  221 + }
  222 + if($date >= $afterThreeMonths && $date <= $afterSixMonths){
  223 + $info = $scoringSystem->read(['type'=>2]);//第一阶段是否有值
  224 + if($info === false){
  225 + return $this->success(2);
  226 + }
  227 + }
  228 + if($date >= $afterOneYear){
  229 + $info = $scoringSystem->read(['type'=>3]);//第一阶段是否有值
  230 + if($info === false){
  231 + return $this->success(3);
  232 + }
  233 + }
  234 + return $this->success(0);
  235 + }
187 236
188 /** 237 /**
189 * @remark :组装返回数据 238 * @remark :组装返回数据
@@ -212,6 +261,7 @@ class UserLoginLogic @@ -212,6 +261,7 @@ class UserLoginLogic
212 $info['upload_config'] = $project['upload_config']; 261 $info['upload_config'] = $project['upload_config'];
213 $info['main_lang_id'] = $project['main_lang_id']; 262 $info['main_lang_id'] = $project['main_lang_id'];
214 $info['image_max'] = $project['image_max']; 263 $info['image_max'] = $project['image_max'];
  264 + $info['uptime_type'] = $this->getHistory($project);
215 $info['uptime'] = $project['uptime']; 265 $info['uptime'] = $project['uptime'];
216 $info['is_update_language'] = $project['is_update_language']; 266 $info['is_update_language'] = $project['is_update_language'];
217 $info['configuration'] = $project['deploy_build']['configuration']; 267 $info['configuration'] = $project['deploy_build']['configuration'];
@@ -222,7 +272,7 @@ class UserLoginLogic @@ -222,7 +272,7 @@ class UserLoginLogic
222 $info['is_visualization'] = json_decode($project['is_visualization']); 272 $info['is_visualization'] = json_decode($project['is_visualization']);
223 } 273 }
224 //保存项目缓存 274 //保存项目缓存
225 - Cache::put('user-'.$info['project_id'],$project,$minutes = null); 275 + Cache::put('user-'.$info['project_id'],$project,12 * 3600);
226 return $this->success($info); 276 return $this->success($info);
227 } 277 }
228 278
@@ -61,9 +61,6 @@ class RouteMap extends Base @@ -61,9 +61,6 @@ class RouteMap extends Base
61 $info = self::where(['project_id' => $project_id, 'source' => $source, 'source_id'=>$source_id])->first(); 61 $info = self::where(['project_id' => $project_id, 'source' => $source, 'source_id'=>$source_id])->first();
62 $suffix = ''; 62 $suffix = '';
63 if(empty($info)){ 63 if(empty($info)){
64 - if($source == self::SOURCE_PRODUCT_KEYWORD){  
65 - $suffix = '-tag';  
66 - }  
67 if($source == self::SOURCE_PRODUCT){ 64 if($source == self::SOURCE_PRODUCT){
68 $suffix = '-product'; 65 $suffix = '-product';
69 } 66 }
@@ -17,8 +17,8 @@ class AmazonS3Service @@ -17,8 +17,8 @@ class AmazonS3Service
17 protected $s3; 17 protected $s3;
18 protected $accessKeyId = 'AKIAU6YKND7SAWIKBXCZ';//key 18 protected $accessKeyId = 'AKIAU6YKND7SAWIKBXCZ';//key
19 protected $secretAccessKey = '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';//密匙 19 protected $secretAccessKey = 'Hwd2abya/2Icu6NMDo4YrdTqCtir1BeTuUj5kEkB';//密匙
20 - protected $region = 's3://arn:aws:s3:us-west-2:340934860772:accesspoint/globalso-v6';//地址  
21 - protected $bucket = 'arn:aws:s3:::globalso-v6';//桶子 20 + protected $region = 'us-west-2';//地址
  21 + protected $bucket = 'arn:aws:s3:us-west-2:340934860772:accesspoint/globalso-v6';//桶子
22 22
23 public function __construct() 23 public function __construct()
24 { 24 {
@@ -40,19 +40,21 @@ class AmazonS3Service @@ -40,19 +40,21 @@ class AmazonS3Service
40 * @method :post 40 * @method :post
41 * @time :2024/1/23 9:20 41 * @time :2024/1/23 9:20
42 */ 42 */
43 - public function uploadFiles(&$files, $s3Key,$filename ,$binary = false) 43 + public function uploadFiles(&$files, $s3Key,$filename)
44 { 44 {
45 - $key = $s3Key.'/'.$filename;  
46 - $Body = $binary ? $files : fopen($files->getRealPath(), 'r'); 45 + $key = ltrim($s3Key.'/'.$filename,'/');
  46 + $body = $files->getRealPath();
47 try { 47 try {
48 $result = $this->s3->putObject([ 48 $result = $this->s3->putObject([
49 'Bucket' => $this->bucket, 49 'Bucket' => $this->bucket,
50 'Key' => $key, 50 'Key' => $key,
51 - 'SourceFile' => $Body,  
52 - 'ACL' => 'public-read', // 设置图片为公共可读,可根据需求修改 51 + 'SourceFile' => $body,
  52 +// 'ACL' => 'public-read', // 设置图片为公共可读,可根据需求修改
53 ]); 53 ]);
  54 + @file_put_contents(storage_path('logs/lyh_error.log'), var_export('ok:'.$result['ObjectURL'], true) . PHP_EOL, FILE_APPEND);
54 return $result['ObjectURL']; 55 return $result['ObjectURL'];
55 } catch (S3Exception $e) { 56 } catch (S3Exception $e) {
  57 + @file_put_contents(storage_path('logs/lyh_error.log'), var_export('失败'.$e->getMessage(), true) . PHP_EOL, FILE_APPEND);
56 return false; 58 return false;
57 } 59 }
58 } 60 }
@@ -51,6 +51,7 @@ return [ @@ -51,6 +51,7 @@ return [
51 'url' => env('AWS_URL'), 51 'url' => env('AWS_URL'),
52 'endpoint' => env('AWS_ENDPOINT'), 52 'endpoint' => env('AWS_ENDPOINT'),
53 'use_path_style_endpoint' => env('AWS_USE_PATH_STYLE_ENDPOINT', false), 53 'use_path_style_endpoint' => env('AWS_USE_PATH_STYLE_ENDPOINT', false),
  54 + 'cdn'=>'https://globalso-v6.s3.us-west-2.amazonaws.com'
54 ], 55 ],
55 56
56 'upload' => [ 57 'upload' => [
@@ -484,7 +484,6 @@ Route::middleware(['bloginauth'])->group(function () { @@ -484,7 +484,6 @@ Route::middleware(['bloginauth'])->group(function () {
484 Route::prefix('rating')->group(function () { 484 Route::prefix('rating')->group(function () {
485 Route::any('/read', [\App\Http\Controllers\Bside\Scoring\RatingController::class, 'getProjectRead'])->name('rating_getProjectRead'); 485 Route::any('/read', [\App\Http\Controllers\Bside\Scoring\RatingController::class, 'getProjectRead'])->name('rating_getProjectRead');
486 Route::any('/save', [\App\Http\Controllers\Bside\Scoring\RatingController::class, 'save'])->name('rating_save'); 486 Route::any('/save', [\App\Http\Controllers\Bside\Scoring\RatingController::class, 'save'])->name('rating_save');
487 - Route::any('/getHistory', [\App\Http\Controllers\Bside\Scoring\RatingController::class, 'getHistory'])->name('rating_getHistory');  
488 Route::any('/code', [\App\Http\Controllers\Bside\Scoring\RatingController::class, 'verificationCode'])->name('rating_code'); 487 Route::any('/code', [\App\Http\Controllers\Bside\Scoring\RatingController::class, 'verificationCode'])->name('rating_code');
489 }); 488 });
490 }); 489 });