@@ -50,10 +50,11 @@ discard block |
||
50 | 50 | $login_id = (int)$fetch['login_id']; |
51 | 51 | |
52 | 52 | // Unique Identifier |
53 | - if($login_id > $userId) |
|
54 | - $identifier = $userId.':'.$login_id; |
|
55 | - else |
|
56 | - $identifier = $login_id.':'.$userId; |
|
53 | + if($login_id > $userId) { |
|
54 | + $identifier = $userId.':'.$login_id; |
|
55 | + } else { |
|
56 | + $identifier = $login_id.':'.$userId; |
|
57 | + } |
|
57 | 58 | |
58 | 59 | $query = "SELECT total_messages from total_message where identifier = '$identifier'"; |
59 | 60 | if($result = $this->connect->query($query)) |
@@ -62,11 +63,12 @@ discard block |
||
62 | 63 | { |
63 | 64 | $total = $result->fetch_assoc(); |
64 | 65 | $total = $total['total_messages']; |
65 | - if($total - $load > 0) |
|
66 | - if($total - $load > 10) |
|
66 | + if($total - $load > 0) { |
|
67 | + if($total - $load > 10) |
|
67 | 68 | $add_load = $load + 10; |
68 | - else |
|
69 | - $add_load = $total; |
|
69 | + } else { |
|
70 | + $add_load = $total; |
|
71 | + } |
|
70 | 72 | } |
71 | 73 | } |
72 | 74 | |
@@ -84,8 +86,7 @@ discard block |
||
84 | 86 | |
85 | 87 | $this->array = array_merge([['name' => $fetch['name'], 'username' => $fetch['username'], 'id' => $fetch['login_id'], 'load' => $add_load, 'login_status' => $fetch['login_status'], 'type' => 1]], $this->array); |
86 | 88 | return json_encode($this->array); |
87 | - } |
|
88 | - else |
|
89 | + } else |
|
89 | 90 | { |
90 | 91 | return json_encode([['name' => $fetch['name'], 'username' => $fetch['username'], 'id' => $fetch['login_id'], 'login_status' => $fetch['login_status'], 'type' => 0]]); |
91 | 92 | } |