apis_v1_dev.cc 1.2 KB

12345678910111213141516171819202122232425262728293031
  1. /*
  2. * @Author: error: git config user.name && git config user.email & please set dead value or install git
  3. * @Date: 2022-07-10 21:57:33
  4. * @LastEditors: error: git config user.name && git config user.email & please set dead value or install git
  5. * @LastEditTime: 2022-07-10 22:06:15
  6. * @FilePath: /gsd/controllers/apis_v1_dev.cc
  7. * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
  8. */
  9. #include "apis_v1_dev.h"
  10. using namespace apis::v1;
  11. // Add definition of your processing function here
  12. void dev::postExpel(const HttpRequestPtr& req, std::function<void (const HttpResponsePtr &)> &&callback, std::string commandCode){
  13. if(Expel::getPtr()->getExpelSize() == 0){
  14. auto *pluginPtr=app().getPlugin<httpHelper>();
  15. callback(pluginPtr->makeWrongReply("设备列表为空"));
  16. }
  17. Expel::getPtr()->Controler(commandCode);
  18. HttpResultMsg<HttpNull, HttpNull> request;
  19. std::string json;
  20. request.code = "200";
  21. request.msg = "成功";
  22. request.ok = true;
  23. request.objectToJson(json);
  24. HttpResponsePtr resp;
  25. resp = HttpResponse::newHttpResponse();
  26. resp->setBody(json);
  27. callback(resp);
  28. }