新增开门指令
This commit is contained in:
@@ -1,11 +1,16 @@
|
||||
package com.yutou.qqbot.Controllers;
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.yutou.qqbot.QQBotManager;
|
||||
import com.yutou.qqbot.utlis.AppTools;
|
||||
import com.yutou.qqbot.utlis.HttpTools;
|
||||
import com.yutou.qqbot.utlis.RedisTools;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.ResponseBody;
|
||||
|
||||
import java.io.File;
|
||||
|
||||
@Controller
|
||||
public class AppController {
|
||||
@RequestMapping("/restart.do")
|
||||
@@ -40,10 +45,27 @@ public class AppController {
|
||||
return "0";
|
||||
} else if ("on".equals(status)) {
|
||||
return "2";
|
||||
}else if("over".equals(status)){
|
||||
RedisTools.set("door","ready");
|
||||
} else if ("over".equals(status)) {
|
||||
RedisTools.set("door", "ready");
|
||||
return "1";
|
||||
}
|
||||
return "-1";
|
||||
}
|
||||
|
||||
@ResponseBody
|
||||
@RequestMapping("/qq/send.do")
|
||||
public String sendQQ(JSONObject json) {
|
||||
File image = null;
|
||||
String ret;
|
||||
if (json.containsKey("image")) {
|
||||
image = HttpTools.syncDownload(json.getString("image"), System.currentTimeMillis() + ".png");
|
||||
}
|
||||
if (image != null) {
|
||||
ret = QQBotManager.getInstance().sendMessage(image, json.getLong("qq"), json.getString("message"));
|
||||
|
||||
} else {
|
||||
ret = QQBotManager.getInstance().sendMessage(json.getLong("qq"), json.getString("message"));
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user