wugg 3 years ago
parent
commit
70ae7eebf6
3 changed files with 23 additions and 3 deletions
  1. 21 2
      app/admin/controller/System.php
  2. 1 1
      app/admin/model/ActionLog.php
  3. 1 0
      app/admin/route/app.php

+ 21 - 2
app/admin/controller/System.php

@@ -96,9 +96,28 @@ class System extends BaseController
      * @param  int  $id
      * @return \think\Response
      */
-    public function read($id)
+    public function upload()
     {
-        //
+        $post  =$this->request->post();
+        $token = isset($post['token']) ? trim($post['token']) : "";
+        if($token==""){
+            return error_show(101,'token不能为空');
+        }
+        $effetc = VerifyTokens($token);
+        if(!empty($effetc) && $effetc['code']!=0){
+            return error_show($effetc['code'],$effetc['message']);
+        }
+        $files = $this->request->file('image');
+        $list="";
+        if($files!=""){
+            $list=UploadImg($files);
+        }
+
+        if(is_array($list)&&!empty($list)){
+            return app_show(0, "上传成功!",$list);
+        }else{
+            return error_show(1005, "上传失败!".$list);
+        }
     }
 
     /**

+ 1 - 1
app/admin/model/ActionLog.php

@@ -10,7 +10,7 @@ use think\Model;
  */
 class ActionLog extends Model
 {
-   public  function Add($token,){
+   public  function Add($token,$order){
 
    }
    public function  list(){}

+ 1 - 0
app/admin/route/app.php

@@ -139,6 +139,7 @@ Route::rule("shareinfo","admin/Share/read");
 Route::rule("loglist","admin/System/index");
 Route::rule("versionlist","admin/System/version");
 Route::rule("lastversion","admin/System/LastVersion");
+Route::rule("uploadimg","admin/System/upload");
 
 Route::rule("wareadd","admin/WareHouse/add");
 Route::rule("wareinfo","admin/WareHouse/info");