UpdateController.php 2.9 KB
<?php
/**
 * @remark :
 * @name   :UpdateController.php
 * @author :lyh
 * @method :post
 * @time   :2023/8/19 9:08
 */

namespace App\Http\Controllers\Bside\BCom;

use App\Helper\Common;
use App\Http\Controllers\Bside\BaseController;
use App\Models\Blog\Blog;
use App\Models\News\News;
use App\Models\Product\Product;

/**
 * @remark :b端网站更新相关
 * @name   :UpdateController
 * @author :lyh
 * @method :post
 * @time   :2023/8/19 9:08
 */
class UpdateController extends BaseController
{
    /**
     * @remark :一键更新所有tdk
     * @name   :updateSeoTdk
     * @author :lyh
     * @method :post
     * @time   :2023/8/19 9:25
     */
    public function updateSeoTdk(){

    }

    /**
     * @remark :更新产品tdk
     * @name   :updateProduct
     * @author :lyh
     * @method :post
     * @time   :2023/8/19 9:25
     */
    public function updateProduct(){
        $productModel = new Product();
        $list = $productModel->list(['status'=>Product::STATUS_ON,'project_id'=>$this->user['project_id'],'deleted_at'=>null]);
        if(!empty($list)){
            foreach ($list as $k => $v){
                if(!empty($v['seo_mate'])){
                    $seo_arr = json_decode($v['seo_mate']);
                    //更新seo_title
                    if(!isset($seo_arr['title'])){
                        //生成seo_title
                        $seo_arr['title'] = Com;
                    }
                    //更新seo_keyword
                    if(!isset($seo_arr['keyword'])){
                        $seo_arr['keyword'] = 1;
                    }
                    //更新seo_keyword
                    if(!isset($seo_arr['description'])){
                        $seo_arr['description'] = 1;
                    }
                }
            }
        }
    }

    /**
     * @remark :更新新闻Tdk
     * @name   :updateNews
     * @author :lyh
     * @method :post
     * @time   :2023/8/19 10:06
     */
    public function updateNews(){
        $newsModel = new News();
        $list = $newsModel->list(['status'=>$newsModel::STATUS_ONE]);
        if(!empty($list)){
            foreach ($list as $k => $v){

            }
        }
    }

    /**
     * @remark :更新blogTdk
     * @name   :updateBlogs
     * @author :lyh
     * @method :post
     * @time   :2023/8/19 10:07
     */
    public function updateBlogs(){
        $blogModel = new Blog();
        $list = $blogModel->list(['status'=>$blogModel::STATUS_ONE]);
        if(!empty($list)){
            foreach ($list as $k => $v){

            }
        }
    }

    /**
     * @remark :AI发送
     * @name   :ai_send
     * @author :lyh
     * @method :post
     * @time   :2023/8/19 10:40
     */
    public function ai_send($key,$keywords){
        $chat_url = 'v2/openai_chat';
        $param = [
            'key'=>$key,
            'keywords'=>$keywords,
        ];
        $data = Common::send_openai_msg($chat_url,$param);

    }
}