小程序和 H5 调用系统的接口

Blade 未结 1 11
eztom
eztom 剑圣 1小时前

一、该问题的重现步骤是什么?

1.   uni-app H5 调用的接口获取OSS文件路径和小程序的路径为什么不相同 小程序请求头多了X-Wx-Openid  还是说带不带token值会影响OSS的Bucket

2.  

3.

二、你期待的结果是什么?实际看到的又是什么?


三、你正在使用的是什么产品,什么版本?在什么操作系统上?


四、请提供详细的错误堆栈信息,这很重要。

cb22b58c-8fba-4978-9a8c-c150de4a4f4b.png

五、若有更多详细信息,请在下面提供。be557fa7-9f2c-4452-b268-a5a65a02fa87.png

1条回答
  • 小程序这块的逻辑不是我们写的,你们得去找下负责开发这块的技术问问

    作者追问:1小时前

    org.springblade.resource.feign;
    
    
    cn.eztom.video.feign.IVideoClient;
    com.alibaba.fastjson.JSONObject;
    com.aliyuncs.DefaultAcsClient;
    com.aliyuncs.exceptions.ClientException;
    com.aliyuncs.vod.model.v20170321.DeleteVideoResponse;
    com.aliyuncs.vod.model.v20170321.GetPlayInfoResponse;
    com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
    lombok.;
    lombok.;
    org.springblade.common.constant.CodeConstant;
    org.springblade.common.utils.EztCommonUtil;
    org.springblade.core.oss.model.BladeFile;
    org.springblade.core.tool.api.R;
    org.springblade.core.tool.utils.Func;
    org.springblade.resource.builder.oss.OssBuilder;
    org.springblade.resource.entity.Oss;
    org.springblade.resource.service.IOssService;
    org.springblade.resource.utilezt.EztSimpleTranscode;
    org.springblade.resource.utilezt.EztVodUtil;
    org.springblade.resource.utilezt.OssUtil;
    org.springblade.system.feign.IDictClient;
    org.springframework.boot.autoconfigure.condition.;
    org.springframework.web.bind.annotation.*;
    org.springframework.web.multipart.MultipartFile;
    springfox.documentation.annotations.;
    
    java.io.IOException;
    java.util.List;
    
    org.springframework.http.MediaType.;
    
    
    OssClient IOssClient {
    
        OssBuilder ;
        IOssService ;
        IVideoClient ;
        OssUtil ;
        IDictClient ;
    
    
        (+ )
        R<String> (String fileName) {
           R.(.template().fileLink(fileName));
        }
    
    
        (value = + , consumes = )
        R<BladeFile> (String directory, String fileName, () MultipartFile file) IOException {
           fileName = directory + + fileName;
           BladeFile bladeFile = .template().putFile(fileName, file.getInputStream());
           R.(bladeFile);
        }
    
        (value = + , consumes = )
        R<BladeFile> (() String fileName, () MultipartFile file) IOException {
           BladeFile bladeFile = .template().putFile(fileName, file.getInputStream());
           R.(bladeFile);
        }
    
        (+ )
        R (String fileName) {
           .template().removeFile(fileName);
           R.();
        }
    
        (String fileName) {
           (Func.(fileName)){
              Oss oss = .getOne(QueryWrapper<Oss>().eq(,).eq(,)); (== oss || Func.(oss.getId()) || Func.(oss.getAccessKey()) || Func.(oss.getSecretKey())){
                 ;
              }
              R r = EztSimpleTranscode.(oss.getAccessKey(),oss.getSecretKey(),fileName);
              (r.isSuccess()){
                 .updateVideo(fileName,EztSimpleTranscode.(fileName));
              }
           }
           ;
        }
    
        (String fileName) {
           (Func.(fileName)){
              Oss oss = .getOne(QueryWrapper<Oss>().eq(,).eq(,)); (!= oss){
                 .deleteFile(oss.getEndpoint(),oss.getAccessKey(),oss.getSecretKey(),oss.getBucketName(),fileName);
                 ;
              }
           }
           ;
        }
    
        String (String videoid) {
           Oss oss = .getOne(QueryWrapper<Oss>().eq(,).eq(,)); (== oss || Func.(oss.getId()) || Func.(oss.getAccessKey()) || Func.(oss.getSecretKey())){
              ;
           }
           DefaultAcsClient client = EztVodUtil.(oss.getAccessKey(),oss.getSecretKey());
           GetPlayInfoResponse response = GetPlayInfoResponse();
           {
              response = EztVodUtil.(client,videoid);
              List<GetPlayInfoResponse.PlayInfo> playInfoList = response.getPlayInfoList();
              (GetPlayInfoResponse.PlayInfo playInfo : playInfoList) {
                 System..print(+ playInfo.getPlayURL() + );
                 playInfo.getPlayURL();
              }
              System..print(+ response.getVideoBase().getTitle() + );
           } (Exception e) {
              System..print(+ e.getLocalizedMessage());
           }
           System..print(+ response.getRequestId() + );
           ;
        }
    
        (String videoid) {
           Oss oss = .getOne(QueryWrapper<Oss>().eq(,).eq(,)); (== oss || Func.(oss.getId()) || Func.(oss.getAccessKey()) || Func.(oss.getSecretKey())){
              ;
           }
           DefaultAcsClient client = EztVodUtil.(oss.getAccessKey(),oss.getSecretKey());
           DeleteVideoResponse response = DeleteVideoResponse();
           {
              response = EztVodUtil.(client,videoid);
              ;
           } (Exception e) {
              System..print(+ e.getLocalizedMessage());
           }
           System..print(+ response.getRequestId() + );
           ;
        }
    
        R (Integer endTime) {
           (Func.(endTime)){
              R.(CodeConstant..getCode(),);
           }
    
           String basePaths = ;
           Integer expireTime = endTime;
    
           (!= expireTime){
              (expireTime >= && expireTime <= ){
                 .encipherParam(expireTime,basePaths);
              }{
                 R.(CodeConstant..getCode(),);
              }
           }{
              R.(CodeConstant..getCode(),);
           }
    
        }
    }


    blade-resource  这个服务是本身框架写的  我现在调用这个接口

     (+ )
        R<String> (String fileName) {
           R.(.template().fileLink(fileName));
        }

    带token  和不带token  访问这个接口 返回的是不一样的bucket  这个token  有什么说法嘛

    Blade-Auth:

    bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ0ZW5hbnRfaWQiOiIwMDAwMDAiLCJ1c2VyX25hbWUiOiIxMzcxMjg5MTY5OSIsInJlYWxfbmFtZSI6IiIsImF2YXRhciI6Imh0dHBzOi8vdGhpcmR3eC5xbG9nby5jbi9tbW9wZW4vdmlfMzIvUGlhanhTcUJSYUVLaWJ6dld1ZGhJM3NTeDJvdExpYURrMmtsTmhWZExzV3RCMUpNSEtLSnRpY25qT1ZpYW1mRGxvaWJyUW9pYzgwZzRpYjdOcEUwMDAyRGw2eTNtbFJTM0FXcURyajRlbWtCVThlMVVWajlzN0tmbGVyTjZ3LzEzMiIsImF1dGhvcml0aWVzIjpbIlN0dWRlbnQiXSwiY2xpZW50X2lkIjoic2FiZXIiLCJyb2xlX25hbWUiOiJTdHVkZW50IiwibGljZW5zZSI6InBvd2VyZWQgYnkgYmxhZGV4IiwicG9zdF9pZCI6IjExMjM1OTg4MTc3Mzg2NzUyMDEiLCJ1c2VyX2lkIjoiMjA3NDAyNzkwNDg5ODY5MTA3MyIsInJvbGVfaWQiOiI1NTU1NTU1NTU1NTU1NTU1NTU1Iiwic2NvcGUiOlsiYWxsIl0sIm5pY2tfbmFtZSI6IuefpeihjOWQiOS4gCIsIm9hdXRoX2lkIjoiIiwiZXhwIjoxNzg3NTU5MjI2LCJkZXB0X2lkIjoiMTEyMzU5ODgxMzczODY3NTIwMSIsImp0aSI6IjljMTc5YjE5LWVlZmMtNDU1MS1hZmFiLWU4NzY2ZTQ1YWIzZCIsImFjY291bnQiOiIxMzcxMjg5MTY5OSJ9.2axShTK3T6-Egx1KRQ43Ngm672mYpaRpwB8l90mXLTs

    我夸服务调用的 来一个服务开放接口  带这个访问是正常的 能显示图片  不带就不正常了


    回答: 1小时前

    默认开启租户模式的话,token里有租户编号,会自动给bucket增加一个租户编号前缀。

    如果你不需要,可以修改oss的yml配置,把tenant-mode改成false。

    0 讨论(0)
提交回复