本文整理汇总了PHP中Customers::findWithUuid方法的典型用法代码示例。如果您正苦于以下问题:PHP Customers::findWithUuid方法的具体用法?PHP Customers::findWithUuid怎么用?PHP Customers::findWithUuid使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Customers
的用法示例。
在下文中一共展示了Customers::findWithUuid方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getAll
public function getAll($uuid)
{
$customers = Customers::findWithUuid($uuid);
if (empty($customers)) {
throw new Shineisp_Api_Exceptions(400006, ":: 'uuid' not valid");
exit;
}
$id = $customers['customer_id'];
$services = Products::getAllServicesByCustomerID($id, 'o.order_id, oi.detail_id as detail_id, pd.name as productname,
DATE_FORMAT(oi.date_start, "%d/%m/%Y") AS date_start, DATE_FORMAT(oi.date_end, "%d/%m/%Y") AS date_end,
DATEDIFF(oi.date_end, CURRENT_DATE) AS daysleft, oi.price as price, oi.autorenew as autorenew, oi.uuid as uuid, s.status as status');
return $services;
}
示例2: update
public function update($uuid, $params)
{
$this->authenticate();
$form = new Api_Form_CustomerForm(array('action' => '#', 'method' => 'post'));
if (array_key_exists('countrycode', $params)) {
$country_id = Countries::getIDbyCode($params['countrycode']);
if ($country_id == null) {
throw new Shineisp_Api_Exceptions(400005, ":: 'countrycode' not valid");
exit;
}
unset($params['coutrycode']);
$params['country_id'] = $country_id;
}
if (array_key_exists('provincecode', $params) && $params['provincecode'] != "") {
$params['area'] = $params['provincecode'];
unset($params['provincecode']);
}
if ($form->isValid($params)) {
if ($params['status'] == false) {
$params['status'] = 'disabled';
}
$customer = Customers::findWithUuid($uuid);
if (empty($customer)) {
return false;
}
$customerid = $customer['customer_id'];
// $data = explode('/', $params['birthdate']);
// list( $gg, $mm, $yyyy ) = $data;
// $params['birthdate'] = $yyyy.'-'.$mm.'-'.$gg;
foreach ($customer as $name => &$value) {
if (array_key_exists($name, $params)) {
$value = $params[$name];
}
}
$fields = $params;
unset($fields['address']);
unset($fields['contact']);
Customers::saveAll($customerid, $fields);
$address = array();
$address['address'] = $params['address'];
$address['city'] = $params['city'];
$address['code'] = $params['code'];
$address['area'] = $params['area'];
$address['region_id'] = $params['regionid'];
$address['country_id'] = $params['country_id'];
$address['customer_id'] = $customerid;
if ($params['addressid'] != 0) {
Addresses::AddNew($address, $params['addressid']);
} else {
Addresses::AddNew($address);
}
if (array_key_exists('contacts', $params) && !empty($params['contacts'])) {
foreach ($params['contacts'] as $contact) {
if ($contact['contact'] == "") {
continue;
}
$c = array();
$c['contact'] = $contact['contact'];
$c['type_id'] = $contact['contacttypes'];
$c['customer_id'] = $customerid;
if (intval($contact['idcontact']) != 0) {
Contacts::AddNew($c, intval($contact['idcontact']));
} else {
Contacts::AddNew($c);
}
}
}
return true;
} else {
$errors = $form->getMessages();
$message = "";
foreach ($errors as $field => $errorsField) {
$message .= "Field '{$field}'<br/>";
foreach ($errorsField as $error => $describe) {
$message .= " => {$error} ({$describe})";
}
}
throw new Shineisp_Api_Exceptions(400004, ":\n{$message}");
exit;
}
}
示例3: delete
public function delete($uuid, $order_uuid = null, $service_uuid)
{
$this->authenticate();
$customers = Customers::findWithUuid($uuid);
if (empty($customers)) {
throw new Shineisp_Api_Exceptions(400007, ":: 'uuid' not valid");
exit;
}
$id = $customers['customer_id'];
if ($order_uuid == null && $service_uuid == null) {
throw new Shineisp_Api_Exceptions(400007, ":: 'order_uuid' not valid and 'service_uuid' not valid");
}
#TODO get order from $order_uuid
if ($service_uuid != null) {
$objService = OrdersItems::findByUUID($service_uuid);
if ($objService == false) {
return false;
}
$service = $objService->toArray();
$orderid = $service['order_id'];
Orders::DeleteByID($orderid, $id);
}
}