函数参数太多,嫌麻烦,又不想新建实体类,教你一招

 public void sendMessage(String code,String phone,String... params){

			  try {
				  SmsSendViaTemplateParam param=new SmsSendViaTemplateParam();
				  param.addParams(Lists.newArrayList(params));
				  param.setReceiver(phone);
				  param.setTemplateCode(code);
				 notificationServiceClient.sendViaTemplate(param);
			} catch (Exception e) {
				 logger.error("短信发送异常",e);
			}
		
	  }

猜你喜欢

转载自blog.csdn.net/a276202031/article/details/78739987