$user->level]; } public function uploadFiveImage(Request $request){ // $path_url = 'public/audit/' . date("ymd"); // $path = $request->file('img')->store($path_url); $file=$request->file('img'); $config = [ 'driver' => 'qiniu', 'domain' => 'http://image.chuliu.cc', //七牛域名 'access_key' => 'cIbo9JAqHBgO6uw97gT5fJOlEHiTiGrpB84unVEn', //AccessKey 'secret_key' => '4f0nTNNrvzOsFc6Rz0GC5DntiJRnk2GcfkyJFNQp', //SecretKey 'bucket' => 'daweiboshi-app', //Bucket名字 'dirname'=> 'daweiboshi-app' ]; $auth = new Auths($config['access_key'], $config['secret_key']); $token = $auth->uploadToken($config['bucket']); $filePath = $file->getRealPath(); $filename =date('His') . uniqid(mt_rand(10000,99999)) .'.jpg'; $dirname=$config['dirname']; $uploadMgr = new UploadManager(); $pathname= $dirname.'/audit/'.date('Ymd').'/'.$filename; try{ $uploadMgr->putFile($token, $pathname, $filePath); }catch(\Exception $e){ return $this->error('450001','','上传失败'); } $url = $config['domain'].'/'.$pathname; if ($url) { // $url = Storage::url($path); return $this->success($url); } else { return $this->error(); } } /* * 用户确认审核通过,并生成授权码 * */ public function user_cert(){ $user=Auth::user(); $user->cert_status=6; $user->save(); return $this->success([]); } public function user_certs($id){ $phone=User::where('id',$id)->value('mobile'); $code=auth_code($phone); $re=User::where('auth_code',$code)->first(); if ($re){ $code=$this->user_certs(); return $code; } return $code; } }