UserCard.php 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  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 Monolog\Handler\IFTTTHandler;
  18. use think\facade\Route as Url;
  19. use think\facade\Validate;
  20. Use app\admin\model\user\UserCard as model;
  21. /**
  22. * 订单管理控制器 同一个订单表放在一个控制器
  23. * Class StoreOrder
  24. * @package app\admin\controller\store
  25. */
  26. class UserCard extends AuthController
  27. {
  28. /**
  29. * @return mixed
  30. */
  31. public function index()
  32. {
  33. return $this->fetch();
  34. }
  35. public function list()
  36. {
  37. $where = Util::getMore([
  38. ['page', 1],
  39. ['limit', 20],
  40. ['name', ''],
  41. ['status', ''],
  42. ['use', ''],
  43. ]);
  44. return Json::successlayui(model::list($where));
  45. }
  46. /**
  47. * 删除
  48. * @param $id
  49. * @return void
  50. * @throws \Exception
  51. */
  52. public function delete($id)
  53. {
  54. if (!$id) return Json::fail('删除失败');
  55. $model = new model;
  56. $res = model::destroy($id);
  57. if ($res){
  58. return Json::success('删除成功!');
  59. }else{
  60. return Json::fail($model->getErrorInfo());
  61. }
  62. }
  63. }