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


PHP QueryBuilder::getInstance方法代码示例

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


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

示例1: callbackGateway

 public function callbackGateway()
 {
     $au = $_GET['au'];
     $ref_id = $_GET['order_id'];
     if (strlen($au) > 4) {
         $payment = Cshop::app()->getDb()->prepare(QueryBuilder::getInstance()->select()->from('payment')->where('reference = ?'));
         $payment->execute(array($au));
         $payment = $payment->fetch();
         $merchantID = $this->merchant;
         $amount = round($payment['amount'] / 10);
         $client = new nusoap_client('http://jahanpay.com/webservice?wsdl', 'wsdl');
         $res = $client->call("verification", array($merchantID, $amount, $au));
         if ($payment['status'] == Application::STATUS_PENDING) {
             if (!empty($res) and $res == 1) {
                 return $payment;
             } else {
                 $message = 'پرداخت توسط جهان پی انجام نشده است .';
             }
         } else {
             $message = 'سفارش قبلا پرداخت شده است.';
         }
     } else {
         $message = 'شماره یکتا اشتباه است.';
     }
     throw new Exception($message);
 }
开发者ID:aliazizi,项目名称:CShop,代码行数:26,代码来源:Jahanpay.php

示例2: callbackGateway

 public function callbackGateway()
 {
     $merchantID = $this->merchantID;
     $au = preg_replace('/[^a-z0-9]/', '', $_GET['au']);
     $ref_id = $_GET['order_id'];
     if (strlen($au) > 4) {
         $payment = Cshop::app()->getDb()->prepare(QueryBuilder::getInstance()->select()->from('payment')->where('id = ?'));
         $payment->execute(array($au));
         $payment = $payment->fetch();
         $amount = round($payment['amount'] / 10);
         $client = new nusoap_client('https://www.sibapal.com/payment/wsdl?wsdl', 'wsdl');
         $res = $client->call("verify", array($merchantID, $amount, $au));
         if ($payment['status'] == Application::STATUS_PENDING) {
             if (!empty($res) and $res == 1) {
                 return $payment;
             } else {
                 $message = 'پرداخت توسط سیباپال انجام نشده است .';
             }
         } else {
             $message = 'سفارش قبلا پرداخت شده است.';
         }
     } else {
         $message = 'شماره یکتا اشتباه است.';
     }
     throw new Exception($message);
 }
开发者ID:aliazizi,项目名称:CShop,代码行数:26,代码来源:Sibapal.php

示例3: callbackGateway

 public function callbackGateway()
 {
     global $db, $get;
     $Status = $_POST['status'];
     $Refnumber = $_POST['refnumber'];
     $Resnumber = $_POST['resnumber'];
     if ($Status == 100) {
         $ParspalPin = trim($this->merchant);
         $pass = $this->pass;
         $payment = Cshop::app()->getDb()->prepare(QueryBuilder::getInstance()->select()->from('payment')->where('reference = ?'));
         $payment->execute(array($Resnumber));
         $payment = $payment->fetch();
         $amount = round($payment['amount'] / 10);
         $soapclient = new nusoap_client('http://merchant.parspal.com/WebService.asmx?wsdl', 'wsdl');
         $params = array('MerchantID' => $ParspalPin, 'Password' => $pass, 'Price' => $amount, 'RefNum' => $Refnumber);
         $res = $soapclient->call('verifyPayment', $params);
         $Status = $res['verifyPaymentResult']['ResultStatus'];
         if (strtolower($Status) == 'success') {
             return $payment;
         } else {
             $message = 'پرداخت ناموفق است. خطا';
         }
     } else {
         $message = 'پرداخت ناموفق است. خطا';
     }
     throw new Exception($message);
 }
开发者ID:aliazizi,项目名称:CShop,代码行数:27,代码来源:Parspal.php

