zoukankan      html  css  js  c++  java
  • 4.29团队冲刺02

    研究百度api

    那东西先是申请一个权限,然后直接调用接口,我的权限还在申请,申请的流程和百度地图的api差不多

     这是创建路径的函数,一个图片过来必须给他个路径才能进行之后的查找操作

    public class CreatPath {
    private static JSONObject temp;

    public static String creatPath(MultipartFile file) throws Exception {
    String PATH = "G:\SmartCloudAlbum\" + staticConfig.UserMail + "\";
    String jsonData = AdvancedGeneral.advancedGeneral(MultipartFileToFile.multipartFileToFile(file));
    System.out.println(jsonData);
    while (jsonData.equals("{"error_code":18,"error_msg":"Open api qps request limit reached"}")) {
    try {
    //睡眠1s
    Thread.currentThread().sleep(100);
    jsonData = AdvancedGeneral.advancedGeneral(MultipartFileToFile.multipartFileToFile(file));
    } catch (InterruptedException e) {
    // TODO Auto-generated catch block
    e.printStackTrace();
    }
    }
    JSONObject jsonObject = JSONObject.parseObject(jsonData);
    temp = jsonObject;
    JSONArray jsonArray = jsonObject.getJSONArray("result");
    jsonObject = jsonArray.getJSONObject(1);
    if (jsonObject.getString("root").equals("人物-人物特写")) {
    //预留功能
    }
    String str = new StringBuilder().append(PATH).append(jsonObject.getString("root")).append("\").append(jsonObject.getString("keyword")).append("\").toString();
    System.out.println(str);
    return str;
    }

    public static String creatName() {
    return temp.getString("log_id");
    }
    }
  • 相关阅读:
    不敢想,做个博客竟如此简单!
    我有一台服务器,能干啥?
    精品 IDEA 插件大汇总!值得收藏
    怒肝半月!Python 学习路线+资源大汇总
    怒肝 Linux 学习路线,这回不难
    多环境
    分享 10 个高星的创意项目!
    js的attribute
    选择大厂该做哪些准备?|小白进入大厂现状
    小白程序猿了解大厂的开发模式
  • 原文地址:https://www.cnblogs.com/L-L-ALICE/p/14910277.html
Copyright © 2011-2022 走看看