AiProductLogic.php 1.6 KB
<?php

namespace App\Http\Logic\Bside\Ai;

use App\Http\Logic\Bside\BaseLogic;
use App\Models\Ai\AiProduct;
use App\Models\Product\Category;
use App\Models\Product\Product;

class AiProductLogic extends BaseLogic
{
    public function __construct()
    {
        parent::__construct();
        $this->param = $this->requestAll;
        $this->model = new AiProduct();
    }

    /**
     * @remark :ai发布产品
     * @name   :productSave
     * @author :lyh
     * @method :post
     * @time   :2023/7/5 14:47
     */
    public function productSave(){
        $this->param['project_id'] = $this->user['project_id'];
        $rs = $this->model->add($this->param);
        if($rs === false){
            $this->fail('error');
        }
        return $this->success();
    }

    /**
     * @param $map
     * @remark :获取产品列表
     * @name   :productList
     * @author :lyh
     * @method :post
     * @time   :2023/7/5 15:08
     */
    public function productList($map){
        $map['project_id'] = $this->user['project_id'];
        $productModel = new Product();
        $list = $productModel->list($map,'created_at',['id','title','attrs','describe','project_id']);
        return $this->success($list);
    }

    /**
     * @remark :获取产品分类
     * @name   :productCateList
     * @author :lyh
     * @method :post
     * @time   :2023/7/5 15:09
     */
    public function productCateList($map){
        $map['project_id'] = $this->user['project_id'];
        $productCateModel = new Category();
        $list = $productCateModel->list($map,'created_at',['id','project_id','title']);
        return $this->success($list);
    }
}