对接运营商权威数据源，根据手机号判断手机号的在网状态。

## 接口说明
+ 只支持移动，电信，联通下发的手机卡，广电号暂不支持
+ 超时时间建议设置为5S。

### 鉴权说明
易盾信息认证服务使用签名方法对接口进行鉴权，所有接口每一次请求都需要包含签名信息（signature参数），以验证用户身份，防止信息被恶意篡改。目前支持MD5，SHA1，SHA256，SM3几种加密算法，详细信息，请参见[接口鉴权](https://support.dun.163.com/documents/391676076156063744?docId=622572798032863232)

## 请求
### 请求地址
| 名称 | 值 |
| --- | --- |
| HTTP URL | [http://verify.dun.163.com/v2/idlephone/check](http://verify.dun.163.com/v1/facedetect/check) |
| HTTP Method | POST |


### 请求头
| 名称 | 类型 | 必填 | 描述 |
| --- | --- | --- | --- |
| Content-Type | String | 是 | 固定值："application/x-www-form-urlencoded" |


### 请求参数
请求参数由请求公共参数和请求业务参数两部分组成，通用参数见[请求通用字段](https://support.dun.163.com/documents/391676076156063744?docId=622573136165068800)

| 参数名称 | 类 型 | 必填 | 最大长度 | 描述 |
| --- | --- | --- | --- | --- |
| phone | String | 是 | 32 | 检测手机号，仅支持国内11位号码，建议开发者增加手机号真实性校验来防刷，检测手机号，仅支持国内11位号码，建议开发者增加手机号真实性校验来防刷。若encryptType为0，该字段为 11 位手机号码。若encryptType为2，该字段为 AES加密后手机号码。若encryptType为1，该字段为 32 位加密的 MD5字符串。 |
| encryptType | String | 是 | 4 | 手机号序列加密方式。支持明文和AES两种方式。 0：不加密。1：MD5方式。2：AES方式，加密密钥为易盾方分配的secretKey。

默认为0，即不加密 |


### 请求体示例
```plain
phone=136xxxxxxxxx&encryptType=0&version=v1&businessId=xxx&timestamp=1638180222235&nonce=xxx&secretId=xxx&signature=xxx
```

## 响应
### 响应结果
响应字段如下，响应通用字段已省略，详细见[响应公共字段](https://support.dun.163.com/documents/391676076156063744?docId=624032228347863040)

| 参数名称 | 类型 | 必须返回 | 描述 |
| --- | --- | --- | --- |
| status | Number | 是 | 检测结果，1 成功，2 失败。 |
| requestId | String | 是 | 本次请求数据标识，可以根据该标识查询数据最新结果。 |
| isPayed | Number | 是 | 本次请求是否收费标识，1代表收费，0代表不收费。 |
| phoneInfo | Object | 否 | 查询的手机号信息。 |
| ∟ mobile | String | 否       |手机号，若入参encryptType字段选择的是加密，则该字段不返回数值  |
| ∟ area   | String | 否       | 手机号所属区域。样例：省-市。 受运营商的限制，有不返回数值的可能性 |
| ∟ numberType | String | 否       | 手机号运营商类型，枚举值<br/>1：移动<br/>2：联通<br/>3：电信 |
| ∟ status | String | 是 | 检测结果，枚举值：<br/>0：正常使用 1：停机 2：在网但不可用 3：不在网/销号/未启用/异常 4：预销户 5：参数不正确或不规范 6：查无记录（号码已收回或者号码从未放出）7：数据源异常，请重试 8：号码频繁使用（24小时内15次）|


### 响应体示例
```plain
{
  "code": 200,
  "msg": "ok",
  "result": {
    "requestId": "2b9314ed5c804e88b1a759e222b41e86",
    "status": 1,
    "isPayed": 1,
    "phoneInfo": {
      "mobile": "136xxxxxxxxx",
      "area": "浙江-杭州",
      "numberType": "1",
      "status": "0"
    }
  }
}
```

### 响应返回码
响应返回码见：[响应返回码](https://support.dun.163.com/documents/391676076156063744?docId=624032338595143680)

### AES加密代码
```plain
import javax.crypto.Cipher;
import javax.crypto.spec.SecretKeySpec;
import org.apache.commons.codec.binary.Base64;
import org.apache.commons.codec.digest.DigestUtils;

public class SecurityAESTool {
    /**
     * AES加密
     *
     * @param str
     *            明文
     * @param key
     *            秘钥
     * @return
     */
    public static String encrypt(String str, String key) {
        byte[] crypted = null;
        try {
            SecretKeySpec skey = new SecretKeySpec(key.getBytes("UTF-8"), "AES");
            Cipher cipher = Cipher.getInstance("AES/ECB/PKCS5Padding");
            cipher.init(Cipher.ENCRYPT_MODE, skey);
            String enStr = str;
            crypted = cipher.doFinal(enStr.getBytes("UTF-8"));
        } catch (Exception e) {
            System.out.println(e.toString());
        }
        String body = Base64.encodeBase64String(crypted);
        return body;
    }

    /**
     * AES解密
     *
     * @param input
     * @param key
     * @return
     */
    public static String decrypt(String input, String key) {
        byte[] output = null;
        String body = null;
        if (input == null || key == null) {
            return null;
        }
        try {
            SecretKeySpec skey = new SecretKeySpec(key.getBytes("UTF-8"), "AES");
            Cipher cipher = Cipher.getInstance("AES/ECB/PKCS5Padding");
            cipher.init(Cipher.DECRYPT_MODE, skey);
            byte[] b = Base64.decodeBase64(input);
            // 解密
            output = cipher.doFinal(b);
            body = new String(output, "UTF-8");
        } catch (Exception e) {
            System.out.println(e.toString());
        }
        return body;
    }

    public static void main(String[] args) {
        String key = "12345678123456781234567812345678"; // 易盾分配的密钥
        String data = "12312341234"; // 手机号
        String encodeKey = DigestUtils.md5Hex(key).toLowerCase().substring(0, 16);
        String enStr = SecurityAESTool.encrypt(data, encodeKey);
        System.out.println(enStr);
    }
}
```