You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
yanzong/app/api/controller/Coupon.php

60 lines
2.0 KiB

11 months ago
<?php
// +----------------------------------------------------------------------
// | 萤火商城系统 [ 致力于通过产品和服务,帮助商家高效化开拓市场 ]
// +----------------------------------------------------------------------
// | Copyright (c) 2017~2023 https://www.yiovo.com All rights reserved.
// +----------------------------------------------------------------------
// | Licensed 这不是一个自由软件,不允许对程序代码以任何形式任何目的的再发行
// +----------------------------------------------------------------------
// | Author: 萤火科技 <admin@yiovo.com>
// +----------------------------------------------------------------------
declare (strict_types=1);
namespace app\api\controller;
use app\api\model\Coupon as CouponModel;
11 months ago
use app\common\enum\coupon\TypeCase;
11 months ago
use cores\exception\BaseException;
11 months ago
use think\db\exception\DataNotFoundException;
use think\db\exception\DbException;
use think\db\exception\ModelNotFoundException;
use think\response\Json;
11 months ago
/**
* 优惠券中心
* Class Coupon
* @package app\api\controller
*/
class Coupon extends Controller
{
/**
11 months ago
* 优惠券列表-商品
11 months ago
* @return Json
* @throws BaseException
11 months ago
* @throws DataNotFoundException
* @throws DbException
* @throws ModelNotFoundException
11 months ago
*/
public function list(): Json
{
$model = new CouponModel;
11 months ago
$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]);
11 months ago
return $this->renderSuccess(compact('list'));
}
}