Subscribe.php 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  1. <?php
  2. // +----------------------------------------------------------------------
  3. // | A3Mall
  4. // +----------------------------------------------------------------------
  5. // | Copyright (c) 2020 http://www.a3-mall.com All rights reserved.
  6. // +----------------------------------------------------------------------
  7. // | Author: xzncit <158373108@qq.com>
  8. // +----------------------------------------------------------------------
  9. namespace app\admin\controller\wechat;
  10. use app\admin\controller\Auth;
  11. use mall\response\Response;
  12. use think\facade\Request;
  13. use think\facade\View;
  14. use app\admin\service\wechat\Subscribe as SubscribeService;
  15. class Subscribe extends Auth {
  16. /**
  17. * 列表
  18. * @return string|\think\response\Json
  19. * @throws \think\db\exception\DataNotFoundException
  20. * @throws \think\db\exception\DbException
  21. * @throws \think\db\exception\ModelNotFoundException
  22. */
  23. public function index(){
  24. if(Request::isAjax()){
  25. $list = SubscribeService::getList(Request::param(),["type"=>0]);
  26. return Response::returnArray("ok",0,$list['data'],$list['count']);
  27. }
  28. return View::fetch();
  29. }
  30. /**
  31. * 编辑
  32. * @return string|\think\response\Json
  33. */
  34. public function editor(){
  35. try{
  36. if(Request::isAjax()){
  37. $data = Request::param();
  38. $data["type"] = 0;
  39. SubscribeService::save($data);
  40. return Response::returnArray("操作成功!");
  41. }
  42. return View::fetch("",SubscribeService::detail(Request::param("id")));
  43. }catch (\Exception $ex){
  44. return Response::returnArray($ex->getMessage(),0);
  45. }
  46. }
  47. /**
  48. * 删除
  49. * @return \think\response\Json
  50. */
  51. public function delete(){
  52. try {
  53. SubscribeService::delete(Request::get("id",0,"intval"));
  54. return Response::returnArray("删除成功");
  55. } catch (\Exception $ex) {
  56. return Response::returnArray("操作失败,请稍候在试。",0);
  57. }
  58. }
  59. }