25 lines
710 B
PHP
25 lines
710 B
PHP
|
<?php
|
||
|
declare (strict_types=1);
|
||
|
|
||
|
namespace app\front;
|
||
|
|
||
|
use app\model\Product;
|
||
|
use app\service\ProductService;
|
||
|
|
||
|
/**
|
||
|
* @author canny
|
||
|
* @date 2024/3/8 9:23
|
||
|
**/
|
||
|
class Index extends Base
|
||
|
{
|
||
|
public function homeData(): \think\Response
|
||
|
{
|
||
|
$productService = app()->make(ProductService::class);
|
||
|
$fields = ['id', 'name', 'cover_image', 'face_amount', 'price', 'type', 'tag', 'sale_num', 'description'];
|
||
|
$data = [
|
||
|
'baoYueProduct' => $productService->getInfoByWhere(['type' => Product::PRODUCT_TYPE_BAO_YUE]),
|
||
|
'product' => $productService->getLists(['type' => Product::PRODUCT_TYPE_NORMAL], $fields, 'sort desc')
|
||
|
];
|
||
|
return responseOk($data);
|
||
|
}
|
||
|
}
|