/** * 批量删除支付方式 */ public function batch_delete() { //初始化返回数据 $return_data = array(); //请求结构体 $request_data = array(); /* 可管理的站点ID列表 */ role::check('manage_payment_type'); try { $payment_type_ids = $this->input->post('payment_type_id'); if (is_array($payment_type_ids) && count($payment_type_ids) > 0) { /* 初始化默认查询条件 */ $query_struct = array('where' => array('id' => $payment_type_ids), 'like' => array(), 'limit' => array('per_page' => 300, 'offset' => 0)); $payment_types = Mypayment_type::instance()->query_assoc($query_struct); /* 删除失败的 */ $failed_payment_type_names = ''; /* 执行操作 */ foreach ($payment_types as $key => $payment_type) { if (!Mypayment_type::instance($payment_type['id'])->delete()) { $failed_payment_type_names .= ' | ' . $payment_type['name']; } } if (empty($failed_payment_type_names)) { throw new MyRuntimeException(Kohana::lang('o_manage.delete_payment_type_success'), 403); } else { /* 中转提示页面的停留时间 */ $return_struct['action']['time'] = 10; $failed_payment_type_names = trim($failed_payment_type_names, ' | '); throw new MyRuntimeException(Kohana::lang('o_manage.delete_payment_type_error', $failed_payment_type_names), 403); } } else { throw new MyRuntimeException(Kohana::lang('o_global.data_load_error'), 403); } } catch (MyRuntimeException $ex) { $return_struct['status'] = 0; $return_struct['code'] = $ex->getCode(); $return_struct['msg'] = $ex->getMessage(); //TODO 异常处理 //throw $ex; if ($this->is_ajax_request()) { $this->template = new View('layout/empty_html'); $this->template->content = $return_struct['msg']; } else { $this->template->return_struct = $return_struct; $content = new View('info'); $this->template->content = $content; /* 请求结构数据绑定 */ $this->template->content->request_data = $request_data; /* 返回结构体绑定 */ $this->template->content->return_struct = $return_struct; } } }
/** * 建站流程中的支付添加 */ function flow_add() { //权限验证 $site_id_list = role::check('manage_payment'); $this->template->content = new View("manage/payment_flow_add"); //支付类型列表 $this->template->content->payment_types = Mypayment_type::instance()->payment_types(); $this->template->content->payment_type_list = Mypayment_type::instance()->select_list(); }
/** * get site payment_api * * @return array */ public function payments() { $list = array(); $payments = ORM::factory('payment')->orderby(array('position' => 'ASC'))->find_all(); foreach ($payments as $key => $rs) { $list[$key] = $rs->as_array(); $list[$key]['payment_type'] = Mypayment_type::instance($rs->payment_type_id)->get(); } return $list; }
</tr> <tr> <td class="a_right a_title">IP/地址:</td> <td class="a_left"><?php echo long2ip($order['ip']); ?> <span id="ip_country"></span></td> </tr> <?php if (!empty($order['payment_id'])) { ?> <?php $payment = Mypayment::instance($order['payment_id'])->get(); $payment_type_id = !empty($payment['payment_type_id']) ? $payment['payment_type_id'] : 0; if (!empty($payment_type_id)) { $payment_type = Mypayment_type::instance($payment_type_id)->get(); } $payment_type_name = !empty($payment_type['name']) ? $payment_type['name'] : ''; ?> <tr> <td class="a_right a_title">支付方式:</td> <td class="a_left"><?php echo $payment_type_name; ?> </td> </tr> <?php } ?> <tr> <td class="a_right a_title">交易号:</td>