UserAuth.php 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111
  1. <?php
  2. namespace app\admin\controller\user;
  3. use app\admin\controller\AuthController;
  4. use think\facade\Route as Url;
  5. use crmeb\traits\CurdControllerTrait;
  6. use app\admin\model\user\User as UserModel;
  7. use app\admin\model\user\UserBill as UserBillAdmin;
  8. use app\admin\model\system\{SystemUserLevel,SystemUserTask};
  9. use crmeb\services\{UtilService,JsonService,FormBuilder as Form};
  10. /**
  11. * 会员设置
  12. * Class UserLevel
  13. * @package app\admin\controller\user
  14. */
  15. class UserAuth extends AuthController
  16. {
  17. use CurdControllerTrait;
  18. /*
  19. * 审核展示
  20. * */
  21. public function index()
  22. {
  23. return $this->fetch();
  24. }
  25. /*
  26. * 创建form表单
  27. * */
  28. public function create($uid =0)
  29. {
  30. if ($uid) $vipinfo = UserModel::get($uid);
  31. $field[] = Form::input('off', '拒绝理由', isset($vipinfo) ? $vipinfo->off: '')->col(Form::col(24));
  32. $form = Form::make_post_form('添加拒绝理由', $field, Url::buildUrl('save', ['uid' => $uid]), 2);
  33. $this->assign(compact('form'));
  34. return $this->fetch('public/form-builder');
  35. }
  36. /*
  37. * 审核/拒绝
  38. * @param $uid 审核的用户uid
  39. * @return json
  40. * */
  41. public function save($uid = 0)
  42. {
  43. $data = UtilService::postMore([
  44. ['off', ''],
  45. ]);
  46. if (!$data['off']) return JsonService::fail('请输入拒绝理由');
  47. if($data['off']){
  48. // 查询是否已审核
  49. $res1=UserModel::where(['uid' => $uid])->find();
  50. if($res1['is_auth']==2||$res1['is_auth']==3){
  51. return JsonService::fail('该信息已审核!不可操作');
  52. }
  53. $res=UserModel::where(['uid' => $uid])->update(['off' =>$data['off'],'is_auth'=>"3"]);
  54. if($res>0){
  55. return JsonService::successful('审核成功');
  56. }else{
  57. return JsonService::fail('该信息已审核!不可重复');
  58. }
  59. }
  60. }
  61. /*
  62. * 审核通过
  63. * @param int $id
  64. * */
  65. public function pass($uid = 0){
  66. if($uid){
  67. // 查询是否已审核
  68. $res1=UserModel::where(['uid' => $uid])->find();
  69. if($res1['is_auth']==2||$res1['is_auth']==3){
  70. return JsonService::fail('该信息已审核!不可操作');
  71. }
  72. $res=UserModel::where(['uid' => $uid])->update(['is_auth' =>2,'off'=>"", 'is_new' => 1]);
  73. if($res>0){
  74. // 添加积分充值记录
  75. // $res2=UserBillAdmin::income('实名认证赠送',$uid, 'integral', 'top_add', 3000, 0, 3000, '首次实名赠送(竞拍消费满30000释放)');
  76. return JsonService::successful('审核成功');
  77. }else{
  78. return JsonService::fail('审核失败');
  79. }
  80. }else{
  81. return JsonService::fail('参数错误!');
  82. }
  83. }
  84. /*
  85. * 获取列表
  86. * @param int page
  87. * @param int limit
  88. * */
  89. public function get_system_user_list()
  90. {
  91. $where =UtilService::getMore([
  92. ['page', 1],
  93. ['limit', 20],
  94. ['is_auth','<>',0]
  95. ]);
  96. return JsonService::successlayui(UserModel::authlist($where));
  97. }
  98. }