Exemple #1
0
 function callback($in, &$paymentId, &$money, &$message, &$tradeno)
 {
     $key = $this->getConf($paymentId, 'key');
     $v_oid = trim($_POST['v_oid']);
     // 商户发送的v_oid定单编号
     $v_pmode = trim($_POST['v_pmode']);
     // 支付方式(字符串)
     $v_pstatus = trim($_POST['v_pstatus']);
     // 支付状态 :20(支付成功);30(支付失败)
     $v_pstring = trim($_POST['v_pstring']);
     // 支付结果信息 : 支付完成(当v_pstatus=20时);失败原因(当v_pstatus=30时,字符串);
     $v_amount = trim($_POST['v_amount']);
     // 订单实际支付金额
     $v_moneytype = trim($_POST['v_moneytype']);
     // 订单实际支付币种
     $v_md5str = trim($_POST['v_md5str']);
     // 拼凑后的MD5校验值
     $md5string = strtoupper(md5($v_oid . $v_pstatus . $v_amount . $v_moneytype . $key));
     if ($v_md5str == $md5string) {
         $money = $v_amount;
         $tradeno = $v_oid;
         $message = $v_pstring;
         //支付单号
         switch ($v_pstatus) {
             case '20':
                 return PAY_SUCCESS;
                 break;
             case '30':
                 return PAY_FAILED;
                 break;
         }
     } else {
         IError::show(403, '校验码不正确');
     }
 }
Exemple #2
0
 public static function checkAdminRights()
 {
     $object = IWeb::$app->getController();
     $admin = array();
     $admin['admin_id'] = ISafe::get('admin_id');
     $admin['admin_name'] = ISafe::get('admin_name');
     $admin['admin_pwd'] = ISafe::get('admin_pwd');
     $admin['admin_role_name'] = ISafe::get('admin_role_name');
     if ($admin['admin_name'] == null || $admin['admin_pwd'] == null) {
         $object->redirect('/systemadmin/index');
         exit;
     }
     $adminObj = new IModel('admin');
     $adminRow = $adminObj->getObj("admin_name = '{$admin['admin_name']}'");
     if ($adminRow && $adminRow['password'] == $admin['admin_pwd'] && $adminRow['is_del'] == 0) {
         //非超管角色
         if ($adminRow['role_id'] != 0) {
             $roleObj = new IModel('admin_role');
             $where = 'id = ' . $adminRow["role_id"] . ' and is_del = 0';
             $roleRow = $roleObj->getObj($where);
             //角色权限校验
             if (self::checkRight($roleRow['rights']) == false) {
                 IError::show('503', 'no permission to access');
                 exit;
             }
         }
         $object->admin = $admin;
     } else {
         IError::show('503', 'no permission to access');
         exit;
     }
 }
Exemple #3
0
 /**
  * @brief 构造函数 初始化商品金额
  * @param float $sum 商品金额
  */
 function __construct($sum)
 {
     //商品金额必须为数字
     if (!is_numeric($sum)) {
         IError::show(403, array('message' => 'order sum must a num'));
     }
     $this->sum = $sum;
 }
Exemple #4
0
 /**
  * @brief 构造函数 初始化商品金额
  * @param float $sum       商品金额
  * @param int   $seller_id 商家ID
  */
 public function __construct($sum, $seller_id = 0)
 {
     //商品金额必须为数字
     if (!is_numeric($sum)) {
         IError::show(403, 'order sum must a num');
     }
     $this->sum = $sum;
     $this->seller_id = $seller_id;
 }
Exemple #5
0
 /**
  * @brief 执行视图渲染
  * @return 视图
  */
 public function run()
 {
     $controller = $this->getController();
     IInterceptor::run("onCreateView", $controller);
     $this->resolveView($this->getView());
     $data = null;
     if (file_exists($this->view . $controller->extend)) {
         $controller->render($this->view, $data);
     } else {
         $path = $this->view . $controller->extend;
         $path = IException::pathFilter($path);
         IError::show("not found this view page({$path})", 404);
     }
     IInterceptor::run("onFinishView");
 }
Exemple #6
0
 /**
  * 获取订单基本信息
  * @param $orderIdString string 订单ID序列
  * @param $seller_id int 商家ID
  */
 public function getOrderInfo($orderIdString, $seller_id = 0)
 {
     $orderObj = new IModel('order');
     $areaIdArray = array();
     $orderList = $orderObj->query('id in (' . $orderIdString . ') and seller_id = ' . $seller_id);
     if (!$orderList) {
         IError::show(403, "无查阅订单权限");
     }
     foreach ($orderList as $key => $val) {
         $temp = area::name($val['province'], $val['city'], $val['area']);
         $orderList[$key]['province_str'] = $temp[$val['province']];
         $orderList[$key]['city_str'] = $temp[$val['city']];
         $orderList[$key]['area_str'] = $temp[$val['area']];
     }
     return $orderList;
 }
Exemple #7
0
 function pro_rule_edit_act()
 {
     $id = IFilter::act(IReq::get('id'), 'int');
     $promotionObj = new IModel('promotion');
     $group_all = IReq::get('group_all', 'post');
     if ($group_all == 'all') {
         $user_group_str = 'all';
     } else {
         $user_group = IFilter::act(IReq::get('user_group', 'post'), 'int');
         $user_group_str = '';
         if ($user_group) {
             $user_group_str = join(',', $user_group);
             $user_group_str = ',' . $user_group_str . ',';
         }
     }
     $dataArray = array('name' => IFilter::act(IReq::get('name', 'post')), 'condition' => IFilter::act(IReq::get('condition', 'post')), 'is_close' => IFilter::act(IReq::get('is_close', 'post')), 'start_time' => IFilter::act(IReq::get('start_time', 'post')), 'end_time' => IFilter::act(IReq::get('end_time', 'post')), 'intro' => IFilter::act(IReq::get('intro', 'post')), 'award_type' => IFilter::act(IReq::get('award_type', 'post')), 'type' => 0, 'user_group' => $user_group_str, 'award_value' => IFilter::act(IReq::get('award_value', 'post')), 'seller_id' => $this->seller['seller_id']);
     if (!in_array($dataArray['award_type'], array(1, 2, 6))) {
         IError::show('促销类型不符合规范', 403);
     }
     $promotionObj->setData($dataArray);
     if ($id) {
         $where = 'id = ' . $id;
         $promotionObj->update($where);
     } else {
         $promotionObj->add();
     }
     $this->redirect('pro_rule_list');
 }
