public function voucher_listOp() { $model = Model('voucher'); $list = $model->getMemberVoucherList($_SESSION['member_id'], $_GET['select_detail_state'], 10); // add by wangjiang查询会员及其附属信息 $result = parent::pointshopMInfo(true); $member_info = $result['member_info']; unset($result); //end wangjiang //取已经使用过并且未有voucher_order_id的代金券的订单ID $used_voucher_code = array(); $voucher_order = array(); if (!empty($list)) { foreach ($list as $v) { if ($v['voucher_state'] == 2 && empty($v['voucher_order_id'])) { $used_voucher_code[] = $v['voucher_code']; } } } if (!empty($used_voucher_code)) { $order_list = Model('order')->getOrderCommonList(array('voucher_code' => array('in', $used_voucher_code)), 'order_id,voucher_code'); if (!empty($order_list)) { foreach ($order_list as $v) { $voucher_order[$v['voucher_code']] = $v['order_id']; $model->editVoucher(array('voucher_order_id' => $v['order_id']), array('voucher_code' => $v['voucher_code'])); } } } Tpl::output('list', $list); Tpl::output('voucherstate_arr', $model->getVoucherStateArray()); Tpl::output('show_page', $model->showpage(2)); $this->profile_menu('voucher_list'); Tpl::showpage('member_voucher.list'); }