package com.offcn.TestUnti;

import io.restassured.RestAssured;
import io.restassured.response.Response;

public class GetVerifyCode {

	//获取验证码的前置信息
	public static RestAssured getVerifyCode() {
		RestAssured ra_VerifyCode = new RestAssured();
		ra_VerifyCode.baseURI = "http://106.75.3.8";
		ra_VerifyCode.port = 8765;
		ra_VerifyCode.basePath = "/puhui-notification-server/api/v1/message/query";
		return ra_VerifyCode;
	}

	//获取验证码并分析出返回
	public static String getGetResponse(String phone) {
		RestAssured ra_VerifyCode = new RestAssured();
		ra_VerifyCode.baseURI = "http://106.75.3.8";
		ra_VerifyCode.port = 8765;
		ra_VerifyCode.basePath = "/puhui-notification-server/api/v1/message/query";
		Response ra_VerifyCode1 = ra_VerifyCode.given().param("mobile", phone).get();
		String str2 = ra_VerifyCode1.body().jsonPath().getString("消息内容").split(",")[0]
				.split("：")[1].trim().toString();
		
		return str2;
	}
}
