Close.php 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  1. <?php
  2. /**
  3. *
  4. * @author: xaboy<365615158@qq.com>
  5. * @day: 2017/11/11
  6. */
  7. namespace app\admin\controller\user;
  8. use app\admin\controller\AuthController;
  9. use crmeb\services\{ExpressService,
  10. JsonService,
  11. JsonService as Json,
  12. MiniProgramService,
  13. WechatService,
  14. FormBuilder as Form,
  15. CacheService,
  16. UtilService as Util};
  17. use think\facade\Route as Url;
  18. use think\facade\Validate;
  19. Use app\admin\model\user\Close as model;
  20. /**
  21. * 订单管理控制器 同一个订单表放在一个控制器
  22. * Class StoreOrder
  23. * @package app\admin\controller\store
  24. */
  25. class Close extends AuthController
  26. {
  27. /**
  28. * @return mixed
  29. */
  30. public function index()
  31. {
  32. $this->assign([
  33. 'year' => get_month(),
  34. ]);
  35. return $this->fetch();
  36. }
  37. public function list()
  38. {
  39. $where = Util::getMore([
  40. ['page', 1],
  41. ['limit', 20],
  42. ['name', ''],
  43. ['data', ''],
  44. ]);
  45. return Json::successlayui(model::list($where));
  46. }
  47. /**
  48. * 删除
  49. * @param $id
  50. * @return void
  51. * @throws \Exception
  52. */
  53. public function delete($id)
  54. {
  55. if (!$id) Json::fail('删除失败');
  56. $model = new model;
  57. $res = model::destroy($id);
  58. if ($res){
  59. return Json::success('删除成功!');
  60. }else{
  61. return Json::fail($model->getErrorInfo());
  62. }
  63. }
  64. }