当前位置: 首页>>代码示例>>PHP>>正文


PHP EnmasseHelper::checkCupponOfMerchant方法代码示例

本文整理汇总了PHP中EnmasseHelper::checkCupponOfMerchant方法的典型用法代码示例。如果您正苦于以下问题:PHP EnmasseHelper::checkCupponOfMerchant方法的具体用法?PHP EnmasseHelper::checkCupponOfMerchant怎么用?PHP EnmasseHelper::checkCupponOfMerchant使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在EnmasseHelper的用法示例。


在下文中一共展示了EnmasseHelper::checkCupponOfMerchant方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: update

 function update()
 {
     $dAuthorId = $this->checkAccess();
     $action = JRequest::getVar('newStatus');
     $coupon = JRequest::getVar('coupon');
     //Check whether coupon belong this merchant or not
     if (!EnmasseHelper::checkCupponOfMerchant($coupon, $dAuthorId)) {
         $msg = JText::_('MERCHANT_INVALID_COUPON_SERIAL');
         $this->setRedirect("index.php?option=com_enmasse&controller=merchant&task=dealCouponMgmt", $msg, "error");
         return;
     }
     $invty = JModel::getInstance('invty', 'enmasseModel')->getByName($coupon);
     if (!$invty) {
         $msg = JText::_('MERCHANT_INVALID_COUPON_SERIAL');
         $this->setRedirect("index.php?option=com_enmasse&controller=merchant&task=dealCouponMgmt", $msg, "error");
     } else {
         $orderItem = JModel::getInstance('orderItem', 'enmasseModel')->getById($invty->order_item_id);
         if ($orderItem->status != "Delivered") {
             $msg = JText::_('COUPON_STATUS_ERROR') . "(" . $invty->name . " - " . $orderItem->status . ")";
             $this->setRedirect("index.php?option=com_enmasse&controller=merchant&task=dealCouponMgmt&filter[deal_id]={$orderItem->pdt_id}", $msg, 'error');
         } elseif ($action == "Used") {
             $invty = JModel::getInstance('invty', 'enmasseModel')->getByName($coupon);
             if ($invty->status == "Used") {
                 $msg = JText::_('COUPON_ALREADY_IN_USE') . '(' . $invty->name . ")";
                 $this->setRedirect("index.php?option=com_enmasse&controller=merchant&task=dealCouponMgmt&filter[deal_id]={$orderItem->pdt_id}", $msg, 'error');
             } else {
                 JModel::getInstance('invty', 'enmasseModel')->updateStatusByName($coupon, "Used");
                 $msg = JText::_('COUPON_STATUS_UPDATE') . '(' . $invty->name . ")";
                 $this->setRedirect("index.php?option=com_enmasse&controller=merchant&task=dealCouponMgmt&filter[deal_id]={$orderItem->pdt_id}", $msg);
             }
         } else {
             JModel::getInstance('invty', 'enmasseModel')->updateStatusByName($coupon, "Taken");
             $msg = JText::_('COUPON_STATUS_UPDATE') . '(' . $invty->name . ")";
             $this->setRedirect("index.php?option=com_enmasse&controller=merchant&task=dealCouponMgmt&filter[deal_id]={$orderItem->pdt_id}", $msg);
         }
     }
 }
开发者ID:marsa1985,项目名称:kazabiz,代码行数:37,代码来源:merchant.php

示例2: markUnused

 public function markUnused()
 {
     //authenticate user
     $oSession = $this->authenticate();
     $result = array();
     $invtyName = JRequest::getVar('qr_code', '', 'post');
     if (!EnmasseHelper::checkCupponOfMerchant($invtyName, $oSession->merchant_id)) {
         $result[EM_WS_FIELD_TYPE] = EM_WS_TYPE_ERROR;
         $result[EM_WS_FIELD_MESSAGE] = JText::_("MERCHANT_WS_INVALID_COUPON_CODE");
         $result[EM_WS_FIELD_DATA] = "";
     } else {
         $oInvty = JModel::getInstance('invty', 'enmasseModel')->getByName($invtyName);
         $orderItem = JModel::getInstance('orderItem', 'enmasseModel')->getById($oInvty->order_item_id);
         if ($orderItem->status != "Delivered") {
             $result[EM_WS_FIELD_TYPE] = EM_WS_TYPE_ERROR;
             $result[EM_WS_FIELD_MESSAGE] = JText::_('COUPON_STATUS_ERROR') . "(" . $oInvty->name . " - " . $orderItem->status . ")";
             $result[EM_WS_FIELD_DATA] = "";
         }
         if ($oInvty->status == "Taken") {
             $result[EM_WS_FIELD_TYPE] = EM_WS_TYPE_ERROR;
             $result[EM_WS_FIELD_MESSAGE] = JText::_('COUPON_ALREADY_IN_TAKEN') . '(' . $oInvty->name . ")";
             $result[EM_WS_FIELD_DATA] = "";
         } else {
             JModel::getInstance('invty', 'enmasseModel')->updateStatusByName($invtyName, "Taken");
             $result[EM_WS_FIELD_TYPE] = EM_WS_TYPE_OK;
             $result[EM_WS_FIELD_MESSAGE] = JText::_('COUPON_STATUS_UPDATE') . '(' . $oInvty->name . ")";
             $result[EM_WS_FIELD_DATA] = "";
         }
     }
     //update user session
     $this->updateSession();
     //return result
     echo json_encode($result);
     die;
 }
开发者ID:marsa1985,项目名称:kazabiz,代码行数:35,代码来源:webservice.php


注:本文中的EnmasseHelper::checkCupponOfMerchant方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。