AiBlogKeywordLogic.php 1.3 KB
<?php
/**
 * @remark :
 * @name   :AiBlogKeywordLogic.php
 * @author :lyh
 * @method :post
 * @time   :2025/11/4 14:37
 */

namespace App\Http\Logic\Bside\Ai;

use App\Http\Logic\Bside\BaseLogic;
use App\Models\Ai\AiBlogKeyword;

class AiBlogKeywordLogic extends BaseLogic
{

    public function __construct()
    {
        parent::__construct();
        $this->param = $this->requestAll;
        $this->model = new AiBlogKeyword();
    }

    /**
     * @remark :获取当前详情
     * @name   :getKeywordInfo
     * @author :lyh
     * @method :post
     * @time   :2025/11/4 14:39
     */
    public function getKeywordInfo()
    {
        $data = $this->model->read(['project_id'=>$this->user['project_id']]);
        return $this->success($data);
    }

    /**
     * @remark :
     * @name   :saveKeyword
     * @author :lyh
     * @method :post
     * @time   :2025/11/4 14:52
     */
    public function saveKeyword()
    {
        $data = $this->model->read(['project_id'=>$this->user['project_id']]);
        if($data !== false){
            $id = $data['id'];
            $this->model->edit($this->param,['id'=>$id]);
        }else{
            $this->param['project_id'] = $this->user['project_id'];
            $id = $this->model->addReturnId($this->param);
        }
        return $this->success(['id'=>$id]);
    }
}