作者 zhl

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

正在显示 53 个修改的文件 包含 469 行增加773 行删除
... ... @@ -164,24 +164,6 @@ class Count extends Command
}
/**
* @param $yesterday
* @name :(服务达标天数)compliance_day
* @author :lyh
* @method :post
* @time :2023/6/14 15:48
*/
public function compliance_day($project_id){
//服务达标天数
$rank_info = DB::table('gl_rank_data')->where(['project_id'=>$project_id,'lang'=>''])->select(['compliance_day'])->first();
if(empty($rank_info)){
$compliance_day = 0;
}else{
$compliance_day = $rank_info->compliance_day;
}
return $compliance_day;
}
/**
* @name :(查询参数设置)selectParam
* @author :lyh
* @method :post
... ...
... ... @@ -67,7 +67,6 @@ class InitProject extends Command
if(!empty($project['serve_id'])){
$project_logic->updateServe($project['serve_id']);
}
$item->status = NoticeLog::STATUS_SUCCESS;
$item->save();
echo 'success:' . $item['id'] . PHP_EOL;
... ...
... ... @@ -38,7 +38,7 @@ abstract class BaseCommands extends Command
if($error){
echo 'error';
}
$error && sleep(60);
$error && sleep(10);
}while($error);
}
... ...
... ... @@ -47,7 +47,7 @@ class ExternalLinks extends BaseCommands
continue;
}
$model = ExternalLinksModel::where('project_id', $project_id)->first();
if ($model && $model->updated_date == getThisWeekStarDate()) {
if ($model && $model->updated_date >= getThisWeekStarDate()) {
continue;
}
if (!$model) {
... ...
... ... @@ -42,7 +42,7 @@ class IndexedPages extends BaseCommands
LogUtils::info('start rank_data_indexed_pages:' . count($list));
foreach ($list as $project_id => $api_no) {
$model = IndexedPagesModel::where('project_id', $project_id)->first();
if($model && $model->updated_date == getThisWeekStarDate()){
if($model && $model->updated_date >= getThisWeekStarDate()){
continue;
}
... ...
... ... @@ -59,7 +59,7 @@ class RankDataTask extends Command
$api = new QuanqiusouApi();
$site_res = $api->getSiteRes();
(new RankDataLogic())->syncRankData($item['data']['api_no'], $site_res);
(new RankDataLogic())->syncRankData($item['data']['api_no'], $site_res, true);
$item->status = NoticeLog::STATUS_SUCCESS;
$item->save();
... ...
... ... @@ -53,7 +53,7 @@ class RankWeek extends BaseCommands
LogUtils::info('start rank_data_week:' . count($list));
foreach ($list as $project_id => $api_no) {
$rank_week = RankWeekModel::where('project_id', $project_id)->first();
if ($rank_week && $rank_week->updated_date == getThisWeekStarDate()) {
if ($rank_week && $rank_week->updated_date >= getThisWeekStarDate()) {
//本周数据已更新
continue;
}
... ...
... ... @@ -46,7 +46,7 @@ class RecommDomain extends BaseCommands
continue;
}
$model = RecommDomainModel::where('project_id', $project_id)->first();
if ($model && $model->updated_date == getThisWeekStarDate()) {
if ($model && $model->updated_date >= getThisWeekStarDate()) {
continue;
}
if (!$model) {
... ...
... ... @@ -47,7 +47,7 @@ class Speed extends BaseCommands
LogUtils::info('start rank_data_speed:' . count($list));
foreach ($list as $project_id => $domain) {
$model = GoogleSpeedModel::where('project_id', $project_id)->first();
if ($model && $model->updated_date == getThisWeekStarDate()) {
if ($model && $model->updated_date >= getThisWeekStarDate()) {
//今周已更新 跳过
continue;
}
... ...
... ... @@ -83,7 +83,7 @@ class HtmlCollect extends Command
//采集html页面,下载资源到本地并替换
try {
$html = curl_c('https://' . $collect_info->domain . $collect_info->route, false);
if ($html == '0' || strpos($html,'404 Not Found') !== false) {
if ($html == '0' || strpos($html, '404 Not Found') !== false) {
$collect_info->status = CollectTask::STATUS_FAIL;
$collect_info->save();
... ... @@ -138,7 +138,7 @@ class HtmlCollect extends Command
}
$update_log = UpdateLog::whereNotIn('project_id', [555, 626])->where('status', UpdateLog::STATUS_COM)->where('collect_status', UpdateLog::COLLECT_STATUS_UN)->orderBy('project_id', 'asc')->first();
$update_log = UpdateLog::where('status', UpdateLog::STATUS_COM)->where('collect_status', UpdateLog::COLLECT_STATUS_UN)->orderBy('project_id', 'asc')->first();
if (!$update_log) {
return false;
}
... ... @@ -286,7 +286,7 @@ class HtmlCollect extends Command
return [
'download' => true,
'url' => $url,
'url_complete' => ($scheme ?: 'https') . '://' . ($host ?: $domain) . $path . ($query ? '?' . $query : '')
'url_complete' => ($scheme ?: 'https') . '://' . $domain . $path . ($query ? '?' . $query : '')
];
} else {
return [
... ...
... ... @@ -302,7 +302,7 @@ class HtmlLanguageCollect extends Command
return [
'download' => true,
'url' => $url,
'url_complete' => ($scheme ?: 'https') . '://' . ($host ?: $domain) . $path . ($query ? '?' . $query : '')
'url_complete' => ($scheme ?: 'https') . '://' . $domain . $path . ($query ? '?' . $query : '')
];
} else {
return [
... ...
<?php
namespace App\Console\Commands\Update;
use App\Models\Collect\CollectSource;
use App\Models\Collect\CollectTask;
use App\Models\Com\UpdateLog;
use App\Models\Com\UpdateOldInfo;
use App\Models\RouteMap\RouteMap;
use App\Services\CosService;
use App\Services\ProjectServer;
use Illuminate\Console\Command;
use Illuminate\Support\Facades\Cache;
use Illuminate\Support\Facades\DB;
use Illuminate\Support\Facades\Redis;
/**
* 4.0,5.0升级到6.0,小语种页面采集
* Class ProjectImport
* @package App\Console\Commands
* @author Akun
* @date 2023/11/20 14:04
*/
class HtmlLanguageSpecialCollect extends Command
{
/**
* The name and signature of the console command.
*
* @var string
*/
protected $signature = 'project_html_language_special_collect';
/**
* The console command description.
*
* @var string
*/
protected $description = '执行项目html页面采集';
public function handle()
{
ini_set('memory_limit', '512M');
while (true) {
$this->start_collect();
}
}
protected function start_collect()
{
$task_id = $this->get_task();
if ($task_id === false) {
//所有项目采集完成
sleep(60);
return true;
} elseif ($task_id === 0) {
//当前项目采集完成
sleep(2);
return true;
}
$task_arr = explode('_', $task_id);
$project_id = $task_arr[0];
$collect_id = $task_arr[1];
//设置数据库
$project = ProjectServer::useProject($project_id);
if ($project) {
$collect_info = CollectTask::select(['id', 'domain', 'route', 'language'])->where('id', $collect_id)->where('status', CollectTask::STATUS_UN)->where('language', '=', '')->first();
if (!$collect_info) {
sleep(2);
return true;
}
echo 'date:' . date('Y-m-d H:i:s') . ', project_id: ' . $project_id . ', collect_id: ' . $collect_id . ', collect start' . PHP_EOL;
$collect_info->status = CollectTask::STATUS_ING;
$collect_info->save();
//获取站点正式和测试域名
$domain_en = $this->get_domain_en($project_id);
$old_info = UpdateOldInfo::getOldDomain($project_id, $domain_en);
//采集html页面,下载资源到本地并替换
try {
$html = curl_c('https://' . $collect_info->domain . $collect_info->route, false);
if ($html == '0' || strpos($html,'404 Not Found') !== false) {
$collect_info->status = CollectTask::STATUS_FAIL;
$collect_info->save();
$error = $html == '0' ? 'no html' : '404 not found';
echo 'date:' . date('Y-m-d H:i:s') . ', project_id: ' . $project_id . ', collect_id: ' . $collect_id . ', error: ' . $error . PHP_EOL;
sleep(2);
return true;
}
//如果有base64图片,先替换掉,再进行资源匹配
$new_html = $html;
preg_match_all("/data:([^;]*);base64,(.*)?\"/", $new_html, $result_img);
$img_base64 = $result_img[2] ?? [];
foreach ($img_base64 as $v64) {
$new_html = str_replace($v64, '', $new_html);
}
$source_list = $this->html_preg($new_html, $project_id, $domain_en, $old_info['web_url_domain'], $old_info['home_url']);
if ($source_list) {
$html = $this->upload_source($html, $source_list, $project_id, $domain_en, $old_info['web_url_domain'], $old_info['home_url']);
}
} catch (\Exception $e) {
$collect_info->status = CollectTask::STATUS_FAIL;
$collect_info->save();
echo 'date:' . date('Y-m-d H:i:s') . ', project_id: ' . $project_id . ', collect_id: ' . $collect_id . ', error: ' . $e->getMessage() . PHP_EOL;
sleep(2);
return true;
}
$collect_info->html = $html;
$collect_info->status = CollectTask::STATUS_COM;
$collect_info->save();
echo 'date:' . date('Y-m-d H:i:s') . ', project_id: ' . $project_id . ', collect_id: ' . $collect_id . ', collect end' . PHP_EOL;
}
//关闭数据库
DB::disconnect('custom_mysql');
sleep(2);
return true;
}
//获取任务
protected function get_task()
{
$key = 'console_html_language_special_collect_task';
$task_id = Redis::rpop($key);
if ($task_id) {
return $task_id;
}
$update_log = UpdateLog::whereIn('project_id', [555, 626])->where('status', UpdateLog::STATUS_COM)->where('collect_status', UpdateLog::COLLECT_STATUS_UN)->first();
if (!$update_log) {
return false;
}
switch ($update_log->api_type) {
case 'page':
$source = RouteMap::SOURCE_PAGE;
break;
case 'news':
$source = RouteMap::SOURCE_NEWS;
break;
case 'blog':
$source = RouteMap::SOURCE_BLOG;
break;
default:
$source = RouteMap::SOURCE_PRODUCT;
break;
}
$complete = false;
//设置数据库
$project = ProjectServer::useProject($update_log->project_id);
if ($project) {
$collect_list = CollectTask::select(['id', 'project_id'])->where('project_id', $update_log['project_id'])->where('source', $source)->where('language', '=', '')->where('status', CollectTask::STATUS_UN)->orderBy('id', 'asc')->limit(50)->get();
if ($collect_list->count() == 0) {
$complete = true;
} else {
foreach ($collect_list as $collect) {
Redis::lpush($key, $collect['project_id'] . '_' . $collect['id']);
}
}
}
//关闭数据库
DB::disconnect('custom_mysql');
if ($complete) {
$update_log->collect_status = UpdateLog::COLLECT_STATUS_COM;
$update_log->save();
return 0;
}
$task_id = Redis::rpop($key);
return $task_id;
}
//获取英文站域名
protected function get_domain_en($project_id)
{
$key = 'console_html_language_domain_en';
$domain = Cache::get($key);
if (!$domain) {
$domain = CollectTask::where('project_id', $project_id)->where('language', '')->value('domain');
Cache::add($key, $domain, 3600);
}
return $domain;
}
//正则匹配html资源
protected function html_preg($html, $project_id, $domain, $web_url_domain, $home_url)
{
$source = [];
if (!$html) {
return $source;
}
//image
preg_match_all('/<img\s+[^>]*?src\s*=\s*(\'|\")(.*?)\\1[^>]*?\/?\s*>/i', $html, $result_img);
$img = $result_img[2] ?? [];
foreach ($img as $vi) {
$check_vi = $this->url_check($vi, $project_id, $domain, $web_url_domain, $home_url);
if ($check_vi && (!in_array($check_vi, $source))) {
$check_vi && $source[] = $check_vi;
}
}
//js
preg_match_all('/<script\s+[^>]*?src\s*=\s*(\'|\")(.*?)\\1[^>]*?\/?\s*>/i', $html, $result_js);
$js = $result_js[2] ?? [];
foreach ($js as $vj) {
$check_vj = $this->url_check($vj, $project_id, $domain, $web_url_domain, $home_url);
if ($check_vj && (!in_array($check_vj, $source))) {
$check_vj && $source[] = $check_vj;
}
}
//video
preg_match_all('/<source\s+[^>]*?src\s*=\s*(\'|\")(.*?)\\1[^>]*?\/?\s*>/i', $html, $result_video);
$video = $result_video[2] ?? [];
foreach ($video as $vv) {
$check_vv = $this->url_check($vv, $project_id, $domain, $web_url_domain, $home_url);
if ($check_vv && (!in_array($check_vv, $source))) {
$check_vv && $source[] = $check_vv;
}
}
//css
preg_match_all('/<link\s+[^>]*?href\s*=\s*(\'|\")(.*?)\\1[^>]*?\/?\s*>/i', $html, $result_css);
$css = $result_css[2] ?? [];
foreach ($css as $vc) {
$check_vc = $this->url_check($vc, $project_id, $domain, $web_url_domain, $home_url);
if ($check_vc && (!in_array($check_vc, $source))) {
$check_vc && $source[] = $check_vc;
}
}
//css background
preg_match_all("/url\(['\"]?(\s*[^>]+?)['\"]?\)/i", $html, $result_css_b);
$css_b = $result_css_b[1] ?? [];
foreach ($css_b as $vc_b) {
$check_vc_b = $this->url_check($vc_b, $project_id, $domain, $web_url_domain, $home_url);
if ($check_vc_b && (!in_array($check_vc_b, $source))) {
$check_vc_b && $source[] = $check_vc_b;
}
}
//a标签下载资源
preg_match_all('/<a\s+[^>]*?href\s*=\s*(\'|\")(.*?)\\1[^>]*?\/?\s*>/i', $html, $result_a);
$down = $result_a[2] ?? [];
foreach ($down as $vd) {
$check_vd = $this->url_check($vd, $project_id, $domain, $web_url_domain, $home_url);
if ($check_vd && (!in_array($check_vd, $source))) {
$check_vd && $source[] = $check_vd;
}
}
return $source;
}
//判断资源是否需要下载
protected function url_check($url, $project_id, $domain, $web_url_domain, $home_url)
{
if ($url) {
$url = str_replace('&quot;', '', $url);
$arr = parse_url($url);
$scheme = $arr['scheme'] ?? '';
$host = $arr['host'] ?? '';
$path = $arr['path'] ?? '';
$query = $arr['query'] ?? '';
$path_arr = explode('.', $path);
$path_end = end($path_arr);
if (
(empty($scheme) || $scheme == 'https' || $scheme == 'http')
&& (empty($host) || (strpos($web_url_domain, $host) !== false) || (strpos($home_url, $host) !== false))
&& $path
&& (substr($path, 0, 1) == '/')
&& (strpos($path, '.') !== false)
&& (strpos($path_end, 'html') === false)
&& (strpos($path_end, 'php') === false)
&& (strpos($path_end, 'com') === false)
&& (strpos($path_end, 'xml') === false)
) {
$source = CollectSource::where('project_id', $project_id)->where('origin', $url)->first();
if (!$source) {
$new_url = str_replace($web_url_domain, $home_url, $url);
$source_new = CollectSource::where('project_id', $project_id)->where('origin', $new_url)->first();
if (!$source_new) {
return [
'download' => true,
'url' => $url,
'url_complete' => ($scheme ?: 'https') . '://' . $home_url . $path . ($query ? '?' . $query : '')
];
} else {
return [
'download' => false,
'url' => $url,
'url_complete' => $source_new['target']
];
}
} else {
return [
'download' => false,
'url' => $url,
'url_complete' => $source['target']
];
}
} else {
return false;
}
} else {
return false;
}
}
//下载并替换资源
protected function upload_source($html, $source, $project_id, $domain, $web_url_domain, $home_url)
{
foreach ($source as $vs) {
if ($vs['download']) {
$new_source = CosService::uploadRemote($project_id, 'source', $vs['url_complete']);
if ($new_source) {
CollectSource::insert([
'project_id' => $project_id,
'origin' => $vs['url'],
'target' => $new_source,
'created_at' => date('Y-m-d H:i:s'),
'updated_at' => date('Y-m-d H:i:s'),
]);
$html = str_replace($vs['url'], getImageUrl($new_source), $html);
if (substr($new_source, -3, 3) == 'css' || substr($new_source, -2, 2) == 'js') {
$source_html = curl_c(getImageUrl($new_source), false);
if (substr($new_source, -3, 3) == 'css') {
preg_match_all("/url\(['\"]?(\s*[^>]+?)['\"]?\)/i", $source_html, $result_source);
} else {
preg_match_all("/[large|thumb]+URL:['\"]+(\s*[^>]+?)['\"]+,/i", $source_html, $result_source);
}
$js_css_source = $result_source[1] ?? [];
if ($js_css_source) {
foreach ($js_css_source as $vjs) {
if (strpos($vjs, 'URL:"') !== false) {
$vjs = substr($vjs, strpos($vjs, 'URL:"') + 5);
}
$vjs_down = str_replace('&quot;', '', $vjs);
if (strpos($vjs_down, 'data:') !== false) {
//过滤二进制文件
continue;
}
if (strlen($vjs_down) > 255) {
//过滤太长文件
continue;
}
$vjs_down_arr = parse_url($vjs_down);
$vjs_down_host = $vjs_down_arr['host'] ?? '';
$cos = config('filesystems.disks.cos');
$cosCdn = $cos['cdn'];
if ($vjs_down_host && $vjs_down_host == $cosCdn) {
//过滤已经下载的
continue;
}
if (empty($vjs_down_host) && substr($vjs_down, 0, 1) != '/') {
//相对路径
$url_arr = explode('/', $vs['url']);
$url_arr[count($url_arr) - 1] = $vjs_down;
$vjs_down = implode('/', $url_arr);
}
$vjs_result = $this->url_check($vjs_down, $project_id, $domain, $web_url_domain, $home_url);
if (!$vjs_result) {
continue;
}
if ($vjs_result['download']) {
$new_vjs = CosService::uploadRemote($project_id, 'source', $vjs_result['url_complete']);
if ($new_vjs) {
CollectSource::insert([
'project_id' => $project_id,
'origin' => $vjs_result['url'],
'target' => $new_vjs,
'created_at' => date('Y-m-d H:i:s'),
'updated_at' => date('Y-m-d H:i:s'),
]);
$source_html = str_replace($vjs, getImageUrl($new_vjs), $source_html);
}
} else {
$source_html = str_replace($vjs, getImageUrl($vjs_result['url_complete']), $source_html);
}
}
CosService::uploadRemote($project_id, 'source', $new_source, $new_source, $source_html);
}
}
}
} else {
$html = str_replace($vs['url'], getImageUrl($vs['url_complete']), $html);
}
}
return $html;
}
}
... ... @@ -312,7 +312,7 @@ class ProjectUpdate extends Command
}
//关联分类
if($category_arr){
if ($category_arr) {
CategoryRelated::saveRelated($id, array_column($category_arr, 'id'));
}
... ... @@ -689,7 +689,7 @@ class ProjectUpdate extends Command
$host = $arr['host'] ?? '';
$path = $arr['path'] ?? '';
$url_complete = ($scheme ?: 'https') . '://' . ($host ?: $domain) . $path;
$url_complete = ($scheme ?: 'https') . '://' . $domain . $path;
if (
(empty($scheme) || $scheme == 'https' || $scheme == 'http')
... ...
... ... @@ -54,12 +54,13 @@ class UpdateRoute extends Command
*/
public function handle(){
$projectModel = new Project();
$list = $projectModel->list(['id'=>['in',[221]],'is_upgrade'=>0]);
$list = $projectModel->list(['id'=>['in',[627]]]);
foreach ($list as $v){
echo date('Y-m-d H:i:s') . 'project_id:'.$v['id'] . PHP_EOL;
ProjectServer::useProject($v['id']);
$this->getProduct();
// $this->getProduct();
// $this->setProductKeyword();
$this->getRouteMap();
DB::disconnect('custom_mysql');
}
echo date('Y-m-d H:i:s') . 'end' . PHP_EOL;
... ... @@ -138,7 +139,22 @@ class UpdateRoute extends Command
}
}
/**
* @remark :升级项目同步路由
* @name :getRouteMap
* @author :lyh
* @method :post
* @time :2024/1/4 11:53
*/
public function getRouteMap(){
$routeMapModel = new RouteMap();
$list = $routeMapModel->list(['source'=>'product','project_id'=>627]);
foreach ($list as $k => $v){
$product = new Product();
$product->edit(['route'=>$v['route']],['id'=>$v['source_id']]);
echo date('Y-m-d H:i:s') . '产品id:'.$v['source_id'] . PHP_EOL;
}
}
/**
* @remark :删除路由通知C端
... ... @@ -154,4 +170,6 @@ class UpdateRoute extends Command
curlGet($url);
return true;
}
}
... ...
... ... @@ -19,11 +19,11 @@ class Kernel extends ConsoleKernel
$schedule->command('remain_day')->dailyAt('03:00')->withoutOverlapping(1); // 项目剩余服务时长
$schedule->command('rank_data_task')->everyMinute()->withoutOverlapping(1); // 排名数据更新任务
$schedule->command('rank_data')->dailyAt('01:00')->withoutOverlapping(1); // 排名数据,每天凌晨执行一次
$schedule->command('rank_data_speed')->weeklyOn(1, '01:00')->withoutOverlapping(1); // 排名数据-测速数据,每周一凌晨执行一次
$schedule->command('rank_data_external_links')->weeklyOn(1, '01:00')->withoutOverlapping(1); // 排名数据-外链,每周一凌晨执行一次
$schedule->command('rank_data_indexed_pages')->weeklyOn(1, '01:00')->withoutOverlapping(1); // 排名数据-页面收录,每周一凌晨执行一次
$schedule->command('rank_data_recomm_domain')->weeklyOn(1, '01:00')->withoutOverlapping(1); // 排名数据-引荐域名,每周一凌晨执行一次
$schedule->command('rank_data_week')->weeklyOn(1, '01:00')->withoutOverlapping(1); // 排名数据,每周一凌晨执行一次
$schedule->command('rank_data_speed')->dailyAt('01:00')->withoutOverlapping(1); // 排名数据-测速数据,每周一凌晨执行一次
$schedule->command('rank_data_external_links')->dailyAt('01:00')->withoutOverlapping(1); // 排名数据-外链,每周一凌晨执行一次
$schedule->command('rank_data_indexed_pages')->dailyAt('01:00')->withoutOverlapping(1); // 排名数据-页面收录,每周一凌晨执行一次
$schedule->command('rank_data_recomm_domain')->dailyAt('01:00')->withoutOverlapping(1); // 排名数据-引荐域名,每周一凌晨执行一次
$schedule->command('rank_data_week')->dailyAt('01:00')->withoutOverlapping(1); // 排名数据,每周一凌晨执行一次
// $schedule->command('share_user')->dailyAt('01:00')->withoutOverlapping(1); // 清除用户ayr_share数据,每天凌晨1点执行一次
$schedule->command('count')->dailyAt('01:00')->withoutOverlapping(1); //每天凌晨1点执行一次
$schedule->command('web_traffic 1')->everyThirtyMinutes(); // 引流 1-3个月的项目,半小时一次
... ...
... ... @@ -34,7 +34,7 @@ class QuanqiusouApi
$res = HttpUtils::get($api_url, []);
if($res){
$res = Arr::s2a($res);
Cache::put($key, $res, 24 * 3600);
Cache::put($key, $res, 2 * 3600);
}
} catch (\Exception | GuzzleException $e) {
errorLog('获取站点收录页面数', [], $e);
... ... @@ -60,7 +60,7 @@ class QuanqiusouApi
$res = HttpUtils::get($api_url, ['apino' => $api_no]);
if($res){
$res = Arr::s2a($res);
Cache::put($key, $res, 24 * 3600);
Cache::put($key, $res, 2 * 3600);
}
} catch (\Exception | GuzzleException $e) {
errorLog('获取站点收录页面数', [], $e);
... ... @@ -80,11 +80,11 @@ class QuanqiusouApi
* @author zbj
* @date 2023/5/11
*/
public function getGoogleRank($api_no, int $lang = 0, int $day = 7)
public function getGoogleRank($api_no, int $lang = 0, int $day = 7, $force = true)
{
$key = "quanqiusou_api_rank_{$api_no}_{$lang}_{$day}_" . date('Y-m-d');
$res = Cache::get($key);
if (!$res) {
if (!$res || $force) {
$param = [
'key' => '289c1fc81c89d79c04ed4fd72822948e',
'w' => $api_no,
... ... @@ -100,7 +100,7 @@ class QuanqiusouApi
$res = HttpUtils::get($api_url, $param);
if($res){
$res = Arr::s2a($res);
Cache::put($key, $res, 24 * 3600);
Cache::put($key, $res, 2 * 3600);
}
} catch (\Exception | GuzzleException $e) {
errorLog('获取谷歌排名数据失败', $api_no, $e);
... ... @@ -127,7 +127,7 @@ class QuanqiusouApi
$res = HttpUtils::get($api_url, []);
if($res){
$res = Arr::s2a($res);
Cache::put($key, $res, 24 * 3600);
Cache::put($key, $res, 2 * 3600);
}
} catch (\Exception | GuzzleException $e) {
errorLog('获取每周谷歌排名数据失败', [], $e);
... ... @@ -162,7 +162,7 @@ class QuanqiusouApi
$res = HttpUtils::get($api_url, $param);
if($res){
$res = Arr::s2a($res);
Cache::put($key, $res, 24 * 3600);
Cache::put($key, $res, 2 * 3600);
}
} catch (\Exception | GuzzleException $e) {
errorLog('获取历史排名统计数据失败', [], $e);
... ... @@ -221,7 +221,7 @@ class QuanqiusouApi
$res = HttpUtils::get($api_url, $param);
if($res){
$res = Arr::s2a($res);
Cache::put($key, $res, 24 * 3600);
Cache::put($key, $res, 2 * 3600);
}
} catch (\Exception | GuzzleException $e) {
errorLog('获取项目小语种数据失败', [], $e);
... ... @@ -249,7 +249,7 @@ class QuanqiusouApi
$res = HttpUtils::get($api_url, $param);
if($res){
$res = Arr::s2a($res);
Cache::put($key, $res, 24 * 3600);
Cache::put($key, $res, 2 * 3600);
}
} catch (\Exception | GuzzleException $e) {
errorLog('获取项目API_NO数据失败', [], $e);
... ...
... ... @@ -35,9 +35,9 @@ class SemrushApi
];
try {
$res = HttpUtils::get($url, $params);
return $this->data($res)[0];
return $this->data($res)[0] ?? [];
}catch (\Exception|GuzzleException $e){
errorLog('获取站点外链数据', $params, $e);
errorLog('获取站点外链数据失败', $params, $e);
return false;
}
}
... ... @@ -63,7 +63,7 @@ class SemrushApi
$res = HttpUtils::get($url, $params);
return $this->data($res);
}catch (\Exception|GuzzleException $e){
errorLog('获取站点外链数据', $params, $e);
errorLog('获取站点外链数据失败', $params, $e);
return false;
}
}
... ...
... ... @@ -65,7 +65,7 @@ if (!function_exists('http_post')) {
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "POST");
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false);
curl_setopt($ch, CURLOPT_HTTPHEADER, $header);
curl_setopt($ch, CURLOPT_USERAGENT, 'Mozilla/5.0 (compatible; MSIE 5.01; Windows NT 5.0)');
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
... ... @@ -74,6 +74,8 @@ if (!function_exists('http_post')) {
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$res = curl_exec($ch);
if (curl_errno($ch)) {
$error_message = curl_error($ch);
@file_put_contents(storage_path('logs/lyh_error.log'), var_export($error_message, true) . PHP_EOL, FILE_APPEND);
@file_put_contents(storage_path('logs/lyh_error.log'), var_export($res, true) . PHP_EOL, FILE_APPEND);
}
curl_close($ch);
... ...
... ... @@ -124,27 +124,4 @@ class BaseController extends Controller
$response = response($result,$result_code,$this->header);
throw new HttpResponseException($response);
}
/**
* @remark :返回json
* @name :success
* @author :lyh
* @method :post
* @time :2023/8/28 10:18
*/
function success(array $data = [], string $code = Code::SUCCESS, bool $objectData = false): JsonResponse
{
if ($objectData) {
$data = (object)$data;
}
$code = Code::fromValue($code);
$response = [
'code' => $code->value,
'data' => $data,
'message' => $code->description,
];
$this->header['token'] = $this->token;
return response()->json($response,200,$this->header);
}
}
... ...
... ... @@ -2,6 +2,7 @@
namespace App\Http\Controllers\Aside\Collect;
use App\Enums\Common\Code;
use App\Http\Controllers\Aside\BaseController;
use App\Http\Logic\Aside\CollectLogic;
... ... @@ -22,6 +23,6 @@ class CollectController extends BaseController
public function index(CollectLogic $collectLogic)
{
$data = $collectLogic->collect_data();
return $this->success($data);
$this->response('success',Code::SUCCESS,$data);
}
}
... ...
... ... @@ -87,9 +87,9 @@ class UpdateController extends BaseController
DB::disconnect('custom_mysql');
$update = ['collect_status' => 0];
if ($this->param['type'] == 2) {
$update['status'] = 0;
}
// if ($this->param['type'] == 2) {
// $update['status'] = 0;
// }
UpdateLog::where('project_id', $this->param['project_id'])->whereIn('api_type', ['post', 'page', 'news', 'blog'])->update($update);
... ...
<?php
namespace App\Http\Controllers\Bside\ProjectAssociation;
namespace App\Http\Controllers\Aside\ProjectAssociation;
use App\Enums\Common\Code;
use App\Exceptions\BsideGlobalException;
use App\Http\Controllers\Bside\BaseController;
use App\Http\Logic\Aside\ProjectAssociation\ProjectAssociationLogic;
use App\Models\ProjectAssociation\ProjectAssociation;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\DB;
use Psr\Container\ContainerExceptionInterface;
use Psr\Container\NotFoundExceptionInterface;
use App\Services\Aside\ProjectAssociation\ProjectAssociationServices;
class ProjectAssociationController extends BaseController
{
private $ProjectAssociationLogic;
public function __construct(Request $request)
{
$this->ProjectAssociationLogic = new ProjectAssociationLogic();
parent::__construct($request);
}
/**
* V6与AICC数据关联
* @return void
* @throws BsideGlobalException
*/
public function saveWeChatData()
public function save()
{
$project_id = (int)request()->post('project_id', 0);
if (empty($project_id)) {
$this->fail('请选择项目!', Code::USER_PARAMS_ERROE);
$this->response('请选择项目!', Code::USER_PARAMS_ERROE);
}
$status = (bool)request()->post('status', 1); # 1 - 正常, 0 - 禁用
$user_id = (int)env('AICC_WECHAT_USER_ID') ?? 0;
if (empty($user_id) && $status) {
$this->fail('请选择要绑定的AICC用户!', Code::USER_PARAMS_ERROE);
$this->response('请选择要绑定的AICC用户!', Code::USER_PARAMS_ERROE);
}
$friend_id = (int)request()->post('friend_id', 0);
if (empty($friend_id) && $status) {
$this->fail('请选择要绑定的AICC用户列表!', Code::USER_PARAMS_ERROE);
$this->response('请选择要绑定的AICC用户列表!', Code::USER_PARAMS_ERROE);
}
$app = (int)request()->post('app', ProjectAssociation::ENTERPRISE_WECHAT);
$app = ProjectAssociation::getApplicationID($app);
$nickname = request()->post('nickname', '');
$user_name = request()->post('user_name', '');
$image = request()->post('image', '');
$data = compact('project_id', 'user_id', 'friend_id', 'nickname', 'user_name', 'image');
$this->ProjectAssociationLogic->saveWeChatData($data);
$data = compact('project_id', 'user_id', 'friend_id', 'nickname', 'user_name', 'image', 'app');
ProjectAssociationServices::getInstance()->save($data);
$this->response('绑定成功');
}
... ... @@ -58,27 +49,34 @@ class ProjectAssociationController extends BaseController
public function check()
{
$project_id = (int)request()->input('project_id', 0);
if (empty($project_id)) {
$this->response('请输入项目信息!', Code::SERVER_ERROR);
}
// 项目绑定状态
$app = (int)request()->input('app', ProjectAssociation::ENTERPRISE_WECHAT);
$app = ProjectAssociation::getApplicationID($app);
$status = request()->input('status');
// 重载redis缓存
$cache = request()->input('cache');
if (isset($status)) {
$status = (int)$status ? ProjectAssociation::STATUS_NORMAL : ProjectAssociation::STATUS_DISABLED;
}
$isRes = $this->ProjectAssociationLogic->normal($project_id);
$isRes = ProjectAssociationServices::getInstance()->normal($project_id, $app);
// 当数据不存在时并开启状态,自动添加一条数据
if (is_null($isRes) && (!is_null($status) && $status)) {
$isRes = $this->ProjectAssociationLogic->saveProject($project_id, $status);
if (is_null($isRes)) {
$value = ProjectAssociationServices::getInstance()->saveProject($project_id, $status, $app);
if (empty($value['bool'])) {
// 保存数据失败
$this->response('绑定AICC数据失败!', Code::SERVER_ERROR);
}
$isRes = $value['isRes'];
} // 关闭状态
elseif (!is_null($isRes) && (!is_null($status) && empty($status))) {
$bool = $this->ProjectAssociationLogic->closedState($isRes, $status);
$bool = ProjectAssociationServices::getInstance()->closedState($isRes, $status);
if ($bool) {
// 关闭aicc绑定成功
$this->response('关闭aicc绑定 - 成功!');
}else{
} else {
// 关闭aicc绑定失败
$this->response('关闭aicc绑定 - 失败!');
}
... ... @@ -88,7 +86,7 @@ class ProjectAssociationController extends BaseController
$this->response('success', Code::SERVER_ERROR);
}
$cache = isset($cache);
$result = $this->ProjectAssociationLogic->getAiccWechatLists($isRes, $cache);
$result = ProjectAssociationServices::getInstance()->getAiccWechatLists($isRes, $app, $cache);
$this->response('success', Code::SUCCESS, $result);
}
}
... ...
... ... @@ -7,6 +7,8 @@ use App\Exceptions\BsideGlobalException;
use App\Helper\Common;
use App\Http\Controllers\Controller;
use App\Http\Requests\Scene;
use App\Models\Template\BTemplate;
use App\Models\Template\Setting;
use Illuminate\Http\JsonResponse;
use Illuminate\Http\Request;
use Illuminate\Http\Exceptions\HttpResponseException;
... ... @@ -127,7 +129,7 @@ class BaseController extends Controller
* @param bool $objectData
* @return JsonResponse
*/
function success($data) :array
function success($data)
{
return $data;
}
... ... @@ -170,4 +172,85 @@ class BaseController extends Controller
return \Illuminate\Support\Facades\Request::isMethod('post');
}
/**
* @remark :获取当前用户选择的模版
* @name :getTemplateId
* @author :lyh
* @method :post
* @time :2024/1/3 10:52
*/
public function getTemplateId($source,$is_list){
$template_id = 0;
if($this->user['is_customized'] == BTemplate::IS_VISUALIZATION) {//定制项目
$type = $this->getCustomizedType($source, $is_list);//获取定制界面类型
//查看当前页面是否定制,是否开启可视化
$page_array = (array)$this->user['is_visualization']->page_array;//获取所有定制界面
if (in_array($type, $page_array)) {//是定制界面
return $this->success($template_id);
}
}
$bSettingModel = new Setting();
$info = $bSettingModel->read(['project_id'=>$this->user['project_id']]);
if($info === false){
return $this->success($template_id);
}
$template_id = $info['template_id'];
return $this->success($template_id);
}
/**
* @remark :定制页面头部类型---根据source获取type类型
* @name :getType
* @author :lyh
* @method :post
* @time :2023/11/16 11:20
*/
public function getCustomizedType($source,$is_list){
$type = BTemplate::TYPE_HOME;
if($source == BTemplate::SOURCE_PRODUCT){
if($is_list == BTemplate::IS_LIST){
$type = BTemplate::TYPE_PRODUCT_LIST;
}else{
$type = BTemplate::TYPE_PRODUCT_DETAIL;
}
}
if($source == BTemplate::SOURCE_BLOG){
if($is_list == BTemplate::IS_LIST){
$type = BTemplate::TYPE_BLOG_LIST;
}else{
$type = BTemplate::TYPE_BLOG_DETAIL;
}
}
if($source == BTemplate::SOURCE_NEWS){
if($is_list == BTemplate::IS_LIST){
$type = BTemplate::TYPE_NEWS_LIST;
}else{
$type = BTemplate::TYPE_NEWS_DETAIL;
}
}
return $type;
}
/**
* @remark :查看是否已装修
* @name :getIsRenovation
* @author :lyh
* @method :post
* @time :2023/9/13 14:02
*/
public function getIsRenovation($source,$is_list,$template_id,$id){
$webTemplateModel = new BTemplate();
$param = [
'source'=>$source,
'project_id'=>$this->user['project_id'],
'source_id'=>$id,
'template_id'=>$template_id,
'is_list'=>$is_list
];
$templateInfo = $webTemplateModel->read($param);
if($templateInfo !== false){
return 1;
}
return 0;
}
}
... ...
... ... @@ -9,6 +9,7 @@ use App\Http\Requests\Bside\Blog\BlogCategoryRequest;
use App\Models\Blog\Blog as BlogModel;
use App\Models\Blog\BlogCategory as BlogCategoryModel;
use App\Models\RouteMap\RouteMap;
use App\Models\Template\BTemplate;
class BlogCategoryController extends BaseController
{
... ... @@ -25,9 +26,11 @@ class BlogCategoryController extends BaseController
$data = [];
if(!empty($lists)){
$blogModel = new BlogModel();
$template_id = $this->getTemplateId(BTemplate::SOURCE_BLOG,BTemplate::IS_LIST);
foreach ($lists as $k => $v){
$v['num'] = $blogModel->formatQuery(['category_id'=>['like','%,' . $v['id'] . ',%']])->count();
$v['url'] = $this->user['domain'] . getRouteMap(RouteMap::SOURCE_BLOG_CATE,$v['id']);
$v['is_renovation'] = $this->getIsRenovation(BTemplate::SOURCE_BLOG,BTemplate::IS_LIST,$template_id,$v['id']);
$lists[$k] = $v;
}
if(!isset($this->map['name'])){
... ...
... ... @@ -32,18 +32,15 @@ class BlogController extends BaseController
$lists = $query->select($filed)->paginate($this->row, ['*'], 'page', $this->page);
if(!empty($lists)){
$lists = $lists->toArray();
// //获取当前项目的所有分类
$data = $this->getCategoryList();
//获取当前用户选择的模版
$templateSettingModel = new Setting();
$info = $templateSettingModel->read(['project_id'=>$this->user['project_id']]);
$template_id = $this->getTemplateId(BTemplate::SOURCE_BLOG,BTemplate::IS_DETAIL);
$user = new User();
foreach ($lists['list'] as $k => $v){
$v['category_name'] = $this->categoryName($v['category_id'],$data);
$v['url'] = $this->user['domain'] . getRouteMap(RouteMap::SOURCE_BLOG,$v['id']);
$v['image_link'] = getImageUrl($v['image']);
$v['operator_name'] = $user->getName($v['operator_id']);
$v['is_renovation'] = $this->getProductIsRenovation($info,$v['id']);
$v['is_renovation'] = $this->getIsRenovation(BTemplate::SOURCE_BLOG,BTemplate::IS_DETAIL,$template_id,$v['id']);
$lists['list'][$k] = $v;
}
}
... ... @@ -51,31 +48,6 @@ class BlogController extends BaseController
}
/**
* @remark :查看产品是否已装修
* @name :getProductIsRenovation
* @author :lyh
* @method :post
* @time :2023/9/13 14:02
*/
public function getProductIsRenovation($info,$id){
if($info !== false){
$webTemplateModel = new BTemplate();
$param = [
'source'=>BTemplate::SOURCE_BLOG,
'project_id'=>$this->user['project_id'],
'source_id'=>$id,
'template_id'=>$info['template_id'],
'is_list'=>0
];
$templateInfo = $webTemplateModel->read($param);
if($templateInfo !== false){
return 1;
}
}
return 0;
}
/**
* @remark :处理列表返回参数
* @name :handleReturnParam
* @author :lyh
... ...
... ... @@ -32,7 +32,7 @@ class CustomModuleCategoryController extends BaseController
]);
$this->map['project_id'] = $this->user['project_id'];
$this->map['status'] = 0;
$list = $customModuleCategory->list($this->map);
$list = $customModuleCategory->list($this->map,'sort');
if(!empty($list)){
foreach ($list as $k => $v){
$v['url'] = $this->user['domain'].$v['route'];
... ... @@ -130,4 +130,23 @@ class CustomModuleCategoryController extends BaseController
$logic->categoryDel();
$this->response('success');
}
/**
* @remark :排序
* @name :sort
* @author :lyh
* @method :post
* @time :2024/1/3 14:18
*/
public function sort(CustomModuleCategoryLogic $logic){
$this->request->validate([
'id'=>['required'],
'sort'=>['required'],
],[
'id.required' => 'ID不能为空',
'sort.required' => '排序字段不能为空',
]);
$logic->categorySort();
$this->response('success');
}
}
... ...
... ... @@ -9,6 +9,7 @@ use App\Http\Requests\Bside\News\NewsCategoryRequest;
use App\Models\News\News as NewsModel;
use App\Models\News\NewsCategory as NewsCategoryModel;
use App\Models\RouteMap\RouteMap;
use App\Models\Template\BTemplate;
class NewsCategoryController extends BaseController
{
... ... @@ -25,9 +26,11 @@ class NewsCategoryController extends BaseController
$data = [];
if(!empty($lists)){
$newsModel = new NewsModel();
$template_id = $this->getTemplateId(BTemplate::SOURCE_BLOG,BTemplate::IS_LIST);
foreach ($lists as $k => $v){
$v['num'] = $newsModel->formatQuery(['category_id'=>['like','%,' . $v['id'] . ',%']])->count();
$v['url'] = $this->user['domain'].getRouteMap(RouteMap::SOURCE_NEWS_CATE,$v['id']);
$v['is_renovation'] = $this->getIsRenovation(BTemplate::SOURCE_NEWS,BTemplate::IS_LIST,$template_id,$v['id']);
$lists[$k] = $v;
}
if(!isset($this->map['name'])){
... ...
... ... @@ -36,15 +36,14 @@ class NewsController extends BaseController
// //获取当前项目的所有分类
$data = $this->getCategoryList();
//获取当前用户选择的模版
$templateSettingModel = new Setting();
$info = $templateSettingModel->read(['project_id'=>$this->user['project_id']]);
$template_id = $this->getTemplateId(BTemplate::SOURCE_NEWS,BTemplate::IS_DETAIL);//获取模版id
$user = new User();
foreach ($lists['list'] as $k => $v){
$v['category_name'] = $this->categoryName($v['category_id'],$data);
$v['url'] = $this->user['domain'].getRouteMap(RouteMap::SOURCE_NEWS,$v['id']);
$v['image_link'] = getImageUrl($v['image']);
$v['operator_name'] = $user->getName($v['operator_id']);
$v['is_renovation'] = $this->getProductIsRenovation($info,$v['id']);
$v['is_renovation'] = $this->getIsRenovation(BTemplate::SOURCE_NEWS,BTemplate::IS_DETAIL,$template_id,$v['id']);
$lists['list'][$k] = $v;
}
}
... ... @@ -52,31 +51,6 @@ class NewsController extends BaseController
}
/**
* @remark :查看产品是否已装修
* @name :getProductIsRenovation
* @author :lyh
* @method :post
* @time :2023/9/13 14:02
*/
public function getProductIsRenovation($info,$id){
if($info !== false){
$webTemplateModel = new BTemplate();
$param = [
'source'=>4,
'project_id'=>$this->user['project_id'],
'source_id'=>$id,
'template_id'=>$info['template_id'],
'is_list'=>0
];
$templateInfo = $webTemplateModel->read($param);
if($templateInfo !== false){
return 1;
}
}
return 0;
}
/**
* @remark :处理列表返回参数
* @name :handleReturnParam
* @author :lyh
... ...
... ... @@ -10,6 +10,7 @@ use App\Models\Product\Category;
use App\Models\Product\CategoryRelated;
use App\Models\Product\Product;
use App\Models\RouteMap\RouteMap;
use App\Models\Template\BTemplate;
use App\Rules\Ids;
use Illuminate\Http\Request;
... ... @@ -36,10 +37,12 @@ class CategoryController extends BaseController
$list = $category->list($this->map,['sort','id'],$filed);
$data = [];
if(!empty($list)){
$template_id = $this->getTemplateId(BTemplate::SOURCE_PRODUCT,BTemplate::IS_LIST);//获取模版id
foreach ($list as $k =>$v){
$v['url'] = $this->user['domain'] . $v['route'].'/';
$v['product_num'] = Category::getProductNum($v['id']);
$v['image_link'] = getImageUrl($v['image']);
$v['is_renovation'] = $this->getIsRenovation(BTemplate::SOURCE_PRODUCT,BTemplate::IS_LIST,$template_id,$v['id']);
$list[$k] = $v;
}
if(!isset($this->map['title'])){
... ...
... ... @@ -7,6 +7,7 @@ use App\Exceptions\BsideGlobalException;
use App\Helper\Arr;
use App\Helper\Common;
use App\Http\Controllers\Bside\BaseController;
use App\Http\Logic\Bside\BTemplate\BTemplateLogic;
use App\Http\Logic\Bside\Product\ProductLogic;
use App\Http\Requests\Bside\Product\ProductRequest;
use App\Models\Product\Category;
... ... @@ -52,15 +53,13 @@ class ProductController extends BaseController
$lists = $lists->toArray();
$cate_data = $this->getCategoryList();//分类
$key_data = $this->getKeywordsList();//关键字
//获取当前用户选择的模版
$templateSettingModel = new Setting();
$info = $templateSettingModel->read(['project_id'=>$this->user['project_id']]);
$template_id = $this->getTemplateId(BTemplate::SOURCE_PRODUCT,BTemplate::IS_DETAIL);//获取模版id
$userModel = new User();
foreach ($lists['list'] as $k=>$v){
$v['category_id_text'] = $this->categoryName($v['category_id'],$cate_data);
$v['keyword_id_text'] = $this->keywordName($v['keyword_id'],$key_data);
$v['created_uid_text'] = $userModel->getName($v['created_uid']);
$v['is_renovation'] = $this->getProductIsRenovation($info,$v['id']);
$v['is_renovation'] = $this->getIsRenovation(BTemplate::SOURCE_PRODUCT,BTemplate::IS_DETAIL,$template_id,$v['id']);
$v['url'] = $this->user['domain'].$v['route'].'/';
$lists['list'][$k] = $v;
}
... ... @@ -119,31 +118,6 @@ class ProductController extends BaseController
}
/**
* @remark :查看产品是否已装修
* @name :getProductIsRenovation
* @author :lyh
* @method :post
* @time :2023/9/13 14:02
*/
public function getProductIsRenovation($info,$id){
if($info !== false){
$webTemplateModel = new BTemplate();
$param = [
'source'=>2,
'project_id'=>$this->user['project_id'],
'source_id'=>$id,
'template_id'=>$info['template_id'],
'is_list'=>0
];
$templateInfo = $webTemplateModel->read($param);
if($templateInfo !== false){
return 1;
}
}
return 0;
}
/**
* @remark :获取所有分类
* @name :getCategoryList
* @author :lyh
... ... @@ -266,9 +240,8 @@ class ProductController extends BaseController
}
$v['status_text'] = Product::statusMap()[$v['status']] ?? '';
//获取当前用户选择的模版
$templateSettingModel = new Setting();
$templateInfo = $templateSettingModel->read(['project_id'=>$this->user['project_id']]);
$v['is_renovation'] = $this->getProductIsRenovation($templateInfo,$v['id']);
$template_id = $this->getTemplateId(BTemplate::SOURCE_PRODUCT,BTemplate::IS_DETAIL);
$v['is_renovation'] = $this->getIsRenovation(BTemplate::SOURCE_PRODUCT,BTemplate::IS_DETAIL,$template_id,$v['id']);
$v['url'] = $this->user['domain'].$v['route'];
//获取当前数据扩展字段及值
$v['extend'] = $this->getExtendInfo($v['id']);
... ...
... ... @@ -7,9 +7,7 @@ use App\Http\Controllers\Bside\BaseController;
use App\Http\Logic\Bside\BTemplate\BTemplateLogic;
use App\Http\Requests\Bside\Template\TemplateRequest;
use App\Models\Template\BTemplate;
use App\Models\Template\BTemplateMain;
use App\Models\Template\Setting;
use App\Models\Template\Template;
class BTemplateController extends BaseController
{
... ... @@ -160,4 +158,16 @@ class BTemplateController extends BaseController
$this->response('模板保存成功');
}
/**
* @remark :获取source类型
* @name :getSource
* @author :lyh
* @method :post
* @time :2024/1/3 9:06
*/
public function getSource(){
$bTemplateModel = new BTemplate();
$info = $bTemplateModel->sourceMap();
$this->response('success',Code::SUCCESS,$info);
}
}
... ...
... ... @@ -94,4 +94,16 @@ class InitHtmlController extends BaseController
$logic->saveCustomizedHtml();
$this->response('success');
}
/**
* @remark :前端获取初始设置模块
* @name :getDetailInfo
* @author :lyh
* @method :post
* @time :2024/1/3 14:27
*/
public function getDetailInfo(InitHtmlLogic $logic){
$data = $logic->getInitModuleMain();
$this->response('success',Code::SUCCESS,$data);
}
}
... ...
... ... @@ -81,8 +81,11 @@ class CreateKeywordLogic extends BaseLogic
$prefix_keyword_suffix = $this->prefixKeywordSuffix($this->param['prefix'] ?? [],$this->param['suffix'] ?? [],$this->param['keyword']);
$data = [
'prefix_keyword'=>$prefix_keyword,
'prefix_keyword_count'=>count($prefix_keyword),
'keyword_suffix'=>$keyword_suffix,
'prefix_keyword_suffix'=>$prefix_keyword_suffix
'keyword_suffix_count'=>count($keyword_suffix),
'prefix_keyword_suffix'=>$prefix_keyword_suffix,
'prefix_keyword_suffix_count'=>count($prefix_keyword_suffix)
];
return $this->success($data);
}
... ...
... ... @@ -5,9 +5,9 @@ namespace App\Http\Logic\Aside\Project;
use App\Enums\Common\Code;
use App\Exceptions\AsideGlobalException;
use App\Models\Com\NoticeLog;
use App\Models\Com\UpdateLog;
use App\Models\Devops\ServerConfig;
use App\Models\Project\ProjectRenew;
use App\Models\Template\BSettingTemplate;
use App\Models\Template\Setting;
use App\Models\User\ProjectMenu;
use App\Models\User\ProjectRole;
... ... @@ -15,7 +15,6 @@ use App\Services\SyncService;
use App\Utils\HttpUtils;
use App\Utils\LogUtils;
use GuzzleHttp\Exception\GuzzleException;
use Illuminate\Support\Arr as SupArr;
use App\Helper\Arr;
use App\Helper\Common;
use App\Helper\FormGlobalsoApi;
... ... @@ -37,9 +36,7 @@ use Hashids\Hashids;
use App\Models\User\User as UserModel;
use Illuminate\Support\Facades\DB;
use Illuminate\Support\Facades\Http;
use Illuminate\Support\Facades\Log;
use Illuminate\Support\Facades\Schema;
use Illuminate\Support\Str;
use App\Http\Logic\Aside\Domain\DomainInfoLogic;
/**
... ... @@ -90,6 +87,15 @@ class ProjectLogic extends BaseLogic
if(isset($info['deploy_build']['other_project']) && !empty($info['deploy_build']['other_project'])){
$info['deploy_build']['other_project']= json_decode($info['deploy_build']['other_project']);
}
//升级项目采集完成时间
$collect_time = '';
if($info['is_upgrade'] == 1){
$collect_info = UpdateLog::where('project_id',$id)->where('api_type','blog')->first();
if($collect_info){
$collect_time = $collect_info->collect_status == 0 ? '采集中' : $collect_info->updated_at->format('Y-m-d H:i:s');
}
}
$info['collect_time'] = $collect_time;
return $this->success($info);
}
... ... @@ -418,8 +424,8 @@ class ProjectLogic extends BaseLogic
'role_menu'=>implode(',',$ids),
'project_id'=>$project_id,
'type'=>1,
'operator_id'=>$this->manager['id'],
'create_id'=>$this->manager['id'],
'operator_id'=>0,
'create_id'=>0,
];
$roleModel->add($data);
}
... ...
... ... @@ -62,14 +62,14 @@ class AyrReleaseLogic extends BaseLogic
if($k == 'images'){
$images = $v;
$imageModel = new Image();
$list = $imageModel->list(['hash'=>['in',$images]],'id');
$list = $imageModel->list(['path'=>['in',$images]],'id');
foreach ($list as $v1){
$arr[] = url('/upload'.$v1['path']);
$arr[] = getImageUrl($v1['path']);
}
}else{
$fileModel = new File();
$info = $fileModel->read(['hash'=>$v]);
$arr[] = url('/upload'.$info['path']);
$info = $fileModel->read(['path'=>$v]);
$arr[] = getFileUrl($info['path']);
}
}
return $this->success($arr);
... ...
... ... @@ -39,6 +39,10 @@ class BTemplateLogLogic extends BaseLogic
$this->fail('error');
}
$bTemplateModel = new BTemplate();
if($info['template_id'] == 0){//定制项目
$bTemplateModel->edit(['html'=>$info['text']],['template_id'=>$info['template_id'],'source'=>$info['source'],'source_id'=>$info['source_id']]);
return $this->success();
}
//演示项目,不允许其他号码编辑
if(($this->user['project_id'] == 1) && (!in_array($this->user['mobile'],$bTemplateModel->mobile)) && ($info['source'] == 1)){
$this->fail('演示项目仅支持演示功能,无法更改首页');
... ...
... ... @@ -604,10 +604,6 @@ class BTemplateLogic extends BaseLogic
$param['head_css'] = characterTruncation($param['html'],'/<style id="globalsojs-header">(.*?)<\/style>/s');
$param['main_css'] = characterTruncation($param['html'],'/<style id="globalsojs-styles">(.*?)<\/style>/s');
$param['footer_css'] = characterTruncation($param['html'],'/<style id="globalsojs-footer">(.*?)<\/style>/s');
if(!isset($param['is_custom'])){
$param['is_custom'] = BTemplate::IS_NO_CUSTOM;
}
$param['type'] = BTemplate::PAGE_HTML;//不显示整个HTML
return $this->success($param);
}
... ...
... ... @@ -297,4 +297,20 @@ class InitHtmlLogic extends BaseLogic
}
return $this->success();
}
/**
* @remark :前端获取设置模块(侧边栏)
* @name :getInitModuleMain
* @author :lyh
* @method :post
* @time :2024/1/3 14:30
*/
public function getInitModuleMain(){
$mainModel = new TemplateTypeMain();
$info = $mainModel->read(['type'=>$this->param['type']]);
if($info === false){
$this->fail('当前类型数据不存在');
}
return $this->success(['html'=>$info['main_html']]);
}
}
... ...
... ... @@ -219,4 +219,19 @@ class CustomModuleCategoryLogic extends BaseLogic
$this->curlDelRoute(['route'=>$info['route']]);
return $this->success();
}
/**
* @remark :排序
* @name :categorySort
* @author :lyh
* @method :post
* @time :2023/9/26 17:38
*/
public function categorySort(){
$rs = $this->model->edit(['sort'=>$this->param['sort']],['id'=>$this->param['id']]);
if($rs === false){
$this->fail('系统错误,请联系管理员');
}
return $this->success();
}
}
... ...
... ... @@ -88,7 +88,7 @@ class CountLogic extends BaseLogic
* @time :2023/5/24 14:03
*/
public function keyword_data_count(){
$yesterday = Carbon::yesterday()->toDateString();
$yesterday = date('Y-m-d');
$rankDataModel = new RankDataModel();
$param = [
'updated_date' => $yesterday,
... ...
... ... @@ -202,7 +202,7 @@ class CategoryLogic extends BaseLogic
* 产品导入:分类处理
* @param $project_id
* @param $category
* @return string
* @return array
* @throws \Exception
* @author Akun
* @date 2023/09/21 14:55
... ... @@ -227,7 +227,9 @@ class CategoryLogic extends BaseLogic
}
//清除缓存
Common::del_user_cache('product_category',$project_id);
return $this->getLastCategory($return);
$category_id = $this->getLastCategory($return);
return ['category_id'=>$category_id,'category_arr'=>$return];
}
/**
... ...
... ... @@ -616,10 +616,13 @@ class ProductLogic extends BaseLogic
if (!$product) {
$category_id = '';
$category_arr = [];
if ($data[2]??'') {
//处理分类
$categoryLogic = new CategoryLogic();
$category_id = $categoryLogic->importProductCategory($project_id, $data[2]);
$category_info = $categoryLogic->importProductCategory($project_id, $data[2]);
$category_id = $category_info['category_id'];
$category_arr = $category_info['category_arr'];
}
$keyword_id = '';
... ... @@ -805,6 +808,11 @@ class ProductLogic extends BaseLogic
$this->edit(['route' => $route], ['id' => $id]);
//关联分类
if($category_arr){
CategoryRelated::saveRelated($id, $category_arr);
}
return true;
}
... ...
... ... @@ -65,8 +65,8 @@ class RankDataLogic extends BaseLogic
'cert_info' => $domain_info['cert_info'] ?? '',
'plan' => Project::planMap()[$project['deploy_build']['plan']],
'keyword_num' => $project['deploy_build']['keyword_num'],
'compliance_day' => $rank['compliance_day'] ?? 0,
'remain_day' => $project['deploy_build']['service_duration'] - ($rank['compliance_day'] ?? 0),
'compliance_day' => $project['finish_remain_day'] ?? 0,
'remain_day' => $project['deploy_build']['service_duration'] - ($project['finish_remain_day'] ?? 0),
];
//小语种列表
... ... @@ -357,19 +357,20 @@ class RankDataLogic extends BaseLogic
* @author zbj
* @date 2023/9/20
*/
public function syncRankData($api_no, $site_res){
$project_id = DeployOptimize::where('api_no', $api_no)->value('project_id');
public function syncRankData($api_no, $site_res, $force=false){
$project_ids = DeployOptimize::where('api_no', $api_no)->pluck('project_id');
foreach ($project_ids as $project_id) {
$project = Project::find($project_id);
if(!$project){
if (!$project) {
throw new \Exception($api_no . '关联的项目不存在');
}
$api = new QuanqiusouApi();
$model = RankData::where('project_id', $project_id)->where('lang', '')->first();
if (!$model || $model->updated_date != date('Y-m-d')) {
$res = $api->getGoogleRank($api_no);
if(!$res){
if (!$model || $model->updated_date != date('Y-m-d') || $force) {
$res = $api->getGoogleRank($api_no, 0, 7, $force);
if (!$res) {
throw new \Exception('接口数据获取失败');
}
//收录数
... ... @@ -378,24 +379,25 @@ class RankDataLogic extends BaseLogic
}
//有小语种的
$lang_list = $api->getLangList();
if(!empty($lang_list[$api_no])){
if (!empty($lang_list[$api_no])) {
$model = RankData::where('project_id', $project_id)->where('lang', '<>', '')->first();
if (!$model || $model->updated_date != date('Y-m-d')) {
$res = $api->getGoogleRank($api_no, 1);
if(!$res){
if (!$model || $model->updated_date != date('Y-m-d') || $force) {
$res = $api->getGoogleRank($api_no, 1, 7, $force);
if (!$res) {
throw new \Exception('接口数据获取失败');
}
$data = [];
//不同的小语种取出来
foreach ($res as $keyword => $v){
foreach ($res as $keyword => $v) {
$data[Arr::last($v)['lang']][$keyword] = $v;
}
foreach ($data as $lang => $rank){
foreach ($data as $lang => $rank) {
$this->save_rank($project_id, $rank, 0, $lang);
}
}
}
}
}
/**
* @param $project_id
... ...
... ... @@ -27,19 +27,5 @@ class EnableCrossRequestMiddleware
exit;
}
return $response;
// 指定允许其他域名访问
// $http_origin = "*";
// if(isset($_SERVER['HTTP_ORIGIN'])){
// $http_origin = $_SERVER['HTTP_ORIGIN'];
// }
// header("Access-Control-Allow-Origin:".$http_origin);
// header('Access-Control-Allow-Methods:POST,GET'); //支持的http 动作
// header('Access-Control-Allow-Credentials: true');
// header('Access-Control-Max-Age: 1000');
// header('Access-Control-Allow-Headers:Origin, X-Requested-With, Content-Type, Accept, Authorization, token'); //响应头 请按照自己需求添加。
// if (strtolower($_SERVER['REQUEST_METHOD']) == 'options') {
// exit;
// }
// return $next($request);
}
}
... ...
... ... @@ -5,6 +5,7 @@ namespace App\Models\ProjectAssociation;
use Illuminate\Database\Eloquent\Builder;
use Illuminate\Database\Eloquent\Model;
/**
* App\Models\ProjectAssociation\ProjectAssociation
*
... ... @@ -17,11 +18,13 @@ use Illuminate\Database\Eloquent\Model;
* @property string|null $image AICC朋友头像
* @property int|null $status 1 - 正常, 0 - 禁用
* @property int|null $m_status 统计当月是否生成数据
* @property int|null $binding_app 1 - 企业微信 2 - 个人微信
* @property \Illuminate\Support\Carbon|null $created_at
* @property \Illuminate\Support\Carbon|null $updated_at
* @method Builder|ProjectAssociation newModelQuery()
* @method Builder|ProjectAssociation newQuery()
* @method static Builder|ProjectAssociation query()
* @method Builder|ProjectAssociation whereBindingApp($value)
* @method Builder|ProjectAssociation whereCreatedAt($value)
* @method Builder|ProjectAssociation whereFriendId($value)
* @method Builder|ProjectAssociation whereId($value)
... ... @@ -46,60 +49,30 @@ class ProjectAssociation extends Model
/** @var int 数据状态 - 禁用 */
const STATUS_DISABLED = 0;
/**
* 保存|修改数据
* @param array $data
* @return bool
*/
public function saveData(array $data): bool
{
# V6项目ID
$project_id = (int)$data['project_id'] ?? 0;
$isRes = self::query()->where('project_id', $project_id)->first();
if (!$isRes) {
$isRes = new self();
$isRes->project_id = $project_id;
}
# AICC朋友ID
$isRes->friend_id = $data['friend_id'] ?? 0;
# AICC朋友昵称
$isRes->nickname = $data['nickname'] ?? 0;
# AICC用户ID
$isRes->user_id = $data['user_id'] ?? 0;
# AICC用户姓名
$isRes->user_name = $data['user_name'] ?? '';
# AICC朋友头像
$isRes->image = $data['image'] ?? '';
return $isRes->save();
}
/** @var int 企业微信 */
const ENTERPRISE_WECHAT = 1;
/**
* 检查项目是否存在
* @param $project_id
* @return Builder|Model|object|null
*/
public function check($project_id)
/** @var int 个人微信 */
const PERSONAL_WECHAT = 2;
public static function getApplicationApiUrl($app)
{
return self::query()->where('project_id', $project_id)->first();
return [
1 => env('AICC_ENTERPRISE_WECHAT_FRIEND_API_URL'),
2 => env('AICC_WECHAT_FRIEND_API_URL'),
][$app] ?? env('AICC_ENTERPRISE_WECHAT_FRIEND_API_URL');
}
/**
* @param int $page
* @param int $perPage
* @return array
* 返回绑定的APP应用类型
* @param $app
* @return int
*/
public function allData(int $page = 1, int $perPage = 15)
public static function getApplicationID($app)
{
$status = 1; # 1 - 正常, 0 - 禁用
$lists = self::query()->where('status', $status)
->where('project_id', '!=', 0)
->where('friend_id', '!=', 0)
->where('user_id', '!=', 0)
->paginate($perPage, ['project_id', 'friend_id', 'user_id'], 'page', $page);
$items = $lists->Items();
$totalPage = $lists->lastPage();
$total = $lists->total();
$currentPage = $lists->currentPage();
return compact('total', 'items', 'totalPage', 'currentPage');
return [
1 => self::ENTERPRISE_WECHAT,
2 => self::PERSONAL_WECHAT,
][$app] ?? self::ENTERPRISE_WECHAT;
}
}
... ...
... ... @@ -45,6 +45,7 @@ class BTemplate extends Base
* 其他相关定义
*/
const IS_LIST = 1;//列表页
const IS_DETAIL = 0;//详情页
const IS_HEADER = 1;//独立头部底部
const IS_NO_HEADER = 0;//非独立头部底部
const IS_CUSTOM = 1;//为扩展模块
... ... @@ -131,7 +132,7 @@ class BTemplate extends Base
* @method :post
* @time :2023/12/29 10:57
*/
public function typeMap()
public function sourceMap()
{
return [
'SOURCE_HOME'=>self::SOURCE_HOME,
... ...
<?php
namespace App\Http\Logic\Aside\ProjectAssociation;
namespace App\Services\Aside\ProjectAssociation;
use App\Enums\Common\Code;
use App\Http\Logic\Logic;
use App\Exceptions\BsideGlobalException;
use App\Models\ProjectAssociation\ProjectAssociation;
use App\Services\BaseService;
use Illuminate\Database\Eloquent\Builder;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Support\Facades\DB;
class ProjectAssociationLogic extends Logic
class ProjectAssociationServices extends BaseService
{
public function saveWeChatData($data)
/**
* 保存aicc与项目关系数据
* @param array $data
* @return bool
* @throws BsideGlobalException
*/
public function save(array $data)
{
$wx = new ProjectAssociation();
$bool = false;
DB::beginTransaction();
try {
$status = $wx->saveData($data);
# V6项目ID
$project_id = (int)$data['project_id'] ?? 0;
$isRes = ProjectAssociation::query()->where('project_id', $project_id)->first();
if (!$isRes) {
$isRes = new ProjectAssociation();
$isRes->project_id = $project_id;
}
# AICC朋友ID
$isRes->friend_id = $data['friend_id'] ?? 0;
# AICC朋友昵称
$isRes->nickname = $data['nickname'] ?? 0;
# AICC用户ID
$isRes->user_id = $data['user_id'] ?? 0;
# AICC用户姓名
$isRes->user_name = $data['user_name'] ?? '';
# AICC朋友头像
$isRes->image = $data['image'] ?? '';
$isRes->binding_app = $data['app'] ?? 1;
$bool = $isRes->save();
DB::commit();
} catch (\Exception $e) {
DB::rollBack();
$e->getMessage();
errorLog('V6与AICC关联失败', $wx, $e);
errorLog('V6与AICC关联失败', $data, $e);
$this->fail('请检查操作是否正确!', Code::SERVER_MYSQL_ERROR);
}
return $status;
return $bool;
}
/**
* status - 正常
* @param $project_id
* @param $app
* @return ProjectAssociation|Builder|Model|object|null
*/
public function normal($project_id)
public function normal($project_id, $app)
{
return ProjectAssociation::query()->whereProjectId($project_id)->whereStatus(ProjectAssociation::STATUS_NORMAL)->first();
return ProjectAssociation::query()->whereProjectId($project_id)->whereStatus(ProjectAssociation::STATUS_NORMAL)->whereBindingApp($app)->first();
}
/**
* status - 禁用
* @param $project_id
... ... @@ -50,11 +75,12 @@ class ProjectAssociationLogic extends Logic
/**
* 初始化数据/修改数据
* @param int $project_id
* @param int $status
* @return Builder|Model|object|ProjectAssociation|null
* @param $project_id
* @param $status
* @param $app
* @return array
*/
public function saveProject($project_id, $status)
public function saveProject($project_id, $status, $app)
{
$bool = false;
DB::beginTransaction();
... ... @@ -65,29 +91,55 @@ class ProjectAssociationLogic extends Logic
$isRes->project_id = $project_id;
$isRes->user_id = (int)env('AICC_WECHAT_USER_ID');
$isRes->status = $status;
$isRes->binding_app = $app;
try {
$bool = $isRes->save();
DB::commit();
} catch (\Exception $exception) {
DB::rollBack();
}
return compact('bool', 'isRes');
}
/**
* 关闭状态
* @param ProjectAssociation $res
* @param int $status 1 - 正常, 0 - 禁用
* @return bool
*/
public function closedState($res, $status)
{
DB::beginTransaction();
$bool = false;
try {
$isRes->save();
$res->status = $status;
$bool = $res->save();
DB::commit();
} catch (\Exception $exception) {
DB::rollBack();
}
return $isRes;
return $bool;
}
/**
* 获取AICC微信列表数据
* @param ProjectAssociation $res
* @param bool $cache
* @param int $type 绑定app应用类型
* @param bool $cache 是否缓存
* @return mixed
*/
public function getAiccWechatLists($res, $cache = false)
public function getAiccWechatLists($res, $type = ProjectAssociation::PERSONAL_WECHAT, $cache = false)
{
$redis_key = 'aicc_friend_lists_' . (int)env('AICC_WECHAT_USER_ID');
$redis_key = 'aicc_friend_lists_' . $type . '_' . (int)env('AICC_WECHAT_USER_ID');
$result = $cache ? false : redis_get($redis_key);
if (empty($result)) {
$url = env('AICC_URL') . env('AICC_WECHAT_FRIEND_API_URL');
$apiUrl = ProjectAssociation::getApplicationApiUrl($type);
$url = env('AICC_URL') . $apiUrl;
$result = curlGet($url);
if (!empty($result['data'])) {
redis_set($redis_key, json_encode($result), 60);
}
} else {
$result = json_decode($result, true);
}
... ... @@ -99,24 +151,4 @@ class ProjectAssociationLogic extends Logic
];
return $result;
}
/**
* 关闭状态
* @param ProjectAssociation $res
* @param int $status 1 - 正常, 0 - 禁用
* @return bool
*/
public function closedState($res, $status)
{
DB::beginTransaction();
$bool = false;
try {
$res->status = $status;
$bool = $res->save();
DB::commit();
} catch (\Exception $exception) {
DB::rollBack();
}
return $bool;
}
}
... ...
... ... @@ -8,10 +8,56 @@ namespace App\Services;
use App\Enums\Common\Code;
use App\Exceptions\BsideGlobalException;
use Mockery;
class BaseService
{
/**
* 单例模式
* 特点:三私,两静,一公
* 三私:三个私有方法,(静态变量、构造函数、克隆函数)
* 两静:两个静态方法,(一个静态变量,一个静态方法)
* 一公:单例模式的出口
*
* 优点:
* 1、在内存里只有一个实例,减少了内存的开销,尤其是频繁的创建和销毁实例(比如管理学院首页页面缓存)。
* 2、避免对资源的多重占用(比如写文件操作)。
*/
protected static $instance;
/**
* @return static
*/
public static function getInstance()
{
if ((static::$instance[static::class] ?? null) instanceof static) {
return static::$instance[static::class];
}
return static::$instance[static::class] = new static();
}
/**
* @return Mockery\Mock
*/
public static function mockInstance()
{
return static::$instance[static::class] = Mockery::mock(static::class)
->makePartial()
->shouldAllowMockingProtectedMethods();
}
private function __construct()
{
}
private function __clone()
{
// TODO: Implement __clone() method.
}
/**
* @notes: 手动抛出异常
* @param string $msg
* @param string $code
... ...
... ... @@ -11,7 +11,7 @@ use App\Services\BaseService;
use App\Traits\RedisTrait;
use App\Utils\HttpUtils;
class DingService extends BaseService
class DingService
{
use RedisTrait;
... ...
... ... @@ -19,7 +19,7 @@ use Illuminate\Support\Facades\Schema;
* Class ProjectServer
* @package App\Services
*/
class ProjectServer extends BaseService
class ProjectServer
{
/**
* @param $project_id
... ... @@ -119,16 +119,17 @@ class ProjectServer extends BaseService
* @method :post
* @time :2023/12/29 9:34
*/
public function initModule($project_id){
$moduleModel = new CustomModule();
$info = $moduleModel->read(['route'=>'video']);
if($info === false){
public static function initModule($project_id){
$info = DB::connection('custom_mysql')->table('gl_custom_module')->first();
if(empty($info)){
$data = [
'name'=>'视频模块',
'project_id'=>$project_id,
'route'=>'video',
'created_at' => date('Y-m-d H:i:s'),
'updated_at' => date('Y-m-d H:i:s')
];
$moduleModel->add($data);
DB::connection('custom_mysql')->table('gl_custom_module')->insert($data);
}
return true;
}
... ...
... ... @@ -17,7 +17,7 @@ use Illuminate\Support\Facades\Log;
* Class SyncService
* @package App\Services
*/
class SyncService extends BaseService
class SyncService
{
/**
* 同步信息到表单系统
... ...
... ... @@ -4,7 +4,7 @@
*/
use App\Http\Controllers\Aside;
use App\Http\Controllers\Bside\ProjectAssociation\ProjectAssociationController;
use App\Http\Controllers\Aside\ProjectAssociation\ProjectAssociationController;
use Illuminate\Support\Facades\Route;
... ... @@ -72,7 +72,7 @@ Route::middleware(['aloginauth'])->group(function () {
//发送记录
Route::any('/log', [Aside\Ai\AiLogController::class, 'lists'])->name('admin.lists');
// 绑定AICC微信应用
Route::post('/wechat', [ProjectAssociationController::class, 'saveWeChatData'])->name('admin.aicc.wechat');
Route::post('/binding/save', [ProjectAssociationController::class, 'save'])->name('admin.binding.save');
// OA后台开启关闭AICC用户绑定
Route::post('/check', [ProjectAssociationController::class, 'check'])->name('admin.aicc.check');
});
... ...
... ... @@ -317,6 +317,7 @@ Route::middleware(['bloginauth'])->group(function () {
Route::any('/savePublicTemplate', [\App\Http\Controllers\Bside\Template\BTemplateController::class, 'savePublicTemplate'])->name('template_savePublicTemplate');
Route::any('/getDetailInfo', [\App\Http\Controllers\Bside\Template\BTemplateController::class, 'getDetailInfo'])->name('template_getDetailInfo');
Route::any('/saveDetail', [\App\Http\Controllers\Bside\Template\BTemplateController::class, 'saveDetail'])->name('template_saveDetail');
Route::any('/getSource', [\App\Http\Controllers\Bside\Template\BTemplateController::class, 'getSource'])->name('template_getSource');
// 模板
Route::prefix('module')->group(function () {
//获取所有左侧模版
... ... @@ -348,6 +349,7 @@ Route::middleware(['bloginauth'])->group(function () {
Route::any('/saveCustomizedHtml', [\App\Http\Controllers\Bside\Template\InitHtmlController::class, 'saveCustomizedHtml'])->name('init_saveCustomizedHtml');
Route::any('/getDetailHtml', [\App\Http\Controllers\Bside\Template\InitHtmlController::class, 'getDetailHtml'])->name('init_getDetailHtml');
Route::any('/saveDetailHtml', [\App\Http\Controllers\Bside\Template\InitHtmlController::class, 'saveDetailHtml'])->name('init_saveDetailHtml');
Route::any('/getDetailInfo', [\App\Http\Controllers\Bside\Template\InitHtmlController::class, 'getDetailInfo'])->name('init_getDetailInfo');
});
// 自定义页面,专题页
... ... @@ -445,6 +447,7 @@ Route::middleware(['bloginauth'])->group(function () {
Route::any('/info', [\App\Http\Controllers\Bside\CustomModule\CustomModuleCategoryController::class, 'info'])->name('custom_category_info');
Route::any('/save', [\App\Http\Controllers\Bside\CustomModule\CustomModuleCategoryController::class, 'save'])->name('custom_category_save');
Route::any('/del', [\App\Http\Controllers\Bside\CustomModule\CustomModuleCategoryController::class, 'del'])->name('custom_category_del');
Route::any('/sort', [\App\Http\Controllers\Bside\CustomModule\CustomModuleCategoryController::class, 'sort'])->name('custom_category_sort');
});
Route::prefix('content')->group(function () {
... ...