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