package com.fdkankan.scene.controller;


import com.fdkankan.common.controller.BaseController;
import com.fdkankan.scene.service.ISceneUploadService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;

@RestController
@RequestMapping("/api/scene/edit/upload")
public class SceneUploadController extends BaseController {

    @Autowired
    private ISceneUploadService sceneUploadService;

    /**
     * 上传图片到oss,base64
     * base64   图片base64
     * fileName  文件名称
     * bizType  业务类型
     * files     文件
     * num 场景码
     * type     0添加，1替换
     */
    @RequestMapping(value = "/files", method = RequestMethod.POST)
    public String uploads(@RequestParam(value = "base64",required = false) String base64,
                                     @RequestParam(value = "fileName",required = false) String fileName,
                                     @RequestParam(value = "bizType",required = false) String bizType,
                                     @RequestParam(value = "files",required = false) MultipartFile[] files,
                                     @RequestParam(value = "num",required = false) String num,
                                     @RequestParam(value = "type",required = false,defaultValue = "1") Integer type) throws Exception {
        return sceneUploadService.uploads(base64,fileName,bizType,files,num,type,getToken());
    }

}