示例4: callbackGateway

 public function callbackGateway()
 {
     $result = $_POST['Result'];
     $requestId = $_POST['RequestId'];
     $followCode = $_POST['FollowCode'];
     $payment = Cshop::app()->getDb()->prepare(QueryBuilder::getInstance()->select()->from('payment')->where('reference = ?'));
     $payment->execute(array($requestId));
     $amount = round($payment['amout']);
     if ($payment['status'] == Application::STATUS_PENDING) {
         if ($result == 0) {
             if ($_POST[Amount] != $payment['amout']) {
                 $message = 'در اطلاعات پرداختي مغايرت وجود دارد';
             } else {
                 $backResult = file("http://www.sharjiran.net/asan_pardakht/CheckPay2.php?FollowCode={$followCode}&RequestId={$requestId}");
                 if ($backResult[0] == 0 && (int) $backResult[1] == (int) $payment['amout'] && $backResult[2] == trim($this->AccountNumber)) {
                     return $payment;
                 } else {
                     $message = 'تراكنش موفقيت آميز نبود';
                 }
             }
         } else {
             if ($result == -1) {
                 $message = 'در اتصال به درگاه بانك مشكلي پيش آمده يا اينكه اطلاعات پرداختي شما نامعتبر بوده است. ';
             }
         }
     } else {
         $message = 'سفارش قبلا پرداخت شده است.';
     }
     throw new Exception($message);
 }
开发者ID:aliazizi,项目名称:CShop,代码行数:30,代码来源:Sharjiran.php

示例5: loadPlugin

 public static function loadPlugin($id)
 {
     $sql = CShop::app()->getDb()->prepare(QueryBuilder::getInstance()->select('*')->from('plugin')->leftJoin('option')->on('category = `class`')->where('plugin.id = ?'));
     $sql->execute(array($id));
     $sql = $sql->fetchAll();
     $class = $sql[0]['class'];
     return new $class($sql[0]['id'], $sql);
 }
开发者ID:aliazizi,项目名称:CShop,代码行数:8,代码来源:PluginBase.php

示例6: getParameters

 public static function getParameters()
 {
     $inputs = CShop::app()->getDb()->query(QueryBuilder::getInstance()->select()->from('input')->order('`order`'))->fetchAll();
     $range = array();
     foreach ($inputs as $input) {
         $range[$input['id']] = $input['name'];
     }
     return array('input' => array('name' => 'فیلد ورودی', 'type' => 'select', 'range' => $range), 'from' => array('name' => 'ایمیل فرستنده'), 'fromname' => array('name' => 'نام فرستنده'), 'subject' => array('name' => 'موضوع ایمیل'), 'signature' => array('name' => 'امضا', 'type' => 'textarea'), 'smtpauth' => array('name' => 'ارسال با SMTP', 'type' => 'select', 'range' => array(0 => 'غیر فعال', 1 => 'فعال')), 'smtpusername' => array('name' => 'نام کاربری SMTP'), 'smtppassword' => array('name' => 'کلمه عبور SMTP', 'type' => 'password'), 'smtphost' => array('name' => 'سرور SMTP'), 'smtpport' => array('name' => 'پورت SMTP'), 'smtpsecure' => array('name' => 'امنیت SMTP'));
 }
开发者ID:aliazizi,项目名称:CShop,代码行数:9,代码来源:SendMail.php

示例7: updateUser

 public function updateUser(&$payment, &$items)
 {
     $sql = CShop::app()->getDb()->prepare(QueryBuilder::getInstance()->select('field.name,item.id')->from('item')->leftJoin('product')->on('product.id = item.productid')->leftJoin('field')->on('field.productid = product.id')->where('paymentid = ? AND type="ibsnggroup"'));
     $sql->execute(array($payment['id']));
     $sql = $sql->fetch();
     $group = $sql['name'];
     $ibs = new IBSngHelper($this->username, $this->password, $this->server);
     $ibs->chargeUser($group, $payment['input'][$this->usernameinput]['value'], $payment['input'][$this->passwordinput]['value']);
     $items[$sql['id']][] = array('fieldname' => $payment['input'][$this->usernameinput]['name'], 'type' => 'text', 'value' => $payment['input'][$this->usernameinput]['value']);
     $items[$sql['id']][] = array('fieldname' => $payment['input'][$this->passwordinput]['name'], 'type' => 'text', 'value' => $payment['input'][$this->passwordinput]['value']);
 }
