<?php
/**
 * Created by PhpStorm.
 * User: chouchou
 * Date: 2020-2-23
 * Time: 23:30
 */

namespace app\em\controller;
use app\admin\controller\Upload;
use app\em\model\Base;
use think\facade\Request;

class UploadFile extends Base
{
    public function upPhoto(){
        $file = Request::file('cp_photo');
        $upload = new Upload($file,1);
        $result = $upload->upload();

        if($result){
            return jsonSuc('照片上传成功',$result);
        } else {
            return jsonErr($result);
        }
    }

    public function upFile(){
        $file = Request::file('up_file');
        $upload = new Upload($file,2);
        $result = $upload->upload();

        if($result){
            return jsonSuc('上传文件成功',$result);
        } else {
            return jsonErr($result);
        }
    }
}