<?php
/**
* @author 龙虾 <15108148@qq.com>
* @version 1.12 2019-12-31
* @copyright 睿谷信息 <www.rgxx.com>
*/
namespace app\home\controller;

class Download extends Base
{
    // 搜索
    public function index($filemd5='')
    {
        if($filemd5) {
            $fileinfo = model('media')->where('filemd5',$filemd5)->find();
            if($fileinfo) {
                $info = pathinfo($fileinfo['url']);
                return download(env('root_path').$info['dirname'].DS.$info['basename'],$fileinfo['original']);
            } else {
                abort(404,lang('content_error'));
            }
        } else {
            abort(404,lang('content_error'));
        }
    }
}
