* @version : HUOSDK 8.0 */ namespace huoAgentSwitch\view; use huolib\constant\OrderConst; class Index { /** * 设置切换页面页面样式 * * @param int $app_id 游戏ID * @param int $pay_switch 目前状态 * @param int $agent_id 渠道ID * @param int $id 对应ID * @param string $url * * @return string */ public static function setSwitch($app_id, $pay_switch, $agent_id = 0, $id = 0, $url = 'admin/game.pay_switch') { $_html = ''; if (OrderConst::PAY_SWITCH_YES == $pay_switch) { /* 1. 设置是否切换 */ $_url = url( $url.'/setSwitch', ['app_id' => $app_id, 'agent_id' => $agent_id, 'pay_switch' => OrderConst::PAY_SWITCH_NO, 'id' => $id] ); $_original_title = lang('CLICK_TO_SWITCH_NO'); $_icon = ''; $_class = 'btn btn-xs btn-success js-ajax-dialog-btn'; $_msg = lang('CONFIRM').lang('PAY_SWITCH_NO'); $_value = lang('PAY_SWITCH_YES'); $_text = ''; $_data_clipboard_text = '_'; $_target = ''; $_html = \cmf\view\Index::link( $_url, $_original_title, $_icon, $_class, $_msg, $_value, $_text, $_data_clipboard_text, $_target ); /* 2. 设置切换规则 */ $_url = url('admin/game.pay_switch/edit', ['app_id' => $app_id, 'agent_id' => $agent_id]); $_dialog_title = lang('EDIT_PAY_SWITCH'); $_title = ''; $_width = 1200; $_height = 600; $_btn = 'btn-xs btn-link'; $_data_original_title = $_dialog_title; $_html .= \cmf\view\Index::linkOpenIframeDialog( $_url, $_dialog_title, $_title, $_width, $_height, $_btn, $_data_original_title ); return $_html; } elseif (OrderConst::PAY_SWITCH_NO == $pay_switch) { /* 1. 设置是否切换 */ $_url = url( $url.'/setSwitch', ['app_id' => $app_id, 'agent_id' => $agent_id, 'pay_switch' => OrderConst::PAY_SWITCH_YES, 'id' => $id] ); $_original_title = lang('CLICK_TO_SWITCH'); $_icon = ''; $_class = 'btn btn-xs btn-default js-ajax-dialog-btn'; $_msg = lang('CONFIRM').lang('PAY_SWITCH_YES'); $_value = lang('PAY_SWITCH_NO'); $_text = ''; $_data_clipboard_text = '_'; $_target = ''; $_html = \cmf\view\Index::link( $_url, $_original_title, $_icon, $_class, $_msg, $_value, $_text, $_data_clipboard_text, $_target ); } return $_html; } /** * 设置弹出样式 * * @param string $url 链接 * @param string $lang 语言 * * @return string */ public static function setting($url, $lang) { if (strpos($url, '/')) { $_url = $url; } else { $_url = url($url); } $_html = \cmf\view\Index::linkOpenIframeDialog( $_url, $lang, lang('SETTING'), 1200, 600, 'btn btn-default', $lang ); return $_html; } }