package com.yxcheng.token.common.controller;

import com.yxcheng.token.common.model.CrRpcResult;
import com.yxcheng.token.common.model.RestfulApi;
import com.yxcheng.token.common.model.SafeModel;

import net.sf.json.JSONObject;


public class BaseClientController {

    @Deprecated
    public boolean isSafe(SafeModel model, CrRpcResult result){
        JSONObject data = new JSONObject();
        data.put("accessKeyID",model.getAccessKeyID());
        data.put("signature",model.getSignature());
        data.put("signatureNonce",model.getSignatureNonce());
        data.put("timeStamp",model.getTimeStamp());
        data.put("version",model.getVersion());
        data.put("data","");

        RestfulApi apiModel = new RestfulApi();
//        return RestFulCheckFactory.newInstance().createCheckService().checkData(data.toString(),apiModel,result);
        return true;
    }


    public boolean checkUserSafe(CrRpcResult result){
        return result!=null && "0".equals(result.getCode());
    }
}
