123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118 |
- <?php
-
- namespace app\admin\controller\integral;
-
- use app\admin\logic\integral\IntegralGoodsLogic;
- use app\admin\validate\integral\IntegralGoodsValidate;
- use app\common\basics\AdminBase;
- use app\common\server\JsonServer;
-
-
- class IntegralGoods extends AdminBase
- {
-
-
-
- public function lists()
- {
- if ($this->request->isAjax()) {
- $get = $this->request->get();
- $lists = IntegralGoodsLogic::getLists($get);
- return JsonServer::success('获取成功', $lists);
- }
- return view();
- }
-
-
-
-
- public function add()
- {
- if ($this->request->isAjax()) {
- $post = $this->request->post();
- $post['status'] = isset($post['status']) && $post['status'] == 'on' ? 1 : 0;
- (new IntegralGoodsValidate())->goCheck('add', $post);
- $res = IntegralGoodsLogic::add($post);
- if (false === $res) {
- $error = IntegralGoodsLogic::getError() ?: '操作失败';
- return JsonServer::error($error);
- }
- return JsonServer::success('操作成功');
- }
- return view();
- }
-
-
-
-
- public function edit()
- {
- if ($this->request->isAjax()) {
- $post = $this->request->post();
- $post['status'] = isset($post['status']) && $post['status'] == 'on' ? 1 : 0;
- (new IntegralGoodsValidate())->goCheck('edit', $post);
- $res = IntegralGoodsLogic::edit($post);
- if (false === $res) {
- $error = IntegralGoodsLogic::getError() ?: '操作失败';
- return JsonServer::error($error);
- }
- return JsonServer::success('操作成功');
- }
- $id = $this->request->get('id');
- return view('', [
- 'detail' => IntegralGoodsLogic::detail($id),
- ]);
- }
-
-
-
-
- public function del()
- {
- if ($this->request->isAjax()) {
- $post = $this->request->post();
- (new IntegralGoodsValidate())->goCheck('del');
- IntegralGoodsLogic::del($post);
- return JsonServer::success('操作成功');
- }
- return JsonServer::error('操作失败');
- }
-
-
-
-
- public function switchStatus()
- {
- if ($this->request->isAjax()) {
- $post = $this->request->post();
- IntegralGoodsLogic::switchStatus($post);
- return JsonServer::success('操作成功');
- }
- return JsonServer::error('操作失败');
- }
-
- }
|