/** * 提交函数 */ function get_code($order, $payment) { $c_mid = trim($payment['allpay_card24_account']); $log_id = $order['log_id']; $order_id = $order['order_sn']; $c_orderamount = $order['order_amount']; $c_returl = return_url(basename(__FILE__, '.php')) . "?log_id=" . $log_id; $c_returl = str_replace('respond', 'allpay_response', $c_returl); $key = trim($payment['allpay_card24_key']); $iv = trim($payment['allpay_card24_iv']); $goods = order_goods($order['order_id']); foreach ($goods as $good) { //先上架商品 $product .= "#" . $good['goods_name']; } $product = substr($product, 1); $date = date('Y/m/d H:i:s'); $desc = "Allpay_Ecshop_Module"; $input_array = array('ChoosePayment' => 'Credit', 'ClientBackURL' => $GLOBALS['ecs']->url(), 'ItemName' => $product, 'MerchantID' => $c_mid, 'MerchantTradeDate' => $date, 'MerchantTradeNo' => $order_id, 'PaymentType' => 'aio', 'ReturnURL' => $c_returl, 'TotalAmount' => intval($c_orderamount), 'TradeDesc' => $desc, 'CreditInstallment' => 24, 'InstallmentAmount' => intval($c_orderamount)); ksort($input_array); $checkvalue = "HashKey=" . $key . "&" . urldecode(http_build_query($input_array)) . "&HashIV=" . $iv; $checkvalue = urlencode($checkvalue); $checkvalue = strtolower($checkvalue); $checkvalue = md5($checkvalue); $gateway = "https://payment.allpay.com.tw/Cashier/AioCheckOut"; //$gateway = "http://payment-stage.allpay.com.tw/Cashier/AioCheckOut"; $def_url = '<form style="text-align:center;" method=post action="' . $gateway . '">'; foreach ($input_array as $param => $value) { $def_url .= "<input type='hidden' name='{$param}' value='{$value}'>"; } $def_url .= "<input type='hidden' name='CheckMacValue' value='" . $checkvalue . "'>"; $def_url .= "<input type='submit' value='" . $GLOBALS['_LANG']['pay_button'] . "'>"; $def_url .= "</form><br />"; return $def_url; }
/** * 提交函数 */ function get_code($order, $payment) { $c_mid = trim($payment['allpay_alipay_account']); $log_id = $order['log_id']; $order_id = $order['order_sn']; $c_tel = trim($order['tel']); $c_email = trim($order['email']); $c_orderamount = $order['order_amount']; $c_returl = return_url(basename(__FILE__, '.php')) . "?log_id=" . $log_id; $c_returl = str_replace('respond', 'allpay_response', $c_returl); $c_name = trim($order['consignee']); $key = trim($payment['allpay_alipay_key']); $iv = trim($payment['allpay_alipay_iv']); $goods = order_goods($order['order_id']); $product = $qty = $price = ""; foreach ($goods as $good) { //先上架商品 $product .= "#" . $good['goods_name']; $qty .= "#" . $good['goods_number']; $price .= "#" . round($good['goods_price']); } $product = substr($product, 1); $qty = substr($qty, 1); $price = substr($price, 1); $date = date('Y/m/d H:i:s'); $desc = "Allpay_Ecshop_Module"; $input_array = array("AlipayItemCounts" => $qty, "AlipayItemName" => urlencode($product), "AlipayItemPrice" => $price, "ChoosePayment" => "Alipay", "Email" => $c_email, "ItemName" => $product, "MerchantID" => $c_mid, "MerchantTradeDate" => $date, "PaymentType" => "aio", "ReturnURL" => $c_returl, "PhoneNo" => $c_tel, "TotalAmount" => intval($c_orderamount), "TradeDesc" => $desc, "UserName" => $c_name, "MerchantTradeNo" => $order_id); ksort($input_array); $checkvalue = "HashKey={$key}&" . urldecode(http_build_query($input_array)) . "&HashIV={$iv}"; $checkvalue = strtolower(urlencode($checkvalue)); $checkvalue = md5($checkvalue); $input_array["CheckMacValue"] = $checkvalue; $gateway = "https://payment.allpay.com.tw/Cashier/AioCheckOut"; //$gateway = "http://payment-stage.allpay.com.tw/Cashier/AioCheckOut"; $def_url = '<form style="text-align:center;" method=post action="' . $gateway . '">'; foreach ($input_array as $keys => $value) { $def_url .= "<input type='hidden' name='{$keys}' value='{$value}'>"; } $def_url .= "<input type='submit' value='" . $GLOBALS['_LANG']['pay_button'] . "'>"; $def_url .= "</form><br />"; return $def_url; }
public function order_goods($order_id) { /* 订单商品 */ $goods_list = order_goods($order_id); foreach ($goods_list as $key => $value) { $goods_list[$key]['market_price'] = price_format($value['market_price'], false); $goods_list[$key]['goods_price'] = price_format($value['goods_price'], false); $goods_list[$key]['subtotal'] = price_format($value['subtotal'], false); } return $goods_list; }
/** * 提交函数 */ function get_code($order, $payment) { //print_r($order);exit; $payment = get_payment('ecbank_pincodeibon'); $c_mid = trim($payment['ecbank_pincodeibon_account']); $c_order = $order['log_id']; $c_od_sob = $order['order_sn']; $c_name = trim($order['consignee']); $c_address = trim($order['address']); $c_tel = trim($order['tel']); $c_post = trim($order['zipcode']); $c_email = trim($order['email']); $c_orderamount = $order['order_amount']; $c_ymd = date('Ymd', time()); $c_moneytype = "0"; $c_retflag = "1"; $c_returl = return_url(basename(__FILE__, '.php')); $notifytype = "0"; $c_language = $payment['ecbank_pincodeibon_language']; $c_memo1 = $order['log_id']; $c_memo2 = $order['log_id']; $key = trim($payment['ecbank_pincodeibon_checkcode']); $def_url = ""; //開始綠界虛擬帳號取號 $param = array('ecbank_gateway' => 'https://ecbank.com.tw/gateway.php', 'mer_id' => $c_mid, 'enc_key' => $key, 'od_sob' => $c_order, 'amt' => intval($c_orderamount), 'prd_desc' => $c_order, 'ok_url' => rawurlencode($c_returl)); // 執行取號 $strAuth = ''; $nvpStr = 'payment_type=ibon' . '&od_sob=' . $param['od_sob'] . '&mer_id=' . $param['mer_id'] . '&enc_key=' . $param['enc_key'] . '&amt=' . $param['amt'] . '&prd_desc=' . $param['prd_desc'] . '&ok_url=' . $param['ok_url']; $temp = order_goods($order['order_id']); //判斷是否使用電子發票 if ($payment['ecbank_pincodeibon_inv_active'] == "1") { $nvpStr .= "&inv_active=1"; $nvpStr .= "&inv_mer_id=" . $payment['ecbank_pincodeibon_inv_mer_id']; $nvpStr .= "&inv_semail=" . $c_email; for ($i = 0; $i < count($temp); $i++) { $nvpStr .= "&prd_name[]=" . $temp[$i]['goods_name']; $nvpStr .= "&prd_qry[]=" . $temp[$i]['goods_number']; $nvpStr .= "&prd_price[]=" . intval($temp[$i]['goods_price']); } $nvpStr .= "&prd_name[]=運費"; $nvpStr .= "&prd_qry[]=1"; $nvpStr .= "&prd_price[]=" . $order['shipping_fee']; } $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, $param['ecbank_gateway']); curl_setopt($ch, CURLOPT_VERBOSE, 1); curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE); curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, FALSE); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); curl_setopt($ch, CURLOPT_POST, 1); curl_setopt($ch, CURLOPT_POSTFIELDS, $nvpStr); $strAuth = curl_exec($ch); if (curl_errno($ch)) { $strAuth = false; } curl_close($ch); //exit; parse_str($strAuth, $res); if (!isset($res['error']) || $res['error'] != '0') { $def_url = '取號錯誤(' . $res['error'] . ')'; } else { //$def_url ='交易單號: '.$res['tsr']; $def_url .= '[統一超商7-Eleven]超商繳費代碼:(<font color=blue size=+2>' . $res['payno'] . '</font>)<br><br>'; $def_url .= '<a href=http://www.ecbank.com.tw/expenses-ibon.htm target=_blank>統一超商7-Eleven ibon 門市操作步驟</a><br>'; $def_url .= '請記下上列超商繳費代碼,至最近之統一超商7-Eleven便利商店,操作代碼繳費機台, 於列印出有調碼之繳款單後,至櫃台支付,<br>便可完成繳費,繳費之收據請留存以供備核,繳費之後才算完成購物流程'; $def_url .= '<br><br>本線上金流機制採用< <a href=http://www.ecbank.com.tw target=_blank>綠界科技 ECBank 線上支付平台</a> >'; //$def_url.='銀行帳戶:(<font color=blue size=+2>'.$res['vaccno'].'</font>)'; $note = '綠界 ECBank 交易流水号:' . $res['tsr']; //order_paid($c_order, '0', $note); return $def_url; } }
/** * 提交函数 */ function get_code($order, $payment) { //include_once(ROOT_PATH.'includes/iconv/cls_iconv.php'); //$iconv = new Chinese(ROOT_PATH); $c_mid = trim($payment['gw_allpay6_account']); //$c_order = $order['order_sn']; $c_order = $order['log_id']; $c_name = trim($order['consignee']); $c_address = trim($order['address']); $c_tel = trim($order['tel']); $c_post = trim($order['zipcode']); $c_email = trim($order['email']); $c_orderamount = $order['order_amount']; $c_ymd = date('Ymd', time()); $c_moneytype = "0"; $c_retflag = "1"; $c_returl = return_url(basename(__FILE__, '.php')); $notifytype = "0"; $c_language = $payment['gw_allpay6_language']; $c_memo1 = $order['log_id']; $c_memo2 = $order['log_id']; //$srcStr = $c_mid . $c_order . $c_orderamount . $c_ymd . $c_moneytype . $c_retflag . $c_returl . $c_paygate . $c_memo1 . $c_memo2 . $notifytype . $c_language . $c_pass; //$c_signstr = md5($srcStr); if (is_numeric($payment['gw_allpay6_installment']) && $payment['gw_allpay6_installment'] > 0) { if ($order['pay_fee'] == 0) { //判斷尚未更新過手續費 $c_orderamount = round($c_orderamount * (1 + $payment['gw_allpay6_installment'])); $pay_button = "" . $GLOBALS['_LANG']['pay_button'] . "" . $GLOBALS['_LANG']['gw_allpay6_stage'] . "期 " . $payment['gw_allpay6_installment'] * 100 . "% 利率付款 總計金額:" . $c_orderamount . "元"; $sql = 'UPDATE ' . $GLOBALS['ecs']->table('pay_log') . ' SET order_amount = ' . round($c_orderamount) . ' WHERE log_id = ' . $order['log_id']; $GLOBALS['db']->query($sql); $order_temp = array("order_amount" => $c_orderamount, "pay_fee" => round($c_orderamount) - round($order['order_amount'])); update_order($order['order_id'], $order_temp); } else { $pay_button = "" . $GLOBALS['_LANG']['pay_button'] . "" . $GLOBALS['_LANG']['gw_allpay6_stage'] . "期 " . $payment['gw_allpay6_installment'] * 100 . "% 利率付款 總計金額:" . $c_orderamount . "元"; } } else { $pay_button = "" . $GLOBALS['_LANG']['pay_button'] . "" . $GLOBALS['_LANG']['gw_allpay6_stage'] . "期零利率付款"; } $def_url = '<br /><form style="text-align:center;" method=post action="https://credit.allpay.com.tw/form_Sc_to5_fn.php">'; $def_url .= "<input type='hidden' name='client' value='" . $c_mid . "'>"; $def_url .= "<input type='hidden' name='act' value='auth'>"; $def_url .= "<input type='hidden' name='stage' value='" . $GLOBALS['_LANG']['gw_allpay6_stage'] . "'>"; $def_url .= "<input type='hidden' name='od_sob' value='" . $c_order . "'>"; $def_url .= "<input type='hidden' name='名稱' value='" . $c_name . "'>"; $def_url .= "<input type='hidden' name='地址' value='" . $c_address . "'>"; $def_url .= "<input type='hidden' name='電話' value='" . $c_tel . "'>"; $def_url .= "<input type='hidden' name='email' value='" . $c_email . "'>"; $def_url .= "<input type='hidden' name='amount' value='" . $c_orderamount . "'>"; $def_url .= "<input type='hidden' name='時間' value='" . $c_ymd . "'>"; $def_url .= "<input type='hidden' name='roturl' value='" . $c_returl . "'>"; $temp = order_goods($order['order_id']); //判斷是否使用電子發票 if ($payment['gw_ecpay3_inv_active'] == "1") { $def_url .= "<input type='hidden' name='inv_active' value='1'>"; $def_url .= "<input type='hidden' name='inv_mer_id' value='" . $payment['gw_allpay6_inv_mer_id'] . "'>"; $def_url .= "<input type='hidden' name='inv_semail' value='" . $c_email . "'>"; for ($i = 0; $i < count($temp); $i++) { $def_url .= "<input type='hidden' name='prd_name[]' value='" . $temp[$i]['goods_name'] . "'>"; $def_url .= "<input type='hidden' name='prd_qry[]' value='" . intval($temp[$i]['goods_number']) . "'>"; $def_url .= "<input type='hidden' name='prd_price[]' value='" . intval($temp[$i]['goods_price']) . "'>"; } $def_url .= "<input type='hidden' name='prd_name[]' value=運費>"; $def_url .= "<input type='hidden' name='prd_qry[]' value=1>"; $def_url .= "<input type='hidden' name='prd_price[]' value='" . intval($order['shipping_fee']) . "'>"; $def_url .= "<input type='hidden' name='prd_name[]' value=手續費>"; $def_url .= "<input type='hidden' name='prd_qry[]' value=1>"; } if ($order['pay_fee'] == 0) { $def_url .= "<input type='hidden' name='prd_price[]' value='" . $order_temp['pay_fee'] . "'>"; } else { $def_url .= "<input type='hidden' name='prd_price[]' value='" . $order['pay_fee'] . "'>"; } $def_url .= "<input type='submit' value='" . $pay_button . "'>"; $def_url .= "</form><br />"; return $def_url; }
/** * 提交函数 */ function get_code($order, $payment) { $c_mid = trim($payment['ecbank_vacc_account']); $c_order = $order['log_id']; $c_name = trim($order['consignee']); $c_address = trim($order['address']); $c_tel = trim($order['tel']); $c_post = trim($order['zipcode']); $c_email = trim($order['email']); $c_orderamount = $order['order_amount']; $c_ymd = date('Ymd', time()); $c_moneytype = "0"; $c_retflag = "1"; $c_returl = return_url(basename(__FILE__, '.php')); $notifytype = "0"; //$c_language = $payment['ecbank_vacc_language']; $c_memo1 = $order['log_id']; $c_memo2 = $order['log_id']; $def_url = ''; $key = trim($payment['ecbank_vacc_checkcode']); //開始綠界虛擬帳號取號 $param = array('ecbank_gateway' => 'https://ecbank.com.tw/gateway.php', 'mer_id' => $c_mid, 'payment_type' => 'vacc', 'setbank' => 'ESUN', 'enc_key' => $key, 'od_sob' => $c_order, 'amt' => intval($c_orderamount), 'expire_day' => '7', 'ok_url' => rawurlencode($c_returl)); // 執行取號 $strAuth = ''; $nvpStr = 'mer_id=' . $param['mer_id'] . '&payment_type=' . $param['payment_type'] . '&setbank=' . $param['setbank'] . '&enc_key=' . $param['enc_key'] . '&od_sob=' . $param['od_sob'] . '&amt=' . $param['amt'] . '&expire_day=' . $param['expire_day'] . '&ok_url=' . $param['ok_url']; $temp = order_goods($order['order_id']); //判斷是否使用電子發票 if ($payment['ecbank_vacc_inv_active'] == "1") { $nvpStr .= "&inv_active=1"; $nvpStr .= "&inv_mer_id=" . $payment['ecbank_vacc_inv_mer_id']; $nvpStr .= "&inv_semail=" . $c_email; $nvpStr .= ""; $nvpStr .= ""; $nvpStr .= ""; for ($i = 0; $i < count($temp); $i++) { $nvpStr .= "&prd_name[]=" . $temp[$i]['goods_name']; $nvpStr .= "&prd_qry[]=" . $temp[$i]['goods_number']; $nvpStr .= "&prd_price[]=" . intval($temp[$i]['goods_price']); } $nvpStr .= "&prd_name[]=運費"; $nvpStr .= "&prd_qry[]=1"; $nvpStr .= "&prd_price[]=" . $order['shipping_fee']; } $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, $param['ecbank_gateway']); curl_setopt($ch, CURLOPT_VERBOSE, 1); curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE); curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, FALSE); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); curl_setopt($ch, CURLOPT_POST, 1); curl_setopt($ch, CURLOPT_POSTFIELDS, $nvpStr); $strAuth = curl_exec($ch); if (curl_errno($ch)) { print_r($strAuth); $strAuth = false; exit; } curl_close($ch); if ($strAuth) { parse_str($strAuth, $res); //print_r($strAuth); //print_r($res); if (!isset($res['error']) || $res['error'] != '0') { $def_url = "<acript>alert('取號錯誤')</script>"; } else { $def_url .= '轉帳銀行代碼:(<font color=blue size=+2>' . $res['bankcode'] . '</font>)'; $def_url .= '轉帳銀行帳戶:(<font color=blue size=+2>' . $res['vaccno'] . '</font>)'; $def_url .= "<br>持玉山銀行金融卡轉帳可免付跨行交易手續費,其它銀行依該行跨行手續費規定扣繳<br><a href=https://netbank.esunbank.com.tw/webatm/> 玉山銀行 WEB-ATM https://netbank.esunbank.com.tw/webatm/</a>"; $note = '綠界 ECBank交易流水号:' . $res['tsr']; //order_paid($c_order, '0', $note); return $def_url; } } else { $def_url = "取號失敗"; return $def_url; //exit; } }
break; case 2: $order['shipping_status'] = "已收货"; break; case 3: $order['shipping_status'] = "备货中"; break; case 4: $order['shipping_status'] = "已发货(部分商品)"; break; case 5: $order['shipping_status'] = "发货中(处理分单)"; break; case 6: $order['shipping_status'] = "已发货(部分商品)"; break; } //获取订单中的商品 $goods_list = order_goods($order['order_id']); $smarty->assign('goods_list', $goods_list); $kuaidi = new Express(); $result = $kuaidi->getorder($order['shipping_name'], $order['invoice_no']); $smarty->assign('order', $order); $smarty->assign('kuaidi_list', $result['data']); } else { show_message('您没有权限查看此物流信息!'); } } else { Header("Location: index.php\n"); } $smarty->display('kuaidi_list.dwt');
function action_order_detail() { $user = $GLOBALS['user']; $_CFG = $GLOBALS['_CFG']; $_LANG = $GLOBALS['_LANG']; $smarty = $GLOBALS['smarty']; $db = $GLOBALS['db']; $ecs = $GLOBALS['ecs']; $user_id = $_SESSION['user_id']; include_once ROOT_PATH . 'includes/lib_transaction.php'; include_once ROOT_PATH . 'includes/lib_payment.php'; include_once ROOT_PATH . 'includes/lib_order.php'; include_once ROOT_PATH . 'includes/lib_clips.php'; $order_id = isset($_GET['order_id']) ? intval($_GET['order_id']) : 0; /* 订单详情 */ $order = get_order_detail($order_id, $user_id); /* 退换货插件 www.68ecshop.com增加 */ $shipping_time = $db->getOne("SELECT shipping_time FROM " . $ecs->table('order_info') . " WHERE order_id = '{$order_id}'"); $now_time = gmtime(); $not_back = 0; if ($GLOBALS['_CFG']['tuihuan_days_fahuo'] > 0) { if (($now_time - $shipping_time) / 86400 < $GLOBALS['_CFG']['tuihuan_days_fahuo']) { $not_back = 1; } } if ($GLOBALS['_CFG']['tuihuan_days_qianshou'] > 0) { if (($now_time - $shipping_time) / 86400 > $GLOBALS['_CFG']['tuihuan_days_qianshou']) { $not_back = 1; } } $smarty->assign('not_back', $not_back); /* 退换货插件 www.68ecshop.com增加 */ if ($order === false) { $err->show($_LANG['back_home_lnk'], './'); exit; } if ($db->getOne("select shipping_code from " . $ecs->table('shipping') . " where shipping_id=" . $order['shipping_id']) == "tc_express") { $order['tc_express'] = 1; $ko_order_sn = $db->getOne("select invoice_no from " . $ecs->table('delivery_order') . " where order_id=" . $order_id); if ($ko_order_sn) { $kos_order_id = $db->getOne("select order_id from " . $ecs->table('kuaidi_order') . " where order_sn='" . $ko_order_sn . "'"); } $sql = "select * from " . $ecs->table('kuaidi_order_status') . " where order_id='{$kos_order_id}' order by status_id"; $res_status = $db->query($sql); $have_shipping_info = 0; $shipping_info = ""; while ($row_status = $db->fetchRow($res_status)) { if ($row_status['status_display'] == 1) { switch ($row_status['status_id']) { case 1: $shipping_info .= "您提交了订单,请等待确认。 (" . local_date('Y-m-d H:i:s', $row_status['status_time']) . ")"; break; case 2: $shipping_info .= "您的快件已经确认,等待快递员揽收。 (" . local_date('Y-m-d H:i:s', $row_status['status_time']) . ")"; break; case 3: $postman_id = $db->getOne("select postman_id from " . $ecs->table('kuaidi_order') . " where order_sn='" . $order['invoice_no'] . "'"); $postman_info = $db->getRow("select postman_name, mobile from " . $ecs->table('postman') . " where postman_id=" . $postman_id); $shipping_info .= "您的快件正在派送,快递员:" . $postman_info['postman_name'] . ",电话:" . $postman_info['mobile'] . " (" . local_date('Y-m-d H:i:s', $row_status['status_time']) . ")"; break; case 4: $shipping_info .= "您的快件已经签收。 (" . local_date('Y-m-d H:i:s', $row_status['status_time']) . ")"; break; case 5: $shipping_info .= "您的快件已被拒收。 (" . local_date('Y-m-d H:i:s', $row_status['status_time']) . ")"; break; case 6: $shipping_info .= "您拒收的快件已被退回。 (" . local_date('Y-m-d H:i:s', $row_status['status_time']) . ")"; break; case 7: $shipping_info .= "您的快件已经取消。 (" . local_date('Y-m-d H:i:s', $row_status['status_time']) . ")"; break; } $shipping_info .= "<br>"; if ($row_status['status_id'] >= 1) { $have_shipping_info++; } } } if ($have_shipping_info) { $result_content = $shipping_info; } else { $result_content = '抱歉,暂时还没有该运单的物流信息哦!'; } } $smarty->assign('result_content', $result_content); /* 是否显示添加到购物车 */ if ($order['extension_code'] != 'group_buy' && $order['extension_code'] != 'exchange_goods') { $smarty->assign('allow_to_cart', 1); } /* 订单商品 */ $goods_list = order_goods($order_id); foreach ($goods_list as $key => $value) { $goods_list[$key]['market_price'] = price_format($value['market_price'], false); $goods_list[$key]['goods_price'] = price_format($value['goods_price'], false); $goods_list[$key]['subtotal'] = price_format($value['subtotal'], false); $sql_back = "SELECT bg.*, bo.back_type FROM " . $ecs->table('back_goods') . " AS bg " . " LEFT JOIN " . $ecs->table('back_order') . " AS bo " . " ON bg.back_id = bo.back_id " . " WHERE bo.order_id = " . $order_id . " AND bg.goods_id = " . $value['goods_id'] . " AND bg.product_id = " . $value['product_id'] . " AND bg.status_back < 6"; $back_info = $db->getRow($sql_back); if (count($back_info['back_id']) > 0) { switch ($back_info['status_back']) { case '3': $sb = "已完成"; break; case '5': $sb = "已申请"; break; // case '6' : $sb = ""; break; // case '7' : $sb = ""; break; // case '6' : $sb = ""; break; // case '7' : $sb = ""; break; default: $sb = "正在"; break; } switch ($back_info['back_type']) { case '1': $bt = "退货"; break; case '3': $bt = "申请维修"; break; case '4': $bt = "退款"; break; default: break; } $shouhou = $sb . " " . $bt; } else { $shouhou = "正常"; } $goods_list[$key]['shouhou'] = $shouhou; } /* 设置能否修改使用余额数 */ if ($order['order_amount'] > 0) { if ($order['order_status'] == OS_UNCONFIRMED || $order['order_status'] == OS_CONFIRMED) { $user = user_info($order['user_id']); if ($user['user_money'] + $user['credit_line'] > 0) { $smarty->assign('allow_edit_surplus', 1); $smarty->assign('max_surplus', sprintf($_LANG['max_surplus'], $user['user_money'])); } } } /* 未发货,未付款时允许更换支付方式 */ if ($order['order_amount'] > 0 && $order['pay_status'] == PS_UNPAYED && $order['shipping_status'] == SS_UNSHIPPED) { $payment_list = available_payment_list(false, 0, true); /* 过滤掉当前支付方式和余额支付方式 */ if (is_array($payment_list)) { foreach ($payment_list as $key => $payment) { if ($payment['pay_id'] == $order['pay_id'] || $payment['pay_code'] == 'balance') { unset($payment_list[$key]); } } } $smarty->assign('payment_list', $payment_list); } /* 订单 支付 配送 状态语言项 */ $order['order_status'] = $_LANG['os'][$order['order_status']]; $order['pay_status'] = $_LANG['ps'][$order['pay_status']]; $order['shipping_status_id'] = $order['shipping_status']; // 代码增加 By // www.68ecshop.com $order['shipping_status'] = $_LANG['ss'][$order['shipping_status']]; /* 增值税发票_添加_START_www.68ecshop.com */ /* 增值税发票收票地址 */ if ($order['inv_type'] == 'vat_invoice') { $order['inv_complete_address'] = get_inv_complete_address($order); } /* 发票金额 */ $order['formatted_inv_money'] = price_format($order['inv_money']); /* 增值税发票_添加_END_www.68ecshop.com */ $smarty->assign('order', $order); /* 代码增加_start By www.68ecshop.com */ $smarty->assign('mobile_phone', $GLOBALS['db']->getOne("select mobile_phone from " . $GLOBALS['ecs']->table('users') . " where user_id='{$_SESSION['user_id']}'")); foreach ($goods_list as $goods_key => $goods_val) { $sql_goods = "select count(*) from " . $ecs->table('back_order') . " where order_id='{$order['order_id']}' and goods_id='{$goods_val['goods_id']}'"; $back_order_count = $db->getOne($sql_goods); $goods_list[$goods_key]['back_can'] = $back_order_count ? '0' : '1'; /* 代码增加_start By www.68ecshop.com _20150804 */ if ($goods_val['extension_code'] == 'virtual_good') { $virtual_goods_card = $db->getAll("select gc.card_sn,gc.end_date,buy_date from " . $ecs->table('virtual_goods_card') . " as gc join (select order_id,order_sn from " . $ecs->table('order_info') . " where order_id='{$goods_val['order_id']}') as oi on gc.order_sn = oi.order_sn"); foreach ($virtual_goods_card as $k => $v) { $virtual_goods_card[$k]['end_date'] = empty($v['end_date']) ? '' : local_date('Y-m-d', $v['end_date']); $virtual_goods_card[$k]['buy_date'] = empty($v['buy_date']) ? '' : local_date('Y-m-d', $v['buy_date']); $virtual_goods_card[$k]['end_date_time'] = empty($v['end_date']) ? '' : $v['end_date']; $virtual_goods_card[$k]['buy_date_time'] = empty($v['buy_date']) ? '' : $v['buy_date']; } $goods_list[$goods_key]['virtual_goods_card'] = $virtual_goods_card; } /* 代码增加_end By www.68ecshop.com _20150804 */ $goods_list[$key]['shouhou'] = $shouhou; } /* 设置能否修改使用余额数 */ if ($order['order_amount'] > 0) { if ($order['order_status'] == OS_UNCONFIRMED || $order['order_status'] == OS_CONFIRMED) { $user = user_info($order['user_id']); if ($user['user_money'] + $user['credit_line'] > 0) { $smarty->assign('allow_edit_surplus', 1); $smarty->assign('max_surplus', sprintf($_LANG['max_surplus'], $user['user_money'])); } } } /* 未发货,未付款时允许更换支付方式 */ if ($order['order_amount'] > 0 && $order['pay_status'] == PS_UNPAYED && $order['shipping_status'] == SS_UNSHIPPED) { $payment_list = available_payment_list(false, 0, true); /* 过滤掉当前支付方式和余额支付方式 */ if (is_array($payment_list)) { foreach ($payment_list as $key => $payment) { if ($payment['pay_id'] == $order['pay_id'] || $payment['pay_code'] == 'balance') { unset($payment_list[$key]); } } } $smarty->assign('payment_list', $payment_list); } /* 订单 支付 配送 状态语言项 */ $order['order_status'] = $_LANG['os'][$order['order_status']]; $order['pay_status'] = $_LANG['ps'][$order['pay_status']]; $order['shipping_status_id'] = $order['shipping_status']; // 代码增加 By // www.68ecshop.com $order['shipping_status'] = $_LANG['ss'][$order['shipping_status']]; /* 增值税发票_添加_START_www.68ecshop.com */ /* 增值税发票收票地址 */ if ($order['inv_type'] == 'vat_invoice') { $order['inv_complete_address'] = get_inv_complete_address($order); } /* 发票金额 */ $order['formatted_inv_money'] = price_format($order['inv_money']); /* 增值税发票_添加_END_www.68ecshop.com */ $smarty->assign('order', $order); /* 代码增加_start By www.68ecshop.com */ foreach ($goods_list as $goods_key => $goods_val) { $sql_goods = "select count(*) from " . $ecs->table('back_order') . " where order_id='{$order['order_id']}' and goods_id='{$goods_val['goods_id']}'"; $back_order_count = $db->getOne($sql_goods); $goods_list[$goods_key]['back_can'] = $back_order_count ? '0' : '1'; } /* 代码增加_end By www.68ecshop.com */ $smarty->assign('goods_list', $goods_list); $smarty->display('user_transaction.dwt'); }
function action_order_detail() { $user = $GLOBALS['user']; $_CFG = $GLOBALS['_CFG']; $_LANG = $GLOBALS['_LANG']; $smarty = $GLOBALS['smarty']; $db = $GLOBALS['db']; $ecs = $GLOBALS['ecs']; $user_id = $GLOBALS['user_id']; include_once ROOT_PATH . 'includes/lib_transaction.php'; include_once ROOT_PATH . 'includes/lib_payment.php'; include_once ROOT_PATH . 'includes/lib_order.php'; include_once ROOT_PATH . 'includes/lib_clips.php'; include_once ROOT_PATH . 'kuaidi/kuaidi.php'; $order_id = isset($_GET['order_id']) ? intval($_GET['order_id']) : 0; /* 订单详情 */ $order = get_order_detail($order_id, $user_id); if ($order === false) { $GLOBALS['err']->show($_LANG['back_home_lnk'], './'); exit; } /* 是否显示添加到购物车 */ if ($order['extension_code'] != 'group_buy' && $order['extension_code'] != 'exchange_goods') { $smarty->assign('allow_to_cart', 1); } /* 订单商品 */ $goods_list = order_goods($order_id); foreach ($goods_list as $key => $value) { $goods_list[$key]['market_price'] = price_format($value['market_price'], false); $goods_list[$key]['goods_price'] = price_format($value['goods_price'], false); $goods_list[$key]['subtotal'] = price_format($value['subtotal'], false); } /* 设置能否修改使用余额数 */ if ($order['order_amount'] > 0) { if ($order['order_status'] == OS_UNCONFIRMED || $order['order_status'] == OS_CONFIRMED) { $user = user_info($order['user_id']); if ($user['user_money'] + $user['credit_line'] > 0) { $smarty->assign('allow_edit_surplus', 1); $smarty->assign('max_surplus', sprintf($_LANG['max_surplus'], $user['user_money'])); } } } /* 未发货,未付款时允许更换支付方式 */ if ($order['order_amount'] > 0 && $order['pay_status'] == PS_UNPAYED && $order['shipping_status'] == SS_UNSHIPPED) { $payment_list = available_payment_list(false, 0, true); /* 过滤掉当前支付方式和余额支付方式 */ if (is_array($payment_list)) { foreach ($payment_list as $key => $payment) { if ($payment['pay_id'] == $order['pay_id'] || $payment['pay_code'] == 'balance') { unset($payment_list[$key]); } } } $smarty->assign('payment_list', $payment_list); } /* 订单 支付 配送 状态语言项 */ $order['order_status'] = $_LANG['os'][$order['order_status']]; $order['pay_status'] = $_LANG['ps'][$order['pay_status']]; $order['shipping_status'] = $_LANG['ss'][$order['shipping_status']]; //快递跟踪 $kuaidi = new Express(); $result = $kuaidi->getorder($order['shipping_name'], $order['invoice']); $smarty->assign('kuaidi', $result['data'][0]); $smarty->assign('order', $order); $smarty->assign('goods_list', $goods_list); $smarty->display('user_transaction.dwt'); }
//-- PROCESSOR /*------------------------------------------------------ */ $cache_id = sprintf('%X', crc32($_REQUEST['id'] . '-' . $_CFG['lang'])); if (!$smarty->is_cached('xspace_show.dwt', $cache_id)) { /* 文章详情 */ $article = get_article_info($article_id); if (empty($article)) { ecs_header("Location: ./\n"); exit; } if (!empty($article['link']) && $article['link'] != 'http://' && $article['link'] != 'https://') { ecs_header("location:{$article['link']}\n"); exit; } include_once ROOT_PATH . 'includes/lib_order.php'; $order_goods_list = order_goods($article["order_id"]); foreach ($order_goods_list as $key => $value) { $order_goods_list[$key]['goods_thumb'] = get_goods_thumb($value['goods_id']); $order_goods_list[$key]['market_price'] = price_format($value['market_price'], false); $order_goods_list[$key]['goods_price'] = price_format($value['goods_price'], false); $order_goods_list[$key]['subtotal'] = price_format($value['subtotal'], false); } $smarty->assign('order_goods_list', $order_goods_list); $smarty->assign('article_categories', article_categories_tree($article_id)); //文章分类树 $smarty->assign('categories', get_categories_tree()); // 分类树 $smarty->assign('helps', get_shop_help()); // 网店帮助 $smarty->assign('top_goods', get_top10()); // 销售排行
} } $smarty->assign('is_team', $is_team); $smarty->assign('order', $row); include_once ROOT_PATH . 'includes/lib_payment.php'; include_once ROOT_PATH . 'includes/lib_order.php'; /* $sql = "SELECT * FROM " . $GLOBALS['hhs']->table('order_info') . " WHERE team_sign = '$team_sign' and team_first=1 "; $order=$db->getRow($sql); if ($order === false) { exit; }*/ /* 订单商品 */ $goods_list = order_goods($team_sign); foreach ($goods_list as $key => $value) { $goods_list[$key]['market_price'] = price_format($value['market_price'], false); $goods_list[$key]['goods_price'] = price_format($value['goods_price'], false); $goods_list[$key]['subtotal'] = price_format($value['subtotal'], false); } //参团的人 $sql = "select u.user_name,u.uname,u.headimgurl,o.pay_time,o.team_first from " . $hhs->table('order_info') . " as o left join " . $hhs->table('users') . " as u on o.user_id=u.user_id where team_sign=" . $team_sign . " and team_status>0 order by order_id "; $team_mem = $db->getAll($sql); foreach ($team_mem as $k => $v) { $team_mem[$k]['date'] = local_date('Y-m-d H:i:s', $v['pay_time']); } $team_start = $team_mem[0]['pay_time']; $smarty->assign('team_start', $team_start); $smarty->assign('systime', gmtime()); $smarty->assign('team_mem', $team_mem);
function action_chat() { $user_id = $_SESSION['user_id']; $smarty = get_smarty(); $ecs = get_ecs(); $db = get_database(); /** * 判断当前用户是为聊天系统的注册用户 */ $exist = check_of_username_exist($user_id); // 获取用户头像 if (!empty($user_id)) { $sql = "select password, headimg from " . $ecs->table('users') . " where user_id = '{$user_id}'"; $row = $db->getRow($sql); $headimg = $row['headimg']; $password = $row['password']; $smarty->assign('headimg', $headimg); } if (!$exist) { // 查询ECShop内用户信息 $sql = 'select a.user_id, a.password, a.email, a.user_name from ' . $ecs->table('users') . ' AS a where a.user_id = "' . $user_id . '"'; $user = $GLOBALS['db']->getRow($sql); if (empty($user)) { // 根据user_id未查找到任何用户信息 } // 用户不存在,创建用户信息 $username = $user_id; $password = $user['password']; $name = $user['user_name']; $email = $user['email']; $type = 10; $shop_id = -1; $result = create_of_user($username, $password, $name, $email, $type, $shop_id); if ($result) { // 创建成功 } else { // 创建失败 } } // 获取前端传来的商品编号、订单编号、店铺编号等 // 商品编号则显示商品信息 // 订单编号则显示订单信息 // 店铺编号则显示店铺信息 $goods_id = null; $supp_id = -1; $order_id = null; $customers = null; // 获取客服信息 $tab_items = array(); // 客服类型 $cus_types = CUSTOMER_SERVICE; // 记录需要发给客服的URL if (!empty($_REQUEST['chat_goods_id'])) { /* 咨询商品信息 */ $goods_id = $_REQUEST['chat_goods_id']; $goods = goods_info($goods_id); $smarty->assign('chat_goods', $goods); $smarty->assign('chat_goods_id', $goods_id); // 获取店铺信息 $supp_id = null; $tab_items[] = array("id" => "chat_goods", "name" => "咨询商品"); // 客服+售前 $cus_types = CUSTOMER_SERVICE . ',' . CUSTOMER_PRE; } if (!empty($_REQUEST['chat_supp_id'])) { /* 店铺信息 */ $supp_id = $_REQUEST['chat_supp_id']; $supp_info = get_dianpu_baseinfo($supp_id); $smarty->assign('supp_info', $supp_info); $smarty->assign('chat_supp_id', $supp_id); $tab_items[] = array("id" => "chat_supp", "name" => "店铺信息"); // 客服+售前 $cus_types = CUSTOMER_SERVICE . ',' . CUSTOMER_PRE; } if (!empty($_REQUEST['chat_order_id'])) { /* 咨询订单信息 */ require 'includes/lib_order.php'; $order_id = $_REQUEST['chat_order_id']; // 获取商品和店铺信息 $goods_id = null; $supp_id = null; $order = order_info($order_id); $order['order_status_text'] = $GLOBALS['_LANG']['os'][$order['order_status']] . ',' . $GLOBALS['_LANG']['ps'][$order['pay_status']] . ',' . $GLOBALS['_LANG']['ss'][$order['shipping_status']]; $order['goods_list'] = order_goods($order_id); $smarty->assign('chat_order', $order); $smarty->assign('chat_order_id', $order_id); $smarty->assign('chat_order_sn', $order['order_sn']); $tab_items[] = array("id" => "chat_order", "name" => "咨询订单"); // 客服+售后 $cus_types = CUSTOMER_SERVICE . ',' . CUSTOMER_AFTER; } if (true) { /* 最近订单列表 */ require 'includes/lib_transaction_1.php'; // 获取用户最近的5条订单列表 $order_list = get_user_orders_1($user_id, 5, 0); // 所有客服忙碌状态,提示web端 $smarty->assign('order_list', $order_list); $smarty->assign('order_count', count($order_list)); $tab_items[] = array("id" => "chat_order_list", "name" => "最近订单"); // 客服 $cus_types = CUSTOMER_SERVICE; } // 获取客服信息 $customers = get_customers($cus_types, $supp_id); // 转换为JSON数据 $smarty->assign('tab_items', json_encode($tab_items)); $to = null; // 客服获取策略:0-顺序、1-随机、2-竞争 if (!empty($customers)) { // 暂时采用随机策略 $poliy = 1; if ($poliy == 0) { foreach ($customers as $customer) { $status = $customer['status']; if ($status == '在线' || $status == '空闲') { $to = $customer; break; // if(isset($customer['cus_status']) && count($customers) > 1) // { // if(time() - $customer['chat_time'] > 5*60) // { // set_customer_status($customer['cus_id'], 0); // $customer['cus_status'] = 0; // } // if($customer['cus_status'] == 0) // { // $to = $customer; // break; // } // } // else // { // $to = $customer; // break; // } } } } else { if ($poliy == 1) { /* 随进策略 */ $onlines = array(); foreach ($customers as $customer) { $status = $customer['status']; if ($status == '在线' || $status == '空闲') { $onlines[] = $customer; } } if (count($onlines) > 0) { $min = 1; $max = count($onlines); $i = mt_rand($min, $max); $to = $onlines[$i - 1]; } } else { } } if (empty($to)) { if ($supp_id == -1) { // 所有客服忙碌状态,提示web端 $smarty->assign('system_notice', '当前客服忙碌,请稍后联系!'); } else { // 所有客服忙碌状态,提示web端 $smarty->assign('system_notice', '当前店铺客服忙碌,请稍后联系!'); } } else { $xmpp_domain = get_xmpp_domain(); $_SESSION['OF_FROM'] = $user_id . '@' . $xmpp_domain; $_SESSION['OF_TO'] = $to['of_username'] . '@' . $xmpp_domain; $smarty->assign('from', $_SESSION['OF_FROM']); $smarty->assign('password', $password); // $smarty->assign('password', "123456"); $smarty->assign('to', '==to=='); $smarty->assign('username', $_SESSION['user_name']); $smarty->assign('customername', $to['cus_name']); // 存储在Session中方便其他地方使用 // 所有客服忙碌状态,提示web端 $smarty->assign('system_notice', '客服<span class="kf_name">' . $to['cus_name'] . '</span>已加入会话!'); } } else { // 所有客服忙碌状态,提示web端 $smarty->assign('system_notice', '当前客服忙碌,请稍后联系!'); } // 打开聊天页面 $smarty->display('chat.dwt'); }
public static function get_user_order_detail($order_id) { include_once ROOT_PATH . 'includes/lib_transaction.php'; include_once ROOT_PATH . 'includes/lib_payment.php'; include_once ROOT_PATH . 'includes/lib_order.php'; include_once ROOT_PATH . 'includes/lib_clips.php'; global $db; $order_id = addslashes($order_id); $user_id = addslashes($_SESSION['user_id']); $res = array('code' => RES_SUCCSEE); /* 订单详情 */ $order = get_order_detail($order_id, $user_id); if ($order === false) { $res['code'] = RES_FAIL; return json_encode($res); } /* 订单商品 */ $goods_list = order_goods($order_id); //true 只返回支付的地址 不需要返回给我们其他代码 $order_detail = get_order_detail($order_id, $user_id, true); foreach ($goods_list as $key => $value) { $goods_list[$key]['market_price'] = price_format($value['market_price'], false); $goods_list[$key]['goods_price'] = price_format($value['goods_price'], false); $goods_list[$key]['subtotal'] = price_format($value['subtotal'], false); } /* 设置能否修改使用余额数 */ if ($order['order_amount'] > 0) { if ($order['order_status'] == OS_UNCONFIRMED || $order['order_status'] == OS_CONFIRMED) { $user = user_info($order['user_id']); if ($user['user_money'] + $user['credit_line'] > 0) { $order['allow_edit_surplus'] = 1; $order['max_surplus'] = sprintf($_LANG['max_surplus'], $user['user_money']); } } } //订单 支付 配送 状态语言项 //$order['order_status'] = $_LANG['os'][$order['order_status']]; //$order['pay_status'] = $_LANG['ps'][$order['pay_status']]; //$order['shipping_status'] = $_LANG['ss'][$order['shipping_status']]; $city_name = $db->getOne("select region_name from ship_region where region_id={$order['city']}"); $order['cityName'] = $city_name; $order['districtName'] = MES_User::_get_distruct_name($order['city'], $order['district']); if ($order['fork_message']) { $order['fork_message'] = json_decode($order['fork_message']); } return json_encode(array('code' => RES_SUCCSEE, 'order' => $order, 'goods_list' => $goods_list, 'pay_online' => $order_detail['pay_online'])); }
/** * 提交函数 */ function get_code($order, $payment) { //print_r($order);exit; $payment = get_payment('ecbank_pinline'); $c_mid = trim($payment['ecbank_pinline_account']); $c_order = $order['log_id']; $c_od_sob = $order['order_sn']; $c_name = trim($order['consignee']); $c_address = trim($order['address']); $c_tel = trim($order['tel']); $c_post = trim($order['zipcode']); $c_email = trim($order['email']); $c_orderamount = $order['order_amount']; $c_ymd = date('Ymd', time()); $c_moneytype = "0"; $c_retflag = "1"; $c_returl = return_url(basename(__FILE__, '.php')); $notifytype = "0"; $c_language = $payment['ecbank_pinline_language']; $c_memo1 = $order['log_id']; $c_memo2 = $order['log_id']; $key = trim($payment['ecbank_pinline_checkcode']); $def_url = ""; $lineurl = ""; //開始綠界產生超商繳款代碼 $param = array('ecbank_gateway' => 'https://ecbank.com.tw/gateway.php', 'mer_id' => $c_mid, 'enc_key' => $key, 'od_sob' => $c_order, 'amt' => intval($c_orderamount), 'expire_day' => 3, 'ok_url' => rawurlencode($c_returl)); // 執行取號 $strAuth = ''; $nvpStr = 'payment_type=barcode' . '&od_sob=' . $param['od_sob'] . '&mer_id=' . $param['mer_id'] . '&enc_key=' . $param['enc_key'] . '&amt=' . $param['amt'] . '&expire_day=' . $param['expire_day'] . '&ok_url=' . $param['ok_url']; $temp = order_goods($order['order_id']); //判斷是否使用電子發票 if ($payment['ecbank_pinline_inv_active'] == "1") { $nvpStr .= "&inv_active=1"; $nvpStr .= "&inv_mer_id=" . $payment['ecbank_pinline_inv_mer_id']; $nvpStr .= "&inv_semail=" . $c_email; $nvpStr .= ""; $nvpStr .= ""; $nvpStr .= ""; for ($i = 0; $i < count($temp); $i++) { $nvpStr .= "&prd_name[]=" . $temp[$i]['goods_name']; $nvpStr .= "&prd_qry[]=" . $temp[$i]['goods_number']; $nvpStr .= "&prd_price[]=" . intval($temp[$i]['goods_price']); } $nvpStr .= "&prd_name[]=運費"; $nvpStr .= "&prd_qry[]=1"; $nvpStr .= "&prd_price[]=" . $order['shipping_fee']; } $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, $param['ecbank_gateway']); curl_setopt($ch, CURLOPT_VERBOSE, 1); curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE); curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, FALSE); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); curl_setopt($ch, CURLOPT_POST, 1); curl_setopt($ch, CURLOPT_POSTFIELDS, $nvpStr); $strAuth = curl_exec($ch); if (curl_errno($ch)) { $strAuth = false; } curl_close($ch); //exit; parse_str($strAuth, $res); // 判斷取號結果 if (!isset($res['error']) || $res['error'] != '0') { echo '取條碼錯誤'; } else { $def_url = '條碼訂單編號: ' . $res['od_sob'] . '<br>'; $lineurl = 'https://ecbank.com.tw/order/barcode_print.php?mer_id=' . $param['mer_id'] . '&tsr=' . $res['tsr'] . ''; $def_url .= '請列印超商條碼帳單至超商繳費 [<a href=' . $lineurl . ' target=_blank>點此列印</a>]'; $note = '綠界 ECBank 交易流水号:' . $res['tsr']; //order_paid($c_order, '0', $note); return $def_url; } }
/** * 提交函数 */ function get_code($order, $payment) { //include_once(ROOT_PATH.'includes/iconv/cls_iconv.php'); //$iconv = new Chinese(ROOT_PATH); $c_mid = trim($payment['gw_ecpay_account']); //$c_order = $order['order_sn']; $c_order = $order['log_id']; $c_name = trim($order['consignee']); $c_address = trim($order['address']); $c_tel = trim($order['tel']); $c_post = trim($order['zipcode']); $c_email = trim($order['email']); //$c_orderamount = trim(intval($order['order_amount'])); $c_orderamount = $order['order_amount']; $c_ymd = date('Ymd', time()); $c_moneytype = "0"; $c_retflag = "1"; $c_returl = return_url(basename(__FILE__, '.php')); $notifytype = "0"; $c_language = $payment['gw_ecpay_language']; $c_memo1 = $order['log_id']; $c_memo2 = $order['log_id']; //$srcStr = $c_mid . $c_order . $c_orderamount . $c_ymd . $c_moneytype . $c_retflag . $c_returl . $c_paygate . $c_memo1 . $c_memo2 . $notifytype . $c_language . $c_pass; //$c_signstr = md5($srcStr); $def_url = '<br /><form style="text-align:center;" method=post action="https://ecpay.com.tw/form_Sc_to5.php">'; $def_url .= "<input type='hidden' name='client' value='" . $c_mid . "'>"; $def_url .= "<input type='hidden' name='act' value='auth'>"; $def_url .= "<input type='hidden' name='od_sob' value='" . $c_order . "'>"; $def_url .= "<input type='hidden' name='名稱' value='" . $c_name . "'>"; $def_url .= "<input type='hidden' name='地址' value='" . $c_address . "'>"; $def_url .= "<input type='hidden' name='電話' value='" . $c_tel . "'>"; $def_url .= "<input type='hidden' name='email' value='" . $c_email . "'>"; $def_url .= "<input type='hidden' name='amount' value='" . $c_orderamount . "'>"; $def_url .= "<input type='hidden' name='時間' value='" . $c_ymd . "'>"; $def_url .= "<input type='hidden' name='roturl' value='" . $c_returl . "'>"; $temp = order_goods($order['order_id']); //判斷是否使用電子發票 if ($payment['gw_ecpay_inv_active'] == "1") { $def_url .= "<input type='hidden' name='inv_active' value='1'>"; $def_url .= "<input type='hidden' name='inv_mer_id' value='" . $payment['gw_ecpay_inv_mer_id'] . "'>"; $def_url .= "<input type='hidden' name='inv_semail' value='" . $c_email . "'>"; for ($i = 0; $i < count($temp); $i++) { $def_url .= "<input type='hidden' name='prd_name[]' value='" . $temp[$i]['goods_name'] . "'>"; $def_url .= "<input type='hidden' name='prd_qry[]' value='" . intval($temp[$i]['goods_number']) . "'>"; $def_url .= "<input type='hidden' name='prd_price[]' value='" . intval($temp[$i]['goods_price']) . "'>"; } $def_url .= "<input type='hidden' name='prd_name[]' value=運費>"; $def_url .= "<input type='hidden' name='prd_qry[]' value=1>"; $def_url .= "<input type='hidden' name='prd_price[]' value='" . intval($order['shipping_fee']) . "'>"; } $def_url .= "<input type='hidden' name='roturl' value='" . $c_returl . "'>"; $def_url .= "<input type='submit' value='" . $GLOBALS['_LANG']['pay_button'] . "'>"; $def_url .= "</form><br />"; return $def_url; }
$smarty->display('login.html'); exit; } $id = isset($_GET['id']) ? intval($_GET['id']) : 0; include_once ROOT_PATH . 'includes/lib_transaction.php'; include_once ROOT_PATH . 'includes/lib_payment.php'; include_once ROOT_PATH . 'includes/lib_order.php'; include_once ROOT_PATH . 'includes/lib_clips.php'; /* 订单详情 */ $order = get_order_detail($id, $_SESSION['user_id']); if ($order === false) { exit("对不起,该订单不存在"); } require_once ROOT_PATH . 'languages/' . $_CFG['lang'] . '/user.php'; /* 订单商品 */ $goods_list = order_goods($id); if (empty($goods_list)) { exit("订单错误"); } foreach ($goods_list as $key => $value) { $goods_list[$key]['market_price'] = price_format($value['market_price'], false); $goods_list[$key]['goods_price'] = price_format($value['goods_price'], false); $goods_list[$key]['subtotal'] = price_format($value['subtotal'], false); } /* 订单 支付 配送 状态语言项 */ $order['order_status'] = $_LANG['os'][$order['order_status']]; $order['pay_status'] = $_LANG['ps'][$order['pay_status']]; $order['shipping_status'] = $_LANG['ss'][$order['shipping_status']]; $smarty->assign('order', $order); $smarty->assign('goods_list', $goods_list); $smarty->assign('lang', $_LANG);
public function order_detail () { global $ecs,$db; checkLogin(); include_once('includes/lib_transaction.php'); $order_id = isset($_GET['order_id']) ? intval($_GET['order_id']) : 0; $user_id = intval($_SESSION['user_id']); $order = zy_get_order_detail($order_id, $user_id); if(empty($order)) { $msg = rpcLang('user.php', 'get_orders_failure'); jsonExit("{\"status\":\"$msg\"}"); }else { $country_id = $order['country']; $province_id = $order['province']; $city_id = $order['city']; $district_id = $order['district']; $arr = array($country_id,$province_id,$city_id,$district_id); $result = array (); foreach ($arr as $key => $val) { $sql = "select `region_name` from".$ecs->table('region')."where `region_id`= {$val}"; $region_name = $db->getOne($sql); array_push($result,$region_name); } $order['country_name'] = $result[0]; $order['province_name'] = $result[1]; $order['city_name'] = $result[2]; $order['district_name'] = $result[3]; /* 订单商品 */ $goods_list = order_goods($order_id); foreach ($goods_list AS $key => $value) { $goods_list[$key]['market_price'] = price_format($value['market_price'], false); $goods_list[$key]['goods_price'] = price_format($value['goods_price'], false); $goods_list[$key]['subtotal'] = price_format($value['subtotal'], false); } $order_goods = array('order'=>$order,'goods_list'=>$goods_list); jsonExit($order_goods); } }
$smarty->display('share_to_pay.dwt'); } else { //自己 $smarty->assign('imgUrl', $user_info['headimgurl']); //'http://'.$_SERVER['HTTP_HOST']."/".$goods_list[0]['goods_thumb'] $smarty->assign('title', "找人代付"); $smarty->assign('desc', mb_substr($order_info['wxdesc'], 0, 30, 'utf-8')); // $link = "http://" . $_SERVER['HTTP_HOST'] . "/share_pay.php?showwxpaytitle=1&id=" . $order_id; $smarty->assign('link', $link); $smarty->assign('link2', urlencode($link)); $smarty->display('share_pay.dwt'); } } elseif ($act == 'go_to_pay') { $order_info = order_info($order_id); $smarty->assign('goods_list', order_goods($order_id)); $smarty->assign('order', $order_info); $smarty->display("go_share_pay.dwt"); } elseif ($act == 'success') { $order_info = order_info($order_id); $smarty->assign('order_info', $order_info); $sql = "select count(*) from " . $hhs->table("share_pay_info") . " where order_id=" . $order_id . " and user_id=" . $_SESSION['user_id'] . " and is_paid=1"; $pay_c = $db->getOne($sql); if ($order_info['pay_status'] == 2 && $pay_c > 0) { $smarty->assign('imgUrl', $user_info['headimgurl']); //'http://'.$_SERVER['HTTP_HOST']."/".$goods_list[0]['goods_thumb'] $smarty->assign('title', "找人代付"); $smarty->assign('desc', "付款成功!订单编号:" . $order_info['order_sn']); // $link = "http://" . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI']; $smarty->assign('link', $link);
/** * 提交函数 */ function get_code($order, $payment) { $c_mid = trim($payment['ecbank_webatm_account']); $c_order = $order['log_id']; $c_name = trim($order['consignee']); $c_address = trim($order['address']); $c_tel = trim($order['tel']); $c_post = trim($order['zipcode']); $c_email = trim($order['email']); $c_orderamount = trim(intval($order['order_amount'])); $c_ymd = date('Ymd', time()); $c_moneytype = "0"; $c_retflag = "1"; $c_returl = return_url(basename(__FILE__, '.php')); $notifytype = "0"; $c_language = $payment['ecbank_webatm_language']; $c_memo1 = $order['log_id']; $c_memo2 = $order['log_id']; $def_url = '<br /><form style="text-align:center;" method=post action="https://ecbank.com.tw/gateway.php">'; $def_url .= "<input type='hidden' name='mer_id' value='" . $c_mid . "'>"; $def_url .= "<input type='hidden' name='payment_type' value='web_atm'>"; $def_url .= "<input type='hidden' name='setbank' value='ESUN'>"; $def_url .= "<input type='hidden' name='od_sob' value='" . $c_order . "'>"; $def_url .= "<input type='hidden' name='amt' value='" . $c_orderamount . "'>"; // $def_url .= "<input type='hidden' name='return_url' value='".rawurlencode($c_returl)."'>"; $def_url .= "<input type='hidden' name='return_url' value='" . $c_returl . "'>"; $def_url .= "<input type='hidden' name='c_name' value='" . $c_name . "'>"; $def_url .= "<input type='hidden' name='c_address' value='" . $c_address . "'>"; $def_url .= "<input type='hidden' name='c_tel' value='" . $c_tel . "'>"; $def_url .= "<input type='hidden' name='c_post' value='" . $c_post . "'>"; $def_url .= "<input type='hidden' name='email' value='" . $c_email . "'>"; $def_url .= "<input type='hidden' name='c_ymd' value='" . $c_ymd . "'>"; $def_url .= "<input type='hidden' name='c_moneytype' value='" . $c_moneytype . "'>"; $def_url .= "<input type='hidden' name='c_retflag' value='" . $c_retflag . "'>"; $def_url .= "<input type='hidden' name='c_language' value='" . $c_language . "'>"; $def_url .= "<input type='hidden' name='c_memo1' value='" . $c_memo1 . "'>"; $def_url .= "<input type='hidden' name='c_memo2' value='" . $c_memo2 . "'>"; $def_url .= "<input type='hidden' name='notifytype' value='" . $notifytype . "'>"; $temp = order_goods($order['order_id']); //判斷是否使用電子發票 if ($payment['ecbank_webatm_inv_active'] == "1") { $def_url .= "<input type='hidden' name='inv_active' value='1'>"; $def_url .= "<input type='hidden' name='inv_mer_id' value='" . $payment['ecbank_webatm_inv_mer_id'] . "'>"; $def_url .= "<input type='hidden' name='inv_semail' value='" . $c_email . "'>"; for ($i = 0; $i < count($temp); $i++) { $def_url .= "<input type='hidden' name='prd_name[]' value='" . $temp[$i]['goods_name'] . "'>"; $def_url .= "<input type='hidden' name='prd_qry[]' value='" . intval($temp[$i]['goods_number']) . "'>"; $def_url .= "<input type='hidden' name='prd_price[]' value='" . intval($temp[$i]['goods_price']) . "'>"; } $def_url .= "<input type='hidden' name='prd_name[]' value=運費>"; $def_url .= "<input type='hidden' name='prd_qry[]' value=1>"; $def_url .= "<input type='hidden' name='prd_price[]' value='" . intval($order['shipping_fee']) . "'>"; } $def_url .= "<input type='submit' value='" . $GLOBALS['_LANG']['pay_button'] . "'>"; $def_url .= "</form><br />"; return $def_url; }
/** * 获取用户指定范围的订单列表 * * @access public * @param int $user_id 用户ID号 * @param int $num 列表最大数量 * @param int $start 列表起始位置 * @return array $order_list 订单列表 */ function get_user_orders($user_id, $num = 10, $start = 0) { /* 取得订单列表 */ $arr = array(); $sql = "SELECT order_id, order_sn, order_status, shipping_status, pay_status, add_time, " . "(goods_amount + shipping_fee + insure_fee + pay_fee + pack_fee + card_fee + tax - discount) AS total_fee " . " FROM " . $GLOBALS['ecs']->table('order_info') . " WHERE user_id = '{$user_id}' ORDER BY add_time DESC"; $res = $GLOBALS['db']->SelectLimit($sql, $num, $start); while ($row = $GLOBALS['db']->fetchRow($res)) { if ($row['order_status'] == OS_UNCONFIRMED) { $row['handler'] = "<a href=\"user.php?act=cancel_order&order_id=" . $row['order_id'] . "\" onclick=\"if (!confirm('" . $GLOBALS['_LANG']['confirm_cancel'] . "')) return false;\">" . $GLOBALS['_LANG']['cancel'] . "</a>"; } else { if ($row['order_status'] == OS_SPLITED) { /* 对配送状态的处理 */ if ($row['shipping_status'] == SS_SHIPPED) { @($row['handler'] = "<a href=\"user.php?act=affirm_received&order_id=" . $row['order_id'] . "\" onclick=\"if (!confirm('" . $GLOBALS['_LANG']['confirm_received'] . "')) return false;\">" . $GLOBALS['_LANG']['received'] . "</a>"); } elseif ($row['shipping_status'] == SS_RECEIVED) { @($row['handler'] = '<span style="color:red">' . $GLOBALS['_LANG']['ss_received'] . '</span>'); } else { if ($row['pay_status'] == PS_UNPAYED) { @($row['handler'] = "<a href=\"user.php?act=order_detail&order_id=" . $row['order_id'] . '">' . $GLOBALS['_LANG']['pay_money'] . '</a>'); } else { @($row['handler'] = "<a href=\"user.php?act=order_detail&order_id=" . $row['order_id'] . '">' . $GLOBALS['_LANG']['view_order'] . '</a>'); } } } else { $row['handler'] = '<span style="color:red">' . $GLOBALS['_LANG']['os'][$row['order_status']] . '</span>'; } } $row['shipping_status'] = $row['shipping_status'] == SS_SHIPPED_ING ? SS_PREPARING : $row['shipping_status']; $row['order_status'] = $GLOBALS['_LANG']['os'][$row['order_status']] . ',' . $GLOBALS['_LANG']['ps'][$row['pay_status']] . ',' . $GLOBALS['_LANG']['ss'][$row['shipping_status']]; $goods_thumb = ''; $goods_thumb = $GLOBALS['db']->getOne("SELECT g.goods_thumb FROM " . $GLOBALS['ecs']->table('order_goods') . " AS o LEFT JOIN " . $GLOBALS['ecs']->table('goods') . " AS g ON g.goods_id = o.goods_id WHERE o.order_id = {$row['order_id']}"); $arr[] = array('order_id' => $row['order_id'], 'order_sn' => $row['order_sn'], 'order_time' => local_date($GLOBALS['_CFG']['date_format'], $row['add_time']), 'order_status' => $row['order_status'], 'total_fee' => price_format($row['total_fee'], false), 'order_goods' => order_goods($row['order_id']), 'goods_thumb' => $goods_thumb, 'handler' => $row['handler']); } return $arr; }
include_once ROOT_PATH . 'includes/lib_payment.php'; include_once ROOT_PATH . 'includes/lib_order.php'; include_once ROOT_PATH . 'includes/lib_clips.php'; $order_id = isset($_GET['order_id']) ? intval($_GET['order_id']) : 0; /* 订单详情 */ $order = get_order_detail($order_id, $user_id); if ($order === false) { $err->show($_LANG['back_home_lnk'], './'); exit; } /* 是否显示添加到购物车 */ if ($order['extension_code'] != 'group_buy' && $order['extension_code'] != 'exchange_goods') { $smarty->assign('allow_to_cart', 1); } /* 订单商品 */ $goods_list = order_goods($order_id); foreach ($goods_list as $key => $value) { $goods_list[$key]['market_price'] = price_format($value['market_price'], false); $goods_list[$key]['goods_price'] = price_format($value['goods_price'], false); $goods_list[$key]['subtotal'] = price_format($value['subtotal'], false); } /* 设置能否修改使用余额数 */ if ($order['order_amount'] > 0) { if ($order['order_status'] == OS_UNCONFIRMED || $order['order_status'] == OS_CONFIRMED) { $user = user_info($order['user_id']); if ($user['user_money'] + $user['credit_line'] > 0) { $smarty->assign('allow_edit_surplus', 1); $smarty->assign('max_surplus', sprintf($_LANG['max_surplus'], $user['user_money'])); } } }
/** * 提交函数 */ function get_code($order, $payment) { $c_mid = trim($payment['ecbank_alipay_account']); $c_order = $order['log_id']; $c_name = trim($order['consignee']); $c_address = trim($order['address']); $c_tel = trim($order['tel']); $c_post = trim($order['zipcode']); $c_email = trim($order['email']); $c_orderamount = trim(intval($order['order_amount'])); $c_ymd = date('Ymd', time()); $c_moneytype = "0"; $c_retflag = "1"; $c_returl = return_url(basename(__FILE__, '.php')); $notifytype = "0"; $c_language = $payment['ecbank_alipay_language']; $c_memo1 = $order['log_id']; $c_memo2 = $order['log_id']; $c_key = $payment['ecbank_alipay_checkcode']; $type = "upload_goods"; $goods = order_goods($order['order_id']); $ecbank_gateway = 'https://ecbank.com.tw/web_service/alipay_goods_upload.php'; $goods_href = $_SERVER['HTTP_HOST']; foreach ($goods as $good) { //先上架商品 $post_str = 'enc_key=' . $c_key . '&mer_id=' . $c_mid . '&type=' . $type . '&goods_id=' . $good['goods_id'] . '&goods_title=' . $good['goods_name'] . '&goods_price=' . round($good['goods_price']) . '&goods_href=' . $goods_href; $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, $ecbank_gateway); curl_setopt($ch, CURLOPT_VERBOSE, 1); curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE); curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, FALSE); curl_setopt($ch, CURLOPT_POST, 1); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); curl_setopt($ch, CURLOPT_POSTFIELDS, $post_str); $strAuth = curl_exec($ch); if (curl_errno($ch)) { $strAuth = false; } curl_close($ch); /*if($strAuth == 'state=NEW_SUCCESS'){ echo '新增上架商品成功<br>'; }else if($strAuth == 'state=MODIFY_SUCCESS'){ echo '修改上架商品成功<br>'; }else{ echo '錯誤:'.$strAuth.'<br>'; }*/ } $def_url = '<br /><form style="text-align:center;" method=post action="https://ecbank.com.tw/gateway.php">'; $def_url .= "<input type='hidden' name='mer_id' value='" . $c_mid . "'>"; $def_url .= "<input type='hidden' name='payment_type' value='alipay'>"; $def_url .= "<input type='hidden' name='od_sob' value='" . $c_order . "'>"; $def_url .= "<input type='hidden' name='amt' value='" . round($c_orderamount) . "'>"; // $def_url .= "<input type='hidden' name='return_url' value='".rawurlencode($c_returl)."'>"; $def_url .= "<input type='hidden' name='return_url' value='" . $c_returl . "'>"; $def_url .= "<input type='hidden' name='ok_url' value='" . $c_returl . "'>"; foreach ($goods as $good) { $def_url .= "<input type='hidden' name='goods_name[]' value='" . $good['goods_id'] . "'>"; $def_url .= "<input type='hidden' name='goods_amount[]' value='" . round($good['goods_number']) . "'>"; } //print_r($goods); //判斷是否使用電子發票 if ($payment['ecbank_alipay_inv_active'] == "1") { $def_url .= "<input type='hidden' name='inv_active' value='1'>"; $def_url .= "<input type='hidden' name='inv_mer_id' value='" . $payment['ecbank_alipay_inv_mer_id'] . "'>"; $def_url .= "<input type='hidden' name='inv_semail' value='" . $c_email . "'>"; for ($i = 0; $i < count($goods); $i++) { $def_url .= "<input type='hidden' name='prd_name[]' value='" . $goods[$i]['goods_name'] . "'>"; $def_url .= "<input type='hidden' name='prd_qry[]' value='" . intval($goods[$i]['goods_number']) . "'>"; $def_url .= "<input type='hidden' name='prd_price[]' value='" . intval($goods[$i]['goods_price']) . "'>"; } $def_url .= "<input type='hidden' name='prd_name[]' value=運費>"; $def_url .= "<input type='hidden' name='prd_qry[]' value=1>"; $def_url .= "<input type='hidden' name='prd_price[]' value='" . intval($order['shipping_fee']) . "'>"; } $def_url .= "<input type='submit' value='" . $GLOBALS['_LANG']['pay_button'] . "'>"; $def_url .= "</form><br />"; return $def_url; }