Exemple #8
0
 function callback($in, &$paymentId, &$money, &$message, &$tradeno)
 {
     //比对md5码
     $pKey = $this->getConf($paymentId, 'PrivateKey');
     $user_id = ISafe::get('user_id');
     ksort($in);
     unset($in['controller']);
     unset($in['action']);
     unset($in['payment_name']);
     $temp = array();
     foreach ($in as $k => $v) {
         if ($k != 'sign') {
             $temp[] = $k . '=' . urlencode($v);
         }
     }
     $testStr = join('&', $temp) . '&' . $user_id . $pKey;
     $tradeno = $in['order_no'];
     $money = $in['total_fee'];
     if ($in['sign'] == md5($testStr)) {
         //支付单号
         switch ($in['is_success']) {
             case 'T':
                 $log = new AccountLog();
                 $config = array('user_id' => ISafe::get('user_id'), 'event' => 'pay', 'note' => '通过余额支付方式进行商品购买', 'num' => '-' . $money, 'order_id' => $tradeno);
                 $log->write($config);
                 return PAY_SUCCESS;
                 break;
             case 'F':
                 return PAY_FAILED;
                 break;
         }
     } else {
         IError::show(403, '校验码不正确');
     }
 }
Exemple #9
0
 public static function checkAdminRights()
 {
     $object = IWeb::$app->getController();
     $controllerId = $object->getId();
     $actionId = $object->getAction()->getId();
     //1,针对独立配置的action检测
     if (isset(self::$adminAction[$controllerId . "@" . $actionId]) && method_exists(__CLASS__, self::$adminAction[$controllerId . "@" . $actionId])) {
         call_user_func(array(__CLASS__, self::$adminAction[$controllerId . "@" . $actionId]));
         return;
     } else {
         if ((in_array($controllerId . "@" . $actionId, self::$adminShareSellerAction) || in_array($controllerId . "@*", self::$adminShareSellerAction)) && ($object->seller = self::getSeller())) {
             $object->seller = self::getSeller();
             $object->admin = self::getAdmin();
             //URL中的seller_id作为商家身份标示
             $seller_id = IFilter::act(IReq::get('seller_id'));
             if ($seller_id && !$object->admin && $object->seller['seller_id'] != $seller_id) {
                 die('当前商家身份与要操作的商家身份不符');
             }
             return;
         } else {
             $admin = self::getAdmin();
             if (!$admin) {
                 $object->redirect('/systemadmin/index');
             }
             //获取管理员数据
             $adminRow = self::isValidAdmin($admin['admin_name'], $admin['admin_pwd']);
             //非超管角色
             if ($adminRow['role_id'] != 0) {
                 $roleObj = new IModel('admin_role');
                 $where = 'id = ' . $adminRow["role_id"] . ' and is_del = 0';
                 $roleRow = $roleObj->getObj($where);
                 //角色权限校验
                 if (self::checkRight($roleRow['rights']) == false) {
                     IError::show('503', 'no permission to access');
                     exit;
                 }
             }
             $object->admin = $admin;
         }
     }
 }
Exemple #10
0
 function callback($in, &$paymentId, &$money, &$message, &$tradeno)
 {
     //获取人民币网关账户号
     $merchantAcctId = trim($_REQUEST['merchantAcctId']);
     //设置人民币网关密钥
     ///区分大小写
     $key = $this->getConf($paymentId, 'merchant_key');
     //商户密钥
     //获取网关版本.固定值
     ///快钱会根据版本号来调用对应的接口处理程序。
     ///本代码版本号固定为v2.0
     $version = trim($_REQUEST['version']);
     //获取语言种类.固定选择值。
     ///只能选择1、2、3
     ///1代表中文;2代表英文
     ///默认值为1
     $language = trim($_REQUEST['language']);
     //签名类型.固定值
     ///1代表MD5签名
     ///当前版本固定为1
     $signType = trim($_REQUEST['signType']);
     //获取支付方式
     ///值为:10、11、12、13、14
     ///00:组合支付(网关支付页面显示快钱支持的各种支付方式,推荐使用)10:银行卡支付(网关支付页面只显示银行卡支付).11:电话银行支付(网关支付页面只显示电话支付).12:快钱账户支付(网关支付页面只显示快钱账户支付).13:线下支付(网关支付页面只显示线下支付方式).14:B2B支付(网关支付页面只显示B2B支付,但需要向快钱申请开通才能使用)
     $payType = trim($_REQUEST['payType']);
     //获取银行代码
     ///参见银行代码列表
     $bankId = trim($_REQUEST['bankId']);
     //获取商户订单号
     $orderId = trim($_REQUEST['orderId']);
     //获取订单提交时间
     ///获取商户提交订单时的时间.14位数字。年[4位]月[2位]日[2位]时[2位]分[2位]秒[2位]
     ///如:20080101010101
     $orderTime = trim($_REQUEST['orderTime']);
     //获取原始订单金额
     ///订单提交到快钱时的金额,单位为分。
     ///比方2 ,代表0.02元
     $orderAmount = trim($_REQUEST['orderAmount']);
     //获取快钱交易号
     ///获取该交易在快钱的交易号
     $dealId = trim($_REQUEST['dealId']);
     //获取银行交易号
     ///如果使用银行卡支付时,在银行的交易号。如不是通过银行支付,则为空
     $bankDealId = trim($_REQUEST['bankDealId']);
     //获取在快钱交易时间
     ///14位数字。年[4位]月[2位]日[2位]时[2位]分[2位]秒[2位]
     ///如;20080101010101
     $dealTime = trim($_REQUEST['dealTime']);
     //获取实际支付金额
     ///单位为分
     ///比方 2 ,代表0.02元
     $payAmount = trim($_REQUEST['payAmount']);
     //获取交易手续费
     ///单位为分
     ///比方 2 ,代表0.02元
     $fee = trim($_REQUEST['fee']);
     //获取扩展字段1
     $ext1 = trim($_REQUEST['ext1']);
     //获取扩展字段2
     $ext2 = trim($_REQUEST['ext2']);
     //获取处理结果
     ///10代表 成功; 11代表 失败
     $payResult = trim($_REQUEST['payResult']);
     //获取错误代码
     ///详细见文档错误代码列表
     $errCode = trim($_REQUEST['errCode']);
     //获取加密签名串
     $signMsg = trim($_REQUEST['signMsg']);
     //生成加密串。必须保持如下顺序。
     $merchantSignMsgVal = '';
     $merchantSignMsgVal = $this->appendParam($merchantSignMsgVal, "merchantAcctId", $merchantAcctId);
     $merchantSignMsgVal = $this->appendParam($merchantSignMsgVal, "version", $version);
     $merchantSignMsgVal = $this->appendParam($merchantSignMsgVal, "language", $language);
     $merchantSignMsgVal = $this->appendParam($merchantSignMsgVal, "signType", $signType);
     $merchantSignMsgVal = $this->appendParam($merchantSignMsgVal, "payType", $payType);
     $merchantSignMsgVal = $this->appendParam($merchantSignMsgVal, "bankId", $bankId);
     $merchantSignMsgVal = $this->appendParam($merchantSignMsgVal, "orderId", $orderId);
     $merchantSignMsgVal = $this->appendParam($merchantSignMsgVal, "orderTime", $orderTime);
     $merchantSignMsgVal = $this->appendParam($merchantSignMsgVal, "orderAmount", $orderAmount);
     $merchantSignMsgVal = $this->appendParam($merchantSignMsgVal, "dealId", $dealId);
     $merchantSignMsgVal = $this->appendParam($merchantSignMsgVal, "bankDealId", $bankDealId);
     $merchantSignMsgVal = $this->appendParam($merchantSignMsgVal, "dealTime", $dealTime);
     $merchantSignMsgVal = $this->appendParam($merchantSignMsgVal, "payAmount", $payAmount);
     $merchantSignMsgVal = $this->appendParam($merchantSignMsgVal, "fee", $fee);
     $merchantSignMsgVal = $this->appendParam($merchantSignMsgVal, "ext1", $ext1);
     $merchantSignMsgVal = $this->appendParam($merchantSignMsgVal, "ext2", $ext2);
     $merchantSignMsgVal = $this->appendParam($merchantSignMsgVal, "payResult", $payResult);
     $merchantSignMsgVal = $this->appendParam($merchantSignMsgVal, "errCode", $errCode);
     $merchantSignMsgVal = $this->appendParam($merchantSignMsgVal, "key", $key);
     $merchantSignMsg = md5($merchantSignMsgVal);
     if (strtoupper($signMsg) == strtoupper($merchantSignMsg)) {
         $money = $orderAmount / 100;
         $tradeno = $orderId;
         $message = $payResult;
         //支付单号
         switch ($payResult) {
             case '10':
                 return PAY_SUCCESS;
                 break;
             default:
                 return PAY_FAILED;
                 break;
         }
     } else {
         IError::show(403, '校验码不正确');
     }
 }
