api_v1_User.hpp 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839
  1. /*
  2. * @Author: Your Name lishengyin@sz-sunwin.com
  3. * @Date: 2022-06-15 22:08:07
  4. * @LastEditors: Your Name lishengyin@sz-sunwin.com
  5. * @LastEditTime: 2022-06-16 22:40:11
  6. * @FilePath: /ins/source/controllers/include/api_v1_User.h
  7. * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
  8. */
  9. #pragma once
  10. #include <drogon/HttpController.h>
  11. using namespace drogon;
  12. namespace api
  13. {
  14. namespace v1
  15. {
  16. class User : public drogon::HttpController<User>
  17. {
  18. public:
  19. METHOD_LIST_BEGIN
  20. // use METHOD_ADD to add your custom processing function here;
  21. METHOD_ADD(User::login,"/token?userId={1}&passwd={2}",Post);
  22. METHOD_ADD(User::getInfo,"/{1}/info?token={2}",Get, "LoginFilter");
  23. METHOD_LIST_END
  24. // your declaration of processing function maybe like this:
  25. void login(const HttpRequestPtr &req,
  26. std::function<void (const HttpResponsePtr &)> &&callback,
  27. std::string &&userId,
  28. const std::string &password);
  29. void getInfo(const HttpRequestPtr &req,
  30. std::function<void (const HttpResponsePtr &)> &&callback,
  31. std::string userId,
  32. const std::string &token) const;
  33. };
  34. }
  35. }