| | |
| | | import org.springframework.data.redis.core.RedisTemplate; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import javax.annotation.Resource; |
| | | import javax.servlet.http.HttpServletRequest; |
| | | import javax.servlet.http.HttpSession; |
| | | import java.io.InputStream; |
| | |
| | | @RequestMapping("") |
| | | public class DriverController { |
| | | |
| | | @Autowired |
| | | private RedisTemplate redisTemplate; |
| | | @Resource |
| | | private RedisTemplate<String, Object> redisTemplate; |
| | | @Autowired |
| | | private IDriverService driverService; |
| | | |
| | |
| | | e.printStackTrace(); |
| | | } |
| | | } |
| | | |
| | | |
| | | // @ResponseBody |
| | | // @RequestMapping(value = "/base/driver/uploadImg", method = RequestMethod.POST) |
| | | // @ApiOperation(value = "上传图片", tags = {"司机端-注册"}, notes = "") |
| | | // public ResultUtil uploadImg(MultipartFile file) { |
| | | // try { |
| | | // String bucketName = "grjy_test"; |
| | | // Bucket grjyTest = NCOSSUtil.getBucketInfo(bucketName); |
| | | // if (null == grjyTest) { |
| | | // //创建桶 |
| | | // Boolean bucket = NCOSSUtil.createBucket(bucketName); |
| | | // if (!bucket) { |
| | | // return ResultUtil.error("创建存储桶失败"); |
| | | // } |
| | | // //设置桶策略 |
| | | // String policyText = "{\"Version\":\"2025-06-23\",\"Statement\":[{\"Sid\":\"Stmt20250623\",\"Action\":[\"GetObject\"]" + |
| | | // ",\"Effect\":\"Allow\",\"Resource\":[\"" + bucketName + "\"/*],\"Principal\":{*}}]}"; |
| | | // Boolean bucketPolicy = NCOSSUtil.setBucketPolicy(bucketName, policyText); |
| | | // if (!bucketPolicy) { |
| | | // return ResultUtil.error("设置桶策略失败"); |
| | | // } |
| | | // } |
| | | // //上传对象 |
| | | // String key = "image/driver/" + UUID.randomUUID().toString() + ".png"; |
| | | // String object = NCOSSUtil.putObject(bucketName, key, file.getInputStream()); |
| | | // if (null == object) { |
| | | // return ResultUtil.error("上传图片失败"); |
| | | // } |
| | | // |
| | | // return ResultUtil.success("http://" + QianYunTongProperties.endPoint + "/" + key); |
| | | // } catch (Exception e) { |
| | | // e.printStackTrace(); |
| | | // return ResultUtil.runErr(); |
| | | // } |
| | | // } |
| | | } |