需要向企业微信创建成员,找到了地方,怎么运行呢?求帮助

/**
	 * 创建成员
	 */
	public void createUser() {
		String json = "{\"userid\": \"Javen205\"," + "\"name\": \"Javen205\"," + "\"department\": [3],"
				+ "\"position\": \"产品经理\"," + "\"mobile\": \"\"," + "\"gender\": \"1\"," + "\"email\": \"\","
				+ "\"weixinid\": \"Javen205\","
				// +"\"avatar_mediaid\":
				// \"2-G6nrLmr5EC3MNb_-zL1dDdzkd0p7cNliYu9V5w7o8K0\","
				+ "\"extattr\": {\"attrs\":[{\"name\":\"爱好\",\"value\":\"旅游\"},{\"name\":\"卡号\",\"value\":\"1234567234\"}]}}";
		System.out.println(json);
		ApiResult apiResult = ConUserApi.createUser(json);
		renderText(apiResult.getJson());
	}

上面是代码原本的,需要运行创建新成员。

public static void main(String[] args) {
		JFinal.start("src/main/webapp", 8080, "/", 5);//启动配置项
	}

然后这个运行后出现了

Starting JFinal 3.1

Starting scanner at interval of 5 seconds.

Starting web server on port: 8080

Starting Complete. Welcome To The JFinal World :)

  

然后不知道第一段代码应该放到什么地方运行,然后在企业微信里面可以创建新成员,但是不知道放在那里运行。

也许是个特别简单的问题,刚刚做这个企业微信,求帮助,谢谢!

评论区

JFinal

2017-11-08 17:47

参考这里的 demo :
https://gitee.com/jfinal/jfinal-weixin/tree/master/src/main/java/com/jfinal/weixin/demo

xiaoaqiang

2017-11-09 09:21

@JFinal 波总,这些demo找到了,但是比如我想运行一下:

public void createUser() {
String json = "{\"userid\": \"Javen205\"," + "\"name\": \"Javen205\"," + "\"department\": [3],"
+ "\"position\": \"产品经理\"," + "\"mobile\": \"\"," + "\"gender\": \"1\"," + "\"email\": \"\","
+ "\"weixinid\": \"Javen205\","
// +"\"avatar_mediaid\":
// \"2-G6nrLmr5EC3MNb_-zL1dDdzkd0p7cNliYu9V5w7o8K0\","
+ "\"extattr\": {\"attrs\":[{\"name\":\"爱好\",\"value\":\"旅游\"},{\"name\":\"卡号\",\"value\":\"1234567234\"}]}}";
System.out.println(json);
ApiResult apiResult = ConUserApi.createUser(json);
renderText(apiResult.getJson());
}

应该放到哪里运行呢?

JFinal

2017-11-09 10:34

@xiaoaqiang 两个办法二选一:
1:做个 action,在浏览器地址栏里面输入 url 请求这个 action
2:写个 main 方法主动调用

xiaoaqiang

2017-11-09 13:46

@JFinal 波总,调用还需要改什么配置的东西嘛?

热门反馈

扫码入社