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.
97 lines
2.2 KiB
97 lines
2.2 KiB
<?php
|
|
namespace app\admin\controller;
|
|
use app\Rest;
|
|
use think\App;
|
|
use app\admin\model\Coupon as CouponModel;
|
|
use app\admin\model\ShopType;
|
|
use app\admin\model\Goods;
|
|
class Coupon extends Rest
|
|
{
|
|
|
|
protected $model;
|
|
public function __construct(App $app) {
|
|
parent::__construct($app);
|
|
$this->model = new CouponModel();
|
|
}
|
|
/**
|
|
* 获取福包列表
|
|
*/
|
|
public function couponList(){
|
|
$page = $this->_input['page'];
|
|
$name = $this->_input['name'];
|
|
$dis['uniacid'] = $this->_uniacid;
|
|
$dis['status'] = ['>',-1];
|
|
if(!empty($name)){
|
|
$dis['title'] = ['like',"%$name%"];
|
|
}
|
|
$data = $this->model->couponList($dis,$page);
|
|
$this->success($data);
|
|
}
|
|
|
|
|
|
/**
|
|
* 修改福包
|
|
*/
|
|
public function couponUpdate(){
|
|
$dis = ['id'=>$this->_input['id']];
|
|
$res = $this->model->couponUpdate($dis,$this->_input);
|
|
$this->success($res);
|
|
}
|
|
|
|
/**
|
|
* 添加福包
|
|
*/
|
|
public function couponsAdd(){
|
|
$this->_input['uniacid'] = $this->_uniacid;
|
|
$res = $this->model->couponAdd($this->_input);
|
|
$this->success($res);
|
|
}
|
|
|
|
/**
|
|
* 软删除福包
|
|
*/
|
|
public function couponDel(){
|
|
$dis['id'] = $this->_input['id'];
|
|
$data['status'] = -1;
|
|
$res = $this->model->couponUpdate($dis,$data);
|
|
$this->success($res);
|
|
}
|
|
|
|
/**
|
|
* 获取福包详情
|
|
*
|
|
*/
|
|
public function couponsInfo(){
|
|
$dis = ['id'=>$this->_input['id']];
|
|
$res = $this->model->couponInfo($dis);
|
|
$this->success($res);
|
|
}
|
|
|
|
/**
|
|
*
|
|
*获取所有分类
|
|
*/
|
|
public function getCate(){
|
|
$cateModel = new ShopType();
|
|
$dis['uniacid'] = $this->_uniacid;
|
|
$dis['status'] = 1;
|
|
$data = $cateModel->catSortSelect($dis);
|
|
$this->success($data);
|
|
}
|
|
|
|
/**
|
|
* 获取限用的商品
|
|
*/
|
|
public function getGoods(){
|
|
$goodsModel = new Goods();
|
|
$dis['uniacid'] = $this->_uniacid;
|
|
$dis['status'] = 1;
|
|
$data = $goodsModel->goodsSelect($dis);
|
|
$this->success($data);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|