zainali5120
2020-09-20 3ffaa6bf323862a3770897d4e934baf98d324c47
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
package com.xcong.excoin.modules.blackchain.service;
 
import com.alibaba.fastjson.JSONObject;
import com.xcong.excoin.modules.blackchain.model.RocCreateAcoountModel;
import org.apache.commons.lang3.StringUtils;
 
/**
 *  ROC币种接入
 */
public class RocService {
 
    private final static String URL = "http://api.rocwallet.cc";
 
    private final static String CREATE_WALLET= "/init/createaccount";
    public static String createWallet(){
        RocCreateAcoountModel createAcoountModel = new RocCreateAcoountModel();
        createAcoountModel.setPassword("123456");
        createAcoountModel.setTerminalId("rocexcoin");
        createAcoountModel.setWalletName("coin");
        String post = HttpUtil.jsonPost(URL+CREATE_WALLET, JSONObject.toJSONString(createAcoountModel));
        if(StringUtils.isBlank(post)){
            return null;
        }
        JSONObject jsonObject = JSONObject.parseObject(post);
        Object code = jsonObject.get("code");
        if("0".equals(code.toString())){
            Object o = jsonObject.getJSONObject("data").get("address");
            return o.toString();
        }
        return null;
    }
 
}