53 lines
1.1 KiB
PHP
53 lines
1.1 KiB
PHP
|
|
<?php
|
|||
|
|
|
|||
|
|
namespace App\Http\Controllers\Wx;
|
|||
|
|
|
|||
|
|
use App\BaseApp\BaseController;
|
|||
|
|
use App\Service\wx\WxHomeService;
|
|||
|
|
use App\Service\wx\WxProductService;
|
|||
|
|
use Illuminate\Http\JsonResponse;
|
|||
|
|
|
|||
|
|
/**
|
|||
|
|
* 小程序商品
|
|||
|
|
*/
|
|||
|
|
class ProductController extends BaseController
|
|||
|
|
{
|
|||
|
|
protected array $exceptRoute = ['option', 'create', 'update', 'delete'];
|
|||
|
|
|
|||
|
|
public function __construct()
|
|||
|
|
{
|
|||
|
|
parent::__construct();
|
|||
|
|
$this->service = WxProductService::getInstance();
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
/**
|
|||
|
|
* 商品列表
|
|||
|
|
* @Method GET
|
|||
|
|
*/
|
|||
|
|
public function list(): JsonResponse
|
|||
|
|
{
|
|||
|
|
return jok($this->service->list());
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
/**
|
|||
|
|
* 商品详情,p_user_id 为代理商分享来源
|
|||
|
|
* @Method GET
|
|||
|
|
*/
|
|||
|
|
public function detail(): JsonResponse
|
|||
|
|
{
|
|||
|
|
return jok($this->service->detail(
|
|||
|
|
(int) request()->get('id', 0),
|
|||
|
|
(int) request()->get('p_user_id', 0)
|
|||
|
|
));
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
/**
|
|||
|
|
* 按父级取分类
|
|||
|
|
* @Method GET
|
|||
|
|
*/
|
|||
|
|
public function categoryListByPid(): JsonResponse
|
|||
|
|
{
|
|||
|
|
return jok(WxHomeService::getInstance()->categoryList((int) request()->get('pid', 0)));
|
|||
|
|
}
|
|||
|
|
}
|