1: | <?php
|
2: | namespace Opencart\Catalog\Model\Account;
|
3: | |
4: | |
5: | |
6: | |
7: |
|
8: | class Activity extends \Opencart\System\Engine\Model {
|
9: | |
10: | |
11: | |
12: | |
13: | |
14: | |
15: | |
16: |
|
17: | public function addActivity(string $key, array $data): void {
|
18: | if (isset($data['customer_id'])) {
|
19: | $customer_id = $data['customer_id'];
|
20: | } else {
|
21: | $customer_id = 0;
|
22: | }
|
23: |
|
24: | $this->db->query("INSERT INTO `" . DB_PREFIX . "customer_activity` SET `customer_id` = '" . (int)$customer_id . "', `key` = '" . $this->db->escape($key) . "', `data` = '" . $this->db->escape(json_encode($data)) . "', `ip` = '" . $this->db->escape($this->request->server['REMOTE_ADDR']) . "', `date_added` = NOW()");
|
25: | }
|
26: |
|
27: | |
28: | |
29: | |
30: | |
31: | |
32: | |
33: |
|
34: | public function deleteActivities(int $customer_id): void {
|
35: | $this->db->query("DELETE FROM `" . DB_PREFIX . "customer_activity` WHERE `customer_id` = '" . (int)$customer_id . "'");
|
36: | }
|
37: | }
|
38: | |