124 lines
3.3 KiB
PHP
124 lines
3.3 KiB
PHP
<?php
|
|
namespace app\admin\controller;
|
|
use think\facade\Url;
|
|
use app\admin\logic\PointsLogic;
|
|
|
|
class Points extends AdminBase
|
|
{
|
|
|
|
/**
|
|
* 积分商品的列表
|
|
* @return mixed
|
|
*/
|
|
public function lists(){
|
|
if ($this->request->isAjax()) {
|
|
$get = $this->request->get();
|
|
$this->_success('获取成功', PointsLogic::lists($get));
|
|
}
|
|
return $this->fetch();
|
|
}
|
|
/**
|
|
* 增加积分商城商品
|
|
* @return mixed
|
|
*/
|
|
|
|
public function add(){
|
|
if ($this->request->isAjax()) {
|
|
$post = $this->request->post();
|
|
$data=PointsLogic::add($post);
|
|
if($data){
|
|
$this->_success('增加商品成功');
|
|
}else{
|
|
$this->_error('增加失败');
|
|
}
|
|
|
|
}
|
|
|
|
$this->assign('brand_lists', json_encode(PointsLogic::typelist(), JSON_UNESCAPED_UNICODE));
|
|
return $this->fetch();
|
|
}
|
|
|
|
/**
|
|
* 编辑积分商城商品
|
|
* @return mixed
|
|
*/
|
|
public function edit(){
|
|
if ($this->request->isAjax()) {
|
|
$post = $this->request->post();
|
|
$data=PointsLogic::edit($post);
|
|
$this->_success('修改成功');
|
|
}
|
|
$id = $this->request->get('id');
|
|
$this->assign('info', json_encode(PointsLogic::info($id), JSON_UNESCAPED_UNICODE));
|
|
$this->assign('brand_lists', json_encode(PointsLogic::typelist(), JSON_UNESCAPED_UNICODE));
|
|
return $this->fetch();
|
|
}
|
|
/**
|
|
* 删除积分商品
|
|
* @return mixed
|
|
*/
|
|
public function del(){
|
|
$id = $this->request->post('id');
|
|
$del=PointsLogic::del($id);
|
|
$this->_success('删除成功');
|
|
}
|
|
|
|
/**
|
|
* 积分商品的分类
|
|
* @return mixed
|
|
*/
|
|
|
|
public function type(){
|
|
if ($this->request->isAjax()) {
|
|
$get = $this->request->get();
|
|
$this->_success('获取成功', PointsLogic::type($get));
|
|
}
|
|
return $this->fetch();
|
|
}
|
|
/**
|
|
* 增加积分商品的分类
|
|
* @return mixed
|
|
*/
|
|
public function typeadd(){
|
|
if ($this->request->isAjax()) {
|
|
$post = $this->request->post();
|
|
$post['create_time']=time();
|
|
$data=PointsLogic::typeadd($post);
|
|
if($data){
|
|
$this->_success('增加分类成功');
|
|
}else{
|
|
$this->_error('增加失败');
|
|
}
|
|
}
|
|
return $this->fetch();
|
|
}
|
|
/**
|
|
* 修改商品的分类
|
|
* @return mixed
|
|
*/
|
|
public function typeedit(){
|
|
if ($this->request->isAjax()) {
|
|
$post = $this->request->post();
|
|
$data=PointsLogic::typeedit($post);
|
|
if($data){
|
|
$this->_success('增加分类成功');
|
|
}else{
|
|
$this->_error('增加失败');
|
|
}
|
|
}
|
|
$id = $this->request->get('id');
|
|
$this->assign('detail',PointsLogic::typeinfo($id));
|
|
return $this->fetch();
|
|
}
|
|
/**
|
|
* 修改分类名称
|
|
* @return mixed
|
|
*/
|
|
public function typedel(){
|
|
$id = $this->request->post('id');
|
|
$del=PointsLogic::typedel($id);
|
|
$this->_success('删除成功');
|
|
}
|
|
|
|
|
|
} |