|
@@ -26,16 +26,17 @@ class store_refill_ordercontrol extends BaseSellerControl
|
|
|
*/
|
|
|
public function indexOp()
|
|
|
{
|
|
|
- $model_vr_order = Model('vr_order');
|
|
|
+ $refill_order = Model('refill_order');
|
|
|
|
|
|
$condition['store_id'] = $_SESSION['store_id'];
|
|
|
$condition['order_state'] = ORDER_STATE_PAY;
|
|
|
+ $condition['refill_order.inner_status'] = 0;
|
|
|
+
|
|
|
+ $order_list = $refill_order->getMerchantOrderList($condition, '', 'refill_order.*,vr_order.order_state', 'refill_order.order_id asc');
|
|
|
|
|
|
- $pagesize = 20;
|
|
|
- $order_list = $model_vr_order->getOrderList($condition, $pagesize, '*', 'order_id desc');
|
|
|
|
|
|
Tpl::output('order_list', $order_list);
|
|
|
- Tpl::output('show_page', $model_vr_order->showpage());
|
|
|
+ Tpl::output('show_page', $refill_order->showpage());
|
|
|
self::profile_menu('list', $_GET['state_type']);
|
|
|
|
|
|
Tpl::showpage('store_refill_order.index');
|
|
@@ -47,6 +48,8 @@ class store_refill_ordercontrol extends BaseSellerControl
|
|
|
*/
|
|
|
public function export_pay_orderOp()
|
|
|
{
|
|
|
+ $orders = [];
|
|
|
+
|
|
|
$model_refill_order = Model('refill_order');
|
|
|
|
|
|
$condition['vr_order.store_id'] = $_SESSION['store_id'];
|
|
@@ -54,21 +57,49 @@ class store_refill_ordercontrol extends BaseSellerControl
|
|
|
$condition['refill_order.inner_status'] = 0;
|
|
|
|
|
|
$order_list = $model_refill_order->getMerchantOrderList($condition, '', 'refill_order.*,vr_order.order_state', 'refill_order.order_id asc');
|
|
|
- try {
|
|
|
- $trans = new trans_wapper($model_refill_order, __METHOD__);
|
|
|
- foreach ($order_list as $order) {
|
|
|
-
|
|
|
- $resp = $this->_order_send($order, $_POST);
|
|
|
- if ($resp['state'] != true) {
|
|
|
- $trans->rollback();
|
|
|
- showMessage('处理失败', 'index.php?act=store_refill_order&op=index', 'html', 'error');
|
|
|
- }
|
|
|
+ foreach ($order_list as $order)
|
|
|
+ {
|
|
|
+ $resp = $this->_order_send($order);
|
|
|
+ if ($resp['state'] === true) {
|
|
|
+ $tmp = [];
|
|
|
+ $tmp[] = ['data' => $order['order_id']];
|
|
|
+ $tmp[] = ['data' => $order['order_sn']];
|
|
|
+ $tmp[] = ['data' => $order['card_no']];
|
|
|
+ $tmp[] = ['data' => $order['refill_amount']];
|
|
|
+
|
|
|
+ $orders[] = $tmp;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ if (empty($orders)) {
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ else {
|
|
|
+ Language::read('export');
|
|
|
+ import('libraries.excel');
|
|
|
+ $excel = new Excel();
|
|
|
+ $excel->setStyle(['id' => 's_title', 'Font' => ['FontName' => '宋体', 'Size' => '12', 'Bold' => '1']]);
|
|
|
+
|
|
|
+ $headers = [['styleid' => 's_title', 'data' => '编号'],
|
|
|
+ ['styleid' => 's_title', 'data' => '订单号'],
|
|
|
+ ['styleid' => 's_title', 'data' => '卡号'],
|
|
|
+ ['styleid' => 's_title', 'data' => '充值金额']];
|
|
|
+
|
|
|
+ $table[] = $headers;
|
|
|
+ foreach ($orders as $order) {
|
|
|
+ $table[] = $order;
|
|
|
}
|
|
|
- $trans->commit();
|
|
|
- $this->createExcel($order_list);
|
|
|
- } catch (Exception $e) {
|
|
|
- $trans->rollback();
|
|
|
- showMessage($e->getMessage(), 'index.php?act=store_refill_order&op=index', 'html', 'error');
|
|
|
+
|
|
|
+ $table = $excel->charset($table, CHARSET);
|
|
|
+ $excel->addArray($table);
|
|
|
+ $excel->addWorksheet($excel->charset("充值——已支付未处理订单", CHARSET));
|
|
|
+
|
|
|
+ $len = count($orders);
|
|
|
+ $time = date('Y-m-d', time());
|
|
|
+ $start = $orders[0][0]['data'];
|
|
|
+ $table_name = "{$time} {$start}-{$len}";
|
|
|
+
|
|
|
+ $excel->generateXML($excel->charset($table_name, CHARSET));
|
|
|
}
|
|
|
}
|
|
|
|
|
@@ -82,18 +113,18 @@ class store_refill_ordercontrol extends BaseSellerControl
|
|
|
Language::read('export');
|
|
|
import('libraries.excel');
|
|
|
$excel_obj = new Excel();
|
|
|
- $excel_data = array();
|
|
|
+ $excel_data = [];
|
|
|
//设置样式
|
|
|
- $excel_obj->setStyle(array('id' => 's_title', 'Font' => array('FontName' => '宋体', 'Size' => '12', 'Bold' => '1')));
|
|
|
+ $excel_obj->setStyle(['id' => 's_title', 'Font' => ['FontName' => '宋体', 'Size' => '12', 'Bold' => '1']]);
|
|
|
//header
|
|
|
- $excel_data[0][] = array('styleid' => 's_title', 'data' => '订单号');
|
|
|
- $excel_data[0][] = array('styleid' => 's_title', 'data' => '卡号');
|
|
|
- $excel_data[0][] = array('styleid' => 's_title', 'data' => '充值金额');
|
|
|
+ $excel_data[0][] = ['styleid' => 's_title', 'data' => '订单号'];
|
|
|
+ $excel_data[0][] = ['styleid' => 's_title', 'data' => '卡号'];
|
|
|
+ $excel_data[0][] = ['styleid' => 's_title', 'data' => '充值金额'];
|
|
|
foreach ((array)$data as $k => $v) {
|
|
|
- $tmp = array();
|
|
|
- $tmp[] = array('data' => $v['order_sn']);
|
|
|
- $tmp[] = array('data' => $v['card_no']);
|
|
|
- $tmp[] = array('data' => $v['refill_amount']);
|
|
|
+ $tmp = [];
|
|
|
+ $tmp[] = ['data' => $v['order_sn']];
|
|
|
+ $tmp[] = ['data' => $v['card_no']];
|
|
|
+ $tmp[] = ['data' => $v['refill_amount']];
|
|
|
$excel_data[] = $tmp;
|
|
|
}
|
|
|
$excel_data = $excel_obj->charset($excel_data, CHARSET);
|
|
@@ -123,22 +154,21 @@ class store_refill_ordercontrol extends BaseSellerControl
|
|
|
$condition = [];
|
|
|
$condition['order_id'] = intval($_GET['order_id']);
|
|
|
$condition['store_id'] = $_SESSION['store_id'];
|
|
|
- $order_info = $model_vr_order->getOrderInfo($condition);
|
|
|
+ $order_info = $model_vr_order->getOrderInfo($condition);
|
|
|
$logic_vr_order = Logic('vr_order');
|
|
|
-
|
|
|
+
|
|
|
if ($state_type == 'order_cancel') {
|
|
|
//返回无权限修改,状态不一致
|
|
|
- $result = $this->_order_cancel($order_info,$_POST);
|
|
|
- }
|
|
|
- elseif ($state_type == 'order_success') {
|
|
|
+ $result = $this->_order_cancel($order_info, $_POST);
|
|
|
+ } elseif ($state_type == 'order_success') {
|
|
|
//返回无权限修改,状态不一致
|
|
|
- $result = $this->_order_success($order_info,$_POST);
|
|
|
+ $result = $this->_order_success($order_info, $_POST);
|
|
|
}
|
|
|
|
|
|
- if(!$result['state']) {
|
|
|
- showDialog($result['msg'],'','error');
|
|
|
+ if (!$result['state']) {
|
|
|
+ showDialog($result['msg'], '', 'error');
|
|
|
} else {
|
|
|
- showDialog($result['msg'],'reload','js');
|
|
|
+ showDialog($result['msg'], 'reload', 'js');
|
|
|
}
|
|
|
}
|
|
|
}
|
|
@@ -168,23 +198,15 @@ class store_refill_ordercontrol extends BaseSellerControl
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- private function _order_send($order_info, $post)
|
|
|
+ private function _order_send($order_info)
|
|
|
{
|
|
|
- if (!chksubmit()) {
|
|
|
- Tpl::output('order_id', $order_info['order_id']);
|
|
|
- Tpl::output('order_info', $order_info);
|
|
|
- Tpl::showpage('store_vr_order.send', 'null_layout');
|
|
|
- exit();
|
|
|
- } else {
|
|
|
- $model_vr_order = Model('vr_order');
|
|
|
- $logic_vr_order = Logic('vr_order');
|
|
|
- $if_allow = $model_vr_order->getOrderOperateState('store_send', $order_info);
|
|
|
- if (!$if_allow) {
|
|
|
- return callback(false, '无权操作');
|
|
|
- }
|
|
|
- $msg = $post['state_info1'] != '' ? $post['state_info1'] : $post['state_info'];
|
|
|
- return $logic_vr_order->changeOrderStateSend($order_info['order_id']);
|
|
|
+ $model_vr_order = Model('vr_order');
|
|
|
+ $logic_vr_order = Logic('vr_order');
|
|
|
+ $if_allow = $model_vr_order->getOrderOperateState('store_send', $order_info);
|
|
|
+ if (!$if_allow) {
|
|
|
+ return callback(false, '无权操作');
|
|
|
}
|
|
|
+ return $logic_vr_order->changeOrderStateSend($order_info['order_id']);
|
|
|
}
|
|
|
|
|
|
private function _order_success($order_info, $post)
|