123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115 |
- <?php
- namespace app\admin\controller\enterprise;
- use app\admin\controller\AuthController;
- use think\facade\Route as Url;
- use crmeb\traits\CurdControllerTrait;
- use app\admin\model\enterprise\EnterPriseUser as UserModel;
- use app\admin\model\user\UserBill as UserBillAdmin;
- use app\admin\model\system\SystemAdmin as Admin;
- use app\admin\model\system\{SystemUserLevel,SystemUserTask};
- use crmeb\services\{UtilService,JsonService,FormBuilder as Form};
- /**
- * 会员设置
- * Class UserLevel
- * @package app\admin\controller\user
- */
- class Auth extends AuthController
- {
- use CurdControllerTrait;
- /*
- * 审核展示
- * */
- public function index()
- {
- return $this->fetch();
- }
- /*
- * 创建form表单
- * */
- public function create($uid =0)
- {
- if ($uid) $vipinfo = UserModel::get($uid);
- $field[] = Form::input('off', '拒绝理由', isset($vipinfo) ? $vipinfo->off: '')->col(Form::col(24));
- $form = Form::make_post_form('添加拒绝理由', $field, Url::buildUrl('save', ['uid' => $uid]), 2);
- $this->assign(compact('form'));
- return $this->fetch('public/form-builder');
- }
- /*
- * 审核/拒绝
- * @param $uid 审核的用户uid
- * @return json
- * */
- public function save($uid = 0)
- {
- $data = UtilService::postMore([
- ['off', ''],
- ]);
- if (!$data['off']) return JsonService::fail('请输入拒绝理由');
- if($data['off']){
- // 查询是否已审核
- $res1=UserModel::where(['uid' => $uid])->find();
- if($res1['is_auth']==0||$res1['is_auth']==2){
- return JsonService::fail('该信息已审核!不可操作');
- }
- $res=UserModel::where(['uid' => $uid])->update(['reason' =>$data['off'],'is_auth'=>"0"]);
- if($res>0){
- return JsonService::successful('审核成功');
- }else{
- return JsonService::fail('该信息已审核!不可重复');
- }
- }
- }
-
- /*
- * 审核通过
- * @param int $id
- * */
- //9db06bcff9248837f86d1a6bcf41c9e75c5b46740f277f2c87dd023e960c5cfc
- public function pass($uid = 0,$id,$name){
- if($uid){
- // 查询是否已审核
- $res1=UserModel::where(['uid' => $uid])->find();
- if($res1['is_auth']==0||$res1['is_auth']==2){
- return JsonService::fail('该信息已审核!不可操作');
- }
- $res=UserModel::where(['uid' => $uid])->update(['is_auth' =>2,'reason'=>'审核通过']);
- if($res>0){
- // 取出用户名和密码放到后台管理员中
- $salt= substr(md5(rand(1, 999999)), 0, 6);
- $pwd= md5($res1['password'] . md5($salt));
- $data = ['account' =>$res1['user'], 'pwd' =>$pwd,'salt'=>$salt,'status'=>1,'mer_id'=>$id,'roles'=>7,'real_name'=>$name,'add_time'=>time(),'level'=>2];
- $rslut=Admin::insert($data);
- if($rslut){
- return JsonService::successful('审核成功');
- }
-
-
- }else{
- return JsonService::fail('审核失败');
- }
- }
- return JsonService::fail('参数错误!');
-
- }
- /*
- * 获取列表
- * @param int page
- * @param int limit
- * */
- public function get_system_user_list()
- {
- $where =UtilService::getMore([
- ['page', 1],
- ['limit', 20],
- ['is_auth',0]
- ]);
- return JsonService::successlayui(UserModel::authlist($where));
- }
-
- }
|