|
|
|
@ -13,12 +13,17 @@ public class NumberCodeController {
|
|
|
|
|
public String numberCode(@PathVariable("size") int size){
|
|
|
|
|
System.out.println("size:"+size);
|
|
|
|
|
|
|
|
|
|
//获取随机数
|
|
|
|
|
double mathRandom =( Math.random()*9 + 1) * (Math.pow(10,size -1));
|
|
|
|
|
int numberCode = (int) mathRandom;
|
|
|
|
|
|
|
|
|
|
JSONObject resultObj = new JSONObject();
|
|
|
|
|
resultObj.put("code",1);
|
|
|
|
|
resultObj.put("message","success");
|
|
|
|
|
JSONObject jsonObjectData = new JSONObject();
|
|
|
|
|
jsonObjectData.put("numberCode",123456);
|
|
|
|
|
jsonObjectData.put("numberCode",numberCode);
|
|
|
|
|
resultObj.put("data",jsonObjectData);
|
|
|
|
|
return resultObj.toString();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|