开发者ID:aliazizi,项目名称:CShop,代码行数:11,代码来源:IBSng.php

示例8: callbackGateway

 public function callbackGateway()
 {
     if ($_POST['status'] != '1') {
         $message = 'پرداخت با موفقيت انجام نشده است.';
         throw new Exception($message);
     }
     $refID = $_POST['refnum'];
     $resCode = $_POST['resnum'];
     $id = $this->merchantID;
     $payment = Cshop::app()->getDb()->prepare(QueryBuilder::getInstance()->select()->from('payment')->where('id = ?'));
     $payment->execute(array($resCode));
     $payment = $payment->fetch();
     if ($payment['status'] == Application::STATUS_PENDING) {
         $amount = $payment['amount'];
         $url = 'http://bazpardakht.com/webservice/verify.php';
         $fields = array('id' => urlencode($id), 'resnum' => urlencode($resCode), 'refnum' => urlencode($refID), 'amount' => urlencode($amount / 10));
         //url-ify the data for the POST
         $fields_string = "";
         foreach ($fields as $key => $value) {
             $fields_string .= $key . '=' . $value . '&';
         }
         rtrim($fields_string, '&');
         //open connection
         $ch = curl_init($url);
         //set the url, number of POST vars, POST data
         curl_setopt($ch, CURLOPT_URL, $url);
         curl_setopt($ch, CURLOPT_POST, count($fields));
         curl_setopt($ch, CURLOPT_POSTFIELDS, $fields_string);
         curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
         //execute post
         $result = curl_exec($ch);
         curl_close($ch);
         $result = intval($result);
         $pay = false;
         if ($result <= 0) {
             $pay = false;
         } elseif ($result == '1') {
             $pay = true;
         }
         ///////////////////
         if ($pay) {
             return $payment;
         } else {
             $message = 'خطا در پرداخت';
         }
     } else {
         $message = 'این سفارش قبلا پرداخت شده است.';
     }
     throw new Exception($message);
 }
开发者ID:aliazizi,项目名称:CShop,代码行数:50,代码来源:Bazpardakht.php

示例9: callbackGateway

 public function callbackGateway()
 {
     $api = $this->pin;
     $url = 'http://payline.ir/payment-test/gateway-result-second';
     $trans_id = $_POST['trans_id'];
     $id_get = $_POST['id_get'];
     $result = $this->get($url, $api, $trans_id, $id_get);
     if ($result == 1) {
         $payment = Cshop::app()->getDb()->prepare(QueryBuilder::getInstance()->select()->from('payment')->where('reference = ?'));
         $payment->execute(array($id_get));
         $payment = $payment->fetch();
         if ($payment) {
             return $payment;
         } else {
             $message = 'اطلاعات پرداخت کامل نیست.';
         }
     } else {
         $message = 'پرداخت موفقيت آميز نبود';
     }
     throw new Exception($message);
 }
开发者ID:aliazizi,项目名称:CShop,代码行数:21,代码来源:Payline.php

示例10: callbackGateway

 public function callbackGateway()
 {
     $Authority = $_GET['Authority'];
     $ref_id = $_GET['refID'];
     if ($_GET['Status'] == 'OK') {
         $payment = Cshop::app()->getDb()->prepare(QueryBuilder::getInstance()->select()->from('payment')->where('reference = ?'));
         $payment->execute(array($Authority));
         $amount = round($payment['amout'] / 10);
         $client = new nusoap_client('https://de.zarinpal.com/pg/services/WebGate/wsdl', 'wsdl');
         $res = $client->call("PaymentVerification", array(array('MerchantID' => $this->merchant, 'Authority' => $Authority, 'Amount' => $amount)));
         if ($payment[payment_status] == Application::STATUS_PENDING) {
             if ($res['Status'] == 100) {
                 return $payment;
             } else {
                 $message = 'پرداخت توسط زرین‌پال تایید نشد‌.' . $res['Status'];
             }
         } else {
             $message = 'سفارش قبلا پرداخت شده است.';
         }
     } else {
         $message = 'شماره یکتا اشتباه است.';
     }
     throw new Exception($message);
 }
