作者 张关杰

Merge branch 'develop' of http://47.244.231.31:8099/zhl/globalso-v6 into bate

@@ -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');
@@ -54,7 +54,31 @@ class RatingLogic extends BaseLogic @@ -54,7 +54,31 @@ 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 + @file_put_contents(storage_path('logs/lyh_error.log'), var_export($url, true) . PHP_EOL, FILE_APPEND);
  81 + dd();
  82 +// return http_get($url,['charset=utf-8']);
59 } 83 }
60 } 84 }
@@ -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,7 +171,7 @@ class UserLoginLogic @@ -170,7 +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'];
173 - $info['uptime'] = $project['uptime']; 174 + $info['uptime_type'] = $this->getHistory($project);
174 $info['storage_type'] = $project['storage_type']; 175 $info['storage_type'] = $project['storage_type'];
175 $info['project_location'] = $project['project_location']; 176 $info['project_location'] = $project['project_location'];
176 $info['is_update_language'] = $project['is_update_language']; 177 $info['is_update_language'] = $project['is_update_language'];
@@ -180,10 +181,57 @@ class UserLoginLogic @@ -180,10 +181,57 @@ class UserLoginLogic
180 $info['is_visualization'] = json_decode($project['is_visualization']); 181 $info['is_visualization'] = json_decode($project['is_visualization']);
181 } 182 }
182 //保存项目缓存 183 //保存项目缓存
183 - Cache::put('user-'.$info['project_id'],$project,$minutes = null); 184 + Cache::put('user-'.$info['project_id'],$project,12 * 3600);
184 return $this->success($info); 185 return $this->success($info);
185 } 186 }
186 187
  188 + /**
  189 + * @remark :获取问卷调查记录(阶段记录)
  190 + * @name :getHistory
  191 + * @author :lyh
  192 + * @method :post
  193 + * @time :2024/1/20 15:03
  194 + */
  195 + public function getHistory($projectInfo){
  196 + if(!$projectInfo){
  197 + return $this->success(0);
  198 + }
  199 + //建站中直接返回
  200 + if($projectInfo['type'] == 1){
  201 + return $this->success(0);
  202 + }
  203 + //上线项目判断当前属于第几阶段
  204 + if(empty($projectInfo['uptime'])){
  205 + return $this->success(0);
  206 + }
  207 + //获取上线时间30天后
  208 + $after30Days = date('Y-m-d H:i:s', strtotime($projectInfo['uptime'] . ' +30 days'));
  209 + $afterThreeMonths = date('Y-m-d H:i:s', strtotime($projectInfo['uptime'] . ' +3 months'));
  210 + $afterSixMonths = date('Y-m-d H:i:s', strtotime($projectInfo['uptime'] . ' +6 months'));
  211 + $afterOneYear = date('Y-m-d H:i:s', strtotime($projectInfo['uptime'] . ' +1 year'));
  212 + //获取当前时间
  213 + $date = date('Y-m-d H:i:s');
  214 + $scoringSystem = new ScoringSystem();
  215 + if($date <= $after30Days){
  216 + $info = $scoringSystem->read(['type'=>1]);//第一阶段是否有值
  217 + if($info === false){
  218 + return $this->success(1);
  219 + }
  220 + }
  221 + if($date >= $afterThreeMonths && $date <= $afterSixMonths){
  222 + $info = $scoringSystem->read(['type'=>2]);//第一阶段是否有值
  223 + if($info === false){
  224 + return $this->success(2);
  225 + }
  226 + }
  227 + if($date >= $afterOneYear){
  228 + $info = $scoringSystem->read(['type'=>3]);//第一阶段是否有值
  229 + if($info === false){
  230 + return $this->success(3);
  231 + }
  232 + }
  233 + return $this->success(0);
  234 + }
187 235
188 /** 236 /**
189 * @remark :组装返回数据 237 * @remark :组装返回数据
@@ -212,7 +260,7 @@ class UserLoginLogic @@ -212,7 +260,7 @@ class UserLoginLogic
212 $info['upload_config'] = $project['upload_config']; 260 $info['upload_config'] = $project['upload_config'];
213 $info['main_lang_id'] = $project['main_lang_id']; 261 $info['main_lang_id'] = $project['main_lang_id'];
214 $info['image_max'] = $project['image_max']; 262 $info['image_max'] = $project['image_max'];
215 - $info['uptime'] = $project['uptime']; 263 + $info['uptime_type'] = $this->getHistory($project);
216 $info['is_update_language'] = $project['is_update_language']; 264 $info['is_update_language'] = $project['is_update_language'];
217 $info['configuration'] = $project['deploy_build']['configuration']; 265 $info['configuration'] = $project['deploy_build']['configuration'];
218 $info['project_type'] = $project['type']; 266 $info['project_type'] = $project['type'];
@@ -222,7 +270,7 @@ class UserLoginLogic @@ -222,7 +270,7 @@ class UserLoginLogic
222 $info['is_visualization'] = json_decode($project['is_visualization']); 270 $info['is_visualization'] = json_decode($project['is_visualization']);
223 } 271 }
224 //保存项目缓存 272 //保存项目缓存
225 - Cache::put('user-'.$info['project_id'],$project,$minutes = null); 273 + Cache::put('user-'.$info['project_id'],$project,12 * 3600);
226 return $this->success($info); 274 return $this->success($info);
227 } 275 }
228 276
@@ -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 });