summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--query.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/query.c b/query.c
index 336f0c5..80b92aa 100644
--- a/query.c
+++ b/query.c
@@ -70,6 +70,9 @@ int handle_inline(struct TdUpdateNewInlineQuery *update) {
}
goto cleanup;
}
+ if ((r = sqlite3_bind_int64(stmt_personal_stat, 2, update->sender_user_id_))) {
+ goto sql_err;
+ }
switch (r = sqlite3_step(stmt_personal_stat)) {
case SQLITE_ROW: {
@@ -86,7 +89,11 @@ int handle_inline(struct TdUpdateNewInlineQuery *update) {
}
}
- snprintf(msg_stat, sizeof(msg_stat), "我已经卖了 %d 句菜,TGCN 排名 %d / %d", personal_stat, ranking, total);
+ if (ranking > 0) {
+ snprintf(msg_stat, sizeof(msg_stat), "我已经卖了 %d 句菜,TGCN 排名 %d / %d", personal_stat, ranking, total);
+ } else {
+ snprintf(msg_stat, sizeof(msg_stat), "您从未卖过菜!");
+ }
snprintf(id_temp, sizeof(id_temp), "s%lld", update->sender_user_id_);
results_inline[0] = create_inline_result(id_temp, "卖菜统计", "点击发送卖菜统计", msg_stat);
effective_items_count++;