sugangqiang 2 years ago
parent
commit
4f8f8d32f3
2 changed files with 19 additions and 4 deletions
  1. 18 3
      app/common/controller/Api.php
  2. 1 1
      public/static/js/common/Feng.js

+ 18 - 3
app/common/controller/Api.php

@@ -335,9 +335,24 @@ class Api extends BaseController {
         $id = $param["id"];
         $where = [];
         $where[] = ["id", "=", $id];
-        $where[] = ["type", "=", $type];
-        $fileinfo = Db::table("new_talent_file")->where($where)->findOrEmpty();
-        $filename = $fileinfo["orignName"];
+        $url = "";
+        switch ($type) {
+            case 1:
+                $fileinfo = Db::table("new_talent_file")->where($where)->findOrEmpty();
+                $filename = $fileinfo["orignName"];
+                $url = $fileinfo["url"];
+                break;
+            case 2:
+                $fileinfo = Db::table("new_talent_common_file")->where($where)->findOrEmpty();
+                $filename = $fileinfo["orignName"];
+                $url = $fileinfo["url"];
+                break;
+            case 3:
+                $fileinfo = Db::table("new_currency_filetype")->where($where)->findOrEmpty();
+                $filename = $fileinfo["templateUrl"];
+                $url = $fileinfo["templateUrl"];
+                break;
+        }
         $filepath = "storage/" . $fileinfo["url"];     // 下载文件名
         if (!file_exists($filepath)) {
             header('HTTP/1.1 404 NOT FOUND');

+ 1 - 1
public/static/js/common/Feng.js

@@ -599,7 +599,7 @@ var Feng = {
         });
     },
     downloadFile:function (id,type) {
-        window.location.href = Feng.ctxPath + "/api/common/downloadFile?id=" + id + "&type="+type;
+        window.location.href = Feng.ctxPath + "/common/api/downloadFile?id=" + id + "&type="+type;
     },
     bankChange:function (val,target){
         var bank = $("#"+val).val();