瀏覽代碼

技术附件显示

qiuenguang 1 年之前
父節點
當前提交
0116ecbd86
共有 1 個文件被更改,包括 28 次插入2 次删除
  1. 28 2
      application/api/controller/WorkOrder.php

+ 28 - 2
application/api/controller/WorkOrder.php

@@ -4,6 +4,7 @@ namespace app\api\controller;
 
 
 use app\common\controller\Api;
+use app\common\library\Upload;
 use Monolog\Handler\IFTTTHandler;
 use PhpOffice\PhpSpreadsheet\Cell\Coordinate;
 use think\Config;
@@ -2357,13 +2358,38 @@ class WorkOrder extends Api
     public function ImgUpload(){
         $file = request()->file('image');
         if($file){
-            $info = $file->validate(['size'=>15678,'ext'=>'jpg,png'])->move(ROOT_PATH . 'public' . DS . 'uploads');
+            $info = $file->validate(['size'=>10485760,'ext'=>'jpg,png'])->move(ROOT_PATH . 'public' . DS . 'uploads');
             if($info){
                 $fileName =  $info->getSaveName();
                 $this->success('成功','public' . DS . 'uploads'. DS . $fileName);
             }else{
-                echo $file->getError();
+                $res = $file->getError();
+                $this->error('失败',$res);
             }
         }
     }
+
+    /**
+     * 工单技术附件
+     * @return void
+     * @throws \think\db\exception\DataNotFoundException
+     * @throws \think\db\exception\ModelNotFoundException
+     * @throws \think\exception\DbException
+     */
+    public function OrderAttachments()
+    {
+        if ($this->request->isGet() === false){
+            $this->error('请求错误');
+        }
+        $param = $this->request->param();
+        if (empty($param)){
+            $this->error('参数错误');
+        }
+        $list = \db('工单_相关附件')
+            ->where('关联编号',$param['order'])
+            ->where('附件备注',$param['desc'])
+            ->whereNull('Mod_rq')
+            ->select();
+        $this->success('成功',$list);
+    }
 }