|
|
@ -12,9 +12,13 @@ declare (strict_types=1); |
|
|
|
|
|
|
|
|
|
|
|
namespace app\api\controller; |
|
|
|
namespace app\api\controller; |
|
|
|
|
|
|
|
|
|
|
|
use think\response\Json; |
|
|
|
|
|
|
|
use app\api\model\Coupon as CouponModel; |
|
|
|
use app\api\model\Coupon as CouponModel; |
|
|
|
|
|
|
|
use app\common\enum\coupon\TypeCase; |
|
|
|
use cores\exception\BaseException; |
|
|
|
use cores\exception\BaseException; |
|
|
|
|
|
|
|
use think\db\exception\DataNotFoundException; |
|
|
|
|
|
|
|
use think\db\exception\DbException; |
|
|
|
|
|
|
|
use think\db\exception\ModelNotFoundException; |
|
|
|
|
|
|
|
use think\response\Json; |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* 优惠券中心 |
|
|
|
* 优惠券中心 |
|
|
@ -24,17 +28,33 @@ use cores\exception\BaseException; |
|
|
|
class Coupon extends Controller |
|
|
|
class Coupon extends Controller |
|
|
|
{ |
|
|
|
{ |
|
|
|
/** |
|
|
|
/** |
|
|
|
* 优惠券列表 |
|
|
|
* 优惠券列表-商品 |
|
|
|
* @return Json |
|
|
|
* @return Json |
|
|
|
* @throws BaseException |
|
|
|
* @throws BaseException |
|
|
|
* @throws \think\db\exception\DataNotFoundException |
|
|
|
* @throws DataNotFoundException |
|
|
|
* @throws \think\db\exception\DbException |
|
|
|
* @throws DbException |
|
|
|
* @throws \think\db\exception\ModelNotFoundException |
|
|
|
* @throws ModelNotFoundException |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
public function list(): Json |
|
|
|
public function list(): Json |
|
|
|
{ |
|
|
|
{ |
|
|
|
$model = new CouponModel; |
|
|
|
$model = new CouponModel; |
|
|
|
$list = $model->getList(); |
|
|
|
$list = $model->getList(null, false, ['coupon_case' => TypeCase::SHOP]); |
|
|
|
|
|
|
|
return $this->renderSuccess(compact('list')); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
|
|
|
* @notes:优惠券列表-服务 |
|
|
|
|
|
|
|
* @return Json |
|
|
|
|
|
|
|
* @throws BaseException |
|
|
|
|
|
|
|
* @throws DataNotFoundException |
|
|
|
|
|
|
|
* @throws DbException |
|
|
|
|
|
|
|
* @throws ModelNotFoundException |
|
|
|
|
|
|
|
* @author: wanghousheng |
|
|
|
|
|
|
|
*/ |
|
|
|
|
|
|
|
public function server(): Json |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
$model = new CouponModel; |
|
|
|
|
|
|
|
$list = $model->getList(null, false, ['coupon_case' => TypeCase::SERVER]); |
|
|
|
return $this->renderSuccess(compact('list')); |
|
|
|
return $this->renderSuccess(compact('list')); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |