$order = Table::Fetch('order', $id); if ($order['state'] != 'unpay') { json('付款订单不能删除', 'alert'); } /* card refund */ if ($order['card_id']) { Table::UpdateCache('card', $order['card_id'], array('consume' => 'N', 'team_id' => 0, 'order_id' => 0)); } Table::Delete('order', $order['id']); Session::Set('notice', "删除订单 {$order['id']} 成功"); json(null, 'refresh'); } else { if ('ordercash' == $action) { need_auth('order'); $order = Table::Fetch('order', $id); ZOrder::CashIt($order); $user = Table::Fetch('user', $order['user_id']); Session::Set('notice', "现金付款成功,购买用户:{$user['email']}"); json(null, 'refresh'); } else { if ('teamdetail' == $action) { $team = Table::Fetch('team', $id); $partner = Table::Fetch('partner', $team['partner_id']); $paycount = Table::Count('order', array('state' => 'pay', 'team_id' => $id)); $buycount = Table::Count('order', array('state' => 'pay', 'team_id' => $id), 'quantity'); $onlinepay = Table::Count('order', array('state' => 'pay', 'team_id' => $id), 'money'); $creditpay = Table::Count('order', array('state' => 'pay', 'team_id' => $id), 'credit'); $cardpay = Table::Count('order', array('state' => 'pay', 'team_id' => $id), 'card'); $couponcount = Table::Count('coupon', array('team_id' => $id)); $team['state'] = team_state($team); $city_id = abs(intval($team['city_id']));