UserApply.php 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102
  1. <?php
  2. namespace app\admin\controller\user;
  3. use app\admin\controller\AuthController;
  4. use crmeb\services\{FormBuilder as Form, UtilService as Util, JsonService as Json};
  5. use crmeb\services\JsonService;
  6. use think\facade\Route as Url;
  7. use app\admin\model\user\UserNotice as UserNoticeModel;
  8. use app\admin\model\user\UserNoticeSee as UserNoticeSeeModel;
  9. use app\admin\model\wechat\WechatUser as UserModel;
  10. Use app\admin\model\user\UserApply as model;
  11. /**
  12. * 用户通知
  13. * Class UserNotice
  14. * @package app\admin\controller\user
  15. */
  16. class UserApply extends AuthController
  17. {
  18. /**
  19. * 显示资源列表
  20. *
  21. * @return \think\Response
  22. */
  23. public function index($type)
  24. {
  25. $this->assign('type', $type);
  26. return $this->fetch();
  27. }
  28. public function indexs($type)
  29. {
  30. $this->assign('type', $type);
  31. return $this->fetch();
  32. }
  33. public function list()
  34. {
  35. $where = Util::getMore([
  36. ['status', ''],
  37. ['page', 1],
  38. ['limit', 20],
  39. ['name', ''],
  40. ['type', ''],
  41. ['status', ''],
  42. ]);
  43. return Json::successlayui(model::list($where));
  44. }
  45. public function tg($id,$type)
  46. {
  47. $data = model::find($id);
  48. if (!$data) return Json::fail('数据不存在');
  49. if ($data['status'] != 0) return Json::fail('已审核完成');
  50. $data['status'] = 1;
  51. //老师
  52. if ($type == 1){
  53. $res = \app\admin\model\user\User::where('uid', $data['uid'])->update(['alliance' => 1]) && $data->save();
  54. }elseif($type == 2) {
  55. // 点击
  56. $res = \app\admin\model\user\User::where('uid', $data['uid'])->update(['shopkeeper' => 1]) && $data->save();
  57. }
  58. if ($res) return Json::successful('成功');
  59. return Json::fail('失败');
  60. }
  61. public function btg($id)
  62. {
  63. $data = model::find($id);
  64. if (!$data) return Json::fail('数据不存在');
  65. if ($data['status'] != 0) return Json::fail('已审核完成');
  66. $data['status'] = -1;
  67. $res = $data->save();
  68. if ($res) return Json::successful('成功');
  69. return Json::fail('失败');
  70. }
  71. /**
  72. * 删除指定资源
  73. *
  74. * @param int $id
  75. * @return \think\Response
  76. */
  77. public function delete($id)
  78. {
  79. if (!model::del($id))
  80. return Json::fail(UserNoticeModel::getErrorInfo('删除失败,请稍候再试!'));
  81. else
  82. return Json::successful('删除成功!');
  83. }
  84. }