作者 lyh

gx创建作者

@@ -40,7 +40,7 @@ class AiBlogTask extends Command @@ -40,7 +40,7 @@ class AiBlogTask extends Command
40 while (true){ 40 while (true){
41 $info = $aiBlogTaskModel->where('status',1)->orderBy('id','asc')->first(); 41 $info = $aiBlogTaskModel->where('status',1)->orderBy('id','asc')->first();
42 if(empty($info)){ 42 if(empty($info)){
43 - sleep(30); 43 + sleep(300);
44 continue; 44 continue;
45 } 45 }
46 $info = $info->toArray(); 46 $info = $info->toArray();
@@ -27,6 +27,41 @@ class AiBlogController extends BaseController @@ -27,6 +27,41 @@ class AiBlogController extends BaseController
27 } 27 }
28 28
29 /** 29 /**
  30 + * @remark :获取详情
  31 + * @name :getInfo
  32 + * @author :lyh
  33 + * @method :post
  34 + * @time :2025/2/20 18:17
  35 + */
  36 + public function getInfo(AiBlog $aiBlog){
  37 + $this->request->validate([
  38 + 'id'=>['required'],
  39 + ],[
  40 + 'id.required' => '主键不能为空',
  41 + ]);
  42 + $info = $aiBlog->read(['id'=>$this->param['id']]);
  43 + $this->response('success',Code::SUCCESS,$info);
  44 + }
  45 +
  46 + /**
  47 + * @remark :删除
  48 + * @name :delete
  49 + * @author :lyh
  50 + * @method :post
  51 + * @time :2025/2/20 18:19
  52 + */
  53 + public function delete(AiBlogLogic $aiBlogLogic)
  54 + {
  55 + $this->request->validate([
  56 + 'ids'=>['required', new Ids()]
  57 + ],[
  58 + 'ids.required' => 'ID不能为空'
  59 + ]);
  60 + $aiBlogLogic->blogDelete();
  61 + $this->response('success');
  62 + }
  63 +
  64 + /**
30 * @remark :获取ai博客列表 65 * @remark :获取ai博客列表
31 * @name :getAiBlog 66 * @name :getAiBlog
32 * @author :lyh 67 * @author :lyh
@@ -88,4 +88,24 @@ class AiBlogLogic extends BaseLogic @@ -88,4 +88,24 @@ class AiBlogLogic extends BaseLogic
88 $result = $aiBlogService->createAuthor(); 88 $result = $aiBlogService->createAuthor();
89 return $this->success($result); 89 return $this->success($result);
90 } 90 }
  91 +
  92 + /**
  93 + * @remark :删除
  94 + * @name :blogDelete
  95 + * @author :lyh
  96 + * @method :post
  97 + * @time :2025/2/20 18:21
  98 + */
  99 + public function blogDelete(){
  100 + try {
  101 + foreach ($this->param['ids'] as $id) {
  102 + //删除路由映射
  103 + RouteMap::delRoute(RouteMap::SOURCE_AI_BLOG, $id, $this->user['project_id']);
  104 + $this->model->del(['id'=>$id]);
  105 + }
  106 + }catch (\Exception $e){
  107 + $this->fail('删除失败');
  108 + }
  109 + return $this->success();
  110 + }
91 } 111 }