开发者ID:aliazizi,项目名称:CShop,代码行数:24,代码来源:Zarinpal.php

示例11: callbackGateway

 public function callbackGateway()
 {
     $au = $_SESSION['siba_au'];
     $order_id = $_SESSION['invoice_id'];
     $pin = $this->merchantID;
     $payment = Cshop::app()->getDb()->prepare(QueryBuilder::getInstance()->select()->from('payment')->where('reference = ?'));
     $payment->execute(array($au));
     $payment = $payment->fetch();
     $amount = round($payment['amount'] / 10);
     $bank_return = $_POST + $_GET;
     $res = $this->verify($pin, $amount, $au, $order_id, $bank_return);
     if ($payment['status'] == Application::STATUS_PENDING) {
         if (empty($res)) {
             $message = 'خطا در اتصال به سرور !';
         } elseif ($res['result'] == 1) {
             return $payment;
         } else {
             $message = 'پرداخت  انجام نشده است . <br /> شرح خطا : ' . urldecode($res['msg']);
         }
     } else {
         $message = 'سفارش قبلا پرداخت شده است.';
     }
     throw new Exception($message);
 }
开发者ID:aliazizi,项目名称:CShop,代码行数:24,代码来源:Sibapalp.php

示例12: actionPayment

 public function actionPayment()
 {
     $message['content'] = '';
     $this->pageTitle = 'پرداخت';
     $items = array();
     try {
         if (!isset($_GET['gateway'])) {
             throw new Exception('اطلاعات پرداخت کامل نمی باشد');
         }
         $gateway = $this->db->prepare(QueryBuilder::getInstance()->select()->from('gateway')->leftJoin('option')->on('class = category')->where('gateway.id = ?'));
         $gateway->execute(array($_GET['gateway']));
         $gateway = $gateway->fetchAll();
         if (!$gateway[0]) {
             throw new Exception('اطلاعات پرداخت کامل نمی باشد');
         }
         CShop::import(Cshop::$gatewaypath . DIRECTORY_SEPARATOR . $gateway[0]['class'] . '.php');
         /* @var $plugin GatewayBase */
         $plugin = new $gateway[0]['class']($gateway[0]['id'], $gateway);
         $payment = $plugin->callbackGateway();
         if (!$payment) {
             throw new Exception('اطلاعات پرداخت کامل نمی باشد');
         }
         if ($payment['status'] == Application::STATUS_PENDING) {
             $sql = $this->db->prepare(QueryBuilder::getInstance()->update('payment')->set('status = ?,paymenttime=?')->where('id = ?'));
             $sql->execute(array($payment['status'] = Application::STATUS_COMPLETE, time(), $payment['id']));
             $sql = $this->db->prepare(QueryBuilder::getInstance()->update('item')->set('status = ?')->where('paymentid = ?'));
             $sql->execute(array(Application::STATUS_COMPLETE, $payment['id']));
             $sql = $this->db->prepare(QueryBuilder::getInstance()->select('item.*,value.fieldid,value,field.name AS fieldname,field.type,product.name,product.description')->from('item')->leftJoin('product')->on('product.id = item.productid')->leftJoin('value')->on('item.id = itemid')->leftJoin('field')->on('fieldid = field.id')->where('paymentid = ?'));
             $sql->execute(array($payment['id']));
             while ($item = $sql->fetch()) {
                 $items[$item['id']][] = $item;
             }
             $message['content'] = 'پرداخت با موفقیت انجام شد';
             $message['type'] = 'success';
             $sql = CShop::app()->getDb()->prepare(QueryBuilder::getInstance()->select('input.*,value')->from('payment_meta')->leftJoin('input')->on('inputid = input.id')->where('paymentid = ?'));
             $sql->execute(array($payment['id']));
             $payment['input'] = array();
             while ($row = $sql->fetch()) {
                 $row['data'] = unserialize($row['data']);
                 $payment['input'][$row['id']] = $row;
             }
             CShop::app()->raise(Application::EVENT_AFTER_PAYMENT, array(&$payment, &$items));
         } else {
             throw new Exception('این سفارش قبلا پرداخت شده است.');
         }
     } catch (Exception $e) {
         $message['content'] = $e->getMessage();
     }
     $this->layout = 'layout/payment';
     CShop::app()->raise(Application::EVENT_ITEM_TYPE);
     $this->render('site/payment', array('message' => $message, 'items' => $items));
 }
