本文整理汇总了Java中com.taobao.api.DefaultTaobaoClient类的典型用法代码示例。如果您正苦于以下问题:Java DefaultTaobaoClient类的具体用法?Java DefaultTaobaoClient怎么用?Java DefaultTaobaoClient使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
DefaultTaobaoClient类属于com.taobao.api包,在下文中一共展示了DefaultTaobaoClient类的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: SendPhoneToCustom
import com.taobao.api.DefaultTaobaoClient; //导入依赖的package包/类
@RequestMapping(path = "/phone/send", method = RequestMethod.POST)
public PhoneVo SendPhoneToCustom(@RequestBody PhoneVo vo) throws ApiException {
System.err.println(vo.getPhone());
vo.setCode(RandomStringUtils.randomNumeric(6));
// 24619654
String url = "https://eco.taobao.com/router/rest";
String appkey = "";
String secret = "a68a283919212762db0f58132e1c76bd";
TaobaoClient client = new DefaultTaobaoClient(url, appkey, secret);
AlibabaAliqinFcSmsNumSendRequest req = new AlibabaAliqinFcSmsNumSendRequest();
req.setExtend("123456");
req.setSmsType("normal");
req.setSmsFreeSignName("数盟");
req.setSmsParamString("{\"code\":\"" + vo.getCode() + "\"}");
req.setRecNum(vo.getPhone());
req.setSmsTemplateCode("SMS_94715134");
AlibabaAliqinFcSmsNumSendResponse rsp = client.execute(req);
System.out.println(rsp.getBody());
return vo;
}
开发者ID:514840279,项目名称:danyuan-application,代码行数:23,代码来源:SimapleMailRegist.java
示例2: send
import com.taobao.api.DefaultTaobaoClient; //导入依赖的package包/类
/**
* 发送短信
*/
public String send(String mobiles, String templateId, String jsonContent) throws Exception {
TaobaoClient client = new DefaultTaobaoClient(url, appKey, appSecret);
AlibabaAliqinFcSmsNumSendRequest req = new AlibabaAliqinFcSmsNumSendRequest();
req.setSmsType("normal");
req.setSmsFreeSignName(sign);
req.setSmsParamString(jsonContent);
req.setRecNum(mobiles);
req.setSmsTemplateCode(templateId);
AlibabaAliqinFcSmsNumSendResponse rsp = client.execute(req);
if (!rsp.isSuccess()) {
logger.error("send sms fail. return code: {}, value:{}. please check service return value!", rsp.getErrorCode(), rsp.getMsg());
throw new Exception("send sms fail. res=" + rsp.getErrorCode());
}
return rsp.getMsg();
}
开发者ID:lemon-china,项目名称:lemon-dubbo-message,代码行数:19,代码来源:AlismsClient.java
示例3: getSellerInfo
import com.taobao.api.DefaultTaobaoClient; //导入依赖的package包/类
public void getSellerInfo() {
// 实例化TopClient类
TaobaoClient client = new DefaultTaobaoClient(serverUrl, appkey, appSecret);
// 实例化具体API对应的Request类
UserSellerGetRequest req = new UserSellerGetRequest();
req.setFields("nick, user_id, type");
// req.setNick("sandbox_c_1");
// 执行API请求并打印结果
UserSellerGetResponse response;
try {
response = client.execute(req, sessionkey);
System.out.println("result: " + response.getBody());
} catch (ApiException e) {
e.printStackTrace();
}
}
开发者ID:colddew,项目名称:mix-web,代码行数:21,代码来源:TopAPI.java
示例4: verifyCode
import com.taobao.api.DefaultTaobaoClient; //导入依赖的package包/类
public String verifyCode(User user) throws Exception {
String url = "http://gw.api.taobao.com/router/rest";
int code = VerifyCodeUtil.createVerifyCode();
TaobaoClient client = new DefaultTaobaoClient(url,
"23780335",
"e158afdc661f0d72cf0855b05900f774");
AlidayuSMS alidayuSMS = new AlidayuSMS();
alidayuSMS.setCode(String.valueOf(code));
alidayuSMS.setName(user.getUserName());
ObjectMapper objectMapper = new ObjectMapper();
String json = objectMapper.writeValueAsString(alidayuSMS);
AlibabaAliqinFcSmsNumSendRequest req = new AlibabaAliqinFcSmsNumSendRequest();
//必须填写normal
req.setSmsType("normal");
//应用名称
req.setSmsFreeSignName("WIFI探针管理平台");
//电话号码
req.setRecNum(user.getUserName());
//模板
req.setSmsTemplateCode("SMS_74350014");
req.setExtend(user.getUserName());
req.setSmsParamString(json);
try {
AlibabaAliqinFcSmsNumSendResponse rsp = client.execute(req);
user.setVerifyCode(String.valueOf(code));
user.setVerifyTime(String.valueOf(new Date()));
System.out.println(rsp.getBody());
// HttpSession session = request.getSession();
// session.setAttribute("verifyCode", String.valueOf(code));
//int res = userMapper.updateVerifyCode(user);
int res = userMapper.updateVerifyCode(user);
System.err.println("验证码" + code);
return String.valueOf(code);
} catch (Exception e) {
e.printStackTrace();
return "";
}
}
开发者ID:wanghan0501,项目名称:WiFiProbeAnalysis,代码行数:41,代码来源:LoginServiceImpl.java
示例5: send
import com.taobao.api.DefaultTaobaoClient; //导入依赖的package包/类
/**
* 发送短信
*/
public Map send(PageData pageData){
Map<String,String> map=new HashMap<>();
try {
String recNum=pageData.getString("recNum");
String msgCode=pageData.getString("msgCode");
TaobaoClient client = new DefaultTaobaoClient(url, appkey, secret);
AlibabaAliqinFcSmsNumSendRequest req = new AlibabaAliqinFcSmsNumSendRequest();
req.setExtend(pageData.getString("extend"));
req.setSmsType("normal");
req.setSmsFreeSignName(pageData.getString("smsFreeSignName"));
req.setSmsParamString(pageData.getString("smdParam"));
req.setRecNum(recNum);
req.setSmsTemplateCode(pageData.getString("smsTemplateCode"));
AlibabaAliqinFcSmsNumSendResponse rsp = client.execute(req);
String res=rsp.getBody();
PageData retData=JSON.parseObject(res, PageData.class);
if(retData.containsKey("error_response")){
map.put("state", "0");
map.put("msg", res);
return map;
}else{
map.put("state", "1");
map.put("msg", res);
return map;
}
}catch(Exception e){
map.put("state", "0");
map.put("msg", "程序错误");
return map;
}
}
开发者ID:noseparte,项目名称:Spring-Boot-Server,代码行数:36,代码来源:SendMsgUtils.java
注:本文中的com.taobao.api.DefaultTaobaoClient类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论