作者 张关杰

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

@@ -33,7 +33,7 @@ class UpgradeProjectCount extends Command @@ -33,7 +33,7 @@ class UpgradeProjectCount extends Command
33 protected $description = '升级项目统计'; 33 protected $description = '升级项目统计';
34 34
35 public function handle(){ 35 public function handle(){
36 - $project_id = 759; 36 + $project_id = 627;
37 ProjectServer::useProject($project_id); 37 ProjectServer::useProject($project_id);
38 $this->count($project_id); 38 $this->count($project_id);
39 DB::disconnect('custom_mysql'); 39 DB::disconnect('custom_mysql');
@@ -36,7 +36,7 @@ class UpgradeProjectCount extends Command @@ -36,7 +36,7 @@ class UpgradeProjectCount extends Command
36 protected $description = '升级项目统计'; 36 protected $description = '升级项目统计';
37 37
38 public function handle(){ 38 public function handle(){
39 - $project_id = 759; 39 + $project_id = 627;
40 $oldModel = new UpdateOldInfo(); 40 $oldModel = new UpdateOldInfo();
41 $info = $oldModel->read(['project_id'=>$project_id]); 41 $info = $oldModel->read(['project_id'=>$project_id]);
42 $url = $info['old_domain_online']; 42 $url = $info['old_domain_online'];
@@ -67,8 +67,9 @@ class UpgradeProjectCount extends Command @@ -67,8 +67,9 @@ class UpgradeProjectCount extends Command
67 $end = date('Y-m-t', strtotime($v['month'])); 67 $end = date('Y-m-t', strtotime($v['month']));
68 $arr['project_id'] = $project_id; 68 $arr['project_id'] = $project_id;
69 $res = $this->inquiry($url,$v['month']); 69 $res = $this->inquiry($url,$v['month']);
70 - $arr['month_total'] = 0; 70 +// $arr['month_total'] = 0;
71 if(isset($res['data']['count'])){ 71 if(isset($res['data']['count'])){
  72 + echo date('Y-m-d H:i:s') . '数据:'.$res['data']['count'] . PHP_EOL;
72 $arr['month_total'] = $res['data']['count']; 73 $arr['month_total'] = $res['data']['count'];
73 //获取上一个的count 74 //获取上一个的count
74 $previousMonth = date('Y-m', strtotime($v['month'] . ' -1 month')); 75 $previousMonth = date('Y-m', strtotime($v['month'] . ' -1 month'));
@@ -115,7 +116,6 @@ class UpgradeProjectCount extends Command @@ -115,7 +116,6 @@ class UpgradeProjectCount extends Command
115 ->first(); 116 ->first();
116 $arr['pv'] = $pv_ip->pv_num; 117 $arr['pv'] = $pv_ip->pv_num;
117 $arr['ip'] = $pv_ip->ip_num; 118 $arr['ip'] = $pv_ip->ip_num;
118 - $arr['month_total'] = $pv_ip->inquiry_num;  
119 if($arr['ip'] != 0){ 119 if($arr['ip'] != 0){
120 $arr['rate'] = round(($arr['month_total'] / $arr['ip']) * 10,2); 120 $arr['rate'] = round(($arr['month_total'] / $arr['ip']) * 10,2);
121 } 121 }
@@ -13,6 +13,8 @@ use App\Models\Com\UpdateOldInfo; @@ -13,6 +13,8 @@ use App\Models\Com\UpdateOldInfo;
13 use App\Models\CustomModule\CustomModule; 13 use App\Models\CustomModule\CustomModule;
14 use App\Models\CustomModule\CustomModuleCategory; 14 use App\Models\CustomModule\CustomModuleCategory;
15 use App\Models\CustomModule\CustomModuleContent; 15 use App\Models\CustomModule\CustomModuleContent;
  16 +use App\Models\CustomModule\CustomModuleExtend;
  17 +use App\Models\CustomModule\CustomModuleExtentContent;
16 use App\Models\News\News; 18 use App\Models\News\News;
17 use App\Models\News\NewsCategory; 19 use App\Models\News\NewsCategory;
18 use App\Models\Product\Category; 20 use App\Models\Product\Category;
@@ -566,6 +568,8 @@ class ProjectUpdate extends Command @@ -566,6 +568,8 @@ class ProjectUpdate extends Command
566 568
567 $model = new CustomModuleContent(); 569 $model = new CustomModuleContent();
568 $category_model = new CustomModuleCategory(); 570 $category_model = new CustomModuleCategory();
  571 + $extend_model = new CustomModuleExtend();
  572 + $extend_info_model = new CustomModuleExtentContent();
569 573
570 foreach ($items as $item) { 574 foreach ($items as $item) {
571 $route = $this->get_url_route($item['url'] ?? ''); 575 $route = $this->get_url_route($item['url'] ?? '');
@@ -581,6 +585,13 @@ class ProjectUpdate extends Command @@ -581,6 +585,13 @@ class ProjectUpdate extends Command
581 $category_id = $category_custom['id']; 585 $category_id = $category_custom['id'];
582 } 586 }
583 } 587 }
  588 + //图片
  589 + if (is_array($item['images'] ?? '')) {
  590 + $image = $item['images'][0] ?? '';
  591 + } else {
  592 + $image = $item['images'] ?? '';
  593 + }
  594 + $new_img = $this->source_download($image, $project_id, $domain_arr['host'], $web_url_domain, $home_url);
584 //名称去掉特殊符号 595 //名称去掉特殊符号
585 $item['title'] = $this->special2str($item['title'] ?? ''); 596 $item['title'] = $this->special2str($item['title'] ?? '');
586 597
@@ -593,6 +604,7 @@ class ProjectUpdate extends Command @@ -593,6 +604,7 @@ class ProjectUpdate extends Command
593 'module_id' => $custom_info['id'], 604 'module_id' => $custom_info['id'],
594 'category_id' => $category_id, 605 'category_id' => $category_id,
595 'content' => $item['content'] ?? '', 606 'content' => $item['content'] ?? '',
  607 + 'image' => $new_img,
596 'created_at' => $item['post_time'] ?? date('Y-m-d H:i:s'), 608 'created_at' => $item['post_time'] ?? date('Y-m-d H:i:s'),
597 'updated_at' => $item['post_time'] ?? date('Y-m-d H:i:s'), 609 'updated_at' => $item['post_time'] ?? date('Y-m-d H:i:s'),
598 'is_upgrade' => 1, 610 'is_upgrade' => 1,
@@ -608,8 +620,44 @@ class ProjectUpdate extends Command @@ -608,8 +620,44 @@ class ProjectUpdate extends Command
608 'name' => $item['title'], 620 'name' => $item['title'],
609 'category_id' => $category_id, 621 'category_id' => $category_id,
610 'content' => $item['content'] ?? '', 622 'content' => $item['content'] ?? '',
  623 + 'image' => $new_img
611 ], ['id' => $id]); 624 ], ['id' => $id]);
612 } 625 }
  626 +
  627 + //扩展字段
  628 + if ($item['extend'][0] ?? []) {
  629 + foreach ($item['extend'][0] as $ke => $ve) {
  630 + $extend = $extend_model->read(['title' => $ke]);
  631 + if ($extend) {
  632 + $extend_info = $extend_info_model->read(['key' => $extend['key'], 'content_id' => $id]);
  633 + if (!$extend_info) {
  634 + if ($extend['type'] == 3) {
  635 + $gallery = [];
  636 + if (is_array($ve)) {
  637 + foreach ($ve as $ve_img) {
  638 + $gallery[] = ['title' => '', 'description' => '', 'url' => $this->source_download($ve_img, $project_id, $domain_arr['host'], $web_url_domain, $home_url)];
  639 + }
  640 + }else{
  641 + $gallery[] = ['title' => '', 'description' => '', 'url' => $this->source_download($ve, $project_id, $domain_arr['host'], $web_url_domain, $home_url)];
  642 + }
  643 + $value = Arr::a2s($gallery);
  644 + } elseif ($extend['type'] == 4) {
  645 + $value = Arr::a2s([$this->source_download($ve, $project_id, $domain_arr['host'], $web_url_domain, $home_url)]);
  646 + } else {
  647 + $value = $ve;
  648 + }
  649 + $extend_info_model->add([
  650 + 'key' => $extend['key'],
  651 + 'type' => $extend['type'],
  652 + 'project_id' => $project_id,
  653 + 'content_id' => $id,
  654 + 'module_id' => $custom_info['id'],
  655 + 'values' => $value,
  656 + ]);
  657 + }
  658 + }
  659 + }
  660 + }
