sugangqiang 2 年之前
父節點
當前提交
5388eca6aa
共有 2 個文件被更改,包括 15 次插入1 次删除
  1. 14 0
      app/common/controller/Api.php
  2. 1 1
      public/static/modular/gate/enterprise/enterprise_change_edit.js

+ 14 - 0
app/common/controller/Api.php

@@ -326,6 +326,20 @@ class Api extends BaseController {
         return json(["msg" => "不能删除"]);
     }
 
+    public function deleteTalentCommonFile() {
+        $param = $this->request->param();
+        $where = [["id", "=", $param["id"]]];
+        $file = Db::table("new_talent_common_file")->where($where)->findOrEmpty();
+        $filepath = "storage/" . $file["url"];
+        if (file_exists($filepath)) {
+            unlink($filepath);
+        }
+        Db::table("new_talent_common_file")->delete($file["id"]);
+        //TalentLogApi::write($file["type"], $file["mainId"], 0, sprintf("删除附件,附件名为:%s", $file["orignName"]), 1, $file["typeId"], $param["id"]);
+        return json(["code" => 200, "msg" => "删除成功"]);
+        return json(["msg" => "不能删除"]);
+    }
+
     /**
      * 下载文件
      */

+ 1 - 1
public/static/modular/gate/enterprise/enterprise_change_edit.js

@@ -275,7 +275,7 @@ EpChangeEdit.deleteFile = function (id){
 		return ;
 	}
 	var operation = function() {
-		var ajax = new $ax(Feng.ctxPath + "/api/talentCommonFile/deleteTalentCommonFile", function (data) {
+		var ajax = new $ax("/common/api/deleteTalentCommonFile", function (data) {
 			if(data.code=200){
 				Feng.success(data.msg);
 				$("#fileTable").bootstrapTable("refresh", {});