作者 赵彬吉
正在显示 36 个修改的文件 包含 1227 行增加132 行删除
<?php
/**
* @remark :
* @name :AiBlogTask.php
* @author :lyh
* @method :post
* @time :2025/2/14 11:14
*/
namespace App\Console\Commands\AiBlog;
use App\Models\Ai\AiBlog;
use App\Models\Ai\AiBlogAuthor;
use App\Models\Ai\AiBlogList;
use App\Models\Project\ProjectAiSetting;
use App\Models\RouteMap\RouteMap;
use App\Services\AiBlogService;
use App\Services\ProjectServer;
use Illuminate\Console\Command;
use App\Models\Project\AiBlogTask as AiBlogTaskModel;
use Illuminate\Support\Facades\Cache;
use Illuminate\Support\Facades\DB;
use function Symfony\Component\String\s;
class AiBlogListTask extends Command
{
/**
* The name and signature of the console command.
*
* @var string
*/
protected $signature = 'save_ai_blog_list {project_id}';
/**
* The console command description.
*
* @var string
*/
protected $description = '生成blog列表';
public function handle(){
$project_id = $this->argument('project_id');
ProjectServer::useProject($project_id);
$projectAiSettingModel = new ProjectAiSetting();
$aiSettingInfo = $projectAiSettingModel->read(['project_id'=>$project_id]);
$this->updateBlogList($aiSettingInfo);
DB::disconnect('custom_mysql');
return true;
}
/**
* @remark :更新列表页数据
* @name :updateBlogList
* @author :lyh
* @method :post
* @time :2025/3/5 11:07
*/
public function updateBlogList($aiSettingInfo){
$aiBlogService = new AiBlogService();
$aiBlogService->mch_id = $aiSettingInfo['mch_id'];
$aiBlogService->key = $aiSettingInfo['key'];
$page = 1;
$saveData = [];
$result = $aiBlogService->getAiBlogList($page,15);
if(!isset($result['status']) && $result['status'] != 200){
return true;
}
$total_page = $result['data']['total_page'];
//组装数据保存
$saveData[] = [
'route'=>$page,
'text'=>$result['data']['section'],
];
while ($total_page > $page){
$page++;
$result = $aiBlogService->getAiBlogList($page,15);
if(isset($result['status']) && $result['status'] == 200){
$saveData[] = [
'route'=>$page,
'text'=>$result['data']['section'],
];
}
}
$aiBlogListModel = new AiBlogList();
if(!empty($saveData)){
//写一条路由信息
$aiBlogListModel->truncate();
$aiBlogListModel->insertAll($saveData);
}
return true;
}
}
... ...
... ... @@ -41,52 +41,76 @@ class AiBlogTask extends Command
public function handle(){
$aiBlogTaskModel = new AiBlogTaskModel();
while (true){
$info = $aiBlogTaskModel->where('status',1)->where('type',2)->inRandomOrder()->first();
if(empty($info)){
$list = $aiBlogTaskModel->list(['status'=>1,'type'=>2],'id',['*'],'asc',1000);
if(empty($list)){
sleep(300);
continue;
}
$info = $info->toArray();
echo '开始->任务id:' . $info['task_id'] . PHP_EOL . date('Y-m-d H:i:s');
//获取配置
$aiSettingInfo = $this->getSetting($info['project_id']);
$aiBlogService = new AiBlogService();
$aiBlogService->mch_id = $aiSettingInfo['mch_id'];
$aiBlogService->key = $aiSettingInfo['key'];
$aiBlogService->task_id = $info['task_id'];
$result = $aiBlogService->getDetail();
if(!isset($result['status'])){
continue;
}
if($result['status'] != 200){
sleep(10);
continue;
}
//保存当前项目ai_blog数据
ProjectServer::useProject($info['project_id']);
$aiBlogModel = new AiBlog();
$aiBlogInfo = $aiBlogModel->read(['task_id'=>$info['task_id']],['id']);
if($aiBlogInfo === false){
$aiBlogTaskModel->edit(['status'=>2],['id'=>$info['id']]);
continue;
$updateProject = [];
foreach ($list as $item){
echo '开始->任务id:' . $item['task_id'] . PHP_EOL . date('Y-m-d H:i:s');
//获取配置
$aiSettingInfo = $this->getSetting($item['project_id']);
$aiBlogService = new AiBlogService();
$aiBlogService->mch_id = $aiSettingInfo['mch_id'];
$aiBlogService->key = $aiSettingInfo['key'];
$aiBlogService->task_id = $item['task_id'];
$result = $aiBlogService->getDetail();
if($result['status'] != 200){
sleep(5);
continue;
}
//保存当前项目ai_blog数据
ProjectServer::useProject($item['project_id']);
$aiBlogModel = new AiBlog();
$aiBlogInfo = $aiBlogModel->read(['task_id'=>$item['task_id']],['id']);
if($aiBlogInfo === false){
$aiBlogTaskModel->edit(['status'=>2],['id'=>$item['id']]);
continue;
}
if (!in_array($result['data']['author_id'], $updateProject[$item['project_id']] ?? [])) {
$updateProject[$item['project_id']][] = $result['data']['author_id'];
}
//拿到返回的路由查看是否重复
$route = RouteMap::setRoute($result['data']['url'], RouteMap::SOURCE_AI_BLOG, $aiBlogInfo['id'], $item['project_id']);
if($route != $result['data']['url']){
$aiBlogService->updateDetail(['route'=>$this->param['route']]);
}
$aiBlogModel->edit(['new_title'=>$result['data']['title'], 'image'=>$result['data']['thumb'], 'text'=>$result['data']['section'], 'author_id'=>$result['data']['author_id'], 'route'=>$route ,'status'=>2], ['task_id'=>$item['task_id']]);
DB::disconnect('custom_mysql');
$aiBlogTaskModel->edit(['status'=>2],['id'=>$item['id']]);
}
//拿到返回的路由查看是否重复
$route = RouteMap::setRoute($result['data']['url'], RouteMap::SOURCE_AI_BLOG, $aiBlogInfo['id'], $info['project_id']);
if($route != $result['data']['url']){
$aiBlogService->updateDetail(['route'=>$this->param['route']]);
}
$aiBlogModel->edit(['new_title'=>$result['data']['title'], 'image'=>$result['data']['thumb'], 'text'=>$result['data']['section'], 'author_id'=>$result['data']['author_id'], 'route'=>$route ,'status'=>2], ['task_id'=>$info['task_id']]);
$this->updateAiBlogAuthor($aiSettingInfo,$result['data']['author_id']);
//TODO::更新列表页及作者
$this->updateProject($updateProject);
echo '结束->任务id:' . $item['task_id'] . PHP_EOL . date('Y-m-d H:i:s');
}
return true;
}
/**
* @remark :更新项目作者页面及列表页
* @name :updateProject
* @author :lyh
* @method :post
* @time :2025/3/4 10:25
*/
public function updateProject($updateProject){
if(empty($updateProject)){
return true;
}
foreach ($updateProject as $project_id => $author){
ProjectServer::useProject($project_id);
$aiSettingInfo = $this->getSetting($project_id);
$this->updateBlogList($aiSettingInfo);
//更新作者
foreach ($author as $val){
$this->updateAiBlogAuthor($aiSettingInfo,$val);
}
DB::disconnect('custom_mysql');
//修改任务状态
$aiBlogTaskModel->edit(['status'=>2],['id'=>$info['id']]);
echo '结束->任务id:' . $info['task_id'] . PHP_EOL . date('Y-m-d H:i:s');
}
return true;
}
/**
* @remark :获取项目配置
* @name :getSetting
... ...
<?php
namespace App\Console\Commands\Industry;
use App\Helper\Arr;
use App\Helper\Common;
use App\Helper\Gpt;
use App\Models\Ai\AiCommand;
use App\Models\Domain\DomainInfo;
use App\Models\Industry\ProjectIndustry;
use App\Models\Industry\ProjectIndustryRelated;
use Illuminate\Console\Command;
class CheckProjectIndustry extends Command
{
/**
* The name and signature of the console command.
*
* @var string
*/
protected $signature = 'check_project_industry';
/**
* The console command description.
*
* @var string
*/
protected $description = '匹配上线项目所属行业';
public function handle()
{
$ai_command = AiCommand::where('key', 'project_industry')->value('ai');
if (!$ai_command) {
$this->output('AI指令未配置');
return;
}
$industry_list = ProjectIndustry::where('status', 1)->pluck('industry_name')->toArray();
if (!$industry_list) {
$this->output('行业匹配数据为空');
return;
}
$industry_names = implode(',', $industry_list);
$domainModel = new DomainInfo();
$list = $domainModel->select(['id', 'domain', 'project_id'])->where('status', 1)->where('project_id', '>', 0)->get()->toArray();
foreach ($list as $value) {
$project_id = $value['project_id'];
$domain = $value['domain'];
$has_related_count = ProjectIndustryRelated::select(['id'])->where('project_id', $project_id)->count();
if ($has_related_count > 0) {
$this->output('project_id:' . $project_id . ' , domain:' . $domain . ' | 已分析过滤');
continue;
}
$project_industry = $this->getIndustryByAI($ai_command, $industry_names, $domain);
if ($project_industry) {
$project_industry_name = Arr::splitFilterToArray($project_industry);
$project_industry_id = ProjectIndustry::where('status', 1)->whereIn('industry_name', $project_industry_name)->pluck('id')->toArray();
ProjectIndustryRelated::saveRelated($project_id, $project_industry_id);
$this->output('project_id:' . $project_id . ' , domain:' . $domain . ' | success');
} else {
$this->output('project_id:' . $project_id . ' , domain:' . $domain . ' | AI分析行业失败');
}
}
}
/**
* AI分析行业
* @param $ai_command
* @param $industry_names
* @param $domain
* @return string|string[]
* @author Akun
* @date 2025/03/05 10:42
*/
public function getIndustryByAI($ai_command, $industry_names, $domain)
{
$ai_command = str_replace('{domain}', 'https://' . $domain, $ai_command);
$ai_command = str_replace('{industry}', $industry_names, $ai_command);
$text = Gpt::instance()->openai_chat_qqs($ai_command);
return Common::deal_str($text);
}
public function output($msg)
{
echo date('Y-m-d H:i:s') . ' | ' . $msg . PHP_EOL;
}
}
... ...
... ... @@ -46,8 +46,12 @@ class SyncInquiryRelay extends Command
{
$this->output('开始同步表单系统询盘');
$this->getInquiryForm();
$this->output('开始同步asp采集询盘');
$this->output('开始同步SC平台询盘');
$this->getInquirySzcm();
$this->output('开始同步FS平台询盘');
$this->getInquiryFs();
}
/**
... ... @@ -65,9 +69,6 @@ class SyncInquiryRelay extends Command
//+86区号过滤
continue;
}
if (strpos($item['refer'], 'findsupply.com') !== false) {
$item['source_type'] = InquiryInfo::TYPE_FIND_SUPPLY;
}
$this->saveDate($item, $item['source_type']);
}
}
... ... @@ -112,6 +113,37 @@ class SyncInquiryRelay extends Command
}
/**
* @return bool
* @throws \Exception
* @author Akun
* @date 2025/03/04 11:48
*/
public function getInquiryFs()
{
$service = new InquiryRelayService();
$next_page_url = 'https://www.findsupply.com/api/external?page=1&pagesize=50';
$model = new InquiryInfo();
while ($next_page_url) {
$result = $service->getInquiryFs($next_page_url);
$data = $result['data'];
$next_page_url = $result['next_page_url'];
if ($data) {
foreach ($data as $item) {
$message_sign = md5($item['name'] . $item['email'] . $item['phone'] . $item['ip'] . $item['time']);
$inquiry_info = $model->where('message_sign', $message_sign)->first();
if ($inquiry_info) {
$next_page_url = null;
break;
}
$this->saveDate($item, InquiryInfo::TYPE_FIND_SUPPLY);
}
}
}
return true;
}
/**
* 询盘数据入库
* @param $data
* @param $type
... ... @@ -148,6 +180,7 @@ class SyncInquiryRelay extends Command
$html = curl_c($data['refer'], false);
if (empty($data['title'])) {
$data['title'] = '';
preg_match_all('/<title>([\w\W]*?)<\/title>/', $html, $matches);
if (!empty($matches[1])) {
$data['title'] = substr($matches[1][0], 0, 255);
... ...
... ... @@ -14,6 +14,9 @@ use App\Models\CustomModule\CustomModuleContent;
use App\Models\CustomModule\CustomModuleExtentContent;
use App\Models\News\News;
use App\Models\Product\Category;
use App\Models\Product\CategoryRelated;
use App\Models\Product\Column;
use App\Models\Product\Detail;
use App\Models\Product\Product;
use App\Models\RouteMap\RouteMap;
use App\Models\Template\BTemplate;
... ... @@ -48,10 +51,10 @@ class LyhImportTest extends Command
* @time :2023/11/20 15:13
*/
public function handle(){
ProjectServer::useProject(3283);
echo date('Y-m-d H:i:s') . 'start' . PHP_EOL;
$this->importProduct('https://ecdn6.globalso.com/upload/p/1/file/2025-03/zy_boss_price_copy1.csv',3283);
DB::disconnect('custom_mysql');
// ProjectServer::useProject(3283);
// echo date('Y-m-d H:i:s') . 'start' . PHP_EOL;
// $this->importProduct('https://ecdn6.globalso.com/upload/p/1/file/2025-03/zy_boss_price_copy1.csv',3283);
// DB::disconnect('custom_mysql');
echo date('Y-m-d H:i:s') . 'end' . PHP_EOL;
}
... ... @@ -81,6 +84,8 @@ class LyhImportTest extends Command
fclose($file_handle);
$cateModel = new Category();
$productModel = new Product();
$detailModel = new Detail();
$columnModel = new Column();
foreach ($line_of_text as $k => $val){
if($k < 2){
continue;
... ... @@ -94,7 +99,7 @@ class LyhImportTest extends Command
if($val[0] ?? ''){
$cateInfo = $cateModel->read(['seo_title'=>trim($val[0])]);
if($cateInfo !== false){
$saveData['category_id'] = $cateInfo['id'];
$saveData['category_id'] = ','.$cateInfo['id'].',';
}
}
$saveData['intro'] = $val[2];
... ... @@ -105,7 +110,49 @@ class LyhImportTest extends Command
$gallery = [['alt'=>'主图','url'=>str_replace('/public','',$val[6])]];
$saveData['thumb'] = json_encode($thumb,true);
$saveData['gallery'] = json_encode($gallery,true);
$id = $productModel->addReturnId($saveData);
echo date('Y-m-d H:i:s') . '新增产品id:'.$id . PHP_EOL;
//设置关联关系
if($cateInfo !== false){
CategoryRelated::saveRelated($id,[$cateInfo['id']]);
}
//设置路由
$route = RouteMap::setRoute($val[1],RouteMap::SOURCE_PRODUCT,$id,$project_id);
$productModel->edit(['route'=>$route],['id'=>$id]);
//设置产品描述
$detail = [
'product_id'=>$id,
'column_id'=>1,
'text_type'=>1,
'content'=>json_encode(['content'=>$val[3]])
];
$detailModel->addReturnId($detail);
//扩展描述设置
$detailFaq = [
'column_name'=>'FAQs',
'product_id'=>$id
];
$faqId = $columnModel->addReturnId($detailFaq);
$faqsDetail = json_decode($val[4],true);
$faqContent = '';
if(!empty($faqsDetail) && is_array($faqsDetail)){
foreach ($faqsDetail as $faq_Val){
$faqContent .= "question:".$faq_Val['question'] . "<br />" . "answer:".$faq_Val['answer']. "<br />";
}
$detailFaqInfo = [
'product_id'=>$id,
'column_id'=>$faqId,
'text_type'=>1,
'content'=>json_encode(['content'=>$faqContent])
];
$detailModel->addReturnId($detailFaqInfo);
}else{
@file_put_contents(storage_path('logs/lyh_error.log'), var_export('产品标题:'. $val[1] . PHP_EOL .'faqs数据有问题:' . $val[4], true) . PHP_EOL, FILE_APPEND);
echo date('Y-m-d H:i:s') . '产品标题:'. $val[1] . PHP_EOL .'faqs数据有问题:' . $val[4];
}
}
return true;
}
public function handleCatePid(){
... ...
... ... @@ -7,21 +7,18 @@
* @time :2023/11/20 15:07
*/
namespace App\Console\Commands\Test;
namespace App\Console\Commands\LyhTest;
use App\Helper\Arr;
use App\Helper\Translate;
use App\Models\Blog\Blog;
use App\Models\CustomModule\CustomModuleCategory;
use App\Models\CustomModule\CustomModuleContent;
use App\Models\Product\CategoryRelated;
use App\Models\Product\Keyword;
use App\Models\Product\Product;
use App\Models\Project\ProcessRecords;
use App\Models\Project\Project;
use App\Models\RouteMap\RouteMap;
use App\Models\Template\BTemplate;
use App\Models\Template\Setting;
use App\Models\WebSetting\WebSetting;
use App\Services\ProjectServer;
use App\Utils\HttpUtils;
use GuzzleHttp\Exception\GuzzleException;
... ... @@ -61,46 +58,21 @@ class UpdateRoute extends Command
* @time :2023/11/20 15:13
*/
public function handle(){
$data = $this->ceshi();
echo date('Y-m-d H:i:s') . 'end'.json_encode($data) . PHP_EOL;
}
/**
* @remark :导入数据
* @name :importCustomModule
* @author :lyh
* @method :post
* @time :2025/2/24 14:44
*/
public function importCustomModule(){
}
public function ceshi($api_no = null)
{
$key = 'extend_projects_list';
$data = Cache::get($key);
if (!$data) {
$api_url = 'http://api.quanqiusou.cn/google-rank/api/extend_projects.php';
try {
$data = HttpUtils::get($api_url, []);
if ($data) {
$data = Arr::s2a($data);
Cache::put($key, $data, 4 * 3600);
}
} catch (\Exception | GuzzleException $e) {
errorLog('复制站点项目获取失败', [], $e);
return false;
$projectModel = new Project();
$lists = $projectModel->list(['delete_status'=>0],'id',['id']);
foreach ($lists as $v){
echo date('Y-m-d H:i:s') . 'project_id:'.$v['id'] . PHP_EOL;
ProjectServer::useProject($v['id']);
$webSettingModel = new WebSetting();
$settingInfo = $webSettingModel->read(['project_id'=>$v['id']]);
if($settingInfo !== false && ($settingInfo['anchor_num'] > 3)){
$webSettingModel->edit(['anchor_num'=>3],['project_id'=>$v['id']]);
}
DB::disconnect('custom_mysql');
}
if ($api_no !== null) {
$data = collect($data)->where('apino', $api_no)->first();
return $data ?: [];
}
return $data;
echo date('Y-m-d H:i:s') . 'end' . PHP_EOL;
}
/**
* @remark :更新产品
* @name :updateProduct
... ...
... ... @@ -35,7 +35,7 @@ class Temp extends Command
public function handle()
{
$this->domain_rewrite_https();
}
/**
... ...
... ... @@ -41,10 +41,10 @@ class Validate
* @author zbj
* @date 2025/2/27
*/
public static function phone($email)
public static function phone($phone)
{
try {
$res = HttpUtils::get('https://fob.ai.cc/api/check_phone', ['phone' => $email]);
$res = HttpUtils::get('https://fob.ai.cc/api/check_phone', ['phone' => $phone]);
$res = Arr::s2a($res);
$status = $res['data']['valid_status'] ?? 0;
} catch (\Exception | GuzzleException $e) {
... ... @@ -52,4 +52,21 @@ class Validate
}
return !($status == 2);
}
/**
* @remark :验证
* @name :check_data
* @author :lyh
* @method :post
* @time :2025/3/4 17:16
*/
public static function check_data($data,$type)
{
if($type == 1){
$res = HttpUtils::get('https://fob.ai.cc/api/check_email', ['email' => $data]);
}else{
$res = HttpUtils::get('https://fob.ai.cc/api/check_phone', ['phone' => $data]);
}
return Arr::s2a($res);
}
}
... ...
... ... @@ -739,7 +739,7 @@ if (!function_exists('getAutoLoginCode')) {
function getAutoLoginCode($project_id)
{
$encrypt = new EncryptUtils();
return $encrypt->authcode(json_encode(['project_id' => $project_id]), 'ENCODE', 'autologin', 3600);
return $encrypt->authcode(json_encode(['project_id' => $project_id]), 'ENCODE', 'autologin', 300);
}
}
... ...
... ... @@ -92,7 +92,6 @@ class InquiryForwardController extends BaseController
'id' => 'required',//ID
'name' => 'required',//名称
'email' => 'required',//邮箱
'phone' => 'required',//电话号码
'ip' => 'required',//ip
'forward_url' => 'required',//转发网址
'message' => 'required',//发送内容
... ... @@ -100,7 +99,6 @@ class InquiryForwardController extends BaseController
'id.required' => 'ID不能为空',
'name.required' => '名称不能为空',
'email.required' => '邮箱不能为空',
'phone.required' => '电话号码不能为空',
'ip.required' => 'ip不能为空',
'forward_url.required' => '转发网址不能为空',
'message.required' => '内容不能为空',
... ...
... ... @@ -387,7 +387,7 @@ class OptimizeController extends BaseController
}
$url = $domain.'api/update_robots/?project_id='.$this->param['project_id'];
$res = curlGet($url);
if(empty($res) || $res['status'] != 200){
if(empty($res) || !isset($res['status']) || $res['status'] != 200){
$this->response('生成robots失败,请联系开发人员',Code::SYSTEM_ERROR,['url'=>$url]);
}
$this->response('success',Code::SUCCESS,['url'=>$domain.'robots.txt']);
... ...
... ... @@ -20,6 +20,7 @@ use App\Models\Devops\ServerConfig;
use App\Models\Domain\DomainInfo;
use App\Models\Domain\DomainInfo as DomainInfoModel;
use App\Models\HomeCount\Count;
use App\Models\Industry\ProjectIndustry;
use App\Models\Inquiry\InquirySet;
use App\Models\Manage\BelongingGroup;
use App\Models\Manage\ManageHr;
... ... @@ -1130,4 +1131,16 @@ class ProjectController extends BaseController
}
$this->response('success');
}
/**
* 获取项目所有行业列表
* @author Akun
* @date 2025/03/05 11:40
*/
public function industryList()
{
$model = new ProjectIndustry();
$lists = $model->list(['status' => 1], 'id', ['id', 'industry_name'], 'asc');
$this->response('success', Code::SUCCESS, $lists);
}
}
... ...
<?php
/**
* @remark :
* @name :ProjectMenuSeoController.php
* @author :lyh
* @method :post
* @time :2025/3/4 15:28
*/
namespace App\Http\Controllers\Aside\User;
use App\Enums\Common\Code;
use App\Http\Controllers\Aside\BaseController;
use App\Http\Logic\Aside\User\ProjectMenuSeoLogic;
use App\Models\User\ProjectMenuSeo;
/**
* @remark :设置白帽菜单
* @name :ProjectMenuSeoController
* @author :lyh
* @method :post
* @time :2025/3/4 15:28
*/
class ProjectMenuSeoController extends BaseController
{
/**
* @remark :白帽菜单列表
* @name :lists
* @author :lyh
* @method :post
* @time :2025/3/4 15:33
*/
public function lists(ProjectMenuSeo $projectMenuSeo){
$lists = $projectMenuSeo->list($this->map,'sort');
$menu = array();
foreach ($lists as $k => $v){
$v = (array)$v;
if ($v['pid'] == 0) {
$v['sub'] = _get_child($v['id'], $lists);
$menu[] = $v;
}
}
$this->response('success',Code::SUCCESS,$menu);
}
/**
* @remark :获取白帽详情
* @name :info
* @author :lyh
* @method :post
* @time :2025/3/4 15:34
*/
public function info(ProjectMenuSeo $projectMenuSeo){
$this->request->validate([
'id'=>'required'
],[
'id.required' => 'ID不能为空'
]);
$info = $projectMenuSeo->read($this->param);
$this->response('success',Code::SUCCESS,$info);
}
/**
* @remark :添加菜单
* @name :add
* @author :lyh
* @method :post
* @time :2025/3/4 15:38
*/
public function add(ProjectMenuSeoLogic $projectMenuSeoLogic){
$this->request->validate([
'name'=>'required'
],[
'name.required' => '名称不能为空'
]);
$projectMenuSeoLogic->menu_add();
$this->response('success');
}
/**
* @remark :编辑菜单
* @name :edit
* @author :lyh
* @method :post
* @time :2025/3/4 15:42
*/
public function edit(ProjectMenuSeoLogic $projectMenuSeoLogic){
$this->request->validate([
'name'=>'required'
],[
'name.required' => '名称不能为空'
]);
$projectMenuSeoLogic->menu_edit();
$this->response('success');
}
/**
* @remark :删除菜单
* @name :del
* @author :lyh
* @method :post
* @time :2025/3/4 15:43
*/
public function del(ProjectMenuSeoLogic $projectMenuSeoLogic){
$this->request->validate([
'id'=>['required','array'],
],[
'id.required' => 'ID不能为空',
'id.array' => 'ID为数组',
]);
$projectMenuSeoLogic->menu_del();
$this->response('success');
}
/**
* @remark :获取子菜单
* @name :getSonMenu
* @author :lyh
* @method :post
* @time :2023/8/3 14:19
*/
public function getMenu(ProjectMenuSeoLogic $projectMenuSeoLogic){
$list = $projectMenuSeoLogic->roleMenuInfo();
$this->response('success',Code::SUCCESS,$list);
}
/**
* @remark :排序
* @name :setSort
* @author :lyh
* @method :post
* @time :2023/8/10 16:40
*/
public function sort(ProjectMenuSeoLogic $projectMenuSeoLogic){
$this->request->validate([
'id'=>'required',
],[
'id.required' => 'ID不能为空',
]);
$projectMenuSeoLogic->setParamStatus();
$this->response('success');
}
}
... ...
<?php
/**
* @remark :
* @name :AiVideoController.php
* @author :lyh
* @method :post
* @time :2025/3/5 11:00
*/
namespace App\Http\Controllers\Bside\Ai;
use App\Enums\Common\Code;
use App\Http\Controllers\Bside\BaseController;
use App\Http\Logic\Bside\Ai\AiVideoLogic;
use App\Models\Ai\AiVideo;
class AiVideoController extends BaseController
{
/**
* @remark :获取aiVideo列表
* @name :lists
* @author :lyh
* @method :post
* @time :2025/3/5 14:12
*/
public function lists(AiVideo $aiVideo){
$lists = $aiVideo->lists($this->map,$this->page,$this->row,'id',['id','keyword','new_title','route','image','task_id','status','created_at','updated_at']);
if(!empty($lists) && !empty($lists['list'])){
foreach ($lists['list'] as $k => $v){
$v['image'] = getImageUrl($v['image']);
if(!empty($v['route'])){
$v['route'] = $this->user['test_domain'] . 'video/' . $v['route'];
}
$lists['list'][$k] = $v;
}
}
$this->response('success',Code::SUCCESS,$lists);
}
/**
* @remark :获取详情
* @name :getInfo
* @author :lyh
* @method :post
* @time :2025/3/5 14:22
*/
public function getInfo(AiVideo $aiVideo){
$this->request->validate([
'id'=>['required'],
],[
'id.required' => '主键不能为空',
]);
$info = $aiVideo->read(['id'=>$this->param['id']]);
$info['image'] = getImageUrl($info['image']);
$this->response('success',Code::SUCCESS,$info);
}
/**
* @remark :发布任务
* @name :sendTask
* @author :lyh
* @method :post
* @time :2025/3/5 14:29
*/
public function sendTask(AiVideoLogic $aiVideoLogic){
$this->request->validate([
'keyword'=>['required'],
'type'=>['required'],
],[
'keyword.required' => '关键字不能为空',
'type.required' => '场景不能为空',
]);
//获取当前项目的ai_blog设置
$result = $aiVideoLogic->sendTask();
$this->response('success',Code::SUCCESS,$result);
}
}
... ...
... ... @@ -13,9 +13,9 @@ use App\Models\Project\DeployBuild;
use App\Models\Project\Project;
use App\Models\RouteMap\RouteMap;
use App\Models\User\ProjectMenu as ProjectMenuModel;
use App\Models\User\ProjectMenuSeo;
use App\Models\User\ProjectRole as ProjectRoleModel;
use App\Models\User\User;
use Illuminate\Support\Facades\Artisan;
use Illuminate\Support\Facades\Cache;
/***
... ... @@ -36,9 +36,6 @@ class ComController extends BaseController
}else{
$this->map = $this->getAdminMenuCondition();
}
if(!isset($this->map['type'])){//默认获取6.0菜单
$this->map['type'] = 0;
}
$lists = $projectMenuModel->list($this->map,'sort');
$menu = array();
foreach ($lists as $k => $v){
... ... @@ -52,6 +49,27 @@ class ComController extends BaseController
}
/**
* @remark :白帽seo获取菜单
* @name :seo_get_menu
* @author :lyh
* @method :post
* @time :2025/3/4 14:48
*/
public function seo_get_menu(){
$seoMenuModel = new ProjectMenuSeo();
$lists = $seoMenuModel->list($this->map,'sort');
$menu = array();
foreach ($lists as $k => $v){
$v = (array)$v;
if ($v['pid'] == 0) {
$v['sub'] = _get_child($v['id'], $lists);
$menu[] = $v;
}
}
$this->response('当前用户菜单列表',Code::SUCCESS,$menu);
}
/**
* @remark :获取当前菜单的自定义模块
* @name :getProjectCustomMenu
* @author :lyh
... ...
... ... @@ -4,8 +4,10 @@ namespace App\Http\Controllers\Bside\Inquiry;
use App\Enums\Common\Code;
use App\Helper\Validate;
use App\Http\Controllers\Bside\BaseController;
use App\Http\Logic\Bside\Inquiry\InquiryLogic;
use App\Models\Inquiry\EmailData;
use App\Models\Inquiry\InquiryForm;
use App\Models\Inquiry\PhoneData;
use App\Rules\Ids;
... ... @@ -37,6 +39,13 @@ class InquiryController extends BaseController
$this->response('success',Code::SUCCESS,$data);
}
/**
* @remark :精准询盘列表
* @name :index
* @author :lyh
* @method :post
* @time :2025/3/5 9:48
*/
public function index(InquiryLogic $logic)
{
if(!empty($this->param['form_id'])){
... ... @@ -47,31 +56,86 @@ class InquiryController extends BaseController
$data = $logic->getApiList();
}
if(!empty($data) && !empty($data['list'])){
$phone = [];
$email = $phone = [];
foreach ($data['list'] as $v){
if(!empty($v['phone'])){
$phone[] = $v['phone'];
}
if(!empty($v['email'])){
$email[] = $v['email'];
}
}
}
if(!empty($phone)){
$phoneDataModel = new PhoneData();
$phoneDataList = $phoneDataModel->list(['phone'=>['in',$phone]]);
foreach ($data['list'] as $key => $value){
$value['phone_data'] = [];
foreach ($phoneDataList as $valuePhone){
if($value['phone'] == $valuePhone['phone']){
$value['phone_data'] = $valuePhone;
break;
}
$phoneDataModel = new PhoneData();
$phoneDataList = $phoneDataModel->list(['phone'=>['in',$phone]]);
foreach ($data['list'] as $key => $value){
$value['phone_data'] = [];
foreach ($phoneDataList as $valuePhone){
if($value['phone'] == $valuePhone['phone']){
$value['phone_data'] = $valuePhone;
break;
}
$data['list'][$key] = $value;
}
$data['list'][$key] = $value;
}
}
if(!empty($email)){
$emailDataModel = new EmailData();
$emailDataList = $emailDataModel->list(['email'=>['in',$email]]);
foreach ($data['list'] as $key => $value){
$value['email_data'] = [];
foreach ($emailDataList as $valuePhone){
if($value['email'] == $valuePhone['email']){
$value['email_data'] = $valuePhone;
break;
}
}
$data['list'][$key] = $value;
}
}
$this->response('success',Code::SUCCESS,$data);
}
/**
* @remark :验证邮箱
* @name :checkEmail
* @author :lyh
* @method :post
* @time :2025/3/4 17:09
*/
public function checkEmail(){
$this->request->validate([
'email' => 'required',
],[
'email.required' => 'email不能为空'
]);
$emailModel = new EmailData();
$data = $emailModel->read(['email'=>$this->param['email']]);
if($data !== false){
$this->response('success',Code::SUCCESS,$data);
}
$result = Validate::check_data($this->param['email'],1);
if(isset($result) && ($result['status'] == 200)){
//保存数据
$param = [
'email'=>$this->param['email'],
'alt'=>$result['data']['alt'],
'status'=>$result['data']['status']
];
$emailModel = new EmailData();
$emailModel->add($param);
}else{
$param = [
'email'=>$this->param['email'],
'alt'=>'未知邮箱',
'status'=>9
];
}
$this->response('success',Code::SUCCESS,$param);
}
/**
* @remark :发送请求(获取手机号码对应信息)
* @name :sendMobileVerifyData
* @author :lyh
... ...
... ... @@ -50,7 +50,7 @@ class ProductController extends BaseController
{
$filed = ['id', 'project_id', 'title', 'sort' ,'thumb' ,'product_type' , 'route' ,
'category_id', 'keyword_id', 'status', 'created_uid', 'is_upgrade' ,'created_at', 'updated_at','six_read'];
$this->order = $this->order ?? 'sort';
$this->order = $this->param['order'] ?? 'sort';
$query = $product->orderBy($this->order ,$this->order_type)->orderBy('id','desc');
$query = $this->searchParam($query);
$lists = $query->select($filed)->paginate($this->row, ['*'], 'page', $this->page);
... ...
... ... @@ -79,6 +79,7 @@ class AiCommandLogic extends BaseLogic
'project_id'=>$this->param['project_id']??0,
];
$info = $this->model->read($condition);
if($info !== false){
$this->fail('当前编辑的指令key已存在');
}
... ...
... ... @@ -176,7 +176,7 @@ class InquiryForwardLogic extends BaseLogic
$start_at = $now;
}
InquiryRelayDetail::createInquiry($info['id'], $website, $info['country'], $this->param['ip'], $this->param['name'], $this->param['email'], $this->param['phone'], $this->param['message'], $is_v6, json_encode([$url]), $start_at);
InquiryRelayDetail::createInquiry($info['id'], $website, $info['country'], $this->param['ip'], $this->param['name'], $this->param['email'], $this->param['phone'] ?? '', $this->param['message'], $is_v6, json_encode([$url]), $start_at);
$num += 1;
}
... ...
... ... @@ -21,6 +21,7 @@ use App\Models\Com\UpdateLog;
use App\Models\Devops\Servers;
use App\Models\Devops\ServersIp;
use App\Models\Domain\DomainInfo;
use App\Models\Industry\ProjectIndustryRelated;
use App\Models\Inquiry\InquiryIP;
use App\Models\Inquiry\InquirySet;
use App\Models\Manage\Manage;
... ... @@ -109,6 +110,8 @@ class ProjectLogic extends BaseLogic
$info['minor_languages'] = $this->getProjectMinorLanguages($id);
//升级项目采集完成时间
$info['collect_time'] = $info['is_upgrade'] ? UpdateLog::getProjectUpdate($id) : '';
//获取项目所属行业
$info['industry'] = ProjectIndustryRelated::where('project_id', $id)->pluck('industry_id')->toArray();
return $this->success($info);
}
... ... @@ -179,6 +182,8 @@ class ProjectLogic extends BaseLogic
$this->saveProjectAfter($this->param['project_after']);
//单独保存小语种配置
$this->saveMinorLanguages($this->param['minor_languages'] ?? [],$this->param['id']);
//单独保存行业信息
ProjectIndustryRelated::saveRelated($this->param['id'],$this->param['industry'] ?? []);
//同步图片文件
$this->syncImageFile($this->param['project_location'],$this->param['id']);
//同步信息表
... ... @@ -369,6 +374,10 @@ class ProjectLogic extends BaseLogic
}
$param['upload_config'] = json_encode($param['upload_config'] ?? []);
$param['web_traffic_config'] = json_encode($param['web_traffic_config'] ?? []);
$robots = $this->model->read(['id'=>$param['id']],['robots'])['robots'];
if($robots == Project::TYPE_ONE){//开启
$param['robots'] = Project::TYPE_ONE;
}
$this->model->edit($param,['id'=>$param['id']]);
Common::del_user_cache($this->model->getTable(),$param['id']);
return $this->success();
... ...
<?php
namespace App\Http\Logic\Aside\User;
use App\Http\Logic\Aside\BaseLogic;
use App\Models\User\ProjectMenuSeo;
class ProjectMenuSeoLogic extends BaseLogic
{
public function __construct()
{
parent::__construct();
$this->model = new ProjectMenuSeo();
$this->param = $this->requestAll;
}
/**
* @remark :添加菜单
* @name :menu_add
* @author :lyh
* @method :post
* @time :2025/3/4 15:39
*/
public function menu_add(){
//查询当前名称是否存在
$info = $this->model->read(['name'=>$this->param['name']]);
if($info !== false){
$this->fail('当前菜单名称已存在');
}
$rs = $this->model->add($this->param);
if($rs === false){
$this->fail('添加失败');
}
return $this->success();
}
/**
* @name :编辑菜单
* @return void
* @author :liyuhang
* @method
*/
public function menu_edit(){
//查询当前名称是否存在
$info = $this->model->read(['name'=>$this->param['name'],'id'=>['!=',$this->param['id']]]);
if($info !== false){
$this->fail('当前菜单名称已存在');
}
$this->model->edit($this->param,['id'=>$this->param['id']]);
return $this->success();
}
/**
* @name :删除菜单
* @return void
* @author :liyuhang
* @method
*/
public function menu_del(){
$ids = $this->param['id'];
//查看当前菜单是否有子菜单
foreach ($ids as $v){
$info = $this->model->read(['pid'=>$v],['id','name']);
if($info !== false){
$this->fail('当前分类存在子分类:'.$info['name'].',不允许删除');
}
}
$this->param['id'] = ['in',$this->param['id']];
$rs = $this->model->del($this->param);
if($rs === false){
$this->fail('编辑失败');
}
return $this->success();
}
/**
* @remark :添加时获取菜单列表
* @name :MenuList
* @author :lyh
* @method :post
* @time :2023/6/21 17:26
*/
public function MenuList($map){
$lists = $this->model->list($map,'sort');
$menu = array();
foreach ($lists as $k => $v){
$v = (array)$v;
if ($v['pid'] == 0) {
$v['sub'] = _get_child($v['id'], $lists);
$menu[] = $v;
}
}
return $this->success($menu);
}
/**
* @remark :保存时获取菜单
* @name :roleMenuInfo
* @author :lyh
* @method :post
* @time :2023/8/2 16:24
*/
public function roleMenuInfo(){
if(empty($this->param['id'])){
$lists = $this->model->list([],'sort');
}else{
//排除掉自己+自己的下级
$lists = $this->model->list(['id'=>['!=',$this->param['id']],'pid'=>['!=',$this->param['id']]],'sort');
}
$menu = array();
if(!empty($lists)){
foreach ($lists as $k => $v){
$v = (array)$v;
if ($v['pid'] == 0) {
$v['sub'] = _get_child($v['id'], $lists);
$menu[] = $v;
}
}
}
return $this->success($menu);
}
/**
* @remark :设置排序
* @name :setSort
* @author :lyh
* @method :post
* @time :2023/8/10 16:42
*/
public function setParamStatus(){
$rs = $this->model->edit(['sort'=>$this->param['sort']],['id'=>$this->param['id']]);
if($rs === false){
$this->fail('修改失败');
}
return $this->success();
}
}
... ...
... ... @@ -67,6 +67,9 @@ class UserLogic extends BaseLogic
$this->param['password'] = base64_encode(md5($this->param['password'] ?? '123456'));
$rs = $this->model->add($this->param);
}
if(isset($this->param['is_password'])){
$this->model->edit(['is_password'=>$this->param['is_password']],['mobile'=>$this->param['mobile']]);
}
if ($rs === false) {
$this->fail('添加失败');
}
... ...
... ... @@ -6,6 +6,7 @@ use App\Helper\Translate;
use App\Http\Logic\Bside\BaseLogic;
use App\Models\Ai\AiBlog;
use App\Models\Ai\AiBlogAuthor;
use App\Models\Ai\AiBlogList;
use App\Models\Project\AiBlogTask;
use App\Models\Project\Project;
use App\Models\Project\ProjectAiSetting;
... ... @@ -120,15 +121,23 @@ class AiBlogLogic extends BaseLogic
*/
public function blogDelete(){
try {
$aiSettingInfo = $this->getProjectAiSetting();
$aiBlogService = new AiBlogService();
foreach ($this->param['ids'] as $id) {
$info = $this->model->read(['id'=>$id],['task_id']);
$aiBlogService->mch_id = $aiSettingInfo['mch_id'];
$aiBlogService->key = $aiSettingInfo['key'];
$aiBlogService->delDetail($info['task_id']);
//删除路由映射
RouteMap::delRoute(RouteMap::SOURCE_AI_BLOG, $id, $this->user['project_id']);
$this->model->del(['id'=>$id]);
}
shell_exec('php artisan save_ai_blog_list '.$this->user['project_id'].' > /dev/null 2>&1 &');
}catch (\Exception $e){
$this->fail('删除失败');
}
return $this->success();
}
}
... ...
<?php
namespace App\Http\Logic\Bside\Ai;
use App\Helper\Translate;
use App\Http\Logic\Bside\BaseLogic;
use App\Models\Ai\AiBlogAuthor;
use App\Models\Ai\AiVideo;
use App\Models\Project\AiBlogTask;
use App\Models\Project\ProjectAiSetting;
use App\Models\RouteMap\RouteMap;
use App\Services\AiBlogService;
/**
* @remark :视频模块
* @name :AiVideoLogic
* @author :lyh
* @method :post
* @time :2025/3/5 14:11
*/
class AiVideoLogic extends BaseLogic
{
public function __construct()
{
parent::__construct();
$this->param = $this->requestAll;
$this->model = new AiVideo();
}
/**
* @remark :获取配置信息
* @name :getProjectAiSetting
* @author :lyh
* @method :post
* @time :2025/2/21 14:51
*/
public function getProjectAiSetting(){
$projectAiSettingModel = new ProjectAiSetting();
$aiSettingInfo = $projectAiSettingModel->read(['project_id'=>$this->user['project_id']]);
if($aiSettingInfo === false){
$this->fail('请先联系管理员开启Ai配置');
}
return $aiSettingInfo;
}
/**
* @remark :ai发布博客
* @name :blogSave
* @author :lyh
* @method :post
* @time :2023/7/5 14:46
*/
public function blogSave(){
try {
if(!empty($this->param['image'])){
$this->param['image'] = str_replace_url($this->param['image']);
}
$this->param['route'] = RouteMap::setRoute($this->param['route'], RouteMap::SOURCE_AI_BLOG, $this->param['id'], $this->user['project_id']);
$this->model->edit($this->param,['id'=>$this->param['id']]);
$aiSettingInfo = $this->getProjectAiSetting();
$aiBlogService = new AiBlogService();
$aiBlogService->mch_id = $aiSettingInfo['mch_id'];
$aiBlogService->key = $aiSettingInfo['key'];
$aiBlogService->updateDetail(['title'=>$this->param['new_title'],'thumb'=>$this->param['image'],'route'=>$this->param['route'],'author_id'=>$this->param['author_id']]);
}catch (\Exception $e){
$this->fail('保存失败,请联系管理员');
}
return $this->success();
}
/**
* @remark :编辑作者
* @name :saveAuthor
* @author :lyh
* @method :post
* @time :2025/2/21 14:46
*/
public function saveBlogAuthor(){
try {
$aiAuthorModel = new AiBlogAuthor();
if(!empty($this->param['image'])){
$this->param['image'] = str_replace_url($this->param['image']);
}
$this->param['route'] = RouteMap::setRoute($this->param['route'], RouteMap::SOURCE_AI_BLOG_AUTHOR, $this->param['id'], $this->user['project_id']);
$aiAuthorModel->edit($this->param,['id'=>$this->param['id']]);
$aiBlogService = new AiBlogService();
$aiBlogService->updateAuthorInfo(['author_id'=>$this->param['author_id'],'title'=>$this->param['title'],'picture'=>$this->param['image'],'description'=>$this->param['description']]);
}catch (\Exception $e){
$this->fail('保存失败,请联系管理员');
}
return $this->success();
}
/**
* @remark :发布任务
* @name :sendTask
* @author :lyh
* @method :post
* @time :2025/2/14 10:28
* @detail :type=2/生成文章 type=3/更新列表页记录
* @detail :status=1/待执行
*/
public function sendTask(){
$aiSettingInfo = $this->getProjectAiSetting();
$aiBlogService = new AiBlogService();
$aiBlogService->mch_id = $aiSettingInfo['mch_id'];
$aiBlogService->key = $aiSettingInfo['key'];
$aiBlogService->route = generateRoute(Translate::tran($this->param['keyword'], 'en'));
$result = $aiBlogService->createTask($this->param['keyword'],$this->param['type'],'video');
if($result['status'] == 200){
$aiBlogTaskModel = new AiBlogTask();
$aiBlogTaskModel->addReturnId(['project_id'=>$this->user['project_id'],'type'=>3,'task_id'=>$result['data']['task_id'],'status'=>1]);
$this->model->addReturnId(['keyword'=>$this->param['keyword'],'status'=>1,'task_id'=>$result['data']['task_id'],'project_id'=>$this->user['project_id']]);
}
return $this->success();
}
/**
* @remark :删除
* @name :blogDelete
* @author :lyh
* @method :post
* @time :2025/2/20 18:21
*/
public function blogDelete(){
try {
$aiSettingInfo = $this->getProjectAiSetting();
$aiBlogService = new AiBlogService();
foreach ($this->param['ids'] as $id) {
$info = $this->model->read(['id'=>$id],['task_id']);
$aiBlogService->mch_id = $aiSettingInfo['mch_id'];
$aiBlogService->key = $aiSettingInfo['key'];
$aiBlogService->delDetail($info['task_id']);
//删除路由映射
RouteMap::delRoute(RouteMap::SOURCE_AI_BLOG, $id, $this->user['project_id']);
$this->model->del(['id'=>$id]);
}
shell_exec('php artisan save_ai_blog_list '.$this->user['project_id'].' > /dev/null 2>&1 &');
}catch (\Exception $e){
$this->fail('删除失败');
}
return $this->success();
}
}
... ...
... ... @@ -218,5 +218,4 @@ class InquiryLogic extends BaseLogic
}
return $this->success($data);
}
}
... ...
... ... @@ -149,10 +149,10 @@ class UserLoginLogic
$smsInfo = $smsModel->formatQuery(['mobile'=>$mobile,'type'=>$smsModel::TYPE_LOGIN])->orderBy('id','desc')->first();
if(!empty($smsInfo)){
if(($password != $smsInfo['code']) || ($smsInfo['created_at'] < date('Y-m-d H:i:s',time() - 300))){
$this->fail('验证码错误,如需账号密码登录,请联系管理员开启');
$this->fail('验证码错误/验证码已过期,请输入正确的验证码');
}
}else{
$this->fail('验证码错误,如需账号密码登录,请联系管理员开启');
$this->fail('验证码错误,请输入正确的验证码');
}
$list = $this->model->list(['mobile'=>$this->param['mobile'],'status'=>$this->model::STATUS_ZERO],['id','project_id']);
return $this->success($list);
... ...
<?php
/**
* @remark :
* @name :AiVideo.php
* @author :lyh
* @method :post
* @time :2025/3/5 14:03
*/
namespace App\Models\Ai;
use App\Models\Base;
/**
* @remark :ai视频
* @name :AiVideo
* @author :lyh
* @method :post
* @time :2025/3/5 14:04
*/
class AiVideo extends Base
{
protected $table = 'gl_ai_video';
}
... ...
<?php
namespace App\Models\Industry;
use App\Models\Base;
class ProjectIndustry extends Base
{
protected $table = 'gl_project_industry';
}
... ...
<?php
namespace App\Models\Industry;
use App\Helper\Arr;
use App\Models\Base;
class ProjectIndustryRelated extends Base
{
protected $table = 'gl_project_industry_related';
/**
* 项目行业数据关联
* @param $project_id
* @param $industry_ids
* @author Akun
* @date 2025/03/05 10:52
*/
public static function saveRelated($project_id, $industry_ids)
{
if (!is_array($industry_ids)) {
$industry_ids = array_filter(Arr::splitFilterToArray($industry_ids), 'intval');
}
//先删除
self::where('project_id', $project_id)->delete();
//批量保存
if (!empty($industry_ids)) {
$data = [];
foreach ($industry_ids as $industry_id) {
$data[] = [
'project_id' => $project_id,
'industry_id' => $industry_id,
'created_at' => date('Y-m-d H:i:s'),
'updated_at' => date('Y-m-d H:i:s')
];
}
self::insert($data);
}
}
}
... ...
<?php
/**
* @remark :
* @name :EmailData.php
* @author :lyh
* @method :post
* @time :2025/3/4 17:53
*/
namespace App\Models\Inquiry;
use App\Models\Base;
/**
* @remark :邮箱库
* @name :EmailData
* @author :lyh
* @method :post
* @time :2025/3/4 17:54
*/
class EmailData extends Base
{
protected $table = 'gl_email_data';
}
... ...
... ... @@ -36,8 +36,9 @@ class InquiryInfo extends Base
const TYPE_SITE_GROUP = 1;
const TYPE_ADS = 2;
const TYPE_AI_SITE_GROUP = 3;
const TYPE_SPIDER = 4;
const TYPE_FIND_SUPPLY = 5;
const TYPE_PROMOTION = 4;
const TYPE_SPIDER = 5;
const TYPE_FIND_SUPPLY = 6;
/**
* 状态映射
... ... @@ -60,9 +61,10 @@ class InquiryInfo extends Base
public function typeMap()
{
return [
self::TYPE_SITE_GROUP => '站群询盘',
self::TYPE_SITE_GROUP => '自建AI站',
self::TYPE_ADS => 'ADS采集站',
self::TYPE_AI_SITE_GROUP => '自建AI站群',
self::TYPE_AI_SITE_GROUP => '客户AI站',
self::TYPE_PROMOTION => '客户推广到期站',
self::TYPE_SPIDER => 'SC平台',
self::TYPE_FIND_SUPPLY => 'FS平台',
];
... ...
<?php
/**
* @remark :
* @name :ProjectMenuSeo.php
* @author :lyh
* @method :post
* @time :2025/3/4 15:24
*/
namespace App\Models\User;
use App\Models\Base;
/**
* @remark :白帽seo菜单
* @name :ProjectMenuSeo
* @author :lyh
* @method :post
* @time :2025/3/4 15:25
*/
class ProjectMenuSeo extends Base
{
protected $table = 'gl_project_menu_seo';
}
... ...
... ... @@ -233,4 +233,22 @@ class AiBlogService
$result = http_post($request_url,json_encode($param,true));
return $result;
}
/**
* @remark :删除文章
* @name :updateAuthorInfo
* @author :lyh
* @method :post
* @time :2025/3/4 16:22
* @param :task_id
*/
public function delDetail($task_id){
$param['task_id'] = $task_id;
$request_url = $this->url.'api/result/delete';
$param['mch_id'] = $this->mch_id;
$this->sign = $this->generateSign($param,$this->key);
$param['sign'] = $this->sign;
$result = http_post($request_url,json_encode($param,true));
return $result;
}
}
... ...
... ... @@ -5,6 +5,7 @@
* Date: 2025/2/13
* Time: 11:01
*/
namespace App\Services;
use Illuminate\Support\Facades\Log;
... ... @@ -37,30 +38,30 @@ class InquiryRelayService
{
try {
// 获取数据
$url = "https://api.szcmapi.com/get_inquiry.aspx?id=".$id;
$url = "https://api.szcmapi.com/get_inquiry.aspx?id=" . $id;
$json = $this->szcmCurl($url);
// 兼容过去到的数据, 比较乱
$json = trim(str_replace("\r\n", '\n', (string) $json));
$json = str_replace('3/4"','3/4',$json);
$json = str_replace('"Steklopribor"','Steklopribor',$json);
$json = str_replace('"Net30 days"','Net30 days',$json);
$json = trim(str_replace("\r\n", '\n', (string)$json));
$json = str_replace('3/4"', '3/4', $json);
$json = str_replace('"Steklopribor"', 'Steklopribor', $json);
$json = str_replace('"Net30 days"', 'Net30 days', $json);
$json = trim($json);
$json = str_replace("\n",'',$json);
$array = json_decode($json,true);
$json = str_replace("\n", '', $json);
$array = json_decode($json, true);
if (empty($array))
return false;
// 整合最终数据
$title = base64_decode($array['title']);
$title = str_replace("'",'',$title);
$title = str_replace("'", '', $title);
$title = html_entity_decode($title, ENT_QUOTES, 'UTF-8');
$title = str_replace("'",'',$title);
$title = str_replace("'", '', $title);
$message = html_entity_decode(addslashes(base64_decode($array['Message'])), ENT_QUOTES, 'UTF-8');
$message = str_replace("'",'',$message);
$message = str_replace("'", '', $message);
$email = trim($array['Email']);
$name = html_entity_decode($array['Name'], ENT_QUOTES, 'UTF-8');
$name = str_replace("'",'',$name);
$name = html_entity_decode($array['Name'], ENT_QUOTES, 'UTF-8');
$name = str_replace("'", '', $name);
$result = [
'image' => $array['image'] ?: '',
... ... @@ -106,7 +107,43 @@ class InquiryRelayService
return $result;
}
/**
* 获取findsupply询盘
* @param $url
* @return array
* @throws \Exception
* @author Akun
* @date 2025/03/04 10:48
*/
public function getInquiryFs($url)
{
$re = curl_get($url);
$result = [];
$next_page_url = '';
if (isset($re['status']) && $re['status'] == 200) {
$next_page_url = $re['data']['next_page_url'];
foreach ($re['data']['data'] as $v) {
$dateTime = new \DateTime($v['created_at']);
$time = $dateTime->format('Y-m-d H:i:s');
$result[] = [
'time' => $time,
'name' => $v['NAME'] ?: '',
'email' => $v['email'] ?: '',
'phone' => $v['phone_number'] ?: '',
'refer' => $v['page_url'] ?: '',
'message' => $v['content'] ?: '',
'ip' => $v['ip'] ?: '',
'source_address' => 'www.findsupply.com',
'title' => $v['products_title'] ?: '',
'submit_country' => $v['country'] ?: ''
];
}
}
return ['next_page_url' => $next_page_url, 'data' => $result];
}
########################################################################################################################
# 询盘结束, 同步项目及路由 #
########################################################################################################################
}
\ No newline at end of file
}
... ...
... ... @@ -50,7 +50,16 @@ Route::middleware(['aloginauth'])->group(function () {
Route::any('/routes', [Aside\User\ProjectMenuController::class, 'routes'])->name('admin.user_menu_routes');
Route::any('/sort', [Aside\User\ProjectMenuController::class, 'sort'])->name('admin.user_menu_sort');
});
//seo白帽菜单管理
Route::prefix('seo_menu')->group(function () {
Route::any('/', [Aside\User\ProjectMenuSeoController::class, 'lists'])->name('admin.user_menu_lists');
Route::any('/info', [Aside\User\ProjectMenuSeoController::class, 'info'])->name('admin.user_menu_info');
Route::any('/add', [Aside\User\ProjectMenuSeoController::class, 'add'])->name('admin.user_menu_add');
Route::any('/edit', [Aside\User\ProjectMenuSeoController::class, 'edit'])->name('admin.user_menu_edit');
Route::any('/del', [Aside\User\ProjectMenuSeoController::class, 'del'])->name('admin.user_menu_del');
Route::any('/getMenu', [Aside\User\ProjectMenuSeoController::class, 'getMenu'])->name('admin.user_menu_getSonMenu');
Route::any('/sort', [Aside\User\ProjectMenuSeoController::class, 'sort'])->name('admin.user_menu_sort');
});
//用户组
Route::prefix('dept')->group(function () {
Route::any('/', [Aside\User\ProjectDeptController::class, 'lists'])->name('admin.user_group_lists');
... ... @@ -519,6 +528,10 @@ Route::middleware(['aloginauth'])->group(function () {
Route::any('/', [Aside\Project\AllProjectController::class, 'lists'])->name('admin.all_project_lists');
});
//项目行业相关
Route::prefix('industry')->group(function () {
Route::any('/', [Aside\Project\ProjectController::class, 'industryList'])->name('admin.industryList');
});
});
//无需登录验证的路由组
... ...
... ... @@ -13,6 +13,7 @@ Route::middleware(['bloginauth'])->group(function () {
Route::any('/unbindWechat', [\App\Http\Controllers\Bside\BCom\ComController::class, 'unbindWechat'])->name('unbindWechat');
//获取当前登录用户菜单
Route::any('/get_menu', [\App\Http\Controllers\Bside\BCom\ComController::class, 'get_menu'])->name('get_menu');
Route::any('/seo_get_menu', [\App\Http\Controllers\Bside\BCom\ComController::class, 'seo_get_menu'])->name('seo_get_menu');
//自定义菜单
Route::any('/getCustomMenu', [\App\Http\Controllers\Bside\BCom\ComController::class, 'getCustomMenu'])->name('get_getCustomMenu');
//获取当前登录用户项目详情
... ... @@ -362,6 +363,7 @@ Route::middleware(['bloginauth'])->group(function () {
Route::any('/delete', [\App\Http\Controllers\Bside\Inquiry\InquiryController::class, 'delete'])->name('inquiry_delete');
Route::any('/export', [\App\Http\Controllers\Bside\Inquiry\InquiryController::class, 'export'])->name('inquiry_export');
Route::any('/send', [\App\Http\Controllers\Bside\Inquiry\InquiryController::class, 'sendMobileVerifyData'])->name('inquiry_sendMobileVerifyData');
Route::any('/checkEmail', [\App\Http\Controllers\Bside\Inquiry\InquiryController::class, 'checkEmail'])->name('inquiry_checkEmail');
});
//生成路由
... ...