Exemple #11
0
 /**
  * @brief 获取订单中的支付信息 M:必要信息; R表示店铺; P表示用户;
  * @param $payment_id int    支付方式ID
  * @param $type       string 信息获取方式 order:订单支付;recharge:在线充值;
  * @param $argument   mix    参数
  * @return array 支付提交信息
  */
 public static function getPaymentInfo($payment_id, $type, $argument)
 {
     //最终返回值
     $payment = array();
     //获取公共信息
     $paymentRow = self::getPaymentById($payment_id);
     $payment['M_PartnerId'] = $paymentRow['partner_id'];
     $payment['M_PartnerKey'] = $paymentRow['partner_key'];
     if ($type == 'order') {
         $order_id = $argument;
         //获取订单信息
         $orderObj = new IModel('order');
         $orderRow = $orderObj->getObj('id = ' . $order_id . ' and status = 1');
         if (empty($orderRow)) {
             IError::show(403, '订单信息不正确,不能进行支付');
         }
         $payment['M_Remark'] = $orderRow['postscript'];
         $payment['M_OrderId'] = $orderRow['id'];
         $payment['M_OrderNO'] = $orderRow['order_no'];
         $payment['M_Amount'] = $orderRow['order_amount'];
         //用户信息
         $payment['P_Mobile'] = $orderRow['mobile'];
         $payment['P_Name'] = $orderRow['accept_name'];
         $payment['P_PostCode'] = $orderRow['postcode'];
         $payment['P_Telephone'] = $orderRow['telphone'];
         $payment['P_Address'] = $orderRow['address'];
     } else {
         if ($type == 'recharge') {
             if (ISafe::get('user_id') == null) {
                 IError::show(403, '请登录系统');
             }
             if (!isset($argument['account']) || $argument['account'] <= 0) {
                 IError::show(403, '请填入正确的充值金额');
             }
             $rechargeObj = new IModel('online_recharge');
             $reData = array('user_id' => ISafe::get('user_id'), 'recharge_no' => Order_Class::createOrderNum(), 'account' => $argument['account'], 'time' => ITime::getDateTime(), 'payment_name' => $argument['paymentName']);
             $rechargeObj->setData($reData);
             $r_id = $rechargeObj->add();
             //充值时用户id跟随交易号一起发送,以"_"分割
             $payment['M_OrderNO'] = 'recharge_' . $reData['recharge_no'];
             $payment['M_OrderId'] = $r_id;
             $payment['M_Amount'] = $reData['account'];
         }
     }
     $siteConfigObj = new Config("site_config");
     $site_config = $siteConfigObj->getInfo();
     //交易信息
     $payment['M_Time'] = time();
     $payment['M_Paymentid'] = $payment_id;
     //店铺信息
     $payment['R_Address'] = isset($site_config['address']) ? $site_config['address'] : '';
     $payment['R_Name'] = isset($site_config['name']) ? $site_config['name'] : '';
     $payment['R_Mobile'] = isset($site_config['mobile']) ? $site_config['mobile'] : '';
     $payment['R_Telephone'] = isset($site_config['phone']) ? $site_config['phone'] : '';
     return $payment;
 }
Exemple #12
0
 function arrival_notice()
 {
     $user_id = IFilter::act(ISafe::get('user_id'), 'int');
     $email = IFilter::act(IReq::get('email'));
     $mobile = IFilter::act(IReq::get('mobile'));
     $goods_id = IFilter::act(IReq::get('goods_id'), 'int');
     $register_time = date('Y-m-d H:i:s');
     if (!$goods_id) {
         IError::show(403, '商品ID不存在');
     }
     $model = new IModel('notify_registry');
     $obj = $model->getObj("email = '{$email}' and user_id = '{$user_id}' and goods_id = '{$goods_id}'");
     if (empty($obj)) {
         $model->setData(array('email' => $email, 'user_id' => $user_id, 'mobile' => $mobile, 'goods_id' => $goods_id, 'register_time' => $register_time));
         $model->add();
     } else {
         $model->setData(array('email' => $email, 'user_id' => $user_id, 'mobile' => $mobile, 'goods_id' => $goods_id, 'register_time' => $register_time, 'notify_status' => 0));
         $model->update('id = ' . $obj['id']);
     }
     $this->redirect('arrival_result');
 }
Exemple #13
0
 function ad_edit_act()
 {
     $id = IFilter::act(IReq::get('id'), 'int');
     $content = IReq::get('content');
     //附件上传
     if (isset($_FILES) && $_FILES) {
         $upType = isset($_FILES['img']) ? array("gif", "png", "jpg") : array('flv', 'swf');
         $upObj = new IUpload("5000", $upType);
         $dir = IWeb::$app->config['upload'] . '/' . date('Y') . "/" . date('m') . "/" . date('d');
         $upObj->setDir($dir);
         $upState = $upObj->execute();
         $result = $upState ? current($upState) : "";
         if ($result && isset($result[0]['flag']) && $result[0]['flag'] == 1) {
             //最终附件路径
             $content = $dir . '/' . $result[0]['name'];
         } else {
             if (!$content) {
                 IError::show(403, "请上传正确的附件数据");
             }
         }
     }
     $adObj = new IModel('ad_manage');
     $dataArray = array('content' => IFilter::addSlash($content), 'name' => IFilter::act(IReq::get('name')), 'position_id' => IFilter::act(IReq::get('position_id')), 'type' => IFilter::act(IReq::get('type')), 'link' => IFilter::addSlash(IReq::get('link')), 'start_time' => IFilter::act(IReq::get('start_time')), 'end_time' => IFilter::act(IReq::get('end_time')), 'description' => IFilter::act(IReq::get('description'), 'text'), 'order' => IFilter::act(IReq::get('order'), 'int'), 'goods_cat_id' => IFilter::act(IReq::get('goods_cat_id'), 'int'));
     $adObj->setData($dataArray);
     if ($id) {
         $where = 'id = ' . $id;
         $adObj->update($where);
     } else {
         $adObj->add();
     }
     $this->redirect("ad_list");
 }
Exemple #14
0
 /**
  * @brief api错误处理
  * @param string $apiName api名称
  * @param string $message 错误信息
  * @return Error
  */
 private static function error($apiName, $message)
 {
     IError::show(403, "API of " . $apiName . " is called error , " . $message);
 }
Exemple #15
0
 public function direct_count($id, $type, $buy_num = 1, $promo = '', $active_id = '')
 {
     /*正常购买流程*/
     if ($promo == '' || $active_id == '') {
         $buyInfo = array($type => array('id' => array($id), 'data' => array($id => array('count' => $buy_num)), 'count' => $buy_num));
         return $this->goodsCount($buyInfo);
     }
     /*活动购买流程*/
     $user_id = ISafe::get('user_id') ? ISafe::get('user_id') : 0;
     //获取货品数据
     if ($type == 'product') {
         $model = new IModel('goods as go,products as pro');
         $productRow = $model->getObj('pro.id = ' . $id . ' and pro.goods_id = go.id and go.is_del = 0', 'pro.sell_price,pro.weight,pro.id,pro.spec_array,pro.goods_id,pro.store_nums,go.name,go.point,go.exp,go.list_img');
         if (empty($productRow)) {
             IError::show(403, '参数错误,无法找到商品信息');
         }
         $typeRow = $productRow;
         $goods_id = $typeRow['goods_id'];
     } else {
         $model = new IModel('goods as go');
         $goodsRow = $model->getObj('id = ' . $id . ' and is_del = 0', 'go.name,go.id,go.list_img,go.sell_price,go.point,go.weight,go.store_nums,go.exp');
         if (empty($goodsRow)) {
             IError::show(403, '参数错误,无法找到商品信息');
         }
         $typeRow = $goodsRow;
         $goods_id = $id;
     }
     //库存判断
     if ($buy_num <= 0 || $buy_num > $typeRow['store_nums']) {
         IError::show(403, '购买的数量不正确或大于商品的库存量');
         exit;
     }
     //限时抢购
     if ($promo == 'time') {
         $promotionObj = new IModel('promotion');
         $promotionRow = $promotionObj->getObj('type = 1 and `condition` = ' . $goods_id . ' and NOW() between start_time and end_time and is_close = 0');
         if (!empty($promotionRow)) {
             $memberObj = new IModel('member');
             $memberRow = $memberObj->getObj('user_id = ' . $user_id, 'group_id');
             if ($promotionRow['user_group'] == 'all' || isset($memberRow['group_id']) && stripos(',' . $promotionRow['user_group'] . ',', $memberRow['group_id']) !== false) {
                 $disPrice = $promotionRow['award_value'];
             } else {
                 IError::show(403, '此活动仅限指定的用户组');
             }
         } else {
             IError::show(403, '不存在此限时抢购活动');
         }
     } else {
         if ($promo == 'groupon') {
             $regimentObj = new IModel('regiment');
             $regimentRow = $regimentObj->getObj('id = ' . $active_id . ' and goods_id = ' . $goods_id . ' and NOW() between start_time and end_time and is_close = 0');
             if (!empty($regimentRow)) {
                 $disPrice = $regimentRow['regiment_price'];
             } else {
                 IError::show(403, '不存在此团购活动');
             }
         }
     }
     //没有优惠价格时为商品原价
     if (!isset($disPrice)) {
         $disPrice = $typeRow['sell_price'];
     }
     //设置优惠价格,如果不存在则优惠价等于商品原价
     $typeRow['reduce'] = $typeRow['sell_price'] - $disPrice;
     $typeRow['count'] = $buy_num;
     $typeRow['sum'] = $disPrice * $buy_num;
     //拼接返回数据
     $result = array('final_sum' => $typeRow['sum'], 'promotion' => array(), 'proReduce' => 0, 'sum' => $typeRow['sell_price'] * $buy_num, 'goodsList' => $type == 'goods' ? array($typeRow) : array(), 'productList' => $type == 'product' ? array($typeRow) : array(), 'count' => $buy_num, 'reduce' => $typeRow['reduce'] * $buy_num, 'weight' => $typeRow['weight'] * $buy_num, 'point' => $typeRow['point'] * $buy_num, 'exp' => $typeRow['exp'] * $buy_num, 'freeFreight' => false);
     return $result;
 }
Exemple #16
0
    ?>
</a>
			<?php 
}
?>
		</div>
	</div>
	<?php 
echo Ad::show(1);
?>

	<?php 
$seller_id = IFilter::act(IReq::get('id'), 'int');
$sellerRow = Api::run('getSellerInfo', $seller_id);
if (!$sellerRow) {
    IError::show(403, '商户信息不存在');
}
?>
<div class="position"> <span>您当前的位置:</span> <a href="<?php 
echo IUrl::creatUrl("");
?>
"> 首页</a> » 商户主页 </div>
<div class="wrapper clearfix container_2">

	<div class="sidebar f_l">
		<div class="box m_10">
			<div class="title">商户信息</div>
			<div class="content">
				<div class="c_box">
					<dl class="clearfix">
						<dt><strong><?php 
Exemple #17
0
 /**
  * @brief 获取订单中的支付信息 M:必要信息; R表示店铺; P表示用户;
  * @param $payment_id int    支付方式ID
  * @param $type       string 信息获取方式 order:订单支付;recharge:在线充值;
  * @param $argument   mix    参数
  * @return array 支付提交信息
  */
 public static function getPaymentInfo($payment_id, $type, $argument)
 {
     //最终返回值
     $payment = array();
     //初始化配置参数
     $paymentInstance = Payment::createPaymentInstance($payment_id);
     $configParam = $paymentInstance->configParam();
     foreach ($configParam as $key => $val) {
         $payment[$key] = '';
     }
     //获取公共信息
     $paymentRow = self::getPaymentById($payment_id, 'config_param');
     if ($paymentRow) {
         $paymentRow = JSON::decode($paymentRow);
         foreach ($paymentRow as $key => $item) {
             $payment[$key] = $item;
         }
     }
     if ($type == 'order') {
         $orderIdArray = $argument;
         $M_Amount = 0;
         $M_OrderNO = array();
         foreach ($orderIdArray as $key => $order_id) {
             //获取订单信息
             $orderObj = new IModel('order');
             $orderRow = $orderObj->getObj('id = ' . $order_id . ' and status = 1');
             if (empty($orderRow)) {
                 IError::show(403, '订单信息不正确,不能进行支付');
             }
             //判断商品库存
             $orderGoodsDB = new IModel('order_goods');
             $orderGoodsList = $orderGoodsDB->query('order_id = ' . $order_id);
             foreach ($orderGoodsList as $key => $val) {
                 if (!goods_class::checkStore($val['goods_nums'], $val['goods_id'], $val['product_id'])) {
                     IError::show(403, '商品库存不足无法支付,请重新下单');
                 }
             }
             $M_Amount += $orderRow['order_amount'];
             $M_OrderNO[] = $orderRow['order_no'];
         }
         $payment['M_Remark'] = $orderRow['postscript'];
         $payment['M_OrderId'] = $orderRow['id'];
         $payment['M_OrderNO'] = $orderRow['order_no'];
         $payment['M_Amount'] = $M_Amount;
         //用户信息
         $payment['P_Mobile'] = $orderRow['mobile'];
         $payment['P_Name'] = $orderRow['accept_name'];
         $payment['P_PostCode'] = $orderRow['postcode'];
         $payment['P_Telephone'] = $orderRow['telphone'];
         $payment['P_Address'] = $orderRow['address'];
         //订单批量结算缓存机制
         $cacheObj = new ICache('file');
         $cacheObj->set($payment['M_OrderNO'], join(",", $M_OrderNO));
     } else {
         if ($type == 'recharge') {
             if (ISafe::get('user_id') == null) {
                 IError::show(403, '请登录系统');
             }
             if (!isset($argument['account']) || $argument['account'] <= 0) {
                 IError::show(403, '请填入正确的充值金额');
             }
             $rechargeObj = new IModel('online_recharge');
             $reData = array('user_id' => ISafe::get('user_id'), 'recharge_no' => Order_Class::createOrderNum(), 'account' => $argument['account'], 'time' => ITime::getDateTime(), 'payment_name' => $argument['paymentName']);
             $rechargeObj->setData($reData);
             $r_id = $rechargeObj->add();
             //充值时用户id跟随交易号一起发送,以"_"分割
             $payment['M_OrderNO'] = 'recharge' . $reData['recharge_no'];
             $payment['M_OrderId'] = $r_id;
             $payment['M_Amount'] = $reData['account'];
         }
     }
     $siteConfigObj = new Config("site_config");
     $site_config = $siteConfigObj->getInfo();
     //交易信息
     $payment['M_Time'] = time();
     $payment['M_Paymentid'] = $payment_id;
     //店铺信息
     $payment['R_Address'] = isset($site_config['address']) ? $site_config['address'] : '';
     $payment['R_Name'] = isset($site_config['name']) ? $site_config['name'] : '';
     $payment['R_Mobile'] = isset($site_config['mobile']) ? $site_config['mobile'] : '';
     $payment['R_Telephone'] = isset($site_config['phone']) ? $site_config['phone'] : '';
     return $payment;
 }
