Files
2024-11-11 18:46:54 +01:00

31 lines
1.0 KiB
PHP

<?php
class inpostshipsetUserPointModuleFrontController extends ModuleFrontController
{
public function initContent()
{
parent::initContent();
$id_customer = (int)$_REQUEST['id'];
$point = $_REQUEST['point'];
$return = false;
$issetPoint = Db::getInstance()->getRow('SELECT * FROM `'._DB_PREFIX_.'inpostship_user_point` WHERE `id_customer` = '.(int)$id_customer);
if (empty($issetPoint)) {
$return = (bool)Db::getInstance()->insert('inpostship_user_point', array(
'id_customer' => (int)$id_customer,
'point' => $point,
'date_add' => date('Y-m-d H:i:s'),
'date_upd' => date('Y-m-d H:i:s'),
));
} else {
$return = (bool)Db::getInstance()->update('inpostship_user_point', array(
'point' => $point,
'date_upd' => date('Y-m-d H:i:s'),
), 'id_user_point = '.(int)$issetPoint['id_user_point']);
}
echo json_encode($return);
exit();
}
}