作者 张关杰

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

... ... @@ -33,7 +33,7 @@ class UpgradeProjectCount extends Command
protected $description = '升级项目统计';
public function handle(){
$project_id = 759;
$project_id = 627;
ProjectServer::useProject($project_id);
$this->count($project_id);
DB::disconnect('custom_mysql');
... ...
... ... @@ -36,7 +36,7 @@ class UpgradeProjectCount extends Command
protected $description = '升级项目统计';
public function handle(){
$project_id = 759;
$project_id = 627;
$oldModel = new UpdateOldInfo();
$info = $oldModel->read(['project_id'=>$project_id]);
$url = $info['old_domain_online'];
... ... @@ -67,8 +67,9 @@ class UpgradeProjectCount extends Command
$end = date('Y-m-t', strtotime($v['month']));
$arr['project_id'] = $project_id;
$res = $this->inquiry($url,$v['month']);
$arr['month_total'] = 0;
// $arr['month_total'] = 0;
if(isset($res['data']['count'])){
echo date('Y-m-d H:i:s') . '数据:'.$res['data']['count'] . PHP_EOL;
$arr['month_total'] = $res['data']['count'];
//获取上一个的count
$previousMonth = date('Y-m', strtotime($v['month'] . ' -1 month'));
... ... @@ -115,7 +116,6 @@ class UpgradeProjectCount extends Command
->first();
$arr['pv'] = $pv_ip->pv_num;
$arr['ip'] = $pv_ip->ip_num;
$arr['month_total'] = $pv_ip->inquiry_num;
if($arr['ip'] != 0){
$arr['rate'] = round(($arr['month_total'] / $arr['ip']) * 10,2);
}
... ...
... ... @@ -13,6 +13,8 @@ use App\Models\Com\UpdateOldInfo;
use App\Models\CustomModule\CustomModule;
use App\Models\CustomModule\CustomModuleCategory;
use App\Models\CustomModule\CustomModuleContent;
use App\Models\CustomModule\CustomModuleExtend;
use App\Models\CustomModule\CustomModuleExtentContent;
use App\Models\News\News;
use App\Models\News\NewsCategory;
use App\Models\Product\Category;
... ... @@ -566,6 +568,8 @@ class ProjectUpdate extends Command
$model = new CustomModuleContent();
$category_model = new CustomModuleCategory();
$extend_model = new CustomModuleExtend();
$extend_info_model = new CustomModuleExtentContent();
foreach ($items as $item) {
$route = $this->get_url_route($item['url'] ?? '');
... ... @@ -581,6 +585,13 @@ class ProjectUpdate extends Command
$category_id = $category_custom['id'];
}
}
//图片
if (is_array($item['images'] ?? '')) {
$image = $item['images'][0] ?? '';
} else {
$image = $item['images'] ?? '';
}
$new_img = $this->source_download($image, $project_id, $domain_arr['host'], $web_url_domain, $home_url);
//名称去掉特殊符号
$item['title'] = $this->special2str($item['title'] ?? '');
... ... @@ -593,6 +604,7 @@ class ProjectUpdate extends Command
'module_id' => $custom_info['id'],
'category_id' => $category_id,
'content' => $item['content'] ?? '',
'image' => $new_img,
'created_at' => $item['post_time'] ?? date('Y-m-d H:i:s'),
'updated_at' => $item['post_time'] ?? date('Y-m-d H:i:s'),
'is_upgrade' => 1,
... ... @@ -608,8 +620,44 @@ class ProjectUpdate extends Command
'name' => $item['title'],
'category_id' => $category_id,
'content' => $item['content'] ?? '',
'image' => $new_img
], ['id' => $id]);
}
//扩展字段
if ($item['extend'][0] ?? []) {
foreach ($item['extend'][0] as $ke => $ve) {
$extend = $extend_model->read(['title' => $ke]);
if ($extend) {
$extend_info = $extend_info_model->read(['key' => $extend['key'], 'content_id' => $id]);
if (!$extend_info) {
if ($extend['type'] == 3) {
$gallery = [];
if (is_array($ve)) {
foreach ($ve as $ve_img) {
$gallery[] = ['title' => '', 'description' => '', 'url' => $this->source_download($ve_img, $project_id, $domain_arr['host'], $web_url_domain, $home_url)];
}
}else{
$gallery[] = ['title' => '', 'description' => '', 'url' => $this->source_download($ve, $project_id, $domain_arr['host'], $web_url_domain, $home_url)];
}
$value = Arr::a2s($gallery);
} elseif ($extend['type'] == 4) {
$value = Arr::a2s([$this->source_download($ve, $project_id, $domain_arr['host'], $web_url_domain, $home_url)]);
} else {
$value = $ve;
}
$extend_info_model->add([
'key' => $extend['key'],
'type' => $extend['type'],
'project_id' => $project_id,
'content_id' => $id,
'module_id' => $custom_info['id'],
'values' => $value,
]);
}
}
}
}
} catch (\Exception $e) {
echo 'date:' . date('Y-m-d H:i:s') . ', task_id: ' . $task->id . ', error: ' . $e->getMessage() . PHP_EOL;
continue;
... ...
... ... @@ -492,10 +492,8 @@ if (!function_exists('getFileUrl')) {
* @time :2023/7/20 16:46
*/
function getFileUrl($path,$location = 1){
if(empty($path)){
return '';
}
if(is_array($path)){
$url =[];
foreach ($path as $v){
$url[] = getFileUrl($v);
}
... ...
... ... @@ -41,8 +41,6 @@ class BaseController extends Controller
$this->manage = $info;
Cache::put(Common::MANAGE_TOKEN . $this->token, $info, 3600 * 6);//更新缓存时间
$this->uid = $info['id'];
//写入操作记录
}
}
... ...
... ... @@ -115,10 +115,25 @@ class UpdateController extends BaseController
$old_info->save();
}
UpdateLog::where('project_id', $this->param['project_id'])->whereNotIn('api_type', ['category', 'category_news', 'website_info', 'tag'])->update(['collect_status' => 0]);
$logs = UpdateLog::where('project_id', $this->param['project_id'])->whereNotIn('api_type', ['category', 'category_news'])->get();
if ($this->param['type'] == 2 && !$domain_info) {
UpdateLog::where('project_id', $this->param['project_id'])->whereNotIn('api_type', ['category', 'category_news'])->update(['status' => 0]);
foreach ($logs as $log) {
if ($domain_info) {
$url_arr = parse_url($log->api_url);
$api_url = str_replace($url_arr['host'], $test_domain, $log->api_url);
$log->api_url = $api_url;
$log->status = 0;
} else {
if ($this->param['type'] == 2) {
$log->status = 0;
}
}
if (!in_array($log->api_type, ['website_info', 'tag'])) {
$log->collect_status = 0;
}
$log->save();
}
$this->response('采集任务添加成功');
... ...
... ... @@ -67,6 +67,9 @@ class AyrReleaseController extends BaseController
if(isset($this->param['images']) && !empty($this->param['images'])){
$data['images'] = $this->param['images'];
}
if(empty($data)){
$this->fail('图片视频不能为空');
}
//参数处理
$this->param['mediaUrls'] = $ayrReleaseLogic->image_file_param($data);
//时间处理
... ...
... ... @@ -107,11 +107,11 @@ class TranslateController extends BaseController
}
/**
* @remark :获取5.0的所有路由
* @remark :5.0路由
* @name :getFiveUrl
* @author :lyh
* @method :post
* @time :2024/1/17 11:09
* @time :2024/1/17 16:27
*/
public function getFiveUrl($map){
$data = [];
... ...
... ... @@ -34,7 +34,6 @@ class TranslateLogic extends BaseLogic
* @time :2024/1/12 9:43
*/
public function getTranslateList(){
$this->user['domain'] = 'https://demo.globalso.site/';
$url = $this->user['domain'].(($this->param['url'] != '/') ? $this->param['url'] : '');
$languageInfo = $this->getLanguage($this->param['language_id']);
$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
$info['domain'] = (!empty($project['deploy_optimize']['domain']) ? ((new DomainInfo())->getDomain($project['deploy_optimize']['domain'])) : ($project['deploy_build']['test_domain'] ?? ''));
$info['is_customized'] = $project['is_customized'];
$info['is_upload_manage'] = $project['is_upload_manage'];
$info['is_upgrade'] = $project['is_upgrade'];
$info['is_show_blog'] = $project['is_show_blog'];
$info['upload_config'] = $project['upload_config'];
$info['main_lang_id'] = $project['main_lang_id'];
... ...