Exemple #18
0
 /**
  * @brief 获取订单中的支付信息 M:必要信息; R表示店铺; P表示用户;
  * @param $payment_id 			int    支付方式ID
  * @param $type      			string 信息获取方式 order:订单支付;recharge:在线充值;
  * @param $argument   			mix    参数
  * @return array 支付提交信息
  */
 public static function getPaymentInfo($payment_id, $type, $argument)
 {
     //最终返回值
     $payment = array();
     //初始化配置参数
     $paymentInstance = Payment::createPaymentInstance($payment_id);
     $configParam = $paymentInstance->configParam();
     foreach ($configParam as $key => $val) {
         $payment[$key] = '';
     }
     //获取公共信息
     $paymentRow = self::getPaymentById($payment_id, 'config_param');
     if ($paymentRow) {
         $paymentRow = JSON::decode($paymentRow);
         foreach ($paymentRow as $key => $item) {
             $payment[$key] = $item;
         }
     }
     //print_r($payment);die;
     if ($type == 'order') {
         $order_id = $argument;
         //获取订单信息
         $orderObj = new IModel('order');
         $orderRow = $orderObj->getObj('id = ' . $order_id . ' and status = 1');
         if (empty($orderRow)) {
             IError::show(403, '订单信息不正确,不能进行支付');
         }
         //是商家的订单的话,收款信息为商家个人
         if ($orderRow['seller_id'] > 0) {
             $configParam = $paymentInstance->sellerConfigParam($orderRow['seller_id']);
             if ($configParam == 0) {
                 IError::show(403, '商家收款信息未填写,不能进行支付');
             } else {
                 //重写收款信息
                 foreach ($configParam as $key => $val) {
                     $payment[$key] = $val;
                 }
             }
         }
         $payment['M_Remark'] = $orderRow['postscript'];
         $payment['M_OrderId'] = $orderRow['id'];
         $payment['M_OrderNO'] = $orderRow['order_no'];
         $payment['M_Amount'] = $orderRow['order_amount'];
         //用户信息
         $payment['P_Mobile'] = $orderRow['mobile'];
         $payment['P_Name'] = $orderRow['accept_name'];
         $payment['P_PostCode'] = $orderRow['postcode'];
         $payment['P_Telephone'] = $orderRow['telphone'];
         $payment['P_Address'] = $orderRow['address'];
     } else {
         if ($type == 'recharge') {
             if (ISafe::get('user_id') == null) {
                 IError::show(403, '请登录系统');
             }
             if (!isset($argument['account']) || $argument['account'] <= 0) {
                 IError::show(403, '请填入正确的充值金额');
             }
             $rechargeObj = new IModel('online_recharge');
             $reData = array('user_id' => ISafe::get('user_id'), 'recharge_no' => Order_Class::createOrderNum(), 'account' => $argument['account'], 'time' => ITime::getDateTime(), 'payment_name' => $argument['paymentName']);
             $rechargeObj->setData($reData);
             $r_id = $rechargeObj->add();
             //充值时用户id跟随交易号一起发送,以"_"分割
             $payment['M_OrderNO'] = 'recharge_' . $reData['recharge_no'];
             $payment['M_OrderId'] = $r_id;
             $payment['M_Amount'] = $reData['account'];
         }
     }
     $siteConfigObj = new Config("site_config");
     $site_config = $siteConfigObj->getInfo();
     //交易信息
     $payment['M_Time'] = time();
     $payment['M_Paymentid'] = $payment_id;
     //店铺信息
     $payment['R_Address'] = isset($site_config['address']) ? $site_config['address'] : '';
     $payment['R_Name'] = isset($site_config['name']) ? $site_config['name'] : '';
     $payment['R_Mobile'] = isset($site_config['mobile']) ? $site_config['mobile'] : '';
     $payment['R_Telephone'] = isset($site_config['phone']) ? $site_config['phone'] : '';
     return $payment;
 }
Exemple #19
0
 /**
  * 余额付款
  * T:支付失败;
  * F:支付成功;
  */
 function payment_balance()
 {
     $urlStr = '';
     $user_id = intval($this->user['user_id']);
     $return['attach'] = IReq::get('attach');
     $return['total_fee'] = IReq::get('total_fee');
     $return['order_no'] = IReq::get('order_no');
     $return['return_url'] = IReq::get('return_url');
     $sign = IReq::get('sign');
     if (stripos($return['order_no'], 'recharge_') !== false) {
         IError::show(403, '余额支付方式不能用于在线充值');
         exit;
     }
     if (floatval($return['total_fee']) <= 0 || $return['order_no'] == '' || $return['return_url'] == '') {
         IError::show(403, '支付参数不正确');
     } else {
         $paymentDB = new IModel('payment');
         $paymentRow = $paymentDB->getObj('class_name = "balance" ');
         $pkey = Payment::getConfigParam($paymentRow['id'], 'M_PartnerKey');
         //md5校验
         ksort($return);
         foreach ($return as $key => $val) {
             $urlStr .= $key . '=' . urlencode($val) . '&';
         }
         $urlStr .= $user_id . $pkey;
         if ($sign != md5($urlStr)) {
             IError::show(403, '数据校验不正确');
         } else {
             $memberObj = new IModel('member');
             $memberRow = $memberObj->getObj('user_id = ' . $user_id);
             if (empty($memberRow)) {
                 IError::show(403, '用户信息不存在');
                 exit;
             } else {
                 if ($memberRow['balance'] < $return['total_fee']) {
                     IError::show(403, '账户余额不足');
                     exit;
                 } else {
                     $orderObj = new IModel('order');
                     $orderRow = $orderObj->getObj('order_no  = "' . IFilter::act($return['order_no']) . '" and pay_status = 0 and user_id = ' . $user_id);
                     if (empty($orderRow)) {
                         IError::show(403, '订单已经被处理过,请查看订单状态');
                         exit;
                     }
                     $dataArray = array('balance' => 'balance - ' . IFilter::act($return['total_fee']));
                     $memberObj->setData($dataArray);
                     $is_success = $memberObj->update('user_id = ' . $user_id, 'balance');
                     if ($is_success) {
                         $return['is_success'] = 'T';
                     } else {
                         $return['is_success'] = 'F';
                     }
                     ksort($return);
                     //返还的URL地址
                     $responseUrl = '';
                     foreach ($return as $key => $val) {
                         $responseUrl .= $key . '=' . urlencode($val) . '&';
                     }
                     $nextUrl = urldecode($return['return_url']);
                     if (stripos($nextUrl, '?') === false) {
                         $return_url = $nextUrl . '?' . $responseUrl;
                     } else {
                         $return_url = $nextUrl . '&' . $responseUrl;
                     }
                     //计算要发送的md5校验
                     $urlStrMD5 = md5($responseUrl . $user_id . $pkey);
                     //拼接进返还的URL中
                     $return_url .= 'sign=' . $urlStrMD5;
                     header('location:' . $return_url);
                 }
             }
         }
     }
 }
Exemple #20
0
 /**
  * @brief 获取订单中的支付信息
  * @payment_id   支付方式信息
  * @type         信息获取方式 order:订单支付;recharge:在线充值;
  * @argument     参数
  * @return array 支付提交信息
  * R表示店铺 ; P表示用户;
  */
 public function getPaymentInfo($payment_id, $type, $argument)
 {
     if ($type == 'order') {
         $order_id = $argument;
         //获取订单信息
         $orderObj = new IModel('order');
         $orderRow = $orderObj->getObj('id = ' . $order_id . ' and status = 1');
         if (empty($orderRow)) {
             IError::show(403, '订单信息不正确,不能进行支付');
         }
         //团购
         if ($orderRow['type'] == 1) {
             $regimentRelationObj = new IModel('regiment_user_relation');
             $relationRow = $regimentRelationObj->getObj('order_no = "' . $orderRow['order_no'] . '"');
             if (empty($relationRow)) {
                 IError::show(403, '团购订单已经失效');
                 exit;
             } else {
                 if (abs(ITime::getDiffSec($relationRow['join_time'])) > regiment::time_limit() * 60) {
                     IError::show(403, '支付时间已经过期');
                     exit;
                 }
             }
         }
         $payment['M_Remark'] = $orderRow['postscript'];
         $payment['M_OrderId'] = $orderRow['id'];
         $payment['M_OrderNO'] = $orderRow['order_no'];
         $payment['M_Amount'] = $orderRow['order_amount'];
         //用户信息
         $payment['P_Mobile'] = $orderRow['mobile'];
         $payment['P_Name'] = $orderRow['accept_name'];
         $payment['P_PostCode'] = $orderRow['postcode'];
         $payment['P_Telephone'] = $orderRow['telphone'];
         $payment['P_Address'] = $orderRow['address'];
         $payment['P_Email'] = '';
     } else {
         if ($type == 'recharge') {
             if (ISafe::get('user_id') == null) {
                 IError::show(403, '请登录系统');
             }
             if (!isset($argument['account']) || $argument['account'] <= 0) {
                 IError::show(403, '请填入正确的充值金额');
             }
             $rechargeObj = new IModel('online_recharge');
             $reData = array('user_id' => ISafe::get('user_id'), 'recharge_no' => Block::createOrderNum(), 'account' => $argument['account'], 'time' => ITime::getDateTime(), 'payment_name' => $argument['payment_type'], 'status' => 0);
             $rechargeObj->setData($reData);
             $r_id = $rechargeObj->add();
             //充值时用户id跟随交易号一起发送,以"_"分割
             $payment['M_OrderNO'] = 'recharge_' . $reData['recharge_no'];
             $payment['M_OrderId'] = $r_id;
             $payment['M_Amount'] = $reData['account'];
         }
     }
     $siteConfigObj = new Config("site_config");
     $site_config = $siteConfigObj->getInfo();
     //交易信息
     $payment['M_Def_Amount'] = 0.01;
     $payment['M_Time'] = time();
     $payment['M_Goods'] = '';
     $payment['M_Language'] = "zh_CN";
     $payment['M_Paymentid'] = $payment_id;
     //店铺信息
     $payment['R_Address'] = isset($site_config['address']) ? $site_config['address'] : '';
     $payment['R_Name'] = isset($site_config['name']) ? $site_config['name'] : '';
     $payment['R_Mobile'] = isset($site_config['mobile']) ? $site_config['mobile'] : '';
     $payment['R_Telephone'] = isset($site_config['phone']) ? $site_config['phone'] : '';
     $payment['R_Postcode'] = '';
     $payment['R_Email'] = '';
     return $payment;
 }
Exemple #21
0
 /**
  * @brief 发送验证邮箱邮件
  */
 public function send_check_mail()
 {
     $email = IReq::get('email');
     if (IValidate::email($email) == false) {
         IError::show(403, '邮件格式错误');
     }
     $userDB = new IModel('user');
     $userRow = $userDB->getObj('email = "' . $email . '"');
     $code = base64_encode($userRow['email'] . "|" . $userRow['id']);
     $url = IUrl::getHost() . IUrl::creatUrl("/simple/check_mail/code/{$code}");
     $content = mailTemplate::checkMail(array("{url}" => $url));
     //发送邮件
     $smtp = new SendMail();
     $result = $smtp->send($email, "用户注册邮箱验证", $content);
     if ($result === false) {
         IError::show(403, "发信失败,请重试!或者联系管理员查看邮件服务是否开启");
     }
     $message = "您的邮箱验证邮件已发送到{$email}!请到您的邮箱中去激活";
     $this->redirect('/site/success?message=' . urlencode($message) . '&email=' . $email);
 }
Exemple #22
0
 public function merge_template()
 {
     $this->layout = 'print';
     $order_id = IFilter::act(IReq::get('id'), 'int');
     $seller_id = IFilter::act(IReq::get('seller_id'), 'int');
     $tb_order = new IModel('order');
     $where = $seller_id ? 'id=' . $order_id . ' and seller_id = ' . $seller_id : 'id=' . $order_id;
     $data = $tb_order->getObj($where);
     if (!$data) {
         IError::show(403, "您没有权限查阅该订单");
     }
     if ($data['seller_id']) {
         $sellerObj = new IModel('seller');
         $config_info = $sellerObj->getObj('id = ' . $data['seller_id']);
         $data['set']['name'] = isset($config_info['true_name']) ? $config_info['true_name'] : '';
         $data['set']['phone'] = isset($config_info['phone']) ? $config_info['phone'] : '';
         $data['set']['email'] = isset($config_info['email']) ? $config_info['email'] : '';
         $data['set']['url'] = isset($config_info['home_url']) ? $config_info['home_url'] : '';
     } else {
         $config = new Config("site_config");
         $config_info = $config->getInfo();
         $data['set']['name'] = isset($config_info['name']) ? $config_info['name'] : '';
         $data['set']['phone'] = isset($config_info['phone']) ? $config_info['phone'] : '';
         $data['set']['email'] = isset($config_info['email']) ? $config_info['email'] : '';
         $data['set']['url'] = isset($config_info['url']) ? $config_info['url'] : '';
     }
     //获取地区
     $data['address'] = join('&nbsp;', area::name($data['province'], $data['city'], $data['area'])) . "&nbsp;" . $data['address'];
     $this->setRenderData($data);
     $this->redirect("merge_template");
 }
Exemple #23
0
 /**
  * @brief 【重要】支付回调[同步]
  */
 public function callback()
 {
     //从URL中获取支付方式
     $payment_id = IFilter::act(IReq::get('_id'), 'int');
     $paymentInstance = Payment::createPaymentInstance($payment_id);
     if (!is_object($paymentInstance)) {
         IError::show(403, '支付方式不存在');
     }
     //初始化参数
     $money = '';
     $message = '支付失败';
     $orderNo = '';
     //执行接口回调函数
     $callbackData = array_merge($_POST, $_GET);
     unset($callbackData['controller']);
     unset($callbackData['action']);
     unset($callbackData['_id']);
     $return = $paymentInstance->callback($callbackData, $payment_id, $money, $message, $orderNo);
     //支付成功
     if ($return == 1) {
         //充值方式
         if (stripos($orderNo, 'recharge_') !== false) {
             $tradenoArray = explode('_', $orderNo);
             $recharge_no = isset($tradenoArray[1]) ? $tradenoArray[1] : 0;
             if (payment::updateRecharge($recharge_no)) {
                 $this->redirect('/site/success/message/' . urlencode("充值成功") . '/?callback=/ucenter/account_log');
                 exit;
             }
             IError::show(403, '充值失败');
         } else {
             $order_id = Order_Class::updateOrderStatus($orderNo);
             if ($order_id) {
                 $url = '/site/success/message/' . urlencode("支付成功");
                 $url .= ISafe::get('user_id') ? '/?callback=/ucenter/order_detail/id/' . $order_id : '';
                 $this->redirect($url);
                 exit;
             }
             IError::show(403, '订单修改失败');
         }
     } else {
         $message = $message ? $message : '支付失败';
         IError::show(403, $message);
     }
 }
Exemple #24
0
 public function article()
 {
     $data = array();
     $this->article_id = IFilter::act(IReq::get('id'), 'int');
     if ($this->article_id == '') {
         IError::show(404, '缺少咨询ID参数');
     } else {
         $articleObj = new IModel('article');
         $this->articleRow = $articleObj->getObj('id = ' . $this->article_id);
         if (empty($this->articleRow)) {
             IError::show(404, '资讯文章不存在');
             exit;
         }
         //关联商品
         $relationObj = new IQuery('relation as r');
         $relationObj->join = ' left join goods as go on r.goods_id = go.id ';
         $relationObj->where = ' r.article_id = ' . $this->article_id . ' and go.id is not null ';
         $this->relationList = $relationObj->find();
         $data['articleRow'] = $this->articleRow;
         $data['title'] = count($this->articleRow) > 0 ? $this->articleRow['title'] : '';
         $data['description'] = count($this->articleRow) > 0 ? $this->articleRow['description'] : '';
         $data['keywords'] = count($this->articleRow) > 0 ? $this->articleRow['keywords'] : '';
         $data['kw'] = '';
         $this->setRenderData($data);
         $this->redirect('article');
     }
 }
Exemple #25
0
 /**
  * @brief 回复评论
  */
 function comment_update()
 {
     $id = IFilter::act(IReq::get('id'), 'int');
     $recontent = IFilter::act(IReq::get('recontents'));
     if ($id) {
         $commentDB = new IQuery('comment as c');
         $commentDB->join = 'left join goods as go on go.id = c.goods_id';
         $commentDB->where = 'c.id = ' . $id . ' and go.seller_id = ' . $this->seller['seller_id'];
         $checkList = $commentDB->find();
         if (!$checkList) {
             IError::show(403, '该商品不属于您,无法对其评论进行回复');
         }
         $updateData = array('recontents' => $recontent, 'recomment_time' => ITime::getDateTime());
         $commentDB = new IModel('comment');
         $commentDB->setData($updateData);
         $commentDB->update('id = ' . $id);
     }
     $this->redirect('comment_list');
 }
Exemple #26
0
 function help()
 {
     $id = intval(IReq::get("id"));
     $tb_help = new IModel("help");
     $help_row = $tb_help->query("id={$id}");
     if (!$help_row || !is_array($help_row)) {
         IError::show(404, "您查找的页面已经不存在了");
     }
     $this->help_row = end($help_row);
     $tb_help_cat = new IModel("help_category");
     $cat_row = $tb_help_cat->query("id={$this->help_row['cat_id']}");
     $this->cat_row = end($cat_row);
     $this->redirect("help");
 }
Exemple #27
0
 /**
  * @brief 支付回调测试[同步]
  * define ( "PAY_FAILED", - 1);支付失败
  * define ( "PAY_TIMEOUT", 0);支付超时
  * define ( "PAY_SUCCESS", 1);支付成功
  * define ( "PAY_CANCEL", 2);支付取消
  * define ( "PAY_ERROR", 3);支付错误
  * define ( "PAY_PROGRESS", 4);支付进行
  * define ( "PAY_INVALID", 5);支付无效
  * define ( "PAY_MANUAL", 0);手工支付
  */
 public function callback()
 {
     $payment_name = is_array($payment_name = IReq::get('payment_name')) ? IFilter::act($payment_name[0]) : IFilter::act(IReq::get('payment_name'));
     //初始化参数
     $money = null;
     $message = '支付失败';
     $tradeno = null;
     //获取支付payment的id值
     $pObj = new IModel('payment as a,pay_plugin as b');
     $paymentRow = $pObj->getObj('b.file_path = "' . $payment_name . '" and a.plugin_id = b.id', 'a.id');
     //载入支付接口文件
     $paymentObj = new Payment();
     $payObj = $paymentObj->loadMethod($payment_name);
     if (!is_object($payObj)) {
         IError::show(403, '支付方式不存在');
     }
     //执行接口回调函数
     $return = $payObj->callback(array_merge($_POST, $_GET), $paymentRow['id'], $money, $message, $tradeno);
     //判断返回状态
     if ($return == 1) {
         if (stripos($tradeno, 'recharge_') !== false) {
             $tradenoArray = explode('_', $tradeno);
             $recharge_no = isset($tradenoArray[1]) ? $tradenoArray[1] : 0;
             if (payment::updateRecharge($recharge_no)) {
                 $this->redirect('/site/success/message/' . urlencode("充值成功") . '/?callback=/ucenter/account_log');
             } else {
                 IError::show(403, '充值失败');
             }
         } else {
             $order_id = payment::updateOrder($tradeno);
             if ($order_id != '') {
                 $url = '/site/success/message/' . urlencode("支付成功");
                 $url .= ISafe::get('user_id') ? '/?callback=/ucenter/order_detail/id/' . $order_id : '';
                 $this->redirect($url);
             } else {
                 IError::show(403, '订单修改失败');
             }
         }
     } else {
         IError::show(403, $message);
     }
 }
Exemple #28
0
 function do_pay()
 {
     $id = intval(IReq::get('order_id'));
     $payment = intval(IReq::get('payment'));
     //更新的支付方式
     $orderObj = new IModel('order');
     $orderRow = $orderObj->getObj('id = ' . $id);
     if (empty($orderRow)) {
         IError::show(403, '订单不存在');
     }
     //更换了支付方式,更新手续费
     if ($payment != 0 && $orderRow['pay_type'] != $payment) {
         $paymentObj = new IModel('payment');
         $payRow = $paymentObj->getObj('id = ' . $payment, 'poundage_type,poundage');
         if ($payRow['poundage_type'] == 1) {
             $pay_fee = ($orderRow['order_amount'] - $orderRow['pay_fee']) * ($payRow['poundage'] / 100);
         } else {
             $pay_fee = $payRow['poundage'];
         }
         $dataArray = array('pay_type' => $payment, 'order_amount' => $orderRow['order_amount'] - $orderRow['pay_fee'] + $pay_fee, 'pay_fee' => $pay_fee);
         $orderObj->setData($dataArray);
         $orderObj->update('id = ' . $id);
     } else {
         $payment = $orderRow['pay_type'];
     }
     //拼接query字符串
     $query_str = '?order_id=' . $id . '&id=' . $payment;
     $this->redirect('/block/doPay/' . $query_str);
 }