开发者ID:aliazizi,项目名称:CShop,代码行数:52,代码来源:Controller.php

示例13: deleteInput

 public static function deleteInput($id)
 {
     $input = array();
     $sql = CShop::app()->getDb()->prepare(QueryBuilder::getInstance()->delete('input')->where('id=?'));
     $sql->execute(array($id));
 }
开发者ID:aliazizi,项目名称:CShop,代码行数:6,代码来源:Input.php

示例14: actionStatistic

 public function actionStatistic()
 {
     $message = $this->user->message();
     if (isset($_POST['update'])) {
         foreach ($_POST['order'] as $key => $value) {
             $sql = $this->db->prepare(QueryBuilder::getInstance()->update('category')->set('`order` = ?')->where('id = ?'));
             $sql->execute(array($value, $key));
         }
         $message['content'] = 'تغییرات با موفقیت ذخیره شد';
         $message['type'] = 'success';
         $this->user->message($message);
         CShop::app()->redirect('category.php');
     } elseif (isset($_POST['remove'])) {
         foreach ($_POST['delete'] as $value) {
             $sql = $this->db->prepare(QueryBuilder::getInstance()->delete('category')->where('id = ?'));
             $sql->execute(array($value));
         }
         $message['content'] = 'تغییرات با موفقیت ذخیره شد';
         $message['type'] = 'success';
         $this->user->message($message);
         CShop::app()->redirect('category.php');
     }
     $categories = new Model($this->db->query(QueryBuilder::getInstance()->select()->from('category')->order('`order`')));
     $this->render('admin/category', array('message' => $message, 'items' => $categories));
 }
开发者ID:aliazizi,项目名称:CShop,代码行数:25,代码来源:adminController.php

