Skip to content

Commit d208b2f

Browse files
committed
add lang config
1 parent 868d50a commit d208b2f

File tree

4 files changed

+8
-2
lines changed

4 files changed

+8
-2
lines changed

include/tigerapi/client_config.h

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,9 +29,9 @@ namespace TIGER_API {
2929
account(std::move(account)) {};
3030

3131
ClientConfig(utility::string_t tiger_id, utility::string_t private_key, utility::string_t account,
32-
bool sandbox_debug = false) :
32+
bool sandbox_debug = false, utility::string_t lang = U("en_US")) :
3333
tiger_id(std::move(tiger_id)), private_key(std::move(private_key)),
34-
account(std::move(account)), sandbox_debug(sandbox_debug) {
34+
account(std::move(account)), sandbox_debug(sandbox_debug), lang(lang) {
3535
if (sandbox_debug) {
3636
server_url = SANDBOX_TIGER_SERVER_URL;
3737
server_public_key = SANDBOX_TIGER_PUBLIC_KEY;
@@ -44,6 +44,7 @@ namespace TIGER_API {
4444
utility::string_t account;
4545
utility::string_t charset = U("UTF-8");
4646
utility::string_t sign_type = U("RSA");
47+
utility::string_t lang;
4748

4849
void set_server_url(const utility::string_t &url) {
4950
this->server_url = url;

include/tigerapi/constants.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ static utility::string_t P_METHOD = U("method");
1010
static utility::string_t P_CHARSET = U("charset");
1111
static utility::string_t P_SIGN_TYPE = U("sign_type");
1212
static utility::string_t P_SIGN = U("sign");
13+
static utility::string_t P_LANG = U("lang");
1314
static utility::string_t P_TIMESTAMP = U("timestamp");
1415
static utility::string_t P_VERSION = U("version");
1516
static utility::string_t P_ITEMS = U("items");

src/main.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -348,6 +348,7 @@ int main(int argc, char *args[]) {
348348
U("-----END RSA PRIVATE KEY-----");
349349
config.tiger_id = U("2");
350350
config.account = U("402901");
351+
// config.lang = U("en_US");
351352

352353

353354
/**

src/tiger_client.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,9 @@ namespace TIGER_API {
6969
for (const auto &kvp: common_params.as_object()) {
7070
params[kvp.first] = kvp.second;
7171
}
72+
if (!client_config.lang.empty()) {
73+
body[P_LANG] = value::string(client_config.lang);
74+
}
7275
if (!body.is_null() && body.size() > 0) {
7376
params[P_BIZ_CONTENT] = value::string(body.serialize());
7477
}

0 commit comments

Comments
 (0)