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.
76 lines
2.2 KiB
76 lines
2.2 KiB
<?php
|
|
namespace app\admin\controller\user;
|
|
|
|
|
|
use app\admin\logic\user\ShipLogic;
|
|
use app\common\basics\AdminBase;
|
|
use app\common\server\ConfigServer;
|
|
use app\common\server\JsonServer;
|
|
use think\exception\ValidateException;
|
|
use app\admin\validate\user\LevelValidate;
|
|
use app\admin\logic\user\LevelLogic;
|
|
|
|
class Ship extends AdminBase
|
|
{
|
|
public function lists()
|
|
{
|
|
if($this->request->isAjax()){
|
|
$get = $this->request->get();
|
|
$lists = ShipLogic::lists($get);
|
|
return JsonServer::success('', $lists);
|
|
}
|
|
return view();
|
|
}
|
|
|
|
public function add()
|
|
{
|
|
if($this->request->isAjax()) {
|
|
$post = $this->request->post();
|
|
// try{
|
|
// $post = $this->request->post();
|
|
// validate(LevelValidate::class)->scene('add')->check($post);
|
|
// }catch(ValidateException $e) {
|
|
// return JsonServer::error($e->getError());
|
|
// }
|
|
$result = ShipLogic::add($post);
|
|
if($result === true) {
|
|
return JsonServer::success('添加成功');
|
|
}
|
|
return JsonServer::error(ShipLogic::getError());
|
|
}
|
|
return view();
|
|
}
|
|
|
|
public function edit(){
|
|
if($this->request->isAjax()){
|
|
$post = $this->request->post();
|
|
// try{
|
|
// validate(LevelValidate::class)->scene('edit')->check($post);
|
|
// }catch(ValidateException $e) {
|
|
// return JsonServer::error($e->getError());
|
|
// }
|
|
$result = ShipLogic::edit($post);
|
|
if($result === true) {
|
|
return JsonServer::success('编辑成功');
|
|
}
|
|
return JsonServer::error(ShipLogic::getError());
|
|
}
|
|
|
|
$id = $this->request->get('id', '', 'intval');
|
|
$detail = ShipLogic::detail($id);
|
|
return view('', [
|
|
'detail' => $detail
|
|
]);
|
|
}
|
|
|
|
public function del()
|
|
{
|
|
$id = $this->request->post('id', '', 'intval');
|
|
$result = ShipLogic::del($id);
|
|
if($result === true) {
|
|
return JsonServer::success('删除成功');
|
|
}
|
|
return JsonServer::error(ShipLogic::getError());
|
|
}
|
|
|
|
}
|