AiProductLogic.php
1.6 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
<?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);
}
}