示例15: actionImport

    /**
     * @param Controller $controller
     */
    public function actionImport($controller)
    {
        $content = '<div class="title">انتفال</div>';
        $db = CShop::app()->getDb();
        $lasterrormode = $db->getAttribute(PDO::ATTR_ERRMODE);
        $db->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_SILENT);
        if (isset($_POST['start'])) {
            try {
                $freerdb = new Database(true, $this->dbname, $this->dbserver, $this->dbusername, $this->dbpassword);
                //Payment import
                $items = $freerdb->query(QueryBuilder::getInstance('')->select()->from('payment'));
                $paymentids = array();
                while ($row = $items->fetch()) {
                    $sql = $db->prepare(QueryBuilder::getInstance()->insert('payment')->into(array('amount', 'requesttime', 'status', 'clientip', 'paymenttime', 'reference', 'gatewayid'), true, false));
                    $status = $row['payment_status'] == 1 ? Application::STATUS_PENDING : Application::STATUS_COMPLETE;
                    $sql->execute(array($row['payment_amount'], $row['payment_time'], $status, $row['payment_ip'], $row['payment_time'], $row['payment_res_num'], $this->gatewayid));
                    $paymentids[$row['payment_id']] = $db->lastInsertId();
                    if ($this->email) {
                        $sql = $db->prepare(QueryBuilder::getInstance()->insert('payment_meta')->into(array('inputid', 'paymentid', 'value'), true, false));
                        $sql->execute(array($this->email, $paymentids[$row['payment_id']], $row['payment_email']));
                    }
                    if ($this->mobile) {
                        $sql = $db->prepare(QueryBuilder::getInstance()->insert('payment_meta')->into(array('inputid', 'paymentid', 'value'), true, false));
                        $sql->execute(array($this->mobile, $paymentids[$row['payment_id']], $row['payment_mobile']));
                    }
                }
                //Category import
                $items = $freerdb->query(QueryBuilder::getInstance('')->select()->from('category'));
                $categoryids = array();
                while ($row = $items->fetch()) {
                    $sql = $db->prepare(QueryBuilder::getInstance()->insert('category')->into(array('name', 'description', '`order`'), true, false));
                    $sql->execute(array($row['category_title'], '', $row['category_order']));
                    $categoryids[$row['category_id']] = $db->lastInsertId();
                }
                //Product AND item import
                $items = $freerdb->query(QueryBuilder::getInstance('')->select()->from('product'));
                while ($row = $items->fetch()) {
                    $sql = $db->prepare(QueryBuilder::getInstance()->insert('product')->into(array('name', 'description', 'price', '`order`', 'categoryid'), true, false));
                    $sql->execute(array($row['product_title'], $row['product_body'], $row['product_price'], 0, $categoryids[$row['product_category']]));
                    $productid = $db->lastInsertId();
                    $sql = $db->prepare(QueryBuilder::getInstance()->insert('field')->into(array('productid', 'name', 'type'), true, false));
                    $sql->execute(array($productid, $row['product_first_field_title'], 'text'));
                    $field1 = $db->lastInsertId();
                    $sql = $db->prepare(QueryBuilder::getInstance()->insert('field')->into(array('productid', 'name', 'type'), true, false));
                    $sql->execute(array($productid, $row['product_second_field_title'], 'text'));
                    $field2 = $db->lastInsertId();
                    $sql = $db->prepare(QueryBuilder::getInstance()->insert('field')->into(array('productid', 'name', 'type'), true, false));
                    $sql->execute(array($productid, $row['product_third_field_title'], 'text'));
                    $field3 = $db->lastInsertId();
                    $cards = $freerdb->query(QueryBuilder::getInstance('')->select("*,DECODE(card_first_field,'{$this->salt}') AS card_first_field,DECODE(card_second_field,'{$this->salt}') AS card_second_field,DECODE(card_third_field,'{$this->salt}') AS card_third_field")->from('card')->where('card_product=' . $row['product_id']));
                    while ($card = $cards->fetch()) {
                        //pament id
                        $sql = $db->prepare(QueryBuilder::getInstance()->insert('item')->into(array('productid', 'status', 'createtime', 'paymentid'), true, false));
                        $status = $card['card_status'] == 1 ? Application::STATUS_PENDING : Application::STATUS_COMPLETE;
                        $sql->execute(array($productid, $status, $card['card_time'], $paymentids[$card['card_payment_id']]));
                        $itemid = $db->lastInsertId();
                        $sql = $db->prepare(QueryBuilder::getInstance()->insert('value')->into(array('fieldid', 'itemid', 'value'), true, false));
                        $sql->execute(array($field1, $itemid, $card['card_first_field']));
                        $sql = $db->prepare(QueryBuilder::getInstance()->insert('value')->into(array('fieldid', 'itemid', 'value'), true, false));
                        $sql->execute(array($field2, $itemid, $card['card_second_field']));
                        $sql = $db->prepare(QueryBuilder::getInstance()->insert('value')->into(array('fieldid', 'itemid', 'value'), true, false));
                        $sql->execute(array($field3, $itemid, $card['card_third_field']));
                    }
                }
                $content .= 'انتقال انجام شد';
            } catch (Exception $e) {
                $content .= 'خطا! ' . $e->getMessage();
            }
        } else {
            $content .= '<form method="post">
				<input type="submit" value="شروع" name="start">
			</form>';
        }
        $db->setAttribute(PDO::ATTR_ERRMODE, $lasterrormode);
        $controller->renderWithContent($content);
    }
开发者ID:aliazizi,项目名称:CShop,代码行数:79,代码来源:Freer.php


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