zoukankan      html  css  js  c++  java
  • 团队冲刺第一阶段 2

    研究百度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");
        }
    }
    

      

  • 相关阅读:
    火狐URL编码问题
    Asp.net动态关键字
    charindex ,PATINDEX,contains,FREETEXT用法
    PanGu词库批量添加关键词
    Dictionary SortedList HashSet List用法
    hubbledotnet查询速度慢的问题
    asp.net 页面static变量问题
    String.Concat和String.Format用法
    .net显示今天农历的代码
    存储过程用户登录
  • 原文地址:https://www.cnblogs.com/ltw222/p/14914279.html
Copyright © 2011-2022 走看看