613 } catch (\Exception $e) { 661 } catch (\Exception $e) {
614 echo 'date:' . date('Y-m-d H:i:s') . ', task_id: ' . $task->id . ', error: ' . $e->getMessage() . PHP_EOL; 662 echo 'date:' . date('Y-m-d H:i:s') . ', task_id: ' . $task->id . ', error: ' . $e->getMessage() . PHP_EOL;
615 continue; 663 continue;
@@ -492,10 +492,8 @@ if (!function_exists('getFileUrl')) { @@ -492,10 +492,8 @@ if (!function_exists('getFileUrl')) {
492 * @time :2023/7/20 16:46 492 * @time :2023/7/20 16:46
493 */ 493 */
494 function getFileUrl($path,$location = 1){ 494 function getFileUrl($path,$location = 1){
495 - if(empty($path)){  
496 - return '';  
497 - }  
498 if(is_array($path)){ 495 if(is_array($path)){
  496 + $url =[];
499 foreach ($path as $v){ 497 foreach ($path as $v){
500 $url[] = getFileUrl($v); 498 $url[] = getFileUrl($v);
501 } 499 }
@@ -41,8 +41,6 @@ class BaseController extends Controller @@ -41,8 +41,6 @@ class BaseController extends Controller
41 $this->manage = $info; 41 $this->manage = $info;
42 Cache::put(Common::MANAGE_TOKEN . $this->token, $info, 3600 * 6);//更新缓存时间 42 Cache::put(Common::MANAGE_TOKEN . $this->token, $info, 3600 * 6);//更新缓存时间
43 $this->uid = $info['id']; 43 $this->uid = $info['id'];
44 - //写入操作记录  
45 -  
46 } 44 }
47 } 45 }
48 46
@@ -115,10 +115,25 @@ class UpdateController extends BaseController @@ -115,10 +115,25 @@ class UpdateController extends BaseController
115 $old_info->save(); 115 $old_info->save();
116 } 116 }
117 117
118 - UpdateLog::where('project_id', $this->param['project_id'])->whereNotIn('api_type', ['category', 'category_news', 'website_info', 'tag'])->update(['collect_status' => 0]); 118 + $logs = UpdateLog::where('project_id', $this->param['project_id'])->whereNotIn('api_type', ['category', 'category_news'])->get();
119 119
120 - if ($this->param['type'] == 2 && !$domain_info) {  
121 - UpdateLog::where('project_id', $this->param['project_id'])->whereNotIn('api_type', ['category', 'category_news'])->update(['status' => 0]); 120 + foreach ($logs as $log) {
  121 + if ($domain_info) {
  122 + $url_arr = parse_url($log->api_url);
  123 + $api_url = str_replace($url_arr['host'], $test_domain, $log->api_url);
  124 +
  125 + $log->api_url = $api_url;
  126 + $log->status = 0;
  127 + } else {
  128 + if ($this->param['type'] == 2) {
  129 + $log->status = 0;
  130 + }
  131 + }
  132 +
  133 + if (!in_array($log->api_type, ['website_info', 'tag'])) {
  134 + $log->collect_status = 0;
  135 + }
  136 + $log->save();
122 } 137 }
123 138
124 $this->response('采集任务添加成功'); 139 $this->response('采集任务添加成功');
@@ -67,6 +67,9 @@ class AyrReleaseController extends BaseController @@ -67,6 +67,9 @@ class AyrReleaseController extends BaseController
67 if(isset($this->param['images']) && !empty($this->param['images'])){ 67 if(isset($this->param['images']) && !empty($this->param['images'])){
68 $data['images'] = $this->param['images']; 68 $data['images'] = $this->param['images'];
69 } 69 }
  70 + if(empty($data)){
  71 + $this->fail('图片视频不能为空');
  72 + }
70 //参数处理 73 //参数处理
71 $this->param['mediaUrls'] = $ayrReleaseLogic->image_file_param($data); 74 $this->param['mediaUrls'] = $ayrReleaseLogic->image_file_param($data);
72 //时间处理 75 //时间处理
@@ -107,11 +107,11 @@ class TranslateController extends BaseController @@ -107,11 +107,11 @@ class TranslateController extends BaseController
107 } 107 }
108 108
109 /** 109 /**
110 - * @remark :获取5.0的所有路由 110 + * @remark :5.0路由
111 * @name :getFiveUrl 111 * @name :getFiveUrl
112 * @author :lyh 112 * @author :lyh
113 * @method :post 113 * @method :post
114 - * @time :2024/1/17 11:09 114 + * @time :2024/1/17 16:27
115 */ 115 */
116 public function getFiveUrl($map){ 116 public function getFiveUrl($map){
117 $data = []; 117 $data = [];
@@ -34,7 +34,6 @@ class TranslateLogic extends BaseLogic @@ -34,7 +34,6 @@ class TranslateLogic extends BaseLogic
34 * @time :2024/1/12 9:43 34 * @time :2024/1/12 9:43
35 */ 35 */
36 public function getTranslateList(){ 36 public function getTranslateList(){
37 - $this->user['domain'] = 'https://demo.globalso.site/';  
38 $url = $this->user['domain'].(($this->param['url'] != '/') ? $this->param['url'] : ''); 37 $url = $this->user['domain'].(($this->param['url'] != '/') ? $this->param['url'] : '');
39 $languageInfo = $this->getLanguage($this->param['language_id']); 38 $languageInfo = $this->getLanguage($this->param['language_id']);
40 $info = $this->model->read(['url'=>str_replace_url($this->param['url']),'language_id'=>$this->param['language_id'],'type'=>$this->param['type']]); 39 $info = $this->model->read(['url'=>str_replace_url($this->param['url']),'language_id'=>$this->param['language_id'],'type'=>$this->param['type']]);
@@ -165,6 +165,7 @@ class UserLoginLogic @@ -165,6 +165,7 @@ class UserLoginLogic
165 $info['domain'] = (!empty($project['deploy_optimize']['domain']) ? ((new DomainInfo())->getDomain($project['deploy_optimize']['domain'])) : ($project['deploy_build']['test_domain'] ?? '')); 165 $info['domain'] = (!empty($project['deploy_optimize']['domain']) ? ((new DomainInfo())->getDomain($project['deploy_optimize']['domain'])) : ($project['deploy_build']['test_domain'] ?? ''));
166 $info['is_customized'] = $project['is_customized']; 166 $info['is_customized'] = $project['is_customized'];
167 $info['is_upload_manage'] = $project['is_upload_manage']; 167 $info['is_upload_manage'] = $project['is_upload_manage'];
  168 + $info['is_upgrade'] = $project['is_upgrade'];
168 $info['is_show_blog'] = $project['is_show_blog']; 169 $info['is_show_blog'] = $project['is_show_blog'];
169 $info['upload_config'] = $project['upload_config']; 170 $info['upload_config'] = $project['upload_config'];
170 $info['main_lang_id'] = $project['main_lang_id']; 171 $info['main_lang_id'] = $project['main_lang_id'];