79 lines
2.0 KiB
PHP
79 lines
2.0 KiB
PHP
<?php
|
|
|
|
namespace app\admin\controller;
|
|
|
|
use app\admin\logic\goods\GoodsLogic;
|
|
use app\admin\logic\HotListLogic;
|
|
use app\common\basics\AdminBase;
|
|
use app\common\server\JsonServer;
|
|
use think\facade\Db;
|
|
use app\common\enum\GoodsEnum;
|
|
|
|
class HotList extends AdminBase
|
|
{
|
|
public function lists()
|
|
{
|
|
if ($this->request->isAjax()) {
|
|
$get = $this->request->get();
|
|
$lists = HotListLogic::lists($get);
|
|
return JsonServer::success('', $lists);
|
|
}
|
|
return view();
|
|
}
|
|
|
|
public function add()
|
|
{
|
|
if ($this->request->isAjax()) {
|
|
$form = $this->request->post();
|
|
$result = HotListLogic::create($form);
|
|
if ($result['code'] == 1) {
|
|
return JsonServer::success('添加成功');
|
|
}
|
|
return JsonServer::error($result['msg']);
|
|
}
|
|
return view('');
|
|
}
|
|
|
|
// 修改
|
|
public function audit()
|
|
{
|
|
if ($this->request->isAjax()) {
|
|
$post = $this->request->post();
|
|
$result = HotListLogic::edit($post);
|
|
if ($result['code'] == 1) {
|
|
return JsonServer::success('修改成功');
|
|
}
|
|
return JsonServer::error($result['msg']);
|
|
}
|
|
|
|
$id = $this->request->get('id');
|
|
return view('', [
|
|
'detail' => HotListLogic::detail($id)
|
|
]);
|
|
}
|
|
|
|
// 删除
|
|
public function del()
|
|
{
|
|
if ($this->request->isAjax()) {
|
|
$post = $this->request->post();
|
|
$result = HotListLogic::del($post['id']);
|
|
if ($result) {
|
|
return JsonServer::success('删除成功');
|
|
}
|
|
|
|
return JsonServer::error('删除失败');
|
|
}
|
|
}
|
|
|
|
// 选择商品
|
|
public function goods()
|
|
{
|
|
if ($this->request->isAjax()) {
|
|
$get = $this->request->get();
|
|
return JsonServer::success('', GoodsLogic::lists($get));
|
|
}
|
|
|
|
return view();
|
|
}
|
|
} |