远程调用-其他服务

简介: 远程调用-其他服务

需求

我们现在开发的APP 需要定时将APP收集的预约单发送到另一个DMS系统(服务站), 但是请求DMS系统的接口还需要先登录获取到cookie, 这个cookie是登录DMS系统后返回的Headers中的Set-Cookie的值

已知

DMS登录接口: https://dmstest.chirey.mx/api/v1/login

参数:

{

“enterpriseCode”:“15770”,

“username”:“cherysh”,

“password”:“ChErY2020”

}

同步数据接口

https://dmstest.chirey.mx/dms/afterSales/api/v1/OuterAPI/repairAppointments

编码

首先封装一个获取cookie的方法到HttpUtils中:

public String getCookie() {
        log.info("执行getCookie方法");
        String url = dmsConfig.getLoginUrl();
        HashMap<String, String> param = new HashMap<>();
        param.put("enterpriseCode",dmsConfig.getEnterpriseCode());
        param.put("username",dmsConfig.getUsername());
        param.put("password",dmsConfig.getPassword());
        String cookie = doPostJsonParamGetCookie(url, param);
//        存入redis
        redisUtil.set("cookie",cookie,20*60);
        log.info("cookie==="+cookie);
        return cookie;
    }
/**
    *   String url = "https://dmstest.chirey.mx/api/v1/login";
        HashMap<String, String> param = new HashMap<>();
        param.put("enterpriseCode","15770");
        param.put("username","cherysh");
        param.put("password","ChErY2020");
        String s = doPostJsonParamGetCookie(url, param);
    * */
    public static String doPostJsonParamGetCookie(String url, Map<String, String> jsonParam) {
        CloseableHttpClient httpClient = null;
        CloseableHttpResponse response = null;
        String result = "";
        try {
            httpClient = HttpClientBuilder.create().build();
            HttpPost httpPost = new HttpPost(url);
            httpPost.setHeader("Content-Type", "application/json");
            RequestConfig config = RequestConfig.custom().setConnectTimeout(20000).setConnectionRequestTimeout(20000).setSocketTimeout(20000).build();
            httpPost.setConfig(config);
//            传json参数
            JSONObject json = new JSONObject();
            for (Map.Entry<String, String> pa : jsonParam.entrySet()) {
                json.put(pa.getKey(),pa.getValue());
            }
            httpPost.setEntity(new StringEntity(json.toString(),"UTF-8"));
            response = httpClient.execute(httpPost);
            Header[] headers = response.getHeaders("Set-Cookie");
            for (int i = 0; i < headers.length; i++) {
                if(headers[i].toString().contains(".AspNetCore.Cookies")){
                    result=headers[i].toString().split("Set-Cookie: ")[1];
                }
            }
        } catch (Exception e) {
            logger.error("POST请求发送失败!url:{},异常:", url, e);
        } finally {
            try {
                if (null != httpClient)
                    httpClient.close();
                if (null != response)
                    response.close();
            } catch (IOException e) {
                logger.error("链接关闭失败!url:{},异常:", url, e);
            }
        }
        return result;
    }

然后封装一个同步预约单到dms的方法到HttpUtils中:

/**传jsonArray参数
    [
      {
        "planArriveDate": "2022-06-06T00:52:12.185Z",
        "appointNo": "55555",
        "planArriveTime": "07:00-08:00",
        "dealerCode": "18888",
        "repairType": 1,
        "isWx": "3",
        "cellPhoneNumber": "13855222215",
        "customerName": "王三",
        "licensePlate": "皖B88888",
        "status": 1,
        "vinCode": "LVVDC21B2ND033754"
      }
    ]
    具体写法:
        List<AppointBillVO> allNewBills = appointBillService.getAllNewBillListForDMS();
//        从redis获取cookie
        String cookie = (String) redisUtil.get("cookie");
        if(StringUtils.isEmpty(cookie)){
             cookie = httpUtils.getCookie();
        }
        String url = "https://dmstest.chirey.mx/dms/afterSales/api/v1/OuterAPI/repairAppointments";
        JSONArray jsonArray = JSONArray.parseArray(JSON.toJSONString(allNewBills));
        String result = HttpUtils.doPostJsonObjectParam(url, jsonArray, cookie);
    * */
    public static String doPostJsonObjectParam(String url, JSONArray jsonArray, String cookie) {
        CloseableHttpClient httpClient = null;
        CloseableHttpResponse response = null;
        String result = "";
        try {
            httpClient = HttpClientBuilder.create().build();
            HttpPost httpPost = new HttpPost(url);
            httpPost.setHeader("Cookie", cookie);
            httpPost.setHeader("Content-Type", "application/json");
            RequestConfig config = RequestConfig.custom().setConnectTimeout(20000).setConnectionRequestTimeout(20000).setSocketTimeout(20000).build();
            httpPost.setConfig(config);
//            传json参数
            httpPost.setEntity(new StringEntity(jsonArray.toString(),"UTF-8"));
            response = httpClient.execute(httpPost);
            result = EntityUtils.toString(response.getEntity());
        } catch (Exception e) {
            logger.error("POST请求发送失败!url:{},异常:", url, e);
        } finally {
            try {
                if (null != httpClient)
                    httpClient.close();
                if (null != response)
                    response.close();
            } catch (IOException e) {
                logger.error("链接关闭失败!url:{},异常:", url, e);
            }
        }
        return result;
    }

最后写一个定时任务接口:

//    @Scheduled(cron = "0 0/10 * * * ?") // 使用xxl-job控制定时任务
    @RequiredLog("APP-DMS 同步所有新建预约记录")
    @ApiOperation(value = "APP-DMS 同步所有新建预约记录")
    @RequestMapping(value = {"getAllNewBillListForDMS"}, method = RequestMethod.POST)
    public RespMessage<List<AppointBillVO>> getAllNewBillListForDMS() {
        log.info("APP-DMS 同步所有新建预约记录 定时任务调用了!!!");
        // 查询所有新建预约单
        List<AppointBillVO> allNewBills = appointBillService.getAllNewBillListForDMS();
        log.info("查询到的所有新建预约单==="+allNewBills.toString());
//        从redis获取cookie
        String cookie = (String) redisUtil.get("cookie");
        log.info("从Redis获取到的cookie是==="+cookie);
        if(StringUtils.isEmpty(cookie)){
             cookie = httpUtils.getCookie();
        }
        log.info("cookie==="+cookie);
        if(!CollectionUtils.isEmpty(allNewBills)){
            String url = dmsConfig.getAppointmentsUrl();
            JSONArray jsonArray = JSONArray.parseArray(JSON.toJSONString(allNewBills));
            log.info("APP-DMS 同步的所有预约记录===>"+jsonArray.toJSONString());
            String result = HttpUtils.doPostJsonObjectParam(url, jsonArray, cookie);
            if(result.contains("成功")){
                // 将这些预约单状态修改为已发送
                if(!CollectionUtils.isEmpty(allNewBills) && allNewBills.size() > 0){
                    ArrayList<String> appointNos = new ArrayList<>();
                    allNewBills.forEach(e ->{
                        appointNos.add(e.getAppointNo());
                    });
                    appointBillService.updateStatusByNos(appointNos);
                }
                return RespMessage.ok(allNewBills);
            }
        }
        return RespMessage.errorWithMsg("同步失败");
    }

HttpUtils全部代码

package com.mychery.awesomeproject.util;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.mychery.awesomeproject.config.DmsConfig;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang.StringUtils;
import org.apache.http.Header;
import org.apache.http.HttpEntity;
import org.apache.http.NameValuePair;
import org.apache.http.client.config.RequestConfig;
import org.apache.http.client.entity.UrlEncodedFormEntity;
import org.apache.http.client.methods.CloseableHttpResponse;
import org.apache.http.client.methods.HttpGet;
import org.apache.http.client.methods.HttpPost;
import org.apache.http.client.utils.URIBuilder;
import org.apache.http.entity.StringEntity;
import org.apache.http.impl.client.CloseableHttpClient;
import org.apache.http.impl.client.HttpClientBuilder;
import org.apache.http.impl.client.HttpClients;
import org.apache.http.message.BasicNameValuePair;
import org.apache.http.util.EntityUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import java.io.*;
import java.net.*;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
@Slf4j
@Component
public class HttpUtils {
    private static Logger logger = LoggerFactory.getLogger(HttpUtils.class);
//
    @Autowired
    private RedisUtil redisUtil;
//    private JedisCluster jedisCluster;
    @Autowired
    private DmsConfig dmsConfig;
//    @Scheduled(cron = "0 0/20 * * * ?") 使用xxl-job控制定时任务
//    @Cache_Find
    public String getCookie() {
        log.info("执行getCookie方法");
        String url = dmsConfig.getLoginUrl();
        HashMap<String, String> param = new HashMap<>();
        param.put("enterpriseCode",dmsConfig.getEnterpriseCode());
        param.put("username",dmsConfig.getUsername());
        param.put("password",dmsConfig.getPassword());
        String cookie = doPostJsonParamGetCookie(url, param);
//        存入redis
        redisUtil.set("cookie",cookie,20*60);
        log.info("cookie==="+cookie);
        return cookie;
    }
    /**
     *         String s = null;
     *         try {
     *             s = doGet(".AspNetCore.Cookies=CfDJ8F6Qt6UMPGRBiPITbV-0bZuq3vgFUiASw7A4Ud2tpKJqh4bMixXaBrEWZaGGo1ZZx6OyDzAF6EtxQP1yXyqlA-Ztfw6Mcgjg_6wrL3Ily9lNZo3aBZJguQnPuhvJQucYqppte_QI-ID-Kufu5QjVUJ-VhEXt7OtZIufHRftnDYpEb6RE4Y9cS2mLUwmFDIZkJICL5_hEb6d4xNDclfI-_WqhztjLxh9ZhflboNEyPrFVlOmvUJbxMIHV6ghbRuMX0y7WdFcRUtlkQ-Wxr_W4_Sjcmz05JeANR9MK-1x2IATxFEudwt65AP2eenQEJG_jyw; path=/; samesite=lax; httponly",
     *                     "https://dmstest.chirey.mx/dms/afterSales/api/v1/OuterAPI/GetVehicleInfo",
     *                     "LVTDB11B0JC005750",
     *                     "553");
     *         } catch (Exception e) {
     *             e.printStackTrace();
     *         }
     *         System.out.println(s);
     * @param cookie
     * @param url
     * @param vin
     * @param engine
     * @return
     * @throws Exception
     */
    public static String doGet(String cookie,String url, String vin, String engine) throws Exception {
        // 创建Httpclient对象
        CloseableHttpClient httpclient = HttpClients.createDefault();
        // 定义请求的参数
        URI uri = new URIBuilder(url).setParameter("vin", vin).setParameter("engine",  engine).build();
        // 创建http GET请求
        HttpGet httpGet = new HttpGet(uri);
        httpGet.setHeader("Cookie",cookie);
        //response 对象
        CloseableHttpResponse response = null;
        String resultString="0";
        try {
            // 执行http get请求
            response = httpclient.execute(httpGet);
            // 判断返回状态是否为200
            if (response.getStatusLine().getStatusCode() == 200) {
                resultString = EntityUtils.toString(response.getEntity(), "UTF-8");
                //    System.out.println("内容长度:" + resultString);
            } else {
                throw new Exception("GET请求失败!");
            }
        } finally {
            if (response != null) {
                response.close();
            }
            httpclient.close();
        }
        return resultString;
    }
    /**传json对象参数
       {
         "enterpriseCode":"15770",
         "username":"cherysh",
         "password":"ChErY2020"
        }
    具体写法:
        String url = "https://dmstest.chirey.mx/api/v1/login";
         Map<String, String> param = new HashMap<>();
        param.put("enterpriseCode","15770");
        param.put("username","cherysh");
        param.put("password","ChErY2020");
         String s = doPostJsonParam(url, param);
    * */
    public static String doPostJsonParam(String url, Map<String, String> jsonParam) {
        CloseableHttpClient httpClient = null;
        CloseableHttpResponse response = null;
        String result = "";
        try {
            httpClient = HttpClientBuilder.create().build();
            HttpPost httpPost = new HttpPost(url);
            httpPost.setHeader("Content-Type", "application/json");
            RequestConfig config = RequestConfig.custom().setConnectTimeout(20000).setConnectionRequestTimeout(20000).setSocketTimeout(20000).build();
            httpPost.setConfig(config);
//            传json参数
            JSONObject json = new JSONObject();
            for (Map.Entry<String, String> pa : jsonParam.entrySet()) {
                json.put(pa.getKey(),pa.getValue());
            }
            httpPost.setEntity(new StringEntity(json.toString(),"UTF-8"));
            response = httpClient.execute(httpPost);
            result = EntityUtils.toString(response.getEntity());
        } catch (Exception e) {
            logger.error("POST请求发送失败!url:{},异常:", url, e);
        } finally {
            try {
                if (null != httpClient)
                    httpClient.close();
                if (null != response)
                    response.close();
            } catch (IOException e) {
                logger.error("链接关闭失败!url:{},异常:", url, e);
            }
        }
        return result;
    }
    /**传jsonArray参数
    [
      {
        "planArriveDate": "2022-06-06T00:52:12.185Z",
        "appointNo": "55555",
        "planArriveTime": "07:00-08:00",
        "dealerCode": "18888",
        "repairType": 1,
        "isWx": "3",
        "cellPhoneNumber": "13855222215",
        "customerName": "王三",
        "licensePlate": "皖B88888",
        "status": 1,
        "vinCode": "LVVDC21B2ND033754"
      }
    ]
    具体写法:
        List<AppointBillVO> allNewBills = appointBillService.getAllNewBillListForDMS();
//        从redis获取cookie
        String cookie = (String) redisUtil.get("cookie");
        if(StringUtils.isEmpty(cookie)){
             cookie = httpUtils.getCookie();
        }
        String url = "https://dmstest.chirey.mx/dms/afterSales/api/v1/OuterAPI/repairAppointments";
        JSONArray jsonArray = JSONArray.parseArray(JSON.toJSONString(allNewBills));
        String result = HttpUtils.doPostJsonObjectParam(url, jsonArray, cookie);
    * */
    public static String doPostJsonObjectParam(String url, JSONArray jsonArray, String cookie) {
        CloseableHttpClient httpClient = null;
        CloseableHttpResponse response = null;
        String result = "";
        try {
            httpClient = HttpClientBuilder.create().build();
            HttpPost httpPost = new HttpPost(url);
            httpPost.setHeader("Cookie", cookie);
            httpPost.setHeader("Content-Type", "application/json");
            RequestConfig config = RequestConfig.custom().setConnectTimeout(20000).setConnectionRequestTimeout(20000).setSocketTimeout(20000).build();
            httpPost.setConfig(config);
//            传json参数
            httpPost.setEntity(new StringEntity(jsonArray.toString(),"UTF-8"));
            response = httpClient.execute(httpPost);
            result = EntityUtils.toString(response.getEntity());
        } catch (Exception e) {
            logger.error("POST请求发送失败!url:{},异常:", url, e);
        } finally {
            try {
                if (null != httpClient)
                    httpClient.close();
                if (null != response)
                    response.close();
            } catch (IOException e) {
                logger.error("链接关闭失败!url:{},异常:", url, e);
            }
        }
        return result;
    }
    /**
    *   String url = "https://dmstest.chirey.mx/api/v1/login";
        HashMap<String, String> param = new HashMap<>();
        param.put("enterpriseCode","15770");
        param.put("username","cherysh");
        param.put("password","ChErY2020");
        String s = doPostJsonParamGetCookie(url, param);
    * */
    public static String doPostJsonParamGetCookie(String url, Map<String, String> jsonParam) {
        CloseableHttpClient httpClient = null;
        CloseableHttpResponse response = null;
        String result = "";
        try {
            httpClient = HttpClientBuilder.create().build();
            HttpPost httpPost = new HttpPost(url);
            httpPost.setHeader("Content-Type", "application/json");
            RequestConfig config = RequestConfig.custom().setConnectTimeout(20000).setConnectionRequestTimeout(20000).setSocketTimeout(20000).build();
            httpPost.setConfig(config);
//            传json参数
            JSONObject json = new JSONObject();
            for (Map.Entry<String, String> pa : jsonParam.entrySet()) {
                json.put(pa.getKey(),pa.getValue());
            }
            httpPost.setEntity(new StringEntity(json.toString(),"UTF-8"));
            response = httpClient.execute(httpPost);
            Header[] headers = response.getHeaders("Set-Cookie");
            for (int i = 0; i < headers.length; i++) {
                if(headers[i].toString().contains(".AspNetCore.Cookies")){
                    result=headers[i].toString().split("Set-Cookie: ")[1];
                }
            }
        } catch (Exception e) {
            logger.error("POST请求发送失败!url:{},异常:", url, e);
        } finally {
            try {
                if (null != httpClient)
                    httpClient.close();
                if (null != response)
                    response.close();
            } catch (IOException e) {
                logger.error("链接关闭失败!url:{},异常:", url, e);
            }
        }
        return result;
    }
    /**
     *
     * @param url
     * @param param
     * @return
     */
    public static String doPost(String url, Map<String, String> param) {
        CloseableHttpClient httpClient = null;
        CloseableHttpResponse response = null;
        String result = "";
        try {
            httpClient = HttpClientBuilder.create().build();
            HttpPost httpPost = new HttpPost(url);
            httpPost.setHeader("Content-Type", "application/json");
            RequestConfig config = RequestConfig.custom().setConnectTimeout(20000).setConnectionRequestTimeout(20000).setSocketTimeout(20000).build();
            httpPost.setConfig(config);
//            传普通表单参数
            List<NameValuePair> paramList = new ArrayList<>();
            for (Map.Entry<String, String> pa : param.entrySet()) {
                paramList.add(new BasicNameValuePair(pa.getKey(), pa.getValue()));
            }
            HttpEntity entity = new UrlEncodedFormEntity(paramList);
            httpPost.setEntity(entity);
            response = httpClient.execute(httpPost);
            result = EntityUtils.toString(response.getEntity());
        } catch (Exception e) {
            logger.error("POST请求发送失败!url:{},异常:", url, e);
        } finally {
            try {
                if (null != httpClient)
                    httpClient.close();
                if (null != response)
                    response.close();
            } catch (IOException e) {
                logger.error("链接关闭失败!url:{},异常:", url, e);
            }
        }
        return result;
    }
    /**
     * Post Request
     */
    public static String doPost(String url, String parameterData) throws Exception {
        URL localURL = new URL(url);
        URLConnection connection = localURL.openConnection();
        HttpURLConnection httpURLConnection = (HttpURLConnection) connection;
        httpURLConnection.setDoOutput(true);
        httpURLConnection.setRequestMethod("POST");
        httpURLConnection.setRequestProperty("Accept-Charset", "utf-8");
        httpURLConnection.setRequestProperty("Content-Type", "application/x-www-form-urlencoded");
        httpURLConnection.setRequestProperty("Content-Length", String.valueOf(parameterData.length()));
        httpURLConnection.setConnectTimeout(30000);
        httpURLConnection.setReadTimeout(30000);
        OutputStream outputStream = null;
        OutputStreamWriter outputStreamWriter = null;
        InputStream inputStream = null;
        InputStreamReader inputStreamReader = null;
        BufferedReader reader = null;
        StringBuffer resultBuffer = new StringBuffer();
        String tempLine = null;
        try {
            outputStream = httpURLConnection.getOutputStream();
            outputStreamWriter = new OutputStreamWriter(outputStream);
            outputStreamWriter.write(parameterData.toString());
            outputStreamWriter.flush();
            if (httpURLConnection.getResponseCode() >= 300) {
                throw new Exception("HTTP Request is not success, Response code is " + httpURLConnection.getResponseCode());
            }
            inputStream = httpURLConnection.getInputStream();
            inputStreamReader = new InputStreamReader(inputStream, "UTF-8");
            reader = new BufferedReader(inputStreamReader);
            while ((tempLine = reader.readLine()) != null) {
                resultBuffer.append(tempLine);
            }
        } finally {
            if (outputStreamWriter != null) {
                outputStreamWriter.close();
            }
            if (outputStream != null) {
                outputStream.close();
            }
            if (reader != null) {
                reader.close();
            }
            if (inputStreamReader != null) {
                inputStreamReader.close();
            }
            if (inputStream != null) {
                inputStream.close();
            }
        }
        return resultBuffer.toString();
    }
    /**
     * post请求(用于请求json格式的参数)
     */
    public static String doJsonPost(String urlPath, String json) {
        String result = "";
        BufferedReader reader = null;
        try {
            URL url = new URL(urlPath);
            HttpURLConnection conn = (HttpURLConnection) url.openConnection();
            conn.setRequestMethod("POST");
            conn.setDoOutput(true);
            conn.setDoInput(true);
            conn.setUseCaches(false);
            conn.setRequestProperty("Connection", "Keep-Alive");
            conn.setRequestProperty("Charset", "UTF-8");
            // 设置文件类型:
            conn.setRequestProperty("Content-Type", "application/json; charset=UTF-8");
            // 设置接收类型否则返回415错误
            //conn.setRequestProperty("accept","*/*")此处为暴力方法设置接受所有类型,以此来防范返回415;
            conn.setRequestProperty("accept", "application/json");
            conn.setConnectTimeout(30000);
            conn.setReadTimeout(30000);
            // 往服务器里面发送数据
            if (StringUtils.isNotEmpty(json)) {
                byte[] writebytes = json.getBytes();
                // 设置文件长度
                conn.setRequestProperty("Content-Length", String.valueOf(writebytes.length));
                OutputStream outwritestream = conn.getOutputStream();
                outwritestream.write(json.getBytes());
                outwritestream.flush();
                outwritestream.close();
            }
            logger.info("http返回码:" + conn.getResponseCode());
            if (conn.getResponseCode() == 200) {
                reader = new BufferedReader(new InputStreamReader(conn.getInputStream()));
                result = reader.readLine();
            }
        } catch (Exception e) {
            e.printStackTrace();
        } finally {
            if (reader != null) {
                try {
                    reader.close();
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
        }
        return result;
    }
}


相关实践学习
如何快速连接云数据库RDS MySQL
本场景介绍如何通过阿里云数据管理服务DMS快速连接云数据库RDS MySQL,然后进行数据表的CRUD操作。
目录
相关文章
|
存储 弹性计算 关系型数据库
阿里云服务器ESSD云盘性能等级PL0、PL1、PL2、PL3区别,云盘性能级别PL知识点参考
在我们选择阿里云服务器系统盘和数据盘时,如果是选择ESSD云盘,还需要选择云盘的云盘性能级别PL,PL性能级别有PL3、PL2、PL1、PL0四个性能级别的云盘规格,如果是通过阿里云的活动来购买云服务器的话,由于系统盘默认一般为20G或40G容量,可选的PL性能级别通常只有PL0(单盘IOPS性能上限1万)和PL1(单盘IOPS性能上限5万)可选择,有的用户肯能并不清楚ESSD云盘的性能等级之间有何区别,单盘IOPS性能指的是什么,本文为大家介绍一下ESSD云盘的云盘性能级别PL3、PL2、PL1、PL0相关知识点。
阿里云服务器ESSD云盘性能等级PL0、PL1、PL2、PL3区别,云盘性能级别PL知识点参考
|
4月前
|
人工智能 Shell Python
2026 AI 漫剧高清量产优化教程|基于本地 AI 工具库的漫剧补帧、超分修复、防抖消闪全链路落地
本方案提供全套本地AI漫剧画质优化工具链:8G显卡即可运行,全程离线免费。针对线条模糊、帧闪、发虚、卡顿等90%漫剧常见问题,集成超分、补帧、稳色、压制五大模块,一键批量生成60帧高清成片。资源已打包至夸克网盘,开箱即用。
3180 1
|
4月前
|
自然语言处理 安全 API
通义千问大模型完整解析:核心能力、性能优势、行业落地与官方定价全解读
大模型技术正在深度重构各行各业的生产模式,从日常办公辅助、代码开发、内容创作,到企业业务流程改造、智能客服、法律文档处理、工业质检,大模型的应用边界持续拓宽。通义千问作为阿里云自研的通用大模型体系,拥有完整的模型矩阵,覆盖旗舰大参数模型、均衡通用模型、轻量极速模型、多模态视觉音频模型、代码专项模型,同时对外开放标准化API接口,支持个人开发者、中小企业、大型政企客户不同层级的业务需求。很多开发者与企业在选型的时候,会困惑不同模型版本之间的能力差异,不清楚各项功能的适用边界,对计费定价、订阅套餐、落地适配方案缺少完整认知。本文将从核心功能、性能优势、各行业落地场景、官方定价体系几个维度展开讲解,
6471 1
|
4月前
|
人工智能 自然语言处理 开发者
Token Plan个人版Pro套餐499元/月,适合什么人用?额度有多大?
阿里云百炼Token Plan个人版Pro套餐499元/月(原价600元),7天40,000 Credits,支持6-8个Agent并发,专为高频使用AI编程/智能体工具的重度个人开发者设计。阿里云Token Plan官网:https://t.aliyun.com/U/EsRjVx
|
5月前
|
人工智能 运维 IDE
最新版 Cursor(AI 编程 IDE) 功能介绍及接入阿里云百炼 Coding Plan、Token Plan 教程
在AI赋能软件工程的新时代,传统代码编辑器仅能实现基础语法编辑、文件管理,无法适配复杂项目重构、多文件联动开发、自动化调试、智能工程规划等高阶需求。市面多数AI编程工具存在模型单一、计费昂贵、网络不稳定、无法深度融入IDE工作流等痛点,严重制约开发者常态化提效。**新版Cursor AI编程IDE**作为基于VS Code内核重构的原生AI代码编辑器,并非简单插件赋能,而是从底层深度集成全链路AI编程能力,保留轻量化、高兼容、高自定义的原生优势,同时搭载全局智能补全、多文件批量重构、Agent自主工程开发、长上下文项目理解、终端联动运维等高阶功能,成为当下开发者主流AI编程IDE工具。
895 0
|
12月前
|
人工智能
基于vite7.2+vue3.5+deepseek-v3.2高颜值流式ai会话助手
基于vue3.5+vite7.2+vant4+markdown+openai深度集成deepseek-v3.2聊天大模型。支持浅色+深色主题、stream流式输出、代码高亮、复制代码、katex公式、mermaid图表等功能。
586 4
|
消息中间件 运维 应用服务中间件
“企业微信iPad协议”凌晨断链:当最后一台测试机决定集体沉默
凌晨1:12,三连报警突响:“实例心跳超时”“消息队列堆积”“老板提刀赶来”。问题源于企业微信iPad协议迁移私有化后,因新旧CA根证书不兼容,触发TLS握手失败,导致全量会话中断。苹果严苛的证书校验机制将请求判定为中间人攻击,直接断连。排查抓包定位:客户端内置证书Pin仅认旧根。解决方案简单却关键:F5重导旧根证书,Nginx配置`ssl_trusted_certificate`指向旧链并reload。2:58,系统恢复,演练数据零丢失。教训深刻:文档未提CA白名单,真实逻辑藏于客户端二进制。部署前务必比对证书指纹,否则警报先于用户消息抵达。
756 1
|
存储 运维 监控
光,让云计算跑得更快
深耕技术、不断创新,让云计算继续 “光”速发展!
光,让云计算跑得更快
|
人工智能 架构师 机器人
我是怎么把我的 AI 从“傻瓜”重构成“专家”的
本文分享了一次 Agent 项目的重构经验,讲述如何将一个僵化、被动的指令式系统,升级为具备内在驱动力的“专家”Agent。通过引入“动机层”和“成长机制”,让 Agent 更加主动、灵活并能自我优化,最终实现从“流水线工人”到“资深顾问”的蜕变。
|
人工智能 前端开发 API
手动开发?给我一条提示词,CodeBuddy能做的你都做不到!
本文介绍了使用CodeBuddy完成的一个五一期间的小项目,主要展示其编码能力。项目采用基础的HTML+CSS+JS实现界面,也提到可用React或Next.js复刻。文章重点讲解了通过提示词生成代码的方法,包括局部和整体两种方式,并展示了AI旅行规划功能的实现过程。通过与模型对话调整细节,最终生成满意的界面。CodeBuddy在前后端开发中表现出强大能力,未来可结合绘画作品生成惊艳网站。