<?php
/*
 本代码由 口号帮 创建
 创建时间 2019-05-08 16:22:09
 技术支持 口号帮 
 严禁反编译、逆向等任何形式的侵权行为，违者将追究法律责任
*/

namespace App\Http\Controllers\Web\Advert;use App\Http\Controllers\BaseController;use App\Models\MemberFile;use App\Models\ProductCategory;use App\Models\ProductType;use App\Traits\ReadWord;use Illuminate\Http\Request;use PhpOffice\PhpWord\Reader\Word2007;class MemberFileController extends BaseController{use ReadWord;public function __construct(){view()->share('nick',preg_replace('/(\d{3})\d{4}(\d{4})/','$1****$2',auth('members')->user()['phone']));}public function index(Request $request){$type='source';return view('web.advert.Member.source',compact('files','type'));}public function data(Request $request){$orders=MemberFile::where(['mid'=>auth('members')->user()->id])->with('type_info')->orderBy('id','desc')->paginate($request->get('limit',20))->toArray();$P2gAC0=array();$P2gAC0['code']=0;$P2gAC0['msg']='正在请求中...';$P2gAC0['count']=$orders['total'];$P2gAC0['data']=$orders['data'];$data=$P2gAC0;return response()->json($data);}public function file(){$mid=auth('members')->user()->id;$files=MemberFile::where(['mid'=>$mid])->get();$category=ProductType::all();$type='file';return view('web.advert.Member.file',compact('files','type','category'));}public function store(Request $request){$data=$request->all();$data['mid']=auth('members')->user()->id;$data['path']=$request->fileupload;$data['file_name']=$request->uploadName;$url_type=$data['url_type'];unset($data['url_type']);unset($data['_token']);unset($data['uploadName']);unset($data['fileupload']);unset($data['file']);MemberFile::create($data);$P2g0=$url_type=='source';if($P2g0)goto P2gBodyx2;goto P2gNextx2;P2gBodyx2:return redirect(url('/advert/member/resource'));goto P2gx1;P2gNextx2:return redirect(url('/advert/index'));P2gx1:}public function edit($id){$file=MemberFile::where('id',$id)->first();$type='resource';return view('web.advert.Member.editFile',compact('file','type'));}public function update(Request $request){MemberFile::where('id',$request->id)->update(['type'=>2,'content'=>$request->input('content')]);return redirect(url('/advert/member/resource'));}public function getFileContent(Request $request){$P2g0=public_path() . $request->path;$path=$P2g0;$content=$this->getWordContent($path);$this->set('data',['content'=>$content]);return $this->jsonResponse();}}
?>