Achievement.php 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384
  1. <?php
  2. namespace app\admin\controller\user;
  3. use app\admin\controller\AuthController;
  4. use app\admin\model\user\Ach;
  5. use crmeb\services\{FormBuilder as Form, UtilService as Util, JsonService as Json};
  6. use crmeb\services\JsonService;
  7. use think\facade\Route as Url;
  8. use app\admin\model\user\UserNotice as UserNoticeModel;
  9. use app\admin\model\user\UserNoticeSee as UserNoticeSeeModel;
  10. use app\admin\model\wechat\WechatUser as UserModel;
  11. Use app\admin\model\user\Achievement as model;
  12. /**
  13. * 用户通知
  14. * Class UserNotice
  15. * @package app\admin\controller\user
  16. */
  17. class Achievement extends AuthController
  18. {
  19. /**
  20. * 显示资源列表
  21. *
  22. * @return \think\Response
  23. */
  24. public function index($type)
  25. {
  26. $this->assign('type', $type);
  27. return $this->fetch();
  28. }
  29. public function list()
  30. {
  31. $where = Util::getMore([
  32. ['status', ''],
  33. ['page', 1],
  34. ['limit', 20],
  35. ['name', ''],
  36. ['status', ''],
  37. ['type', ''],
  38. ]);
  39. return Json::successlayui(model::list($where));
  40. }
  41. public function details($id)
  42. {
  43. $this->assign('id', $id);
  44. return $this->fetch();
  45. }
  46. public function details_list($id)
  47. {
  48. $where = Util::getMore([
  49. ['page', 1],
  50. ['limit', 20],
  51. ]);
  52. $list = Ach::where('a_id', $id)->page($where['page'], $where['limit'])->select();
  53. $data['data'] = count($list) > 0 ? $list->toArray() : [];
  54. $data['count'] = Ach::where('a_id', $id)->count();
  55. return Json::successlayui($data);
  56. }
  57. /**
  58. * 删除指定资源
  59. *
  60. * @param int $id
  61. * @return \think\Response
  62. */
  63. public function delete($id)
  64. {
  65. if (!model::del($id))
  66. return Json::fail(UserNoticeModel::getErrorInfo('删除失败,请稍候再试!'));
  67. else
  68. return Json::successful('删除成功!');
  69. }
  70. }