作者 刘锟

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

... ... @@ -53,7 +53,7 @@ class AiBlogAuthorTask extends Command
continue;
}
$info = $info->toArray();
echo '开始->project_id:' . $info['project_id'] . PHP_EOL . date('Y-m-d H:i:s');
echo date('Y-m-d H:i:s').'开始->project_id:' . $info['project_id'] . PHP_EOL;
//获取配置
$aiSettingInfo = $this->getSetting($info['project_id']);
if(empty($aiSettingInfo)){
... ... @@ -82,7 +82,7 @@ class AiBlogAuthorTask extends Command
DB::disconnect('custom_mysql');
//修改任务状态
$aiBlogTaskModel->edit(['status'=>2],['id'=>$info['id']]);
echo '结束->任务id:' . $info['id'] . PHP_EOL . date('Y-m-d H:i:s');
echo date('Y-m-d H:i:s').'结束->任务id:' . $info['id'] . PHP_EOL;
}
return true;
}
... ... @@ -144,7 +144,7 @@ class AiBlogAuthorTask extends Command
$aiBlogService->key = $aiSettingInfo['key'];
$aiBlogService->updateAuthorInfo(['author_id'=>$param['author_id'],'route'=>$param['route'],'title'=>$param['title'],'picture'=>$param['image'],'description'=>$param['description']]);
}catch (\Exception $e){
echo 'error:'.$e->getMessage();
echo 'error:'.$e->getMessage().PHP_EOL;
continue;
}
}
... ...
... ... @@ -21,11 +21,13 @@ use App\Models\Project\Project;
use App\Models\Project\ProjectAiSetting;
use App\Models\RouteMap\RouteMap;
use App\Services\AiBlogService;
use App\Services\DingService;
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 Illuminate\Support\Facades\Redis;
use function Symfony\Component\String\s;
class AiBlogTask extends Command
... ... @@ -37,6 +39,10 @@ class AiBlogTask extends Command
*/
protected $signature = 'save_ai_blog';
public $updateProject = [];//需更新的列表
/**
* The console command description.
*
... ... @@ -45,61 +51,120 @@ class AiBlogTask extends Command
protected $description = '查询ai_blog是否已经生成';
public function handle(){
$aiBlogTaskModel = new AiBlogTaskModel();
while (true){
$list = $aiBlogTaskModel->formatQuery(['status'=>1,'type'=>2])->inRandomOrder()->limit(1000)->get();
if(empty($list)){
//获取任务id
$task_id = $this->getTaskId(2);
if(empty($task_id)){
sleep(300);
continue;
}
$list = $list->toArray();
$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(!isset($result['status'])){
echo json_encode($result,true).PHP_EOL;
continue;
}
if($result['status'] != 200){
echo '错误状态码:'.$result['status'].PHP_EOL;
continue;
}
//保存当前项目ai_blog数据
ProjectServer::useProject($item['project_id']);
$aiBlogModel = new AiBlog();
$aiBlogInfo = $aiBlogModel->read(['task_id'=>$item['task_id']],['id']);
if($aiBlogInfo === false){
echo '任务id不存在:'.$item['task_id'].PHP_EOL;
$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'=>$route,'task_id'=>$item['task_id']]);
}
$aiBlogModel->edit(['new_title'=>$result['data']['title'], 'image'=>$result['data']['thumb'], 'text'=>$result['data']['section'], 'author_id'=>$result['data']['author_id'],'seo_title'=>$result['data']['title'],'seo_keyword'=>$result['data']['keyword'],'seo_description'=>$result['data']['description'], 'route'=>$route ,'status'=>2], ['task_id'=>$item['task_id']]);
DB::disconnect('custom_mysql');
$aiBlogTaskModel->edit(['status'=>2],['id'=>$item['id']]);
echo '结束->任务id:' . $item['task_id'] . PHP_EOL . date('Y-m-d H:i:s');
$this->sendRequest($task_id);
}
return true;
}
/**
* @remark :请求方法
* @name :sendRequest
* @author :lyh
* @method :post
* @time :2025/3/19 16:48
*/
public function sendRequest($task_id){
$aiBlogTaskModel = new AiBlogTaskModel();
$item = $aiBlogTaskModel->read(['id'=>$task_id]);
echo date('Y-m-d H:i:s') . '开始->任务id:' . $item['task_id'] . PHP_EOL;
//获取配置
$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(!isset($result['status']) || ($result['status'] != 200)){
if($item['sort'] < 5){
$aiBlogTaskModel->edit(['sort'=>$item['sort'] + 1],['id'=>$item['id']]);
}else{
$aiBlogTaskModel->edit(['status'=>9],['id'=>$item['id']]);
// 钉钉通知
$dingService = new DingService();
$body = [
'keyword' => 'AI_BLOG生成错误',
'msg' => '任务id:'.$item['task_id'].'拉取数据失败'.PHP_EOL.'返回信息:'.json_encode($result,JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES),
'isAtAll' => false, // 是否@所有人
];
$dingService->handle($body);
}
//TODO::更新列表页及作者
$this->updateProject($updateProject);
echo date('Y-m-d H:i:s'). '错误信息:'.json_encode($result,true).PHP_EOL;
return false;
}
//保存当前项目ai_blog数据
ProjectServer::useProject($item['project_id']);
$aiBlogModel = new AiBlog();
$aiBlogInfo = $aiBlogModel->read(['task_id'=>$item['task_id']],['id']);
if($aiBlogInfo === false){
echo '任务id不存在:'.$item['task_id'].PHP_EOL;
$aiBlogTaskModel->edit(['status'=>$aiBlogModel::STATUS_FINISH],['id'=>$item['id']]);
DB::disconnect('custom_mysql');
return false;
}
if (!in_array($result['data']['author_id'], $this->updateProject[$item['project_id']] ?? [])) {
$this->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'=>$route,'task_id'=>$item['task_id']]);
}
$aiBlogModel->edit(['new_title'=>$result['data']['title'], 'image'=>$result['data']['thumb'], 'text'=>$result['data']['section'], 'author_id'=>$result['data']['author_id'],'seo_title'=>$result['data']['title'],'seo_keyword'=>$result['data']['keyword'],'seo_description'=>$result['data']['description'], 'route'=>$route ,'status'=>$aiBlogModel::STATUS_FINISH], ['task_id'=>$item['task_id']]);
DB::disconnect('custom_mysql');
$aiBlogTaskModel->edit(['status'=>$aiBlogModel::STATUS_FINISH],['id'=>$item['id']]);
echo date('Y-m-d H:i:s').'结束->任务id:' . $item['task_id'] . PHP_EOL;
return true;
}
/**
* @remark :g获取信息
* @name :getDetail
* @author :lyh
* @method :post
* @time :2025/3/19 17:24
*/
public function getDetail(){
}
/**
* @remark :获取任务id
* @name :getTaskId
* @author :lyh
* @method :post
* @time :2025/3/19 16:16
* @param :
*/
public function getTaskId($finish_at = 1)
{
$task_id = Redis::rpop('ai_blog_task');
if (empty($task_id)) {
if(!empty($this->updateProject)){
$this->updateProject($this->updateProject);
$this->updateProject = [];
}
$aiBlogTaskModel = new AiBlogTaskModel();
$finish_at = date('Y-m-d H:i:s', strtotime('-' . $finish_at . ' hour'));
$ids = $aiBlogTaskModel->formatQuery(['status'=>$aiBlogTaskModel::STATUS_RUNNING,'type'=>$aiBlogTaskModel::TYPE_BLOG,'created_at'=>['<=',$finish_at]])->limit(1000)->pluck('id');
if(!empty($ids)){
foreach ($ids as $id) {
Redis::lpush('ai_blog_task', $id);
}
}
$task_id = Redis::rpop('ai_blog_task');
}
return $task_id;
}
/**
* @remark :更新项目作者页面及列表页
* @name :updateProject
* @author :lyh
... ...
<?php
/**
* @remark :
* @name :ImportCustomModule.php
* @author :lyh
* @method :post
* @time :2024/12/9 11:35
*/
namespace App\Console\Commands\CustomModule;
use App\Models\CustomModule\CustomModuleCategory;
use App\Models\CustomModule\CustomModuleContent;
use App\Models\CustomModule\CustomModuleExtentContent;
use App\Models\RouteMap\RouteMap;
use App\Services\ProjectServer;
use Illuminate\Console\Command;
use Illuminate\Support\Facades\DB;
class ImportCustomModule extends Command
{
/**
* The name and signature of the console command.
*
* @var string
*/
protected $signature = 'import_custom_module';
/**
* The console command description.
*
* @var string
*/
protected $description = '特殊项目导入扩展模块及扩展数据';
/**
* @remark :导入
* @name :handle
* @author :lyh
* @method :post
* @time :2024/12/9 11:36
*/
public function handle(){
echo date('Y-m-d H:i:s') . 'project_id:' . PHP_EOL;
ProjectServer::useProject(2837);
$this->import_module_content();
DB::disconnect('custom_mysql');
}
/**
* @remark :导入扩展模块 (保留)
* @name :ceshis
* @author :lyh
* @method :post
* @time :2024/12/6 17:02
*/
public function import_module_content(){
$data = 'MBR10100CT,Rectifier/Schottky Barrier Rectifier,TO-220AB,100,5*2,common cathode,100,0.85,10,2500,175,-,Active,https://v6-file.globalso.com/upload/p/2837/files/MBR10100CT.pdf
MBR2060BCT,Rectifier/Schottky Barrier Rectifier,ITO-220AB,60,10*2,common cathode,150,0.75,50,5000,150,-,Active,https://v6-file.globalso.com/upload/p/2837/files/MBR2060BCT.pdf
MBR20150DCT,Rectifier/Schottky Barrier Rectifier,TO-263(D2PAK),150,10*2,common cathode,150,0.88,5,1500,175,-,Active,https://v6-file.globalso.com/upload/p/2837/files/MBR20150DCT.pdf
MUR2060CT,Rectifier/High Efficient Rectifier,TO-220AB,600,10*2,common cathode,150,1.7,1,500,150,50,Active,https://v6-file.globalso.com/upload/p/2837/files/MUR2060CT.pdf
MUR2040FCT,Rectifier/High Efficient Rectifier,ITO-220AB,400,10*2,common cathode,150,1.3,1,500,150,50,Active,https://v6-file.globalso.com/upload/p/2837/files/MUR2040FCT.pdf
DSEK20S04B,Rectifier/Ultra fast soft Recovery Rectifier,TO-252(DPAK),400,10*2,common cathode,125,1.25,2,500,175,35,Active,https://v6-file.globalso.com/upload/p/2837/files/DSEK20S04B.pdf
DSEK30S06D,Rectifier/Ultra fast soft Recovery Rectifier,TO-263(D2PAK),600,15*2,common cathode,150,1.7,2,500,175,35,Active,https://v6-file.globalso.com/upload/p/2837/files/DSEK30S06D.pdf
DSEK60H06P,Rectifier/Ultra fast soft Recovery Rectifier,TO-247AD,600,30*2,common cathode,300,1.7,5,500,175,60,Active,https://v6-file.globalso.com/upload/p/2837/files/DSEK60H06P.pdf
GBU410,Rectifier/Bridge Rectifier,GBU,1000,4,-,125,1,1,500,150,-,Active,https://v6-file.globalso.com/upload/p/2837/files/GBU410.pdf
GBU1510,Rectifier/Bridge Rectifier,GBU,1000,15,-,250,1,1,500,150,-,Active,https://v6-file.globalso.com/upload/p/2837/files/GBU1510.pdf
GBJ2510,Rectifier/Bridge Rectifier,GBJ,1000,25,-,300,1,1,500,150,-,Active,https://v6-file.globalso.com/upload/p/2837/files/GBJ2510.pdf
GBU1504H,Rectifier/High Efficient Bridge Rectifier,GBU,400,15,-,150,1.3,1,500,150,-,Active,https://v6-file.globalso.com/upload/p/2837/files/GBU1504H.pdf
GBU1506H,Rectifier/High Efficient Bridge Rectifier,GBU,400,15,-,150,1.7,1,500,150,-,Active,https://v6-file.globalso.com/upload/p/2837/files/GBU1506H.pdf
GBJ2504H,Rectifier/High Efficient Bridge Rectifier,GBJ,600,25,-,250,1.3,1,500,150,-,Active,https://v6-file.globalso.com/upload/p/2837/files/GBJ2504H.pdf
GBJ2506H,Rectifier/High Efficient Bridge Rectifier,GBJ,600,25,-,250,1.7,1,500,150,-,Active,https://v6-file.globalso.com/upload/p/2837/files/GBJ2506H.pdf
1N4007,Rectifier/Standard Recovery Rectifier,DO-41,1000,1,-,50,1,1,500,150,-,Active,https://v6-file.globalso.com/upload/p/2837/files/1N4007.pdf
1N5399,Rectifier/Standard Recovery Rectifier,DO-15,1000,1.5,-,75,1,1,500,150,-,Active,https://v6-file.globalso.com/upload/p/2837/files/1N5399.pdf
1N5408,Rectifier/Standard Recovery Rectifier,DO-27,1000,3,-,100,1,1,500,150,-,Active,https://v6-file.globalso.com/upload/p/2837/files/1N5408.pdf
RS1M,Rectifier/Fast Recovery Rectifier,SMA,1000,1,-,50,1.3,1,500,150,500,Active,https://v6-file.globalso.com/upload/p/2837/files/RS1M.pdf
RS2M,Rectifier/Fast Recovery Rectifier,SMB,1000,2,-,75,1.3,1,500,150,500,Active,https://v6-file.globalso.com/upload/p/2837/files/RS2M.pdf
RS3M,Rectifier/Fast Recovery Rectifier,SMC,1000,3,-,100,1.3,1,500,150,500,Active,https://v6-file.globalso.com/upload/p/2837/files/RS3M.pdf
SF28,Rectifier/Super fast Recovery Rectifier,DO-15,600,2,-,60,1.7,1,500,150,35,Active,https://v6-file.globalso.com/upload/p/2837/files/SF28.pdf
SF56G,Rectifier/Super fast Recovery Rectifier,DO-27,400,5,-,125,1.3,1,500,150,35,Active,https://v6-file.globalso.com/upload/p/2837/files/SF56G.pdf
DSE1006,Rectifier/Super fast Recovery Rectifier,TO-220AC,600,10,Single Positive,150,1.7,1,500,150,35,Active,https://v6-file.globalso.com/upload/p/2837/files/DSE1006.pdf
DSE1504F,Rectifier/Super fast Recovery Rectifier,ITO-220AC,400,15,Single Positive,150,1.4,1,500,150,35,Active,https://v6-file.globalso.com/upload/p/2837/files/DSE1504F.pdf';
$array = explode("\n", $data);
foreach ($array as $values){
$array1 = explode(',',$values);
$contentData = [
'name'=>$array1[0],
'route'=>'',
'project_id'=>2837,
'operator_id'=>6393,
'module_id'=>2,
];
$customModuleCategoryModel = new CustomModuleCategory();
if(!empty($array1[1])){
$cate_ids = '';
$cate_arr = explode('/',$array1[1]);
foreach ($cate_arr as $cateV){
$catInfo = $customModuleCategoryModel->read(['name'=>$cateV]);
if($catInfo !== false){
$cate_ids = $cate_ids.','.$catInfo['id'];
}
}
$contentData['category_id'] = empty($cate_ids) ? '' : $cate_ids.',';
}else{
$catInfo = $customModuleCategoryModel->read(['name'=>$array1[1]]);
if($catInfo !== false){
$contentData['category_id'] = ','.$catInfo['id'].',';
}
}
$customModuleContentModel = new CustomModuleContent();
$contentId = $customModuleContentModel->addReturnId($contentData);
$route = RouteMap::setRoute($array1[0],RouteMap::SOURCE_MODULE,$contentId,2837);
$customModuleContentModel->edit(['route'=>$route],['id'=>$contentId]);
$pd_extended_field_arr = [
[
'key'=>'pd_extended_field_1',
'type'=>1,
'project_id'=>2837,
'values'=>$array1[2],
'content_id'=>$contentId,
'module_id'=>2,
'created_at'=>date('Y-m-d H:i:s'),
'updated_at'=>date('Y-m-d H:i:s'),
],
[
'key'=>'pd_extended_field_2',
'type'=>1,
'project_id'=>2837,
'values'=>$array1[3],
'module_id'=>2,
'content_id'=>$contentId,
'created_at'=>date('Y-m-d H:i:s'),
'updated_at'=>date('Y-m-d H:i:s'),
],
[
'key'=>'pd_extended_field_3',
'type'=>1,
'project_id'=>2837,
'values'=>$array1[4],
'module_id'=>2,
'content_id'=>$contentId,
'created_at'=>date('Y-m-d H:i:s'),
'updated_at'=>date('Y-m-d H:i:s'),
],
[
'key'=>'pd_extended_field_4',
'type'=>1,
'project_id'=>2837,
'values'=>$array1[5],
'module_id'=>2,
'content_id'=>$contentId,
'created_at'=>date('Y-m-d H:i:s'),
'updated_at'=>date('Y-m-d H:i:s'),
],
[
'key'=>'pd_extended_field_5',
'type'=>1,
'project_id'=>2837,
'values'=>$array1[6],
'module_id'=>2,
'content_id'=>$contentId,
'created_at'=>date('Y-m-d H:i:s'),
'updated_at'=>date('Y-m-d H:i:s'),
],
[
'key'=>'pd_extended_field_6',
'type'=>1,
'project_id'=>2837,
'values'=>$array1[7],
'module_id'=>2,
'content_id'=>$contentId,
'created_at'=>date('Y-m-d H:i:s'),
'updated_at'=>date('Y-m-d H:i:s'),
],
[
'key'=>'pd_extended_field_7',
'type'=>1,
'project_id'=>2837,
'values'=>$array1[8],
'module_id'=>2,
'content_id'=>$contentId,
'created_at'=>date('Y-m-d H:i:s'),
'updated_at'=>date('Y-m-d H:i:s'),
],
[
'key'=>'pd_extended_field_8',
'type'=>1,
'project_id'=>2837,
'values'=>$array1[9],
'module_id'=>2,
'content_id'=>$contentId,
'created_at'=>date('Y-m-d H:i:s'),
'updated_at'=>date('Y-m-d H:i:s'),
],
[
'key'=>'pd_extended_field_9',
'type'=>1,
'project_id'=>2837,
'values'=>$array1[10],
'module_id'=>2,
'content_id'=>$contentId,
'created_at'=>date('Y-m-d H:i:s'),
'updated_at'=>date('Y-m-d H:i:s'),
],
[
'key'=>'pd_extended_field_10',
'type'=>1,
'project_id'=>2837,
'values'=>$array1[11],
'module_id'=>2,
'content_id'=>$contentId,
'created_at'=>date('Y-m-d H:i:s'),
'updated_at'=>date('Y-m-d H:i:s'),
],
[
'key'=>'pd_extended_field_11',
'type'=>1,
'project_id'=>2837,
'values'=>$array1[12],
'module_id'=>2,
'content_id'=>$contentId,
'created_at'=>date('Y-m-d H:i:s'),
'updated_at'=>date('Y-m-d H:i:s'),
],
[
'key'=>'pd_extended_field_12',
'type'=>4,
'project_id'=>2837,
'values'=>json_encode([['url'=>$array1[13]]]),
'module_id'=>2,
'content_id'=>$contentId,
'created_at'=>date('Y-m-d H:i:s'),
'updated_at'=>date('Y-m-d H:i:s'),
],
];
$extendContentModel = new CustomModuleExtentContent();
$extendContentModel->insert($pd_extended_field_arr);
}
}
}
... ... @@ -54,7 +54,7 @@ class LyhImportTest extends Command
public function handle(){
ProjectServer::useProject(3283);
echo date('Y-m-d H:i:s') . 'start' . PHP_EOL;
$this->importProductCategory('https://ecdn6.globalso.com/upload/p/3283/file/2025-03/zy_boss_pricelistcat.csv',3283);
// $this->importProduct('https://ecdn6.globalso.com/upload/p/3283/file/2025-03/2-1.csv',3283);
DB::disconnect('custom_mysql');
echo date('Y-m-d H:i:s') . 'end' . PHP_EOL;
}
... ...
... ... @@ -66,10 +66,11 @@ class UpdateRoute extends Command
foreach ($lists as $v){
echo date('Y-m-d H:i:s') . '执行项目的project_id:'.$v['id'] . PHP_EOL;
ProjectServer::useProject($v['id']);
$this->updateSeo($v['id']);
$this->updateSeo();
DB::disconnect('custom_mysql');
}
// $this->updateProjectOp();
// $projectModel = new Project();
// $lists = $projectModel->list(['delete_status'=>0],'id',['id']);
... ... @@ -526,22 +527,9 @@ class UpdateRoute extends Command
* @method :post
* @time :2025/3/14 14:39
*/
public function updateSeo($project_id){
$seoModel = new WebSettingSeo();
$seo_info = $seoModel->read(['project_id'=>$project_id]);
if($seo_info !== false){
$prefix = [];
$suffix = [];
if(!empty($seo_info['product_cate_prefix'])){
$prefix[] = ['val'=>[$seo_info['product_cate_prefix']],'level'=>1];
}
if(!empty($seo_info['product_cate_suffix'])){
$suffix[] = ['val'=>[$seo_info['product_cate_suffix']],'level'=>1];
}
if(!empty($prefix) && !empty($suffix)){
$seoModel->edit(['product_category_prefix'=>json_encode($prefix,true),'product_category_suffix'=>json_encode($suffix,true)],['project_id'=>$project_id]);
}
}
public function updateSeo(){
$contentModel = new CustomModuleContent();
$contentModel->edit(['seo_title'=>''],['id'=>['!=',0]]);
return true;
}
}
... ...
... ... @@ -32,7 +32,23 @@ class CategoryController extends BaseController
$this->map = $this->searchParam();
$filed = ['id', 'project_id', 'pid', 'title', 'image', 'route', 'status','created_at','sort'];
$this->map['deleted_at'] = null;
$this->map['pid'] = $this->map['pid'] ?? 0;
if($this->user['project_id'] == 3283){//分类太多加载失败
$list = $this->get3283Lists($category,$filed);
return $this->response('success',Code::SUCCESS,$list);
}else{
$data = $this->getList($category,$filed);
return $this->response('success',Code::SUCCESS,$data);
}
}
/**
* @remark :获取项目列表
* @name :getList
* @author :lyh
* @method :post
* @time :2025/3/19 14:41
*/
public function getList(&$category,$filed){
$list = $category->list($this->map,['sort','id'],$filed);
$data = [];
if(!empty($list)){
... ... @@ -44,9 +60,52 @@ class CategoryController extends BaseController
$v['is_renovation'] = $this->getIsRenovation(BTemplate::SOURCE_PRODUCT,BTemplate::IS_LIST,$template_id,$v['id']);
$list[$k] = $v;
}
$data = $list;
if(!isset($this->map['title'])){
$data = $this->getListSon($list);
}else{
$data = $list;
}
}
return $this->success($data);
}
/**
* @remark :特殊项目特殊处理
* @name :get3283Lists
* @author :lyh
* @method :post
* @time :2025/3/19 14:38
*/
public function get3283Lists(&$category,$filed){
if(!isset($this->map['title'])){
$this->map['pid'] = $this->map['pid'] ?? 0;
}
$list = $category->list($this->map,['sort','id'],$filed);
$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($list,$v['id']);
$v['hasChildren'] = $this->getCategoryHasChildren($category,$v['id']);
$v['image_link'] = getImageUrl($v['image'],$this->user['storage_type'],$this->user['project_location']);
$v['is_renovation'] = $this->getIsRenovation(BTemplate::SOURCE_PRODUCT,BTemplate::IS_LIST,$template_id,$v['id']);
$list[$k] = $v;
}
return $this->success($list);
}
/**
* @remark :查看是否拥有子集
* @name :getCategoryHasChildren
* @author :lyh
* @method :post
* @time :2025/3/20 9:18
*/
public function getCategoryHasChildren(&$category,$id){
$count = $category->counts(['pid'=>$id]);
if($count != 0){
return true;
}
return $this->response('success',Code::SUCCESS,$data);
return false;
}
/**
... ...
... ... @@ -14,4 +14,17 @@ use App\Models\Base;
class AiBlogTask extends Base
{
protected $table = 'gl_ai_blog_task';
/**
* 任务状态
*/
const STATUS_RUNNING = 1;
const STATUS_FINISH = 2;
/**
* 任务类型
*/
const TYPE_AUTHOR = 1;
const TYPE_BLOG = 2;
const TYPE_VIDEO = 3;
}
... ...
... ... @@ -15,7 +15,7 @@ class DingService
{
use RedisTrait;
const LINK = 'https://oapi.dingtalk.com/robot/send111?access_token=723c99369cc16806a26fee8b8ab2c5ae37a78ef842e6a3af89fed0b2a6211836';
const LINK = 'https://oapi.dingtalk.com/robot/send?access_token=2cdba958f11f24f961f13aba2d1acbcd60ed64c998a184492cc63814696e34e1';
const INFO = 'INFO';
const ERROR = 'ERROR';
const WARNNING = 'WARNNING';
... ... @@ -23,11 +23,11 @@ class DingService
/**
* @notes: 发送钉钉消息 同样的消息 1分钟内不重复
* @param array $body
* @return int|mixed
* @author:wlj
* @date: 2022/8/10 15:31
* @remark :钉钉发送错误信息
* @name :handle
* @author :lyh
* @method :post
* @time :2025/3/19 18:03
*/
public function handle(array $body)
{
... ...