|
|
|
@ -18,6 +18,7 @@ use app\common\model\GoodsImage as GoodsImageModel; |
|
|
|
|
use app\common\model\UploadFile as UploadFileModel; |
|
|
|
|
use app\common\service\qrcode\Goods as GoodsPoster; |
|
|
|
|
use cores\exception\BaseException; |
|
|
|
|
use think\db\exception\DbException; |
|
|
|
|
use think\response\Json; |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
@ -30,15 +31,13 @@ class Goods extends Controller |
|
|
|
|
/** |
|
|
|
|
* 商品列表 |
|
|
|
|
* @return Json |
|
|
|
|
* @throws \think\db\exception\DbException |
|
|
|
|
* @throws DbException |
|
|
|
|
*/ |
|
|
|
|
public function list(): Json |
|
|
|
|
{ |
|
|
|
|
// 获取列表数据 |
|
|
|
|
$model = new GoodsModel; |
|
|
|
|
$storeid = request()->header()['storeid']; |
|
|
|
|
$param = $this->request->param(); |
|
|
|
|
$param['store_id'] = $storeid; |
|
|
|
|
$list = $model->getList($param); |
|
|
|
|
return $this->renderSuccess(compact('list')); |
|
|
|
|
} |
|
|
|
@ -49,16 +48,13 @@ class Goods extends Controller |
|
|
|
|
* @param bool $verifyStatus 是否验证商品状态(上架) |
|
|
|
|
* @return Json |
|
|
|
|
* @throws \think\db\exception\DataNotFoundException |
|
|
|
|
* @throws \think\db\exception\DbException |
|
|
|
|
* @throws DbException |
|
|
|
|
* @throws \think\db\exception\ModelNotFoundException |
|
|
|
|
* @throws BaseException |
|
|
|
|
*/ |
|
|
|
|
public function detail(int $goodsId, bool $verifyStatus = true): Json |
|
|
|
|
{ |
|
|
|
|
// wmc商品详情 |
|
|
|
|
$storeid = request()->header()['storeid']; |
|
|
|
|
$param = $this->request->param(); |
|
|
|
|
$param['store_id'] = $storeid; |
|
|
|
|
$model = new GoodsModel; |
|
|
|
|
$goodsInfo = $model->getDetails($goodsId, $verifyStatus); |
|
|
|
|
if (!empty($goodsInfo['content'])) { |
|
|
|
@ -163,7 +159,7 @@ class Goods extends Controller |
|
|
|
|
* @param int $goodsId |
|
|
|
|
* @return Json |
|
|
|
|
* @throws \think\db\exception\DataNotFoundException |
|
|
|
|
* @throws \think\db\exception\DbException |
|
|
|
|
* @throws DbException |
|
|
|
|
* @throws \think\db\exception\ModelNotFoundException |
|
|
|
|
*/ |
|
|
|
|
public function specData(int $goodsId): Json |
|
|
|
@ -190,7 +186,7 @@ class Goods extends Controller |
|
|
|
|
* 推荐的商品列表 |
|
|
|
|
* @return Json |
|
|
|
|
* @throws \think\db\exception\DataNotFoundException |
|
|
|
|
* @throws \think\db\exception\DbException |
|
|
|
|
* @throws DbException |
|
|
|
|
* @throws \think\db\exception\ModelNotFoundException |
|
|
|
|
*/ |
|
|
|
|
public function recommended(): Json |
|
|
|
@ -289,7 +285,7 @@ class Goods extends Controller |
|
|
|
|
* @param string $channel 二维码渠道(小程序码、h5码) |
|
|
|
|
* @throws BaseException |
|
|
|
|
* @throws \think\db\exception\DataNotFoundException |
|
|
|
|
* @throws \think\db\exception\DbException |
|
|
|
|
* @throws DbException |
|
|
|
|
* @throws \think\db\exception\ModelNotFoundException |
|
|
|
|
*/ |
|
|
|
|
public function poster(int $goodsId, string $channel = 'H5'): Json |
|
|
|
|