作者 刘锟

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

正在显示 31 个修改的文件 包含 263 行增加1138 行删除
... ... @@ -146,6 +146,7 @@ class Languages extends Command
{"short":"ug","english":"Uyghur","chinese":"维吾尔语","language":"ئۇيغۇر"}]';
$data = json_decode($data);
foreach ($data as $v){
$v = (array)$v;
echo date('Y-m-d H:i:s') . ' start: ' . $v['short'] . PHP_EOL;
$languageModel = new WebLanguage();
$languageModel->add($v);
... ...
... ... @@ -3,7 +3,9 @@
namespace App\Console\Commands;
use App\Helper\FormGlobalsoApi;
use App\Models\Inquiry\InquiryOther;
use App\Models\Project\Project;
use App\Services\ProjectServer;
use Illuminate\Console\Command;
/**
... ... @@ -51,13 +53,19 @@ class LastInquiry extends Command
}
$api = new FormGlobalsoApi();
$res = $api->getInquiryList($item['deploy_optimize']['domain']);
if($res && $res['status'] == 200){
if(empty($res['data']['data'][0])){
continue;
}
$item->last_inquiry_time = $res['data']['data'][0]['submit_time'];
$item->save();
$last_time = $res['data']['data'][0] ?? '';
//其他询盘的最新时间
ProjectServer::useProject($item['id']);
$other_last_time = InquiryOther::orderBy('id', 'desc')->value('submit_time');
$last_inquiry_time = $last_time > $other_last_time ? $last_time : $other_last_time;
if(!$last_inquiry_time){
continue;
}
$item->last_inquiry_time = $last_inquiry_time;
$item->save();
}
}
}
... ...
... ... @@ -159,21 +159,21 @@ class InquiryMonthlyCount extends Command
//访问来源前10
$source = DB::connection('custom_mysql')->table('gl_customer_visit')
->select('referrer_url', DB::raw('COUNT(*) as count'))
->groupBy('referrer_url')->where(['domain'=>$domain])
->groupBy('referrer_url')
->whereBetween('updated_date', [$startTime,$endTime])
->orderByDesc('count')->limit(10)->get()->toArray();
$arr['source'] = json_encode($source);
//访问国家前15
$source_country = DB::connection('custom_mysql')->table('gl_customer_visit')
->select('country',DB::raw('COUNT(*) as ip'),DB::raw('SUM(depth) as pv'))
->groupBy('country')->where(['domain'=>$domain])
->groupBy('country')
->whereBetween('updated_date', [$startTime,$endTime])
->orderBy('ip','desc')->limit(15)->get()->toArray();
$arr['source_country'] = json_encode($source_country);
//受访界面前15
$referrer_url = DB::connection('custom_mysql')->table('gl_customer_visit')
->select('url',DB::raw('COUNT(*) as num'))
->orderBy('num','desc')->where(['domain'=>$domain])
->orderBy('num','desc')
->whereBetween('updated_date', [$startTime,$endTime])
->groupBy('url')
->limit(15)->get()->toArray();
... ... @@ -181,7 +181,7 @@ class InquiryMonthlyCount extends Command
//访问端口
$referrer_port = DB::connection('custom_mysql')->table('gl_customer_visit')
->select('device_port',DB::raw('COUNT(*) as num'))
->orderBy('num','desc')->where(['domain'=>$domain])
->orderBy('num','desc')
->whereBetween('updated_date', [$startTime,$endTime])
->groupBy('device_port')
->limit(15)->get()->toArray();
... ...
... ... @@ -18,6 +18,7 @@ use App\Services\ProjectServer;
use Illuminate\Console\Command;
use Illuminate\Database\QueryException;
use Illuminate\Support\Facades\DB;
use Illuminate\Support\Str;
/**
* 测试
... ... @@ -57,65 +58,52 @@ class Test extends Command
*/
public function handle()
{
$projects = Project::all();
foreach ($projects as $project){
echo "project " . $project->id;
if(!ProjectServer::useProject($project->id)){
echo '-->' . '未配置数据库' . PHP_EOL;
continue;
$domains = DB::table('gl_customer_visit')->groupBy('domain')->select('domain')->pluck('domain')->toArray();
foreach($domains as $domain){
if(!Str::contains($domain, 'globalso.site')){
$this->sync($domain);
}
}
}
public function sync($domain){
echo date('Y-m-d H:i:s') . "同步项目{$domain}" . PHP_EOL;
if(!Str::startsWith($domain,'www.')){
$domain = 'www.'.$domain;
}
$project_id = DomainInfo::where('domain', $domain)->value('project_id');
if(!$project_id){
echo date('Y-m-d H:i:s') . "项目{$domain}不存在" . PHP_EOL;
return true;
}
if(!ProjectServer::useProject($project_id)){
echo date('Y-m-d H:i:s') . "项目{$domain}数据库配置无效" . PHP_EOL;
return true;
}
$visit = 0;
$visit_item = 0;
$list = DB::table('gl_customer_visit')->whereIn('domain', [$domain, str_replace('www.','',$domain)])->get();
foreach ($list as $v){
$v = (array) $v;
$items = DB::table('gl_customer_visit_item')->where('customer_visit_id', $v['id'])->get();
unset($v['id']);
$id = DB::connection('custom_mysql')->table('gl_customer_visit')->insertGetId($v);
try {
$page = BCustomTemplate::where('url', '404')->first();
if(!$page){
$page = new BCustomTemplate();
}
$page->project_id = $project->id;
$page->name = '404';
$page->status = 1;
$page->url = '404';
$page->html = '<main>
<section data-section="section" data-screen="screen-large" class="section-404-wrap-block section-block-error404"
id="sectionIdyxqu938">
<div class="layout" data-unable="demo01-error404">
<img src="https://ecdn6.globalso.com/upload/m/image_other/2023-10/6528a87e594db30162.png" />
</div>
<p style="text-align: center">SORRY. THE PAGE HAS EITHER MOVED OR CANNOT BE FOUND.</p>
<style>
.section-block-error404 .layout {
height: 700px;
display: flex;
align-items: center;
justify-content: center;
}
.section-block-error404 img {
width: 400px;
}
@media only screen and (max-width:500) {
.section-block-error404 img {
max-width: 100%;
}
}
</style>
<script>
</script>
</section>
</main>';
$page->html_style = '<style id="globalsojs-styles"></style>';
$page->description = 'Sorry. The page has either moved or cannot be found.';
$page->title = '404-Page not found';
$page->save();
$visit++;
$domain = (new DomainInfo())->getDomain($project['deploy_optimize']['domain']);
$url = $domain.'api/delHtml/?project_id='.$project->id.'&route=404';
curlGet($url);
}catch (QueryException | \Exception $e){
echo '-->' . $e->getMessage() . PHP_EOL;
continue;
$data = [];
foreach ($items as $item){
$item = (array) $item;
unset($item['id']);
$item['customer_visit_id'] = $id;
$data[] = $item;
$visit_item++;
}
echo '-->成功:' . PHP_EOL;
DB::connection('custom_mysql')->table('gl_customer_visit_item')->insert($data);
}
echo date('Y-m-d H:i:s') . "visit:{$visit};item:{$visit_item}" . PHP_EOL;exit;
}
}
... ...
<?php
namespace App\Helper;
use App\Models\WebSetting\WebSettingCountry;
/**
* @name:多语言国家设置
*/
class Country
{
public $tls_list = [
'en' => [
'text' => '英语',
'lang_text' => 'English',
'con_flag' => 'con_flag/en.jfif',
'shop_lang' => 'en-gb',
],
'zh' => [
'text' => '中文',
'lang_text' => '简体中文',
'con_flag' => 'con_flag/zh.jfif',
'shop_lang' => 'zh-cn',
],
'fr' => [
'text' => '法语',
'lang_text' => 'En français',
'con_flag' => '',
],
'de' => [
'text' => '德语',
'lang_text' => 'Das ist Deutsch.',
'con_flag' => '',
],
'ko' => [
'text' => '韩语',
'lang_text' => '',
'con_flag' => '',
],
'ja' => [
'text' => '日语',
'lang_text' => '',
'con_flag' => '',
],
'es' => [
'text' => '西班牙语',
'lang_text' => 'Español.',
'con_flag' => '',
],
'ar' => [
'text' => '阿拉伯语',
'lang_text' => '',
'con_flag' => '',
],
'pt' => [
'text' => '葡萄牙语(葡萄牙、巴西)',
'lang_text' => 'Língua portuguesa',
'con_flag' => '',
],
'ru' => [
'text' => '俄语',
'lang_text' => '',
'con_flag' => '',
],
'af' => [
'text' => '南非荷兰语',
'lang_text' => '',
'con_flag' => '',
],
'sq' => [
'text' => '阿尔巴尼亚语',
'lang_text' => '',
'con_flag' => '',
],
'am' => [
'text' => '阿姆哈拉语',
'lang_text' => '',
'con_flag' => '',
],
'hy' => [
'text' => '亚美尼亚语',
'lang_text' => '',
'con_flag' => '',
],
'az' => [
'text' => '阿塞拜疆语',
'lang_text' => '',
'con_flag' => '',
],
'eu' => [
'text' => '巴斯克语',
'lang_text' => '',
'con_flag' => '',
],
'be' => [
'text' => '白俄罗斯语',
'lang_text' => '',
'con_flag' => '',
],
'bn' => [
'text' => '孟加拉语',
'lang_text' => '',
'con_flag' => '',
],
'bs' => [
'text' => '波斯尼亚语',
'lang_text' => '',
'con_flag' => '',
],
'bg' => [
'text' => '保加利亚语',
'lang_text' => '',
'con_flag' => '',
],
'ca' => [
'text' => '加泰罗尼亚语',
'lang_text' => '',
'con_flag' => '',
],
'ceb' => [
'text' => '宿务语',
'lang_text' => '',
'con_flag' => '',
],
'cn' => [
'text' => '中文(简体)',
'lang_text' => '简体中文',
'con_flag' => 'con_flag/zh.jfif',
'shop_lang' => 'zh-cn',
],
'tw' => [
'text' => '中文(繁体)',
'lang_text' => '繁体中文',
'con_flag' => 'con_flag/zh.jfif',
],
'co' => [
'text' => '科西嘉语',
'lang_text' => '',
'con_flag' => '',
],
'hr' => [
'text' => '克罗地亚语',
'lang_text' => '',
'con_flag' => '',
],
'cs' => [
'text' => '捷克语',
'lang_text' => '',
'con_flag' => '',
],
'da' => [
'text' => '丹麦语',
'lang_text' => '',
'con_flag' => '',
],
'nl' => [
'text' => '荷兰语',
'lang_text' => '',
'con_flag' => '',
],
'eo' => [
'text' => '世界语',
'lang_text' => '',
'con_flag' => '',
],
'et' => [
'text' => '爱沙尼亚语',
'lang_text' => '',
'con_flag' => '',
],
'fi' => [
'text' => '芬兰语',
'lang_text' => '',
'con_flag' => '',
],
'fy' => [
'text' => '弗里斯兰语',
'lang_text' => '',
'con_flag' => '',
],
'gl' => [
'text' => '加利西亚语',
'lang_text' => '',
'con_flag' => '',
],
'ka' => [
'text' => '格鲁吉亚语',
'lang_text' => '',
'con_flag' => '',
],
'el' => [
'text' => '希腊语',
'lang_text' => '',
'con_flag' => '',
],
'gu' => [
'text' => '古吉拉特语',
'lang_text' => '',
'con_flag' => '',
],
'ht' => [
'text' => '海地克里奥尔语',
'lang_text' => '',
'con_flag' => '',
],
'ha' => [
'text' => '豪萨语',
'lang_text' => '',
'con_flag' => '',
],
'haw' => [
'text' => '夏威夷语',
'lang_text' => '',
'con_flag' => '',
],
'iw' => [
'text' => '希伯来语',
'lang_text' => '',
'con_flag' => '',
],
'hi' => [
'text' => '印地语',
'lang_text' => '',
'con_flag' => '',
],
'hmn' => [
'text' => '苗语',
'lang_text' => '',
'con_flag' => '',
],
'hu' => [
'text' => '匈牙利语',
'lang_text' => '',
'con_flag' => '',
],
'is' => [
'text' => '冰岛语',
'lang_text' => '',
'con_flag' => '',
],
'ig' => [
'text' => '伊博语',
'lang_text' => '',
'con_flag' => '',
],
'id' => [
'text' => '印度尼西亚语',
'lang_text' => 'Bahasa Indonesia',
'con_flag' => 'con_flag/id.jfif',
'shop_lang' => 'id',
],
'ga' => [
'text' => '爱尔兰语',
'lang_text' => '',
'con_flag' => '',
],
'it' => [
'text' => '意大利语',
'lang_text' => 'Lingua italiana',
'con_flag' => '',
],
'jw' => [
'text' => '爪哇语',
'lang_text' => '',
'con_flag' => '',
],
'kn' => [
'text' => '卡纳达语',
'lang_text' => '',
'con_flag' => '',
],
'kk' => [
'text' => '哈萨克语',
'lang_text' => '',
'con_flag' => '',
],
'km' => [
'text' => '高棉语',
'lang_text' => '',
'con_flag' => '',
],
'rw' => [
'text' => '卢旺达语',
'lang_text' => '',
'con_flag' => '',
],
'ku' => [
'text' => '库尔德语',
'lang_text' => '',
'con_flag' => '',
],
'ky' => [
'text' => '吉尔吉斯语',
'lang_text' => '',
'con_flag' => '',
],
'lo' => [
'text' => '老挝文',
'lang_text' => '',
'con_flag' => '',
],
'la' => [
'text' => '拉丁文',
'lang_text' => '',
'con_flag' => '',
],
'lv' => [
'text' => '拉脱维亚语',
'lang_text' => '',
'con_flag' => '',
],
'lt' => [
'text' => '立陶宛语',
'lang_text' => '',
'con_flag' => '',
],
'lb' => [
'text' => '卢森堡语',
'lang_text' => '',
'con_flag' => '',
],
'mk' => [
'text' => '马其顿语',
'lang_text' => '',
'con_flag' => '',
],
'mg' => [
'text' => '马尔加什语',
'lang_text' => '',
'con_flag' => '',
],
'ms' => [
'text' => '马来语',
'lang_text' => 'Bahasa Melayu',
'con_flag' => 'con_flag/ms.jfif',
'shop_lang' => 'ms-my',
],
'ml' => [
'text' => '马拉雅拉姆文',
'lang_text' => '',
'con_flag' => '',
],
'mt' => [
'text' => '马耳他语',
'lang_text' => '',
'con_flag' => '',
],
'mi' => [
'text' => '毛利语',
'lang_text' => '',
'con_flag' => '',
],
'mr' => [
'text' => '马拉地语',
'lang_text' => '',
'con_flag' => '',
],
'mn' => [
'text' => '蒙古文',
'lang_text' => '',
'con_flag' => '',
],
'my' => [
'text' => '缅甸语',
'lang_text' => '',
'con_flag' => '',
],
'ne' => [
'text' => '尼泊尔语',
'lang_text' => '',
'con_flag' => '',
],
'no' => [
'text' => '挪威语',
'lang_text' => '',
'con_flag' => '',
],
'ny' => [
'text' => '尼杨扎语(齐切瓦语)',
'lang_text' => '',
'con_flag' => '',
],
'or' => [
'text' => '奥里亚语(奥里亚)',
'lang_text' => '',
'con_flag' => '',
],
'ps' => [
'text' => '普什图语',
'lang_text' => '',
'con_flag' => '',
],
'fa' => [
'text' => '波斯语',
'lang_text' => '',
'con_flag' => '',
],
'pl' => [
'text' => '波兰语',
'lang_text' => '',
'con_flag' => '',
],
'pa' => [
'text' => '旁遮普语',
'lang_text' => '',
'con_flag' => '',
],
'ro' => [
'text' => '罗马尼亚语',
'lang_text' => '',
'con_flag' => '',
],
'sm' => [
'text' => '萨摩亚语',
'lang_text' => '',
'con_flag' => '',
],
'gd' => [
'text' => '苏格兰盖尔语',
'lang_text' => '',
'con_flag' => '',
],
'sr' => [
'text' => '塞尔维亚语',
'lang_text' => '',
'con_flag' => '',
],
'st' => [
'text' => '塞索托语',
'lang_text' => '',
'con_flag' => '',
],
'sn' => [
'text' => '修纳语',
'lang_text' => '',
'con_flag' => '',
],
'sd' => [
'text' => '信德语',
'lang_text' => '',
'con_flag' => '',
],
'si' => [
'text' => '僧伽罗语',
'lang_text' => '',
'con_flag' => '',
],
'sk' => [
'text' => '斯洛伐克语',
'lang_text' => '',
'con_flag' => '',
],
'sl' => [
'text' => '斯洛文尼亚语',
'lang_text' => '',
'con_flag' => '',
],
'so' => [
'text' => '索马里语',
'lang_text' => '',
'con_flag' => '',
],
'su' => [
'text' => '巽他语',
'lang_text' => '',
'con_flag' => '',
],
'sw' => [
'text' => '斯瓦希里语',
'lang_text' => '',
'con_flag' => '',
],
'sv' => [
'text' => '瑞典语',
'lang_text' => '',
'con_flag' => '',
],
'tl' => [
'text' => '塔加路语(菲律宾语)',
'lang_text' => 'Pilipino',
'con_flag' => 'con_flag/tl.jfif',
'shop_lang' => 'tl',
],
'tg' => [
'text' => '塔吉克语',
'lang_text' => '',
'con_flag' => '',
],
'ta' => [
'text' => '泰米尔语',
'lang_text' => '',
'con_flag' => '',
],
'tt' => [
'text' => '鞑靼语',
'lang_text' => '',
'con_flag' => '',
],
'te' => [
'text' => '泰卢固语',
'lang_text' => '',
'con_flag' => '',
],
'th' => [
'text' => '泰文',
'lang_text' => 'ไทย',
'con_flag' => 'con_flag/th.jfif',
'shop_lang' => 'th',
],
'tr' => [
'text' => '土耳其语',
'lang_text' => '',
'con_flag' => '',
],
'tk' => [
'text' => '土库曼语',
'lang_text' => '',
'con_flag' => '',
],
'uk' => [
'text' => '乌克兰语',
'lang_text' => '',
'con_flag' => '',
],
'ur' => [
'text' => '乌尔都语',
'lang_text' => '',
'con_flag' => '',
],
'ug' => [
'text' => '维吾尔语',
'lang_text' => '',
'con_flag' => '',
],
'uz' => [
'text' => '乌兹别克语',
'lang_text' => '',
'con_flag' => '',
],
'vi' => [
'text' => '越南语',
'lang_text' => '',
'con_flag' => '',
],
'cy' => [
'text' => '威尔士语',
'lang_text' => '',
'con_flag' => '',
],
'xh' => [
'text' => '班图语',
'lang_text' => '',
'con_flag' => '',
],
'yi' => [
'text' => '意第绪语',
'lang_text' => '',
'con_flag' => '',
],
'yo' => [
'text' => '约鲁巴语',
'lang_text' => '',
'con_flag' => '',
],
'zu' => [
'text' => '祖鲁语',
'lang_text' => '',
'con_flag' => '',
],
];
/**
* @name :(获取翻译国家)set_country
* @author :lyh
* @method :post
* @time :2023/5/4 17:57
*/
public function set_country(){
$data = [];
foreach ($this->tls_list as $k=>$v){
$data[] = ['name'=>$v['text'],'alias'=>$k,'image'=>$k.'.png','con_flag'=>$v['con_flag'],'lang_text'=>$v['lang_text']];
}
$webCountry = new WebSettingCountry();
$webCountry->insert($data);
return true;
}
}
... ... @@ -123,6 +123,8 @@ class ProjectController extends BaseController
public function searchUpgrade(&$query){
if(isset($this->map['is_upgrade'])){
$query->where('gl_project.is_upgrade', $this->map['is_upgrade']);
}else{
$query->where('gl_project.is_upgrade', 0);
}
return $query;
}
... ...
... ... @@ -11,15 +11,14 @@ namespace App\Http\Controllers\Bside\BCom;
use App\Enums\Common\Code;
use App\Http\Controllers\Bside\BaseController;
use App\Http\Logic\Bside\Setting\WebSettingLogic;
use App\Models\Com\UpdateNotify;
use App\Models\Com\UpdateProgress;
use App\Models\Project\Country as CountryModel;
use App\Models\Project\Project;
use App\Models\RouteMap\RouteMap;
use App\Models\WebSetting\WebSettingCountry;
use App\Models\WebSetting\WebLanguage;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Redis;
/**
* @remark :通知C端
... ... @@ -186,13 +185,8 @@ class CNoticeController extends BaseController
if($info !== false){
$ids = explode(',',$info['country_lists']);
}
$webSettingCountryModel = new WebSettingCountry();
$lists = $webSettingCountryModel->list(['id'=>['in',$ids]],'id',['id','name','country_img']);
if (!empty($lists)){
foreach ($lists as $k => $v){
$lists[$k]['image_link'] = url('upload/country/' . $v['country_img']);
}
}
$languageModel = new WebLanguage();
$lists = $languageModel->list(['id'=>['in',$ids]]);
$this->response('success',Code::SUCCESS,$lists);
}
... ...
<?php
/**
* @remark :
* @name :LanguageController.php
* @author :lyh
* @method :post
* @time :2023/11/30 11:21
*/
namespace App\Http\Controllers\Bside\Setting;
use App\Enums\Common\Code;
use App\Http\Controllers\Bside\BaseController;
use App\Http\Logic\Bside\Setting\WebSettingCountryLogic;
use App\Models\Project\Country as CountryModel;
use App\Models\WebSetting\WebLanguage;
/**
* @name:多语言国家配置列
*/
class WebSettingCountryController extends BaseController
class LanguageController extends BaseController
{
/**
* @name :列表lists
* @remark :获取小语种列表
* @name :lists
* @author :lyh
* @method :post
* @time :2023/4/28 14:40
* @time :2023/11/30 10:59
*/
public function lists(WebSettingCountryLogic $webSettingCountryLogic){
$lists = $webSettingCountryLogic->country_list();
public function lists(){
$webLanguageModel = new WebLanguage();
$lists = $webLanguageModel->list();
$this->response('success',Code::SUCCESS,$lists);
}
}
... ...
... ... @@ -5,9 +5,8 @@ namespace App\Http\Controllers\Bside\Setting;
use App\Enums\Common\Code;
use App\Helper\Translate;
use App\Http\Controllers\Bside\BaseController;
use App\Http\Logic\Bside\Setting\ProofreadingLogic;
use App\Models\WebSetting\Proofreading;
use App\Models\WebSetting\WebSettingCountry;
use App\Models\WebSetting\WebLanguage;
use Illuminate\Support\Facades\DB;
class ProofreadingController extends BaseController
... ... @@ -22,8 +21,8 @@ class ProofreadingController extends BaseController
*/
public function lists(){
//获取语种信息
$webSettingCountryModel = new WebSettingCountry();
$countryInfo = $webSettingCountryModel->read(['id'=>$this->param['language_id']]);
$languageModel = new WebLanguage();
$languageInfo = $languageModel->read(['id'=>$this->param['language_id']]);
//获取当前链接和语种的校队列表
$proofreadingModel = new Proofreading();
$list = $proofreadingModel->list(['url'=>$this->param['url'],'language_id'=>$this->param['language_id'],'type'=>1],'created_at',['text','translate']);
... ... @@ -31,7 +30,7 @@ class ProofreadingController extends BaseController
$new_list = $this->getUrlRead($this->param['url']);
if(empty($list)){
$data = [];
$translate_list = Translate::tran($new_list, $countryInfo['alias']);
$translate_list = Translate::tran($new_list, $languageInfo['short']);
foreach ($new_list as $k=>$v){
$data[] = [
'text'=>trim($v),
... ... @@ -51,7 +50,7 @@ class ProofreadingController extends BaseController
}
$arr2 = array_values(array_diff($new_list, $old_list));
if(!empty($arr2)){
$translate_list = Translate::tran($arr2, $countryInfo['alias']);
$translate_list = Translate::tran($arr2, $languageInfo['alias']);
foreach ($arr2 as $k1=>$v1){
$data[] = [
'text'=>$v1,
... ... @@ -179,17 +178,6 @@ class ProofreadingController extends BaseController
}
/**
* @name :(当前项目选中的语言列表)languageList
* @author :lyh
* @method :post
* @time :2023/6/12 15:52
*/
public function languageList(ProofreadingLogic $proofreadingLogic){
$list = $proofreadingLogic->countryLanguageList($this->map,$this->order);
$this->response('success',Code::SUCCESS,$list);
}
/**
* @remark :获取Url内容
* @name :getUrlRead
* @author :lyh
... ...
... ... @@ -19,17 +19,6 @@ class WebSettingHtmlController extends BaseController
* @time :2023/4/28 14:45
*/
public function save(WebSettingHtmlLogic $webSettingHtmlLogic){
if(isset($this->param) && !empty($this->param)){
$this->request->validate([
'head_html'=>'required',
'body_html'=>'required',
'footer_html'=>'required'
],[
'head_html.required' => 'head_html不能为空',
'body_html.required' => 'body_html不能为空',
'footer_html.required' => 'footer_html不能为空'
]);
}
$info = $webSettingHtmlLogic->setting_html_save();
$this->response('success',Code::SUCCESS,$info);
}
... ...
... ... @@ -69,10 +69,12 @@ class OnlineCheckLogic extends BaseLogic
*/
public function saveOnlineCheck(){
$info = $this->model->read(['project_id'=>$this->param['id']]);
$projectModel = new Project();
if($info !== false){
$this->fail('已提交,请勿重复提交');
}else{
$projectModel = new Project();
//提交审核修改状态为审核中
$projectModel->edit(['status'=>$projectModel::STATUS_ONE],['id'=>$this->param['id']]);
//组装数据
$data = [
'project_id' => $this->param['id'],
... ... @@ -85,8 +87,6 @@ class OnlineCheckLogic extends BaseLogic
if($rs === false){
$this->fail('error');
}
//提交审核修改状态为审核中
$projectModel->edit(['status'=>$projectModel::STATUS_ONE],['id'=>$this->param['id']]);
}
return $this->success();
}
... ...
... ... @@ -378,8 +378,8 @@ class BTemplateLogic extends BaseLogic
$route = 'all';
}
}
return $this->updateNotify(['project_id'=>$this->user['project_id'], 'type'=>$type, 'route'=>$route]);
return $this->success();
$this->addUpdateNotify($type,$route);
return $this->curlDelRoute($route);
}
/**
... ...
... ... @@ -66,8 +66,8 @@ class CustomTemplateLogic extends BaseLogic
try {
$this->param['url'] = str_replace_url($this->param['url']);
if(isset($this->param['id']) && !empty($this->param['id'])){
$id = $this->param['id'];
$this->param['url'] = $this->editCustomRoute($this->param['url']);
$this->param['url'] = RouteMap::setRoute($this->param['url'], RouteMap::SOURCE_PAGE, $this->param['id'], $this->user['project_id']);
$this->editCustomRoute($this->param['url']);
$this->model->edit($this->param,['id'=>$this->param['id']]);
}else{
if($this->param['url'] == $this->model::NOT_FOUND_PAGE_URL){
... ... @@ -75,9 +75,10 @@ class CustomTemplateLogic extends BaseLogic
}
$this->param['project_id'] = $this->user['project_id'];
$id = $this->model->addReturnId($this->param);
$route = RouteMap::setRoute($this->param['url'], RouteMap::SOURCE_PAGE, $id, $this->user['project_id']);
$this->addUpdateNotify(RouteMap::SOURCE_PAGE,$route);
$this->model->edit(['url'=>$route],['id'=>$id]);
}
$route = RouteMap::setRoute($this->param['url'], RouteMap::SOURCE_PAGE, $id, $this->user['project_id']);
$this->model->edit(['url'=>$route],['id'=>$id]);
}catch (\Exception $e){
$this->fail('error');
}
... ... @@ -110,8 +111,9 @@ class CustomTemplateLogic extends BaseLogic
if($rs === false){
$this->fail('系统错误,请联系管理');
}
$data = ['project_id'=>$this->user['project_id'], 'type'=>RouteMap::SOURCE_PAGE, 'route'=>$info['url']];
$this->updateNotify($data);
//通知
$this->addUpdateNotify(RouteMap::SOURCE_PAGE,$info['url']);
$this->curlDelRoute($info['url']);
return $this->success();
}
... ... @@ -210,14 +212,10 @@ class CustomTemplateLogic extends BaseLogic
$this->fail('404页面链接不可修改');
}
if($info['url'] != $route){
//生成一条删除路由记录
$data = [
'source'=>RouteMap::SOURCE_PAGE,
'route'=>$info['url'],
];
$this->setRouteDeleteSave($data);
$this->addUpdateNotify(RouteMap::SOURCE_PAGE,$route);
$this->curlDelRoute($info['url']);
}
return $route;
return true;
}
/**
... ... @@ -261,11 +259,7 @@ class CustomTemplateLogic extends BaseLogic
RouteMap::delRoute(RouteMap::SOURCE_PAGE, $id, $this->user['project_id']);
//生成一条删除路由记录
$info = $this->model->read(['id' => $id], ['id', 'url']);
$data = [
'source' => RouteMap::SOURCE_NEWS,
'route' => $info['url'],
];
$this->setRouteDeleteSave($data);
$this->curlDelRoute($info['url']);
return $this->success();
}
... ...
... ... @@ -142,49 +142,36 @@ class BaseLogic extends Logic
}
/**
* @name :(通知更新)projectUrl
* @name :生成一条新路由记录
* @author :lyh
* @method :post
* @time :2023/6/6 14:09
*/
function updateNotify($data)
public function addUpdateNotify($type,$route)
{
$updateNotifyModel = new UpdateNotify();
if($data['route'] != 'all'){
$info = $updateNotifyModel->read(['project_id'=>$data['project_id'],'route'=>$data['route'],'status'=>1]);
if($info === false){
$param = [
'project_id'=>$data['project_id'],
'type'=>$data['type'],
'route'=>$data['route'],
];
$updateNotifyModel->add($param);
}
//单页面直接通知更新
$url = $this->user['domain'].'api/delHtml/?project_id='.$this->user['project_id'].'&route='.$data['route'];
$info = $updateNotifyModel->read(['project_id'=>$this->user['project_id'],'route'=>$route,'status'=>1]);
if($info === false){
$param = [
'project_id'=>$this->user['project_id'], 'type'=>$type, 'route'=>$route,'status'=>1
];
$updateNotifyModel->add($param);
}else{
$url = $this->user['domain'].'api/webInfo/?type=clear_website';
$updateNotifyModel->edit(['route'=>$route],['project_id'=>$this->user['project_id'],'type'=>$type,'status'=>1]);
}
curlGet($url);
return $this->success();
}
/**
* @remark :删除和编辑路由时生成一条记录
* @name :setRouteDeleteSave
* @remark :删除路由通知C端
* @name :curlDelRoute
* @author :lyh
* @method :post
* @time :2023/9/7 9:38
* @time :2023/11/30 14:43
*/
public function setRouteDeleteSave($param){
$routeDeleteModel = new RouteDelete();
$data = [
'project_id'=>$this->user['project_id'],
'source'=>$param['source'],
'created_at'=>date('Y-m-d H:i:s'),
'route'=>$param['route'],
];
$routeDeleteModel->insert($data);
public function curlDelRoute($route){
$url = $this->user['domain'].'api/delHtml/?project_id='.$this->user['project_id'].'&route='.$route;
curlGet($url);
return $this->success();
}
}
... ...
... ... @@ -32,8 +32,7 @@ class BlogCategoryLogic extends BaseLogic
DB::beginTransaction();
try {
if(isset($this->param['id']) && !empty($this->param['id'])){
//查看路由是否更新
$id = $this->param['id'];
$this->param['alias'] = RouteMap::setRoute($this->param['alias'], RouteMap::SOURCE_BLOG_CATE, $this->param['id'], $this->user['project_id']);
$this->editCategoryRoute($this->param['id'], $this->param['alias']);
$this->editHandleCategory($this->param['id'],$this->param['pid']);
$this->param['operator_id'] = $this->user['id'];
... ... @@ -46,18 +45,17 @@ class BlogCategoryLogic extends BaseLogic
//拼接参数
$this->param = $this->addParamProcessing($this->param);
$id = $this->model->addReturnId($this->param);
$route = RouteMap::setRoute($this->param['alias'], RouteMap::SOURCE_BLOG_CATE, $id, $this->user['project_id']);
$this->addUpdateNotify(RouteMap::SOURCE_BLOG_CATE,$route);
$this->edit(['alias'=>$route],['id'=>$id]);
//处理子集
$this->addProcessingSon($id);
}
$route = RouteMap::setRoute($this->param['alias'], RouteMap::SOURCE_BLOG_CATE, $id, $this->user['project_id']);
$this->edit(['alias'=>$route],['id'=>$id]);
DB::commit();
}catch (\Exception $e){
DB::rollBack();
$this->fail('系统错误,请联系管理');
}
//通知更新
$this->updateNotify(['project_id'=>$this->user['project_id'], 'type'=>RouteMap::SOURCE_BLOG_CATE, 'route'=>$route]);
return $this->success();
}
... ... @@ -114,11 +112,8 @@ class BlogCategoryLogic extends BaseLogic
//生成一条删除路由记录
$info = $this->model->read(['id'=>$id],['id','alias']);
if($info['alias'] != $route){
$data = [
'source'=>RouteMap::SOURCE_NEWS_CATE,
'route'=>$info['alias'],
];
$this->setRouteDeleteSave($data);
$this->addUpdateNotify(RouteMap::SOURCE_BLOG_CATE,$route);
$this->curlDelRoute($info['alias']);
}
return true;
}
... ... @@ -311,11 +306,7 @@ class BlogCategoryLogic extends BaseLogic
RouteMap::delRoute(RouteMap::SOURCE_BLOG_CATE, $id, $this->user['project_id']);
//生成一条删除路由记录
$info = $this->model->read(['id'=>$id],['id','alias']);
$data = [
'source'=>RouteMap::SOURCE_BLOG_CATE,
'route'=>$info['alias'],
];
$this->setRouteDeleteSave($data);
$this->curlDelRoute($info['alias']);
return $this->success();
}
... ... @@ -331,27 +322,22 @@ class BlogCategoryLogic extends BaseLogic
*/
public function importBlogCategory($project_id,$user_id,$category){
$return = [];
$cate_arr = explode('/',$category);
$pid = 0;
foreach ($cate_arr as $v){
if($v){
$category_info = $this->model->read(['name'=>$v,'pid'=>$pid]);
if(!$category_info){
$id = $this->model->addReturnId(['name'=>$v,'pid'=>$pid,'project_id'=>$project_id,'operator_id'=>$user_id,'create_id'=>$user_id]);
$route = RouteMap::setRoute($v, RouteMap::SOURCE_BLOG_CATE, $id, $project_id);
$this->model->edit(['alias'=>$route],['id'=>$id]);
}else{
$id = $category_info['id'];
}
$return[] = $id;
$pid = $id;
}
}
return $this->getLastCategory($return);
}
... ...
... ... @@ -34,22 +34,20 @@ class BlogLogic extends BaseLogic
try {
$this->param = $this->paramProcessing($this->param);
if(isset($this->param['id']) && !empty($this->param['id'])){
//是否更新路由
$id = $this->param['id'];
$this->param['url'] = RouteMap::setRoute($this->param['url'], RouteMap::SOURCE_BLOG, $this->param['id'], $this->user['project_id']);
$this->editNewsRoute($this->param['id'],$this->param['url']);
$this->edit($this->param,['id'=>$this->param['id']]);
}else{
$id = $this->model->addReturnId($this->param);
$route = RouteMap::setRoute($this->param['url'], RouteMap::SOURCE_BLOG, $id, $this->user['project_id']);
$this->addUpdateNotify(RouteMap::SOURCE_BLOG,$route);
$this->edit(['url'=>$route],['id'=>$id]);
}
$route = RouteMap::setRoute($this->param['url'], RouteMap::SOURCE_BLOG, $id, $this->user['project_id']);
$this->edit(['url'=>$route],['id'=>$id]);
DB::commit();
}catch (\Exception $e){
DB::rollBack();
$this->fail('error');
}
//通知更新
$this->updateNotify(['project_id'=>$this->user['project_id'], 'type'=>RouteMap::SOURCE_BLOG, 'route'=>$route]);
return $this->success();
}
... ... @@ -64,11 +62,8 @@ class BlogLogic extends BaseLogic
//生成一条删除路由记录
$info = $this->model->read(['id'=>$id],['id','url']);
if($info['url'] != $route){
$data = [
'source'=>RouteMap::SOURCE_BLOG,
'route'=>$info['url'],
];
$this->setRouteDeleteSave($data);
$this->addUpdateNotify(RouteMap::SOURCE_BLOG,$route);
$this->curlDelRoute($info['url']);
}
return true;
}
... ... @@ -90,10 +85,11 @@ class BlogLogic extends BaseLogic
/**
* @name :获取数据详情
* @return array
* @author :liyuhang
* @method
* @remark :获取数据详情
* @name :blogInfo
* @author :lyh
* @method :post
* @time :2023/11/30 15:17
*/
public function blogInfo(){
$info = $this->model->read($this->param);
... ... @@ -110,11 +106,11 @@ class BlogLogic extends BaseLogic
/**
* @name :修改状态
* @return array
* @throws \App\Exceptions\BsideGlobalException
* @author :liyuhang
* @method
* @remark :修改状态
* @name :blogStatus
* @author :lyh
* @method :post
* @time :2023/11/30 15:16
*/
public function blogStatus(){
$this->param['operator_id'] = $this->user['id'];
... ... @@ -126,10 +122,11 @@ class BlogLogic extends BaseLogic
}
/**
* @name :删除
* @return void
* @author :liyuhang
* @method
* @remark :删除
* @name :blogDel
* @author :lyh
* @method :post
* @time :2023/11/30 15:17
*/
public function blogDel(){
DB::beginTransaction();
... ... @@ -158,11 +155,7 @@ class BlogLogic extends BaseLogic
RouteMap::delRoute(RouteMap::SOURCE_BLOG, $id, $this->user['project_id']);
//生成一条删除路由记录
$info = $this->model->read(['id'=>$id],['id','url']);
$data = [
'source'=>RouteMap::SOURCE_BLOG,
'route'=>$info['url'],
];
$this->setRouteDeleteSave($data);
$this->curlDelRoute($info['url']);
return $this->success();
}
... ...
... ... @@ -6,7 +6,9 @@ use App\Helper\FormGlobalsoApi;
use App\Http\Logic\Bside\BaseLogic;
use App\Models\HomeCount\Count;
use App\Models\HomeCount\MonthCount;
use App\Models\Inquiry\InquiryOther;
use App\Models\Project\DeployOptimize;
use App\Services\ProjectServer;
use Carbon\Carbon;
use Illuminate\Support\Facades\DB;
... ... @@ -44,6 +46,8 @@ class MonthCountLogic extends BaseLogic
$startTime = Carbon::now()->startOfMonth()->toDateString();
$endTime = date('Y-m-d',time());
$arr = [];
ProjectServer::useProject($this->user['project_id']);
$arr = $this->inquiryCount($arr,$startTime,$endTime,$this->user['domain']);
$arr = $this->flowCount($arr,$startTime,$endTime,$this->user['project_id']);
$arr = $this->sourceCount($arr,$startTime,$endTime,$this->user['domain']);
... ... @@ -67,8 +71,8 @@ class MonthCountLogic extends BaseLogic
//数据详情
$data = $inquiry_list['data']['data'] ?? '';
$arr['month_total'] = 0;
$countryArr = [];
if(isset($data) && !empty($data)){
$countryArr = [];
foreach ($data as $v){
if(($startTime.' 00:00:00' <= $v['submit_time']) && $v['submit_time'] <= $endTime.' 23:59:59'){
$arr['month_total']++;
... ... @@ -76,14 +80,27 @@ class MonthCountLogic extends BaseLogic
if(isset($countryArr[$v['country']])){
$countryArr[$v['country']]++;
}else{
$countryArr[$v['country']] = 0;
$countryArr[$v['country']] = 1;
}
}
arsort($countryArr);
$top20 = array_slice($countryArr, 0, 15, true);
$arr['country'] = $top20;
}
}
//加上其他询盘
$arr['total'] += InquiryOther::count();
$arr['month_total'] += InquiryOther::whereBetween('submit_time',[$startTime, $endTime])->count();
$countryData = InquiryOther::whereBetween('submit_time',[$startTime, $endTime])
->select("country",DB::raw('COUNT(*) as count'))
->groupBy('country')->get()->toArray();
foreach ($countryData as $v1){
if(isset($countryArr[$v1['country']])){
$countryArr[$v1['country']] += $v1['count'];
}else{
$countryArr[$v1['country']] = $v1['count'];
}
}
arsort($countryArr);
$top20 = array_slice($countryArr, 0, 15, true);
$arr['country'] = $top20;
return $arr;
}
... ... @@ -118,31 +135,31 @@ class MonthCountLogic extends BaseLogic
*/
public function sourceCount(&$arr,$startTime,$endTime,$domain){
//访问来源前10
$source = DB::table('gl_customer_visit')
$source = DB::connection('custom_mysql')->table('gl_customer_visit')
->select('referrer_url', DB::raw('COUNT(*) as count'))
->groupBy('referrer_url')->where(['domain'=>$domain])
->groupBy('referrer_url')
->whereBetween('updated_date', [$startTime,$endTime])
->orderByDesc('count')->limit(10)->get()->toArray();
$arr['source'] = $source;
//访问国家前15
$source_country = DB::table('gl_customer_visit')
$source_country = DB::connection('custom_mysql')->table('gl_customer_visit')
->select('country',DB::raw('COUNT(*) as ip'),DB::raw('SUM(depth) as pv'))
->groupBy('country')->where(['domain'=>$domain])
->groupBy('country')
->whereBetween('updated_date', [$startTime,$endTime])
->orderBy('ip','desc')->limit(15)->get()->toArray();
$arr['source_country'] = $source_country;
//受访界面前15
$referrer_url = DB::table('gl_customer_visit')
$referrer_url = DB::connection('custom_mysql')->table('gl_customer_visit')
->select('url',DB::raw('COUNT(*) as num'))
->orderBy('num','desc')->where(['domain'=>$domain])
->orderBy('num','desc')
->whereBetween('updated_date', [$startTime,$endTime])
->groupBy('url')
->limit(15)->get()->toArray();
$arr['referrer_url'] = $referrer_url;
//访问断后
$referrer_port = DB::table('gl_customer_visit')
$referrer_port = DB::connection('custom_mysql')->table('gl_customer_visit')
->select('device_port',DB::raw('COUNT(*) as num'))
->orderBy('num','desc')->where(['domain'=>$domain])
->orderBy('num','desc')
->whereBetween('updated_date', [$startTime,$endTime])
->groupBy('device_port')
->limit(15)->get()->toArray();
... ...
... ... @@ -55,7 +55,7 @@ class NavLogic extends BaseLogic
$this->model->add($this->param);
}
//编辑菜单后,通知更新
$this->updateNotify(['project_id'=>$this->user['project_id'], 'type'=>RouteMap::SOURCE_NAV, 'route'=>'all']);
$this->addUpdateNotify(RouteMap::SOURCE_NAV, 'all');
return $this->success();
}
... ... @@ -97,7 +97,7 @@ class NavLogic extends BaseLogic
$this->fail('error');
}
//编辑菜单后,通知更新
$this->updateNotify(['project_id'=>$this->user['project_id'], 'type'=>RouteMap::SOURCE_NAV, 'route'=>'all']);
$this->addUpdateNotify(RouteMap::SOURCE_NAV, 'all');
return $this->success();
}
... ... @@ -151,7 +151,7 @@ class NavLogic extends BaseLogic
if($pid){
$p_cate = $category->where('id', $pid)->select($fields)->first();
if($p_cate){
$nav_pid = $this->model->where('import_id', $nav['id'])->where('url', $p_cate['alias'])->value('id');
$nav_pid = $this->model->where('import_id', $nav['id'])->where('url', $p_cate['alias'])->value('id') ?: $nav_pid;
}
}
$list = $category->list(['pid' => $pid], 'id', $fields, 'asc');
... ...
... ... @@ -44,11 +44,10 @@ class NewsCategoryLogic extends BaseLogic
DB::beginTransaction();
try {
if(isset($this->param['id']) && !empty($this->param['id'])){
$this->param['operator_id'] = $this->user['id'];
//查看路由是否更新
$id = $this->param['id'];
$this->param['alias'] = RouteMap::setRoute($this->param['alias'], RouteMap::SOURCE_NEWS_CATE, $this->param['id'], $this->user['project_id']);
$this->editCategoryRoute($this->param['id'],$this->param['alias']);
$this->editHandleCategory($this->param['id'],$this->param['pid']);
$this->param['operator_id'] = $this->user['id'];
$this->edit($this->param,['id'=>$this->param['id']]);
}else{
if(!isset($this->param['alias']) || empty($this->param['alias'])){
... ... @@ -56,18 +55,17 @@ class NewsCategoryLogic extends BaseLogic
}
$this->param = $this->addParamProcessing($this->param);
$id = $this->model->addReturnId($this->param);
$route = RouteMap::setRoute($this->param['alias'], RouteMap::SOURCE_NEWS_CATE, $id, $this->user['project_id']);
$this->addUpdateNotify(RouteMap::SOURCE_NEWS_CATE,$route);
$this->model->edit(['alias'=>$route],['id'=>$id]);
//当父级分类拥有产品时,处理子集
$this->addProcessingSon($id);
}
$route = RouteMap::setRoute($this->param['alias'], RouteMap::SOURCE_NEWS_CATE, $id, $this->user['project_id']);
$this->model->edit(['alias'=>$route],['id'=>$id]);
DB::commit();
}catch (\Exception $e){
DB::rollBack();
$this->fail('系统错误,请联系管理员');
}
//更新通知记录表
$this->updateNotify(['project_id'=>$this->user['project_id'], 'type'=>RouteMap::SOURCE_NEWS_CATE, 'route'=>$route]);
return $this->success();
}
... ... @@ -124,22 +122,19 @@ class NewsCategoryLogic extends BaseLogic
//生成一条删除路由记录
$info = $this->model->read(['id'=>$id],['id','alias']);
if($info['alias'] != $route){
$data = [
'source'=>RouteMap::SOURCE_NEWS_CATE,
'route'=>$info['alias'],
];
$this->setRouteDeleteSave($data);
$this->addUpdateNotify(RouteMap::SOURCE_NEWS_CATE,$route);
$this->curlDelRoute($info['alias']);
}
return true;
}
/**
* @name :修改状态
* @return array
* @throws \App\Exceptions\BsideGlobalException
* @author :liyuhang
* @method
* @remark :修改状态
* @name :status_news_category
* @author :lyh
* @method :post
* @time :2023/11/30 15:13
*/
public function status_news_category(){
$this->param['operator_id'] = $this->user['id'];
... ... @@ -291,13 +286,8 @@ class NewsCategoryLogic extends BaseLogic
public function delRoute($id){
//删除路由映射
RouteMap::delRoute(RouteMap::SOURCE_NEWS_CATE, $id, $this->user['project_id']);
//生成一条删除路由记录
$info = $this->model->read(['id'=>$id],['id','alias']);
$data = [
'source'=>RouteMap::SOURCE_NEWS_CATE,
'route'=>$info['alias'],
];
$this->setRouteDeleteSave($data);
$this->curlDelRoute($info['alias']);
return $this->success();
}
... ... @@ -313,22 +303,18 @@ class NewsCategoryLogic extends BaseLogic
*/
public function importNewsCategory($project_id,$user_id,$category){
$return = [];
$cate_arr = explode('/',$category);
$pid = 0;
foreach ($cate_arr as $v){
if($v){
$category_info = $this->model->read(['name'=>$v,'pid'=>$pid]);
if(!$category_info){
$id = $this->model->addReturnId(['name'=>$v,'pid'=>$pid,'project_id'=>$project_id,'operator_id'=>$user_id,'create_id'=>$user_id]);
$route = RouteMap::setRoute($v, RouteMap::SOURCE_NEWS_CATE, $id, $project_id);
$this->model->edit(['alias'=>$route],['id'=>$id]);
}else{
$id = $category_info['id'];
}
$return[] = $id;
$pid = $id;
}
... ...
... ... @@ -63,23 +63,22 @@ class NewsLogic extends BaseLogic
try {
$this->param = $this->paramProcessing($this->param);
if (isset($this->param['id']) && !empty($this->param['id'])) {
$this->param['url'] = RouteMap::setRoute($this->param['url'], RouteMap::SOURCE_NEWS, $this->param['id'], $this->user['project_id']);
//是否更新路由
$this->editNewsRoute($this->param['id'], $this->param['url']);
$id = $this->param['id'];
$this->edit($this->param, ['id' => $this->param['id']]);
} else {
$id = $this->model->addReturnId($this->param);
$route = RouteMap::setRoute($this->param['url'], RouteMap::SOURCE_NEWS, $id, $this->user['project_id']);
$this->addUpdateNotify(RouteMap::SOURCE_NEWS,$route);
$this->edit(['url' => $route], ['id' => $id]);
}
//更新路由
$route = RouteMap::setRoute($this->param['url'], RouteMap::SOURCE_NEWS, $id, $this->user['project_id']);
$this->edit(['url' => $route], ['id' => $id]);
DB::commit();
} catch (\Exception $e) {
DB::rollBack();
$this->fail('系统错误,请联系管理员');
}
//通知更新
$this->updateNotify(['project_id' => $this->user['project_id'], 'type' => RouteMap::SOURCE_NEWS, 'route' => $route]);
return $this->success();
}
... ... @@ -95,11 +94,8 @@ class NewsLogic extends BaseLogic
//生成一条删除路由记录
$info = $this->model->read(['id' => $id], ['id', 'url']);
if ($info['url'] != $route) {
$data = [
'source' => RouteMap::SOURCE_NEWS,
'route' => $info['url'],
];
$this->setRouteDeleteSave($data);
$this->addUpdateNotify(RouteMap::SOURCE_NEWS,$route);
$this->curlDelRoute($info['url']);
}
return true;
}
... ... @@ -271,11 +267,7 @@ class NewsLogic extends BaseLogic
RouteMap::delRoute(RouteMap::SOURCE_NEWS, $id, $this->user['project_id']);
//生成一条删除路由记录
$info = $this->model->read(['id' => $id], ['id', 'url']);
$data = [
'source' => RouteMap::SOURCE_NEWS,
'route' => $info['url'],
];
$this->setRouteDeleteSave($data);
$this->curlDelRoute($info['url']);
return $this->success();
}
... ...
... ... @@ -113,19 +113,20 @@ class CategoryLogic extends BaseLogic
DB::beginTransaction();
try {
if(isset($this->param['id']) && !empty($this->param['id'])){
//是否编辑路由
$id = $this->editCategoryRoute($this->param['id'],$this->param['route']);
$this->param['route'] = RouteMap::setRoute($this->param['route'], RouteMap::SOURCE_PRODUCT_CATE, $this->param['id'], $this->user['project_id']);
$this->editCategoryRoute($this->param['id'],$this->param['route']);
//处理子集
$this->editHandleCategory($this->param['id'],$this->param['pid']);
$this->model->edit($this->param,['id'=>$this->param['id']]);
}else{
$this->param['project_id'] = $this->user['project_id'];
$id = $this->model->addReturnId($this->param);
$route = RouteMap::setRoute($this->param['route'], RouteMap::SOURCE_PRODUCT_CATE, $id, $this->user['project_id']);
$this->addUpdateNotify(RouteMap::SOURCE_PRODUCT_CATE,$route);
$this->edit(['route'=>$route],['id'=>$id]);
//处理子集
$this->addProcessingSon($id);
}
$route = RouteMap::setRoute($this->param['route'], RouteMap::SOURCE_PRODUCT_CATE, $id, $this->user['project_id']);
$this->edit(['route'=>$route],['id'=>$id]);
//清除缓存
Common::del_user_cache('product_category',$this->user['project_id']);
DB::commit();
... ... @@ -133,9 +134,6 @@ class CategoryLogic extends BaseLogic
DB::rollBack();
$this->fail('系统错误,请联系管理员');
}
//通知更新
$notifyData = ['project_id'=>$this->user['project_id'], 'type'=>RouteMap::SOURCE_PRODUCT_CATE, 'route'=>$route];
$this->updateNotify($notifyData);
return $this->success();
}
... ... @@ -234,13 +232,10 @@ class CategoryLogic extends BaseLogic
//生成一条删除路由记录
$info = $this->model->read(['id'=>$id],['id','route']);
if($info['route'] != $route){
$data = [
'source'=>RouteMap::SOURCE_PRODUCT_CATE,
'route'=>$info['route'],
];
$this->setRouteDeleteSave($data);
$this->addUpdateNotify(RouteMap::SOURCE_PRODUCT_CATE,$route);
$this->curlDelRoute($info['route']);
}
return $id;
return true;
}
/**
... ... @@ -283,11 +278,7 @@ class CategoryLogic extends BaseLogic
RouteMap::delRoute(RouteMap::SOURCE_PRODUCT_CATE, $id, $this->user['project_id']);
//生成一条删除路由记录
$info = $this->model->read(['id'=>$id],['id','route']);
$data = [
'source'=>RouteMap::SOURCE_PRODUCT_CATE,
'route'=>$info['route'],
];
$this->setRouteDeleteSave($data);
$this->curlDelRoute($info['route']);
return $this->success();
}
... ... @@ -302,27 +293,22 @@ class CategoryLogic extends BaseLogic
*/
public function importProductCategory($project_id,$category){
$return = [];
$cate_arr = explode('/',$category);
$pid = 0;
foreach ($cate_arr as $v){
if($v){
$category_info = $this->model->read(['title'=>$v,'pid'=>$pid]);
if(!$category_info){
$id = $this->model->addReturnId(['title'=>$v,'pid'=>$pid,'project_id'=>$project_id]);
$route = RouteMap::setRoute($v, RouteMap::SOURCE_PRODUCT_CATE, $id, $project_id);
$this->model->edit(['route'=>$route],['id'=>$id]);
}else{
$id = $category_info['id'];
}
$return[] = $id;
$pid = $id;
}
}
//清除缓存
Common::del_user_cache('product_category',$project_id);
return $this->getLastCategory($return);
... ...
... ... @@ -56,17 +56,16 @@ class KeywordLogic extends BaseLogic
try {
$this->param = $this->handleSaveParam($this->param);
if(isset($this->param['id']) && !empty($this->param['id'])){
//TODO::不能修改路由
$this->model->edit($this->param,['id'=>$this->param['id']]);
$id = $this->param['id'];
}else{
$this->param['project_id'] = $this->user['project_id'];
$this->param['created_at'] = date('Y-m-d H:i:s');
$this->param['updated_at'] = $this->param['created_at'];
$this->param = $this->addHandleParam($this->param);
$id = $this->model->insertGetId($this->param);
//路由映射
$route = RouteMap::setRoute($this->param['title'], RouteMap::SOURCE_PRODUCT_KEYWORD, $id, $this->user['project_id']);
$this->addUpdateNotify(RouteMap::SOURCE_PRODUCT_KEYWORD,$route);
$this->model->edit(['route'=>$route],['id'=>$id]);
}
//路由映射
$route = RouteMap::setRoute($this->param['title'], RouteMap::SOURCE_PRODUCT_KEYWORD, $id, $this->user['project_id']);
$this->model->edit(['route'=>$route],['id'=>$id]);
//清除缓存
Common::del_user_cache('product_keyword',$this->user['project_id']);
DB::commit();
... ... @@ -74,12 +73,24 @@ class KeywordLogic extends BaseLogic
DB::rollBack();
$this->fail('保存失败');
}
//通知更新
$this->updateNotify(['project_id'=>$this->user['project_id'], 'type'=>RouteMap::SOURCE_PRODUCT_KEYWORD, 'route'=>$route]);
return $this->success();
}
/**
* @remark :添加组装数据
* @name :addHandleParam
* @author :lyh
* @method :post
* @time :2023/11/30 15:00
*/
public function addHandleParam($param){
$param['project_id'] = $this->user['project_id'];
$param['created_at'] = date('Y-m-d H:i:s');
$param['updated_at'] = $param['created_at'];
return $this->success($param);
}
/**
* @remark :保存数据时参数处理
* @name :handleSaveParam
* @author :lyh
... ... @@ -174,11 +185,7 @@ class KeywordLogic extends BaseLogic
RouteMap::delRoute(RouteMap::SOURCE_PRODUCT_KEYWORD, $id, $this->user['project_id']);
//生成一条删除路由记录
$info = $this->model->read(['id'=>$id],['id','route']);
$data = [
'source'=>RouteMap::SOURCE_PRODUCT_KEYWORD,
'route'=>$info['route'],
];
$this->setRouteDeleteSave($data);
$this->curlDelRoute($info['route']);
return $this->success();
}
... ... @@ -193,9 +200,7 @@ class KeywordLogic extends BaseLogic
*/
public function importProductKeyword($project_id,$keyword){
$return = [];
$keyword_arr = explode(',',$keyword);
foreach ($keyword_arr as $v){
$keyword_info = $this->model->read(['title'=>$v]);
if(!$keyword_info){
... ... @@ -207,7 +212,6 @@ class KeywordLogic extends BaseLogic
}
$return[] = $k_id;
}
//清除缓存
Common::del_user_cache('product_keyword',$project_id);
return ','.implode(',',$return).',';
... ...
... ... @@ -56,16 +56,18 @@ class ProductLogic extends BaseLogic
DB::connection('custom_mysql')->beginTransaction();
try {
if(isset($this->param['id']) && !empty($this->param['id'])){
$id = $this->param['id'];
$this->param['route'] = RouteMap::setRoute($this->param['route'], RouteMap::SOURCE_PRODUCT, $this->param['id'], $this->user['project_id']);
//查看路由是否更新
$this->param['route'] = $this->editProductRoute($this->param['route']);
$this->editProductRoute($this->param['id'],$this->param['route']);
$this->model->edit($this->param,['id'=>$this->param['id']]);
$id = $this->param['id'];
}else{
$this->param = $this->addHandleParam($this->param);
$id = $this->model->addReturnId($this->param);
$route = RouteMap::setRoute($this->param['route'], RouteMap::SOURCE_PRODUCT, $id, $this->user['project_id']);
$this->addUpdateNotify(RouteMap::SOURCE_PRODUCT,$route);
$this->model->edit(['route'=>$route],['id'=>$id]);
}
$this->param['route'] = RouteMap::setRoute($this->param['route'], RouteMap::SOURCE_PRODUCT, $id, $this->user['project_id']);
$this->model->edit(['route'=> $this->param['route']],['id'=>$id]);
//产品分类关联
CategoryRelated::saveRelated($id, $category_ids);
//保存扩展字段
... ... @@ -75,8 +77,6 @@ class ProductLogic extends BaseLogic
DB::connection('custom_mysql')->rollBack();
$this->fail('系统错误请联系管理员');
}
//通知更新
$this->updateNotify(['project_id'=>$this->user['project_id'], 'type'=>RouteMap::SOURCE_PRODUCT, 'route'=>$this->param['route']]);
return $this->success();
}
... ... @@ -154,10 +154,15 @@ class ProductLogic extends BaseLogic
}else{
$this->param['thumb'] = Arr::a2s([]);
}
if(isset($this->param['route']) && !empty($this->param['route'])){
$this->param['route'] = RouteMap::setRoute($this->param['route'], RouteMap::SOURCE_PRODUCT, $this->param['id'], $this->user['project_id']);
try {
if(isset($this->param['route']) && !empty($this->param['route'])){
$this->param['route'] = RouteMap::setRoute($this->param['route'], RouteMap::SOURCE_PRODUCT, $this->param['id'], $this->user['project_id']);
$this->editProductRoute($this->param['id'],$this->param['route']);
}
$this->model->edit($this->param,['id'=>$this->param['id']]);
}catch (\Exception $e){
$this->fail('系统错误,请连续管理员');;
}
$this->model->edit($this->param,['id'=>$this->param['id']]);
return $this->success();
}
... ... @@ -285,15 +290,11 @@ class ProductLogic extends BaseLogic
* @method :post
* @time :2023/9/7 10:02
*/
public function editProductRoute($route){
$info = $this->model->read(['id'=>$this->param['id']]);
public function editProductRoute($id,$route){
$info = $this->model->read(['id'=>$id]);
if($info['route'] != $route){
//生成一条删除路由记录
$data = [
'source'=>RouteMap::SOURCE_PRODUCT,
'route'=>$route,
];
$this->setRouteDeleteSave($data);
$this->addUpdateNotify(RouteMap::SOURCE_PRODUCT,$route);
$this->curlDelRoute($info['route']);
}
return $route;
}
... ... @@ -340,11 +341,7 @@ class ProductLogic extends BaseLogic
RouteMap::delRoute(RouteMap::SOURCE_PRODUCT, $id, $this->user['project_id']);
//生成一条删除路由记录
$info = $this->model->read(['id'=>$id],['id','route']);
$data = [
'source'=>RouteMap::SOURCE_PRODUCT,
'route'=>$info['route'],
];
$this->setRouteDeleteSave($data);
$this->curlDelRoute($info['route']);
return $this->success();
}
... ...
<?php
namespace App\Http\Logic\Bside\Setting;
use App\Http\Logic\Bside\BaseLogic;
use App\Models\Project\Country;
use App\Models\WebSetting\Proofreading;
use App\Models\WebSetting\WebSettingCountry;
use Illuminate\Support\Facades\DB;
class ProofreadingLogic extends BaseLogic
{
public function __construct()
{
parent::__construct();
$this->model = new Proofreading();
$this->param = $this->requestAll;
}
/**
* @name :(保存翻译校队)proofreadingSave
* @author :lyh
* @method :post
* @time :2023/6/12 11:03
*/
public function proofreadingSave(){
DB::beginTransaction();
try {
//删除以前的数据
$this->model->del(['project_id'=>$this->user['project_id'],'language_id'=>$this->param['language_id'],'type'=>$this->param['type']]);
foreach ($this->param['data'] as $k => $v){
$v['created_at'] = date('Y-m-d H:i:s');
$v['updated_at'] = date('Y-m-d H:i:s');
$v['project_id'] = $this->user['project_id'];
$v['language_id'] = $this->param['language_id'];
$v['type'] = $this->param['type'];
$v['alias'] = $this->param['alias'];
$this->param['data'][$k] = $v;
}
//新增
$this->model->insert($this->param['data']);
DB::commit();
}catch (\Exception $e){
DB::rollBack();
$this->fail('error');
}
return $this->success();
}
/**
* @name :(项目已选中多语言国家列表)countryLanguageList
* @author :lyh
* @method :post
* @time :2023/6/12 15:54
*/
public function countryLanguageList($map,$order = 'created_at'){
$map['project_id'] = $this->user['project_id'];
$projectCountryModel = new Country();
$countryInfo = $projectCountryModel->read($map);
$list = [];
if(!empty($countryInfo['country_lists'])){
$countryArr = explode(",",$countryInfo['country_lists']);
$webCountryModel = new WebSettingCountry();
$list = $webCountryModel->list(['id'=>['in',$countryArr]]);
}
return $this->success($list);
}
}
<?php
namespace App\Http\Logic\Bside\Setting;
use App\Http\Logic\Bside\BaseLogic;
use App\Models\Project\Country;
use App\Models\Project\Country as CountryModel;
use App\Models\WebSetting\WebSettingCountry;
class WebSettingCountryLogic extends BaseLogic
{
public function __construct()
{
parent::__construct();
$this->model = new WebSettingCountry();
$this->param = $this->requestAll;
}
/**
* @name :(获取多语言国家)user_country_list
* @author :lyh
* @method :post
* @time :2023/4/28 16:18
*/
public function country_list(){
$lists = $this->model->list($this->param,'id',['id','name','alias','lang_text']);
return $this->success($lists);
}
}
... ... @@ -46,7 +46,7 @@ class WebSettingReceivingLogic extends BaseLogic
}catch (\Exception $e){
$this->fail('error');
}
app(SyncService::class)->projectAcceptAddress($this->user['project_id']);
(new SyncService())->projectAcceptAddress($this->user['project_id']);
return $this->success();
}
}
... ...
... ... @@ -35,7 +35,7 @@ class VisitLogic extends BaseLogic
'customer_visit_id' => $this->param['id'],
// 'domain' => $this->user['domain'],
];
$data = $this->model->list($map);
$data = $this->model->list($map, 'created_at');
return $this->success($data);
}
... ...
... ... @@ -20,7 +20,6 @@ class News extends Base
if(!$value){
return date('Y-m-d H:i:s', strtotime($this->getAttribute('created_at')));
}
return $value;
}
}
... ...
... ... @@ -164,4 +164,10 @@ class Product extends Base
// return self::where('project_id', $project_id)->where('status', self::STATUS_ON)->count();
// }
public function getSendTimeAttribute($value){
if(!$value){
return date('Y-m-d H:i:s', strtotime($this->getAttribute('created_at')));
}
return $value;
}
}
... ...
<?php
namespace App\Models\WebSetting;
use App\Models\Base;
class WebSettingCountry extends Base
{
protected $table = 'gl_web_setting_country';
}
... ... @@ -144,7 +144,6 @@ Route::middleware(['bloginauth'])->group(function () {
});
//多语言设置
Route::prefix('country')->group(function () {
Route::any('/', [\App\Http\Controllers\Bside\Setting\WebSettingCountryController::class, 'lists'])->name('web_setting_country_lists');
Route::any('/info', [\App\Http\Controllers\Bside\Setting\ProjectCountryController::class, 'info'])->name('web_setting_country_info');
Route::any('/save', [\App\Http\Controllers\Bside\Setting\ProjectCountryController::class, 'save'])->name('web_setting_country_save');
});
... ... @@ -170,7 +169,6 @@ Route::middleware(['bloginauth'])->group(function () {
Route::any('/imageList', [\App\Http\Controllers\Bside\Setting\ProofreadingController::class, 'imageList'])->name('web_proofreading_imageList');
Route::any('/save', [\App\Http\Controllers\Bside\Setting\ProofreadingController::class, 'save'])->name('web_proofreading_save');
Route::any('/saveImage', [\App\Http\Controllers\Bside\Setting\ProofreadingController::class, 'saveImage'])->name('web_proofreading_saveImage');
Route::any('/languageList', [\App\Http\Controllers\Bside\Setting\ProofreadingController::class, 'languageList'])->name('web_proofreading_languageList');
});
//seo设置
... ... @@ -418,6 +416,11 @@ Route::middleware(['bloginauth'])->group(function () {
Route::any('/upload', [\App\Http\Controllers\Bside\FileManage\FileManageController::class, 'upload'])->name('file_manager_upload');
Route::any('/delete', [\App\Http\Controllers\Bside\FileManage\FileManageController::class, 'delete'])->name('file_manager_delete');
});
//小语种
Route::prefix('language')->group(function () {
Route::any('/', [\App\Http\Controllers\Bside\Setting\LanguageController::class, 'lists'])->name('language_lists');
});
});
//无需登录验证的路由组
Route::group([], function () {
... ...