|
@@ -10,8 +10,9 @@
|
|
|
defined('InShopNC') or exit('Access Invalid!');
|
|
|
require_once(BASE_HELPER_PATH . '/vrorder_helper.php');
|
|
|
require_once(BASE_CORE_PATH . '/framework/function/http.php');
|
|
|
+require_once(BASE_HELPER_PATH . '/refill/util.php');
|
|
|
|
|
|
-
|
|
|
+use refill\util;
|
|
|
class store_refill_ordercontrol extends BaseSellerControl
|
|
|
{
|
|
|
public function __construct()
|
|
@@ -30,10 +31,11 @@ class store_refill_ordercontrol extends BaseSellerControl
|
|
|
|
|
|
$member_id = $_SESSION['member_id'];
|
|
|
$condition['store_id'] = $_SESSION['store_id'];
|
|
|
- $condition['status'] = 1;
|
|
|
+ $condition['fetch_status'] = 1;
|
|
|
$total_fetch_order = $mod->where($condition)->count();
|
|
|
|
|
|
$condition['member_id'] = $member_id;
|
|
|
+ $condition['fetch_status'] = 2;
|
|
|
$order_list = $mod->getFetchOrderList($condition,20);
|
|
|
|
|
|
Tpl::output('order_list', $order_list);
|
|
@@ -45,84 +47,86 @@ class store_refill_ordercontrol extends BaseSellerControl
|
|
|
|
|
|
public function fetch_orderOp()
|
|
|
{
|
|
|
- if (chksubmit()) {
|
|
|
- $num = intval($_GET['num']);
|
|
|
- $mod = Model('fetch_order');
|
|
|
- $condition['status'] = 1;
|
|
|
- $fetch_order = $mod->where($condition)->order('add_time desc')->limit($num)->select();
|
|
|
- if(empty($fetch_order)) {
|
|
|
- showDialog('暂无可抢订单','index.php?act=store_refill_order&op=index','error');
|
|
|
- echo json_encode(['status' => false, 'msg' => "暂无可抢订单"]);
|
|
|
- }
|
|
|
- $order_ids = '';
|
|
|
- foreach ($fetch_order as $order)
|
|
|
- {
|
|
|
- $order_ids .= "{$order['order_id']},";
|
|
|
- }
|
|
|
- $order_ids = rtrim($order_ids,',');
|
|
|
- $member_id = $_SESSION['member_id'];
|
|
|
- $update_cond['order_id'] = ['in' , $order_ids];
|
|
|
- $update_cond['memeber_id'] = $member_id;
|
|
|
- $res = $mod->editFetchOrder(['status' => 2, 'member_id' => $member_id], $update_cond);
|
|
|
- if($res) {
|
|
|
- showDialog('抢单成功','index.php?act=store_refill_order&op=index','succ');
|
|
|
- } else {
|
|
|
- showDialog('抢单失败','index.php?act=store_refill_order&op=index','error');
|
|
|
- }
|
|
|
+ $num = intval($_GET['num']);
|
|
|
+ $card_type = intval($_GET['card_type']);
|
|
|
+ if(empty($num) || empty($card_type)) {
|
|
|
+ showDialog('请选择卡类型或抢单数量','index.php?act=store_refill_order&op=index','error');
|
|
|
+ }
|
|
|
+ $mod = Model('fetch_order');
|
|
|
+ $member_id = $_SESSION['member_id'];
|
|
|
+ $store_id = $_SESSION['store_id'];
|
|
|
+ $res = $mod->fetch($store_id, $member_id, $card_type, $num);
|
|
|
+ if(!empty($res)) {
|
|
|
+ showDialog('抢单成功','index.php?act=store_refill_order&op=index','succ');
|
|
|
} else {
|
|
|
- $this->indexOp();
|
|
|
+ showDialog('抢单失败','index.php?act=store_refill_order&op=index','error');
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- public function batch_disposeOp()
|
|
|
+ public function fetch_countOp()
|
|
|
{
|
|
|
- if (!chksubmit()) {
|
|
|
- $model_refill_order = Model('refill_order');
|
|
|
+ $card_type = $_GET['card_type'];
|
|
|
+ $mod = Model('fetch_order');
|
|
|
+ $condition['store_id'] = $_SESSION['store_id'];
|
|
|
+ $condition['fetch_status'] = 1;
|
|
|
+ if(!empty($card_type)) {
|
|
|
+ $condition['card_type'] = $card_type;
|
|
|
+ }
|
|
|
+ $count = $mod->where($condition)->count();
|
|
|
+ if(empty($count)) {
|
|
|
+ $count = 0;
|
|
|
+ }
|
|
|
+ echo(json_encode(['code' => 200, 'count' => $count]));
|
|
|
+ exit;
|
|
|
+ }
|
|
|
|
|
|
- $condition['vr_order.store_id'] = $_SESSION['store_id'];
|
|
|
- $condition['vr_order.order_state'] = ORDER_STATE_SEND;
|
|
|
- $condition['refill_order.inner_status'] = 0;
|
|
|
+ public function fetch_reputOp()
|
|
|
+ {
|
|
|
+ $fetch_id = intval($_GET['fetch_id']);
|
|
|
+ $mod = Model('fetch_order');
|
|
|
+ $res = $mod->reput($fetch_id);
|
|
|
+ if(!empty($res)) {
|
|
|
+ showDialog('操作成功','index.php?act=store_refill_order&op=index','succ');
|
|
|
+ } else {
|
|
|
+ showDialog('操作失败','index.php?act=store_refill_order&op=index','error');
|
|
|
+ }
|
|
|
+ }
|
|
|
|
|
|
- $order_list = $model_refill_order->getMerchantOrderList($condition, '', 'refill_order.*,vr_order.order_state', 'refill_order.order_id asc');
|
|
|
+ public function batch_disposeOp()
|
|
|
+ {
|
|
|
+ $state_type = $_GET['state_type'];
|
|
|
+ $official_sn = $_GET['official_sn'] ?? '';
|
|
|
+ $fetch_id = intval($_GET['fetch_id']);
|
|
|
|
|
|
- Tpl::output('order_list', $order_list);
|
|
|
- Tpl::output('show_page', $model_refill_order->showpage());
|
|
|
- Tpl::showpage('store_refill_order.batch_dispose');
|
|
|
+ $mod = Model('fetch_order');
|
|
|
+ $fetch_order = $mod->getFetchOrder(['fetch_id' => $fetch_id],'*',true,true);
|
|
|
+
|
|
|
+ if (!empty($fetch_order)) {
|
|
|
+ $params = ['state' => $state_type,
|
|
|
+ 'order_sn' => $fetch_order['order_sn'],
|
|
|
+ 'official_sn' => $official_sn];
|
|
|
+ Log::record("state: {$state_type}, order_sn: {$fetch_order['order_sn']}, official_sn: {$official_sn}", Log::DEBUG);
|
|
|
+ refill\util::push_notify($fetch_order['channel_name'],$params);
|
|
|
+ $mod->processed($fetch_id,$state_type,$official_sn);
|
|
|
+ showDialog("成功", 'reload', 'js');
|
|
|
exit();
|
|
|
- } else {
|
|
|
- $state_type = $_GET['state_type'];
|
|
|
- $ch_trade_no = $_GET['ch_trade_no'];
|
|
|
- $order_id = intval($_GET['order_id']);
|
|
|
-
|
|
|
- $refill_order = Model('refill_order');
|
|
|
- $refill_info = $refill_order->getOrderInfo(['order_id' => $order_id]);
|
|
|
-
|
|
|
- if (!empty($refill_info)) {
|
|
|
- $params = ['state_type' => $state_type,
|
|
|
- 'order_id' => $order_id,
|
|
|
- 'channel_name' => $refill_info['channel_name'],
|
|
|
- 'official_sn' => $ch_trade_no];
|
|
|
- $resp = http_request(BASE_SITE_URL . '/mobile/refill_inner.php', $params, 'POST');
|
|
|
- if ($resp === 'success') {
|
|
|
- showDialog("成功", 'reload', 'js');
|
|
|
- exit();
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- showDialog("失败", '', 'error');
|
|
|
}
|
|
|
- }
|
|
|
|
|
|
+ showDialog("失败", '', 'error');
|
|
|
+ }
|
|
|
|
|
|
- private function _order_send($order_info)
|
|
|
+ public function fetch_listOp()
|
|
|
{
|
|
|
- $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']);
|
|
|
+ $mod = Model('fetch_order');
|
|
|
+
|
|
|
+ $condition['store_id'] = $_SESSION['store_id'];
|
|
|
+ $condition['member_id'] = $_SESSION['member_id'];
|
|
|
+ $condition['fetch_status'] = 3;
|
|
|
+ $order_list = $mod->getFetchOrderList($condition,20);
|
|
|
+
|
|
|
+ Tpl::output('order_list', $order_list);
|
|
|
+ Tpl::output('show_page', $mod->showpage());
|
|
|
+ Tpl::showpage('store_refill_order.batch_dispose');
|
|
|
}
|
|
|
|
|
|
/**
|