-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathProcessor.h
More file actions
90 lines (83 loc) · 3.69 KB
/
Processor.h
File metadata and controls
90 lines (83 loc) · 3.69 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
#ifndef _Processor_H_
#define _Processor_H_
#include <util/tc_singleton.h>
#include "login.pb.h"
#include "LoginProto.h"
#include <curl/curl.h>
#include <json/json.h>
#include "UserInfoProto.h"
#include "CommonStruct.pb.h"
//
using namespace tars;
/**
*请求处理类
*
*/
class Processor
{
public:
Processor();
~Processor();
public:
//查询
int SelectUserAccount(long uid, userinfo::GetUserResp &rsp);
//查询
int SelectUserInfo(long uid, userinfo::GetUserBasicResp &rsp);
//更新用户第三方信息
int UpdateUserThirdInfo(const userinfo::UpdateUserInfoReq &req, userinfo::UpdateUserInfoResp &rsp);
//账号登录
int UserLogin(const LoginProto::UserLoginReq &req, LoginProto::UserLoginResp &rsp, const map<string, string> &extraInfo);
//登出
int UserLogout(const LoginProto::LogoutReq &req, LoginProto::LogoutResp &rsp, bool sysOp = false, string ip = "");
//游客登录
int DeviceLogin(const LoginProto::DeviceLoginReq &req, LoginProto::DeviceLoginResp &rsp, const map<string, string> &extraInfo);
//快速登录
int QuickLogin(const LoginProto::QuickLoginReq &req, LoginProto::QuickLoginResp &rsp, const map<string, string> &extraInfo);
//第三方登录
int ThirdPartyLogin(const LoginProto::ThirdPartyLoginReq &req, LoginProto::ThirdPartyLoginResp &rsp, const map<string, string> &extraInfo);
//账号注册处理
int UserRegister(const LoginProto::RegisterReq req, LoginProto::RegisterResp &rsp, const string &ip);
//账号注册处理
int UserRegister2(const LoginProto::RegisterReq req, LoginProto::RegisterResp &rsp, const map<std::string, std::string> &extraInfo);
//账号注册处理
int ThirdRegister(const LoginProto::RegisterReq req, LoginProto::RegisterResp &rsp, userinfo::UpdateUserInfoReq &userInfo, const int regType, const string &ip);
//账号注册处理
int UserRegister(const login::RegisterReq req, login::RegisterResp &rsp, int areaID, string ip);
//手机号码登录
int PhoneLogin(const LoginProto::PhoneLoginReq &req, LoginProto::PhoneLoginResp &rsp, const map<string, string> &extraInfo);
//发送手机验证码
int PhoneMsgCode(const LoginProto::SendPhoneMessageCodeReq &req, LoginProto::SendPhoneMessageCodeResp &rsp);
//发送网关信息
int UserRounter(const LoginProto::UserRounterInfoReq &req, LoginProto::UserRounterInfoResp &rsp);
//绑定三方账号
int BindThirdPartyAccount(const login::BindThirdPartyAccountReq &req, login::BindThirdPartyAccountResp &rsp);
private:
//产生uuid串
string generateUUIDStr();
//
int httpGet(const char *url, std::string &resJson);
//
int httpPost(const char *url, const std::string &postParams, std::string &resJson);
//
int getUserInfoFromGoogle(const std::string &tokenid, const std::string &openid, userinfo::UpdateUserInfoReq &req);
//
int getUserInfoFromApple(const std::string &tokenid, userinfo::UpdateUserInfoReq &req);
//
int getUserInfoFromFacebook(const std::string &tokenid, userinfo::UpdateUserInfoReq &req);
//
int checkFacebookAuth(const std::string &input_token);
//
int sendAuthCode(const std::string &phone, const tars::Int32 &smsCode);
//
int setAuthData(const std::string &phone, const tars::Int32 &smsCode);
//
int getAuthData(const std::string &phone, std::string &ret);
//
int delAuthData(const std::string &phone);
public:
//
bool ConvertJwkToPem(const std::string &strnn, const std::string &stree, std::string &strPubKey);
};
//singleton
typedef TC_Singleton<Processor, CreateStatic, DefaultLifetime> ProcessorSingleton;
#endif