mirror of
https://github.com/sctn4elk/CustomerRewardsRESTAPI.git
synced 2025-01-10 05:34:29 -06:00
Clean up, fix attribute update query
This commit is contained in:
parent
c67b95240b
commit
fc0237ef43
|
@ -115,7 +115,7 @@ class AttributeController extends BaseController {
|
||||||
$this->attributeModel->attributeId = $input['LOYALTY_ATTRIBUTE_ID'];
|
$this->attributeModel->attributeId = $input['LOYALTY_ATTRIBUTE_ID'];
|
||||||
|
|
||||||
$result = $this->attributeModel->findMemberAttribute();
|
$result = $this->attributeModel->findMemberAttribute();
|
||||||
if (! $result) {
|
if (!$result) {
|
||||||
return $this->notFoundResponse("attributeModel->findMemberAttribute");
|
return $this->notFoundResponse("attributeModel->findMemberAttribute");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,14 +1,15 @@
|
||||||
<?php
|
<?php
|
||||||
header("Content-Type: multipart/form-data");
|
|
||||||
header("Access-Control-Allow-Origin: *");
|
|
||||||
|
|
||||||
require_once PD . "/Model/ImageModel.php";
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Description of ImageController
|
* Description of ImageController
|
||||||
*
|
*
|
||||||
* @author Mike Howard
|
* @author Mike Howard
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
header("Content-Type: multipart/form-data");
|
||||||
|
header("Access-Control-Allow-Origin: *");
|
||||||
|
|
||||||
|
require_once PD . "/Model/ImageModel.php";
|
||||||
|
|
||||||
class ImageController extends BaseController {
|
class ImageController extends BaseController {
|
||||||
|
|
||||||
public $imageModel;
|
public $imageModel;
|
||||||
|
|
|
@ -80,7 +80,7 @@ class AttributeModel extends Database {
|
||||||
$query .= "'" . $jsonPayLoad[$keys[$i]] . "', ";
|
$query .= "'" . $jsonPayLoad[$keys[$i]] . "', ";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
$query .= $jsonPayLoad[$keys[$i]] . ")";
|
$query .= "'" . $jsonPayLoad[$keys[$i]] . "')";
|
||||||
|
|
||||||
$rowCount = $this->processStatement($query);
|
$rowCount = $this->processStatement($query);
|
||||||
return $rowCount;
|
return $rowCount;
|
||||||
|
|
|
@ -24,7 +24,7 @@ class Database {
|
||||||
public function processQuery($query = "", $params = [])
|
public function processQuery($query = "", $params = [])
|
||||||
{
|
{
|
||||||
try {
|
try {
|
||||||
$stmt = $this->connection->prepare( $query );
|
$stmt = $this->connection->prepare($query);
|
||||||
if($stmt === false) {
|
if($stmt === false) {
|
||||||
throw New Exception("Unable to do prepared statement: " . $query);
|
throw New Exception("Unable to do prepared statement: " . $query);
|
||||||
}
|
}
|
||||||
|
@ -59,7 +59,8 @@ class Database {
|
||||||
$rowCount = $this->connection->affected_rows;
|
$rowCount = $this->connection->affected_rows;
|
||||||
if($rowCount < 1)
|
if($rowCount < 1)
|
||||||
{
|
{
|
||||||
throw New Exception("Statement did not return any rows: " . $query);
|
$msg = "Statement did not return any rows: " . $query;
|
||||||
|
return $this->unprocessableQueryResponse($msg);
|
||||||
}
|
}
|
||||||
|
|
||||||
$stmt->close();
|
$stmt->close();
|
||||||
|
@ -77,18 +78,18 @@ class Database {
|
||||||
$result = $this->connection->query($query."(".$imageModel->memberId.", '".$imageModel->imageType."', '".$data."')");
|
$result = $this->connection->query($query."(".$imageModel->memberId.", '".$imageModel->imageType."', '".$data."')");
|
||||||
|
|
||||||
if($result === false) {
|
if($result === false) {
|
||||||
$msg = "Unable to execute the statement: " . $query;
|
$msg = "Unable to execute the statement: " . $data;
|
||||||
return $this->unprocessableQueryResponse($msg);
|
return $this->unprocessableQueryResponse($msg);
|
||||||
}
|
}
|
||||||
|
|
||||||
$rowCount = $this->connection->affected_rows;
|
$rowCount = $this->connection->affected_rows;
|
||||||
if($rowCount < 1)
|
if($rowCount < 1)
|
||||||
{
|
{
|
||||||
$msg = "Statement did not return any rows: " . $query;
|
$msg = "Statement did not return any rows: " . $data;
|
||||||
return $this->unprocessableQueryResponse($msg);
|
return $this->unprocessableQueryResponse($msg);
|
||||||
}
|
}
|
||||||
} catch(Exception $e) {
|
} catch(Exception $e) {
|
||||||
$msg = $query . " " . $e->getMessage();
|
$msg = $data . " " . $e->getMessage();
|
||||||
return $this->unprocessableQueryResponse($msg);
|
return $this->unprocessableQueryResponse($msg);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -72,6 +72,6 @@ class ImageModel extends Database {
|
||||||
|
|
||||||
public function returnImageBlob()
|
public function returnImageBlob()
|
||||||
{
|
{
|
||||||
|
throw New Exception("Not Implemented");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user