if ($cid == '' && $rid != 'norefund') { json('您没有选择优惠券', 'alert'); return false; } $cids = explode(',', $cid); $order = Table::Fetch('order', $id); if ($order['card_id']) { Table::UpdateCache('order', $order['id'], array('rstate' => 'norefund')); json(array(array('data' => '该订单为使用代金券订单,不支持分券退款!', 'type' => 'alert'), array('data' => 'X.boxClose();', 'type' => 'eval'), array('data' => 'null', 'type' => 'refresh')), 'mix'); } if ($rid == 'norefund') { Table::UpdateCache('order', $order['id'], array('rstate' => 'norefund')); json(array(array('data' => '设置成功,该申请未通过!', 'type' => 'alert'), array('data' => 'X.boxClose();', 'type' => 'eval'), array('data' => 'null', 'type' => 'refresh')), 'mix'); } else { if ($rid == 'credit') { ZFlow::CouponRefund($order, $cids); } else { ZFlow::CouponOtherRefund($order, $cids); } } /* team -- */ $team = Table::Fetch('team', $order['team_id']); team_state($team); if ($team['state'] != 'failure') { $minus = $team['conduser'] == 'Y' ? 1 : count($cids); Table::UpdateCache('team', $team['id'], array('now_number' => array("now_number - {$minus}"))); } /* coupons delete*/ foreach ($cids as $key => $value) { Table::Delete('coupon', $value); }