only one account per fcm_token

This commit is contained in:
2018-11-12 15:19:10 +01:00
parent faf5207478
commit 3f18fdd35a
7 changed files with 32 additions and 11 deletions

View File

@@ -15,7 +15,7 @@ $user_key = $INPUT['user_key'];
$pdo = getDatabase();
$stmt = $pdo->prepare('SELECT user_id, user_key, quota_today, is_pro, quota_day FROM users WHERE user_id = :uid LIMIT 1');
$stmt = $pdo->prepare('SELECT user_id, user_key, quota_today, is_pro, quota_day, fcm_token FROM users WHERE user_id = :uid LIMIT 1');
$stmt->execute(['uid' => $user_id]);
$datas = $stmt->fetchAll(PDO::FETCH_ASSOC);
@@ -33,11 +33,12 @@ if ($data['quota_day'] === null || $data['quota_day'] !== date("Y-m-d")) $quota=
echo json_encode(
[
'success' => true,
'user_id' => $user_id,
'quota' => $quota,
'quota_max' => Statics::quota_max($is_pro),
'is_pro' => $is_pro,
'message' => 'ok'
'success' => true,
'user_id' => $user_id,
'quota' => $quota,
'quota_max' => Statics::quota_max($is_pro),
'is_pro' => $is_pro,
'fcm_token_set' => ($data['fcm_token'] != null),
'message' => 'ok'
]);
return 0;