作者 刘锟

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

... ... @@ -5,6 +5,7 @@ namespace App\Console\Commands\DayCount;
use App\Helper\Common;
use App\Helper\FormGlobalsoApi;
use App\Models\Domain\DomainInfo;
use App\Models\Inquiry\InquiryOther;
use App\Models\Project\DeployBuild;
use App\Models\Project\DeployOptimize;
use App\Models\Project\Project;
... ... @@ -80,7 +81,7 @@ class Count extends Command
$arr['created_at'] = date('Y-m-d H:i:s');
$arr['updated_at'] = date('Y-m-d H:i:s');
//询盘统计
$arr = $this->inquiry($arr,$v['test_domain']);
$arr = $this->inquiry($arr,$v['test_domain'], $v['id']);
echo date('Y-m-d H:i:s') . json_encode($arr) . '->' . PHP_EOL;
$data[] = $arr;
}
... ... @@ -124,11 +125,11 @@ class Count extends Command
* @method :post
* @time :2023/6/14 15:44
*/
public function inquiry($arr,$domain){
public function inquiry($arr,$domain,$project_id){
$inquiry_list = (new FormGlobalsoApi())->getInquiryList($domain,'',1,100000000);
if($inquiry_list['status'] == self::STATUS_ERROR){
$arr['inquiry_num'] = 0;
$arr['country'] = json_encode([]);
$countryArr = [];
}else{
$arr['inquiry_num'] = $inquiry_list['data']['total'];
//询盘国家统计
... ... @@ -138,13 +139,27 @@ class Count extends Command
if(isset($countryArr[$v1['country']])){
$countryArr[$v1['country']]++;
}else{
$countryArr[$v1['country']] = 0;
$countryArr[$v1['country']] = 1;
}
}
arsort($countryArr);
$top20 = array_slice($countryArr, 0, 20, true);
$arr['country'] = json_encode($top20);
}
//加上其他询盘
ProjectServer::useProject($project_id);
$arr['inquiry_num'] = InquiryOther::count();
$countryData = InquiryOther::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, 20, true);
$arr['country'] = json_encode($top20);
return $arr;
}
... ...
<?php
/**
* @remark :
* @name :Languages.php
* @author :lyh
* @method :post
* @time :2023/11/30 10:29
*/
namespace App\Console\Commands;
use Illuminate\Console\Command;
class Languages extends Command
{
/**
* The name and signature of the console command.
*
* @var string
*/
protected $signature = 'update_progress';
/**
* The console command description.
*
* @var string
*/
protected $description = '导入小语种';
/**
* @name :(定时执行)handle
* @author :lyh
* @method :post
* @time :2023/5/12 14:48
*/
public function handle()
{
$data = '[{"short":"en","chinese":"英文","english":"English","language":"English"},
{"short":"zh","chinese":"简体中文","english":"Chinese","language":"Chinese Simplified"},
{"short":"zh-TW","chinese":"繁体中文","english":"Chinese","language":"Chinese Traditional"},
{"short":"fr","chinese":"法语","english":"French","language":"Français"},
{"short":"de","chinese":"德语","english":"German","language":"Deutsch"},
{"short":"pt","chinese":"葡萄牙语","english":"Portuguese","language":"Português"},
{"short":"es","chinese":"西班牙语","english":"Spanish","language":"Español"},
{"short":"ru","chinese":"俄语","english":"Russian","language":"Русский"},
{"short":"ja","chinese":"日语","english":"Japanese","language":"日本語"},
{"short":"ko","chinese":"韩语","english":"Korean","language":"한국어"},
{"short":"ar","chinese":"阿拉伯语","english":"Arabic","language":"العربية"},
{"short":"ga","chinese":"爱尔兰语","english":"Irish","language":"Gaeilge"},
{"short":"el","chinese":"希腊语","english":"Greek","language":"Ελληνικά"},
{"short":"tr","chinese":"土耳其语","english":"Turkish","language":"Türkçe"},
{"short":"it","chinese":"意大利语","english":"Italian","language":"Italiano"},
{"short":"da","chinese":"丹麦语","english":"Danish","language":"Dansk"},
{"short":"ro","chinese":"罗马尼亚语","english":"Romanian","language":"Română"},
{"short":"id","chinese":"印度尼西亚语","english":"Indonesian","language":"Bahasa Indonesia"},
{"short":"cs","chinese":"捷克语","english":"Czech","language":"Čeština"},
{"short":"af","chinese":"南非荷兰语","english":"Afrikaans","language":"Afrikaans"},
{"short":"sv","chinese":"瑞典语","english":"Swedish","language":"Svenska"},
{"short":"pl","chinese":"波兰语","english":"Polish","language":"Polski"},
{"short":"eu","chinese":"巴斯克语","english":"Basque","language":"Euskara"},
{"short":"ca","chinese":"加泰罗尼亚语","english":"Catalan","language":"Català"},
{"short":"eo","chinese":"世界语","english":"Esperanto","language":"Esperanto"},
{"short":"hi","chinese":"北印度语","english":"Hindi","language":"हिन्दी"},
{"short":"lo","chinese":"老挝语","english":"Lao","language":"Lao"},
{"short":"sq","chinese":"阿尔巴尼亚语","english":"Albanian","language":"Shqip"},
{"short":"am","chinese":"阿姆哈拉语","english":"Amharic","language":"አማርኛ"},
{"short":"hy","chinese":"亚美尼亚语","english":"Armenian","language":"Armenian"},
{"short":"az","chinese":"阿塞拜疆语","english":"Azerbaijani","language":"Azerbaijani"},
{"short":"be","chinese":"白俄罗斯语","english":"Belarusian","language":"беларуская м"},
{"short":"bn","chinese":"孟加拉语","english":"Bengali","language":"বাংলা"},
{"short":"bs","chinese":"波斯尼亚语","english":"Bosnian","language":"Bosnian"},
{"short":"bg","chinese":"保加利亚语","english":"Bulgarian","language":"Български"},
{"short":"ceb","chinese":"宿务语","english":"Cebuano","language":"Cebuano"},
{"short":"ny","chinese":"齐佩瓦语","english":"Chichewa","language":"Chichewa"},
{"short":"co","chinese":"科西嘉语","english":"Corsican","language":"Corsican"},
{"short":"hr","chinese":"克罗地亚语","english":"Croatian","language":"Hrvatski"},
{"short":"nl","chinese":"荷兰语","english":"Dutch","language":"Nederlands"},
{"short":"et","chinese":"爱沙尼亚语","english":"Estonian","language":"Eesti Keel"},
{"short":"tl","chinese":"菲律宾语","english":"Filipino","language":"Tagalog"},
{"short":"fi","chinese":"芬兰语","english":"Finnish","language":"Suomi"},
{"short":"fy","chinese":"弗利然语","english":"Frisian","language":"Frisian"},
{"short":"gl","chinese":"加利西亚语","english":"Galician","language":"Galego"},
{"short":"ka","chinese":"格鲁吉亚语","english":"Georgian","language":"ქართული"},
{"short":"gu","chinese":"古吉特拉语","english":"Gujarati","language":"ગુજરાતી"},
{"short":"ht","chinese":"海地-克里奥尔语","english":"Haitian","language":"Kreyòl Ayisyen"},
{"short":"ha","chinese":"豪撒语","english":"Hausa","language":"Hausa"},
{"short":"haw","chinese":"夏威夷语","english":"Hawaiian","language":"Hawaiian"},
{"short":"iw","chinese":"希伯来语","english":"Hebrew","language":"עברית"},
{"short":"hmn","chinese":"苗语","english":"Hmong","language":"Hmong"},
{"short":"hu","chinese":"匈牙利语","english":"Hungarian","language":"Magyar"},
{"short":"is","chinese":"冰岛语","english":"Icelandic","language":"Íslenska"},
{"short":"ig","chinese":"伊博语","english":"Igbo","language":"Igbo"},
{"short":"jw","chinese":"爪哇语","english":"Javanese","language":"Javanese"},
{"short":"kn","chinese":"坎纳达语","english":"Kannada","language":"ಕನ್ನಡ"},
{"short":"kk","chinese":"哈萨克语","english":"Kazakh","language":"Kazakh"},
{"short":"km","chinese":"高棉语","english":"Khmer","language":"Khmer"},
{"short":"ku","chinese":"库尔德语","english":"Kurdish","language":"هه‌رێمی کوردستان"},
{"short":"ky","chinese":"吉尔吉斯斯坦语","english":"Kyrgyz","language":"Kyrgyz"},
{"short":"la","chinese":"拉丁语","english":"Latin","language":"Latin"},
{"short":"lv","chinese":"拉脱维亚语","english":"Latvian","language":"Latviešu"},
{"short":"lt","chinese":"立陶宛语","english":"Lithuanian","language":"Lietuvių"},
{"short":"lb","chinese":"卢森堡语","english":"Luxembou..","language":"Herzogtum Lëtzebuerg"},
{"short":"mk","chinese":"马其顿语","english":"Macedonian","language":"македонски"},
{"short":"mg","chinese":"马尔加什语","english":"Malagasy","language":"Malagasy"},
{"short":"ms","chinese":"马来语","english":"Malay","language":"Bahasa Melayu"},
{"short":"ml","chinese":"德拉维族(Dravidian)语","english":"Malayalam","language":"Malayalam "},
{"short":"mt","chinese":"马其他语","english":"Maltese","language":"Malti"},
{"short":"mi","chinese":"毛利语","english":"Maori","language":"Maori"},
{"short":"mr","chinese":"马拉地语","english":"Marathi","language":"Marathi"},
{"short":"mn","chinese":"蒙古族语","english":"Mongolian","language":"Mongolian"},
{"short":"my","chinese":"缅甸语","english":"Burmese","language":"Burmese"},
{"short":"ne","chinese":"尼泊尔语","english":"Nepali","language":"Nepali"},
{"short":"no","chinese":"挪威语","english":"Norwegian","language":"Norsk"},
{"short":"ps","chinese":"普什图语","english":"Pashto","language":"Pashto"},
{"short":"fa","chinese":"波斯语","english":"Persian","language":"فارسی"},
{"short":"pa","chinese":"旁遮普语","english":"Punjabi","language":"Punjabi"},
{"short":"sr","chinese":"塞尔维亚语","english":"Serbian","language":"Српски"},
{"short":"st","chinese":"塞索托语","english":"Sesotho","language":"Sesotho"},
{"short":"si","chinese":"僧伽罗语","english":"Sinhala","language":"Sinhala"},
{"short":"sk","chinese":"斯洛伐克语","english":"Slovak","language":"Slovenčina"},
{"short":"sl","chinese":"斯洛文尼亚语","english":"Slovenian","language":"slovenščina"},
{"short":"so","chinese":"索马里语","english":"Somali","language":"Somali"},
{"short":"sm","chinese":"萨摩亚语","english":"Samoan","language":"Samoan"},
{"short":"gd","chinese":"苏格兰盖尔语","english":"Scots Gaelic","language":"Gàidhlig"},
{"short":"sn","chinese":"修纳语","english":"Shona","language":"Shona"},
{"short":"sd","chinese":"信德语","english":"Sindhi","language":"سنڌي‎"},
{"short":"su","chinese":"巽他语","english":"Sundanese","language":"Sundanese"},
{"short":"sw","chinese":"斯瓦西里语","english":"Swahili","language":"Kiswahili"},
{"short":"tg","chinese":"塔吉克语","english":"Tajik","language":"Tajik"},
{"short":"ta","chinese":"泰米尔语","english":"Tamil","language":"தமிழ்"},
{"short":"te","chinese":"泰卢固语","english":"Telugu","language":"తెలుగు"},
{"short":"th","chinese":"泰语","english":"Thai","language":"ภาษาไทย"},
{"short":"uk","chinese":"乌克兰语","english":"Ukrainian","language":"Українська"},
{"short":"ur","chinese":"乌尔都语","english":"Urdu","language":"اردو"},
{"short":"uz","chinese":"乌兹别克语","english":"Uzbek","language":"Uzbek"},
{"short":"vi","chinese":"越南语","english":"Vietnamese","language":"Tiếng Việt"},
{"short":"cy","chinese":"威尔士语","english":"Welsh","language":"Cymraeg"},
{"short":"xh","chinese":"科萨语","english":"Xhosa","language":"Xhosa"},
{"short":"yi","chinese":"意地绪语","english":"Yiddish","language":"ײִדיש"},
{"short":"yo","chinese":"约鲁巴语","english":"Yoruba","language":"Yoruba"},
{"short":"zu","chinese":"祖鲁语","english":"Zulu","language":"Zulu"},
{"short":"rw","english":"Kinyarwanda","chinese":"卢旺达","language":"Kinyarwanda"},
{"short":"tt","english":"Tatar","chinese":"鞑靼语","language":"Татар"},
{"short":"or","english":"Oriya","chinese":"奥利亚语","language":"ଓଡିଆ"},
{"short":"tk","english":"Turkmen","chinese":"土库曼语","language":"Türkmenler"},
{"short":"ug","english":"Uyghur","chinese":"维吾尔语","language":"ئۇيغۇر"}]';
}
}
... ...
... ... @@ -4,6 +4,7 @@ namespace App\Console\Commands\MonthlyCount;
use App\Helper\FormGlobalsoApi;
use App\Models\Domain\DomainInfo;
use App\Models\Inquiry\InquiryOther;
use App\Models\Project\Project;
use App\Services\ProjectServer;
use Carbon\Carbon;
... ... @@ -54,12 +55,12 @@ class InquiryMonthlyCount extends Command
if(!empty($value['domain'])){
$info = $domainInfo->read(['id'=>$value['domain']]);
if($info !== false){
$value['test_domain'] = $value['domain'];
$value['test_domain'] = $info['domain'];
}
}
$arr = [];
//按月统计询盘记录
$arr = $this->inquiryCount($arr,$startTime,$endTime,$value['test_domain']);
$arr = $this->inquiryCount($arr,$startTime,$endTime,$value['test_domain'],$value['project_id']);
$arr = $this->flowCount($arr,$startTime,$endTime,$value['project_id']);
ProjectServer::useProject($value['project_id']);
$arr = $this->sourceCount($arr,$value['test_domain'],$startTime,$endTime);
... ... @@ -83,7 +84,7 @@ class InquiryMonthlyCount extends Command
* @method :post
* @time :2023/6/30 14:29
*/
public function inquiryCount(&$arr,&$startTime,&$endTime,$domain){
public function inquiryCount(&$arr,&$startTime,&$endTime,$domain,$project_id){
$inquiry_list = (new FormGlobalsoApi())->getInquiryList($domain,'',1,100000000);
//总数
$arr['total'] = $inquiry_list['data']['total'] ?? 0;
... ... @@ -96,17 +97,32 @@ class InquiryMonthlyCount extends Command
foreach ($data as $v){
if(($startTime.' 00:00:00' <= $v['submit_time']) && $v['submit_time'] <= $endTime.' 23:59:59'){
$arr['month_total']++;
if(isset($countryArr[$v['country']])){
$countryArr[$v['country']]++;
}else{
$countryArr[$v['country']] = 1;
}
}
if(isset($countryArr[$v['country']])){
$countryArr[$v['country']]++;
}else{
$countryArr[$v['country']] = 0;
}
}
arsort($countryArr);
$top20 = array_slice($countryArr, 0, 15, true);
$arr['country'] = json_encode($top20);
}
//加上其他询盘
ProjectServer::useProject($project_id);
$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'] = json_encode($top20);
return $arr;
}
... ...
... ... @@ -10,6 +10,7 @@ namespace App\Console\Commands\Test;
use App\Helper\Common;
use App\Models\Blog\Blog;
use App\Models\Devops\ServerConfig;
use App\Models\Domain\DomainInfo;
use App\Models\File\Image;
use App\Models\Manage\BelongingGroup;
use App\Models\Manage\Dept;
... ... @@ -43,10 +44,10 @@ class Demo extends Command
*
* @return void
*/
public function __construct()
{
parent::__construct();
}
// public function __construct()
// {
// parent::__construct();
// }
public function curlRequest($url, $data, $method = 'POST', $header = [], $time_out = 60)
{
... ... @@ -77,6 +78,7 @@ class Demo extends Command
*/
public function handle()
{
return $this->domain();
$result = app(SyncService::class)->projectAcceptAddress(1);
dd($result);
$data = [
... ... @@ -293,4 +295,26 @@ class Demo extends Command
}
dd(1);
}
/**
* @remark :获取域名
* @name :domain
* @author :lyh
* @method :post
* @time :2023/11/29 18:47
*/
public function domain(){
$domainModel = new DomainInfo();
$lists = $domainModel->list();
foreach ($lists as $k => $v){
if($v['project_id'] != 0){
echo date('Y-m-d H:i:s') . ' start: ' . $v['project_id'] . PHP_EOL;
$domain = 'https://'.$v['domain'].'/';
$url = $domain.'/api/update_robots/?project_id='.$v['project_id'];
http_get($url);
echo date('Y-m-d H:i:s') . ' end: ' . $v['project_id'] . PHP_EOL;
}
}
return true;
}
}
... ...
... ... @@ -83,6 +83,7 @@ class OnlineController extends BaseController
'gl_project_deploy_optimize.assist_mid AS optimize_assist_mid',
'gl_project_deploy_optimize.tech_mid AS optimize_tech_mid',
'gl_project_deploy_optimize.domain AS domain',
'gl_project_deploy_optimize.quality_mid AS quality_mid',
];
return $select;
}
... ... @@ -108,6 +109,7 @@ class OnlineController extends BaseController
$item['optimize_optimist'] = $manageModel->getName($item['optimize_optimist_mid']);
$item['optimize_assist'] = $manageModel->getName($item['optimize_assist_mid']);
$item['optimize_tech'] = $manageModel->getName($item['optimize_tech_mid']);
$item['quality_mid_name'] = $manageModel->getName($item['quality_mid']);
$item['plan'] = Project::planMap()[$item['plan']];
$item['created_at'] = date('Y年m月d日', strtotime($item['created_at']));
$item['autologin_code'] = getAutoLoginCode($item['id']);
... ...
... ... @@ -5,6 +5,7 @@ namespace App\Http\Controllers\Aside\Optimize;
use App\Enums\Common\Code;
use App\Http\Controllers\Aside\BaseController;
use App\Http\Logic\Aside\Optimize\OptimizeLogic;
use App\Http\Logic\Aside\Project\ProjectLogic;
use App\Models\Ai\AiPrefix;
use App\Models\ASide\APublicModel;
use App\Models\Channel\Channel;
... ... @@ -73,6 +74,7 @@ class OptimizeController extends BaseController
$item['optimize_optimist'] = $manageModel->getName($item['optimize_optimist_mid']);
$item['optimize_assist'] = $manageModel->getName($item['optimize_assist_mid']);
$item['optimize_tech'] = $manageModel->getName($item['optimize_tech_mid']);
$item['quality_mid_name'] = $manageModel->getName($item['quality_mid']);
$item['plan'] = Project::planMap()[$item['plan']];
$item['created_at'] = date('Y年m月d日', strtotime($item['cooperate_date']));
$item['autologin_code'] = getAutoLoginCode($item['id']);
... ... @@ -244,9 +246,20 @@ class OptimizeController extends BaseController
$projectModel = new Project();
$rs = $projectModel->edit(['robots'=>$this->param['robots']],['id'=>$this->param['project_id']]);
if($rs === false){
$this->response('系统错误,请联系管理员',Code::SYSTEM_ERROR);
$this->response('执行错误,请联系开发人员',Code::SYSTEM_ERROR);
}
//TODO::通知C端
$this->response('success');
$projectLogic = new ProjectLogic();
$project = $projectLogic->getProjectInfo($this->param['project_id']);
$domain = !empty($project['deploy_optimize']['domain']) ? ((new DomainInfo())->getDomain($project['deploy_optimize']['domain'])) : '';
if(empty($domain)){
$domain = $project['deploy_build']['test_domain'];
}
$url = $domain.'api/update_robots/?project_id='.$this->param['project_id'];
$res = curlGet($url);
if(empty($res) || $res['status'] != 200){
$this->response('生成robots失败,请联系开发人员',Code::SYSTEM_ERROR,['url'=>$url]);
}
$this->response('success',Code::SUCCESS,['url'=>$domain.'robots.txt']);
}
}
... ...
... ... @@ -310,6 +310,7 @@ class ProjectController extends BaseController
$item['optimize_optimist'] = $manageModel->getName($item['optimize_optimist_mid']);
$item['optimize_assist'] = $manageModel->getName($item['optimize_assist_mid']);
$item['optimize_tech'] = $manageModel->getName($item['optimize_tech_mid']);
$item['quality_mid_name'] = $manageModel->getName($item['quality_mid']);
$item['plan'] = Project::planMap()[$item['plan']];
$item['created_at'] = date('Y年m月d日', strtotime($item['cooperate_date']));
$item['autologin_code'] = getAutoLoginCode($item['id']);
... ...
... ... @@ -22,7 +22,11 @@ class InquiryController extends BaseController
public function index(InquiryLogic $logic)
{
$data = $logic->getApiList();
if(($this->param['type']??'') == 'other'){
$data = $logic->getOtherList();
}else{
$data = $logic->getApiList();
}
return $this->success($data);
}
... ... @@ -32,7 +36,12 @@ class InquiryController extends BaseController
],[
'id.required' => 'ID不能为空'
]);
$data = $logic->getInfo($this->param['id']);
if(($this->param['type']??'') == 'other'){
$data = $logic->getOtherInfo($this->param['id']);
}else{
$data = $logic->getInfo($this->param['id']);
}
return $this->success($data);
}
... ... @@ -43,8 +52,12 @@ class InquiryController extends BaseController
],[
'ids.required' => 'ID不能为空'
]);
if(($this->param['type']??'') == 'other'){
$logic->deleteOther($this->param['ids']);
}else{
$logic->delete($this->param['ids']);
}
$logic->delete($this->param['ids']);
return $this->success();
}
... ... @@ -58,22 +71,32 @@ class InquiryController extends BaseController
*/
public function export(InquiryLogic $logic)
{
$data = $logic->getApiList(true);
if(($this->param['type']??'') == 'other'){
$data = $logic->getOtherList(true);
$map = [
'submit_time' => '询盘发送时间',
'email' => '邮箱',
'ip_address' => '访问国家/地区(IP)',
'referer' => '发送页面',
];
}else{
$data = $logic->getApiList(true);
$map = [
'submit_time' => '询盘发送时间',
'name' => '姓名',
'email' => '邮箱',
'phone' => '电话',
'ip_address' => '访问国家/地区(IP)',
'refer' => '发送页面',
'message' => '询盘内容',
];
}
$data = $data['list'] ?? [];
foreach ($data as &$item){
$item['ip_address'] = "{$item['country']}({$item['ip']})";
}
$map = [
'submit_time' => '询盘发送时间',
'name' => '姓名',
'email' => '邮箱',
'phone' => '电话',
'ip_address' => '访问国家/地区(IP)',
'refer' => '发送页面',
'message' => '询盘内容',
];
//生成文件,发送到客户端
$table = new BatchExportService("询盘数据导出");
$file = $table->head($map)->data($data)->save();
... ...
... ... @@ -63,6 +63,10 @@ class BTemplateLogLogic extends BaseLogic
//更新所有界面的other
if(!empty($info['other'])){
$commonTemplateModel->edit(['other'=>$info['other']],['project_id'=>$this->user['project_id'],'template_id'=>$info['template_id']]);
}else{
$footer_other = str_replace('<header','',characterTruncation($info['text'],'/<style id="globalsojs-footer">(.*?)<header/s'));
$other = preg_replace('/<style id="globalsojs-footer">(.*?)<\/style>/s', '', $footer_other);
$commonTemplateModel->edit(['other'=>$other],['project_id'=>$this->user['project_id'],'template_id'=>$info['template_id']]);
}
}catch (\Exception $e){
$this->fail('系统错误,请联系管理员');
... ... @@ -115,7 +119,8 @@ class BTemplateLogLogic extends BaseLogic
$this->fail('当前数据不存在,或已被删除');
}
if(empty($info['other'])){
$info['other'] = str_replace('<header','',characterTruncation($info['text'],"/<link id=\"google-fonts-link\"(.*?)<header/s"));;
$footer_other = str_replace('<header','',characterTruncation($info['text'],'/<style id="globalsojs-footer">(.*?)<header/s'));
$info['other'] = preg_replace('/<style id="globalsojs-footer">(.*?)<\/style>/s', '', $footer_other);
}
$html = $info['head_css'].$info['main_css'].$info['footer_css'].$info['other'].
$info['head_html'].$info['main_html'].$info['footer_html'];
... ...
... ... @@ -277,7 +277,8 @@ class BTemplateLogic extends BaseLogic
'footer_html'=>$param['footer_html'],
'footer_css'=>$param['footer_css'],
];
$other = str_replace('<header','',characterTruncation($param['html'],"/<link id=\"google-fonts-link\"(.*?)<header/s"));
$footer_other = str_replace('<header','',characterTruncation($param['html'],'/<style id="globalsojs-footer">(.*?)<header/s'));
$other = preg_replace('/<style id="globalsojs-footer">(.*?)<\/style>/s', '', $footer_other);
if($info === false){
$data['template_id'] = $param['template_id'];
$data['project_id'] = $this->user['project_id'];
... ... @@ -335,8 +336,9 @@ class BTemplateLogic extends BaseLogic
'main_css'=>$param['main_css'],
'footer_html'=>$param['footer_html'],
'footer_css'=>$param['footer_css'],
'other'=> str_replace('<header','',characterTruncation($param['html'],"/<link id=\"google-fonts-link\"(.*?)<header/s"))
];
$footer_other = str_replace('<header','',characterTruncation($param['html'],'/<style id="globalsojs-footer">(.*?)<header/s'));
$data['other'] = preg_replace('/<style id="globalsojs-footer">(.*?)<\/style>/s', '', $footer_other);
$bTemplateLogModel = new BTemplateLog();
return $bTemplateLogModel->add($data);
}
... ...
... ... @@ -136,8 +136,9 @@ class CustomTemplateLogic extends BaseLogic
'footer_css'=>characterTruncation($html,'/<style id="globalsojs-footer">(.*?)<\/style>/s'),
'main_html' => characterTruncation($html,'/<main\b[^>]*>(.*?)<\/main>/s'),
'main_css' => characterTruncation($html,'/<style id="globalsojs-styles">(.*?)<\/style>/s'),
'other'=> str_replace('<header','',characterTruncation($html,"/<link id=\"google-fonts-link\"(.*?)<header/s"))
];
$footer_other = str_replace('<header','',characterTruncation($html,'/<style id="globalsojs-footer">(.*?)<header/s'));
$data['other'] = preg_replace('/<style id="globalsojs-footer">(.*?)<\/style>/s', '', $footer_other);
$bTemplateLogModel = new BTemplateLog();
return $bTemplateLogModel->add($data);
}
... ... @@ -151,7 +152,6 @@ class CustomTemplateLogic extends BaseLogic
*/
public function saveCommonTemplate($html,$template_id){
$type = $this->getType();
$templateCommonModel = new BTemplateCommon();
$info = $templateCommonModel->read(['template_id'=>$template_id,'project_id'=>$this->user['project_id'],'type'=>$type]);
$data = [
... ... @@ -160,7 +160,8 @@ class CustomTemplateLogic extends BaseLogic
'footer_html'=>characterTruncation($html,'/<footer\b[^>]*>(.*?)<\/footer>/s'),
'footer_css'=>characterTruncation($html,'/<style id="globalsojs-footer">(.*?)<\/style>/s'),
];
$other = str_replace('<header','',characterTruncation($html,"/<link id=\"google-fonts-link\"(.*?)<header/s"));
$footer_other = str_replace('<header','',characterTruncation($html,'/<style id="globalsojs-footer">(.*?)<header/s'));
$other = preg_replace('/<style id="globalsojs-footer">(.*?)<\/style>/s', '', $footer_other);
if($info === false){
$data['template_id'] = $template_id;
$data['project_id'] = $this->user['project_id'];
... ...
... ... @@ -341,6 +341,8 @@ class VisualizationLogic extends BaseLogic
'footer_html'=>characterTruncation($html,'/<footer\b[^>]*>(.*?)<\/footer>/s'),
'footer_css'=>characterTruncation($html,'/<style id="globalsojs-footer">(.*?)<\/style>/s'),
];
$footer_other = str_replace('<header','',characterTruncation($html,'/<style id="globalsojs-footer">(.*?)<header/s'));
$data['other'] = preg_replace('/<style id="globalsojs-footer">(.*?)<\/style>/s', '', $footer_other);
$bTemplateLogModel = new BTemplateLog();
return $bTemplateLogModel->add($data);
}
... ... @@ -362,7 +364,8 @@ class VisualizationLogic extends BaseLogic
'footer_html'=>characterTruncation($html,'/<footer\b[^>]*>(.*?)<\/footer>/s'),
'footer_css'=>characterTruncation($html,'/<style id="globalsojs-footer">(.*?)<\/style>/s'),
];
$other = str_replace('<header','',characterTruncation($html,"/<link id=\"google-fonts-link\"(.*?)<header/s"));
$footer_other = str_replace('<header','',characterTruncation($html,'/<style id="globalsojs-footer">(.*?)<header/s'));
$other = preg_replace('/<style id="globalsojs-footer">(.*?)<\/style>/s', '', $footer_other);
if($info === false){
$data['template_id'] = $template_id;
$data['project_id'] = $this->user['project_id'];
... ...
... ... @@ -8,6 +8,9 @@ use App\Helper\Translate;
use App\Http\Logic\Aside\Project\ProjectLogic;
use App\Http\Logic\Bside\BaseLogic;
use App\Models\Domain\DomainInfo;
use App\Models\Inquiry\InquiryOther;
use App\Services\ProjectServer;
use Illuminate\Support\Facades\DB;
/**
* Class InquiryLogic
... ... @@ -28,7 +31,11 @@ class InquiryLogic extends BaseLogic
public function getApiList($export = false)
{
$page_size = $export ? 1000 : 20;
if(isset($this->request['row'])){
$page_size = $this->request['row'];
}else{
$page_size = $export ? 1000 : 20;
}
$search = $this->request['search'] ?: '';
$page = $this->request['page'] ?: 1;
$project = (new ProjectLogic())->getProjectInfo($this->user['project_id']);
... ... @@ -53,6 +60,23 @@ class InquiryLogic extends BaseLogic
return $this->success($data);
}
public function getOtherList($export = false){
$page_size = $export ? 1000 : 20;
$search = $this->request['search'] ?: '';
$page = $this->request['page'] ?: 1;
$map = [];
if($search){
$map['email'] = ['like','%'.$search.'%'];
}
ProjectServer::useProject($this->user['project_id']);
$data = (new InquiryOther())->lists($map,$page,$page_size,'id',
['id', 'email', 'ip', 'country', 'domain', DB::raw('referer as refer'), DB::raw('status as read_status'), 'submit_time']
);
return $this->success($data);
}
public function getInfo($id)
{
$project = (new ProjectLogic())->getProjectInfo($this->user['project_id']);
... ... @@ -69,6 +93,15 @@ class InquiryLogic extends BaseLogic
return $this->success(['trans_message' => $trans_message]);
}
public function getOtherInfo($id){
//修改状态为已读
if($this->request['read_status']){
ProjectServer::useProject($this->user['project_id']);
(new InquiryOther())->edit(['status' => 1], ['id' => $id]);
}
return $this->success(['trans_message' => '']);
}
public function delete($ids, $map = [])
{
$project = (new ProjectLogic())->getProjectInfo($this->user['project_id']);
... ... @@ -81,6 +114,16 @@ class InquiryLogic extends BaseLogic
return $this->success();
}
public function deleteOther($ids, $map = [])
{
$ids = array_filter(Arr::splitFilterToArray($ids), 'intval');
if(!$ids){
$this->fail('ID不能为空');
}
ProjectServer::useProject($this->user['project_id']);
(new InquiryOther())->del(['id'=>['in',$ids]]);
return $this->success();
}
... ...
... ... @@ -24,12 +24,7 @@ class WebSettingCountryLogic extends BaseLogic
* @time :2023/4/28 16:18
*/
public function country_list(){
$lists = $this->model->list($this->param,'id',['id','name','country_img']);
if (!empty($lists)){
foreach ($lists as $k => $v){
$lists[$k]['image_link'] = url('upload/country/' . $v['country_img']);
}
}
$lists = $this->model->list($this->param,'id',['id','name','alias','lang_text']);
return $this->success($lists);
}
... ...
... ... @@ -24,7 +24,7 @@ class VisitLogic extends BaseLogic
public function getVisitList($map,$page,$row,$order,$filed = ['*'])
{
$map['domain'] = $this->user['domain'];
// $map['domain'] = $this->user['domain'];
$lists = $this->model->lists($map,$page,$row,$order,$filed);
return $this->success($lists);
}
... ... @@ -33,7 +33,7 @@ class VisitLogic extends BaseLogic
$this->model = new VisitItem();
$map = [
'customer_visit_id' => $this->param['id'],
'domain' => $this->user['domain'],
// 'domain' => $this->user['domain'],
];
$data = $this->model->list($map);
return $this->success($data);
... ...
<?php
namespace App\Models\Inquiry;
use App\Models\Base;
use Illuminate\Database\Eloquent\SoftDeletes;
/**
* Class InquiryOther
* @package App\Models\Inquiry
* @author zbj
* @date 2023/11/29
*/
class InquiryOther extends Base
{
use SoftDeletes;
//连接数据库
protected $connection = 'custom_mysql';
protected $table = 'gl_inquiry_other';
}
... ...