|
@@ -4,6 +4,7 @@ include(BASE_CONFIG_PATH . CONFIG_PREFIX . '/refill.ini.php');
|
|
require_once(BASE_HELPER_PATH . '/model/member_info.php');
|
|
require_once(BASE_HELPER_PATH . '/model/member_info.php');
|
|
require_once(BASE_HELPER_PATH . '/refill/chprice_helper.php');
|
|
require_once(BASE_HELPER_PATH . '/refill/chprice_helper.php');
|
|
|
|
|
|
|
|
+#通道列表
|
|
class providerControl extends SystemControl
|
|
class providerControl extends SystemControl
|
|
{
|
|
{
|
|
public function __construct()
|
|
public function __construct()
|
|
@@ -14,6 +15,7 @@ class providerControl extends SystemControl
|
|
public function indexOp()
|
|
public function indexOp()
|
|
{
|
|
{
|
|
global $config;
|
|
global $config;
|
|
|
|
+
|
|
$provider_model = Model('refill_provider');
|
|
$provider_model = Model('refill_provider');
|
|
$condition = [];
|
|
$condition = [];
|
|
if (trim($_GET['name']) != '') {
|
|
if (trim($_GET['name']) != '') {
|
|
@@ -78,20 +80,23 @@ class providerControl extends SystemControl
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
- if(!empty($_GET['export']))
|
|
|
|
- {
|
|
|
|
|
|
+
|
|
|
|
+ if (!empty($_GET['export'])) {
|
|
$this->provider_export($providers);
|
|
$this->provider_export($providers);
|
|
return;
|
|
return;
|
|
}
|
|
}
|
|
|
|
+
|
|
$stats = ['available_total' => $available_total, 'debt_total' => $debt_total];
|
|
$stats = ['available_total' => $available_total, 'debt_total' => $debt_total];
|
|
$opened_text = ['使用中', '已禁用'];
|
|
$opened_text = ['使用中', '已禁用'];
|
|
$type_text = ['油卡', '手机充值卡', '增值业务'];
|
|
$type_text = ['油卡', '手机充值卡', '增值业务'];
|
|
|
|
+
|
|
Tpl::output('opened_text', $opened_text);
|
|
Tpl::output('opened_text', $opened_text);
|
|
Tpl::output('type_text', $type_text);
|
|
Tpl::output('type_text', $type_text);
|
|
Tpl::output('provider_list', $providers);
|
|
Tpl::output('provider_list', $providers);
|
|
Tpl::output('stats', $stats);
|
|
Tpl::output('stats', $stats);
|
|
Tpl::output('prices', $this->all_price());
|
|
Tpl::output('prices', $this->all_price());
|
|
Tpl::output('show_page', $provider_model->showpage());
|
|
Tpl::output('show_page', $provider_model->showpage());
|
|
|
|
+
|
|
Tpl::showpage('provider.index');
|
|
Tpl::showpage('provider.index');
|
|
}
|
|
}
|
|
|
|
|
|
@@ -770,4 +775,86 @@ class providerControl extends SystemControl
|
|
}
|
|
}
|
|
return $result;
|
|
return $result;
|
|
}
|
|
}
|
|
|
|
+
|
|
|
|
+ /**
|
|
|
|
+ * 新增通道
|
|
|
|
+ */
|
|
|
|
+ public function provider_addOp()
|
|
|
|
+ {
|
|
|
|
+ $provider_model = Model('refill_provider');
|
|
|
|
+ if (chksubmit()) {
|
|
|
|
+ $params = $_POST;
|
|
|
|
+ unset($params['form_submit']);
|
|
|
|
+ $result = $provider_model->addProvider($params);
|
|
|
|
+ if ($result) {
|
|
|
|
+ $url = [
|
|
|
|
+ [
|
|
|
|
+ 'url' => 'index.php?act=provider&op=index',
|
|
|
|
+ 'msg' => '返回通道列表',
|
|
|
|
+ ],
|
|
|
|
+ [
|
|
|
|
+ 'url' => 'index.php?act=provider&op=provider_add',
|
|
|
|
+ 'msg' => '继续新增通道',
|
|
|
|
+ ],
|
|
|
|
+ ];
|
|
|
|
+ $this->log('添加通道:' . '[ ' . $_POST['name'] . ']', 1);
|
|
|
|
+ showMessage('通道添加成功', $url);
|
|
|
|
+ } else {
|
|
|
|
+ showMessage('通道添加失败');
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ Tpl::showpage('provider.add');
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ public function provider_editOp()
|
|
|
|
+ {
|
|
|
|
+ $provider_model = Model('refill_provider');
|
|
|
|
+ if (chksubmit()) {
|
|
|
|
+ $provider_id = intval($_POST['provider_id']) ?? '';
|
|
|
|
+ $provider = $provider_model->getProviderInfo(['provider_id' => $provider_id]);
|
|
|
|
+ if (empty($provider)) {
|
|
|
|
+ showMessage('通道信息有误');
|
|
|
|
+ }
|
|
|
|
+ $params = $_POST;
|
|
|
|
+ unset($params['form_submit']);
|
|
|
|
+ if (empty($params)) {
|
|
|
|
+ showMessage('通道编辑成功', 'index.php?act=provider&op=index');
|
|
|
|
+ }
|
|
|
|
+ $result = $provider_model->editProvider($params, ['provider_id' => $provider_id]);
|
|
|
|
+ if ($result) {
|
|
|
|
+ $this->log('编辑通道:' . '[ ' . $provider['name'] . ']', 1);
|
|
|
|
+ showMessage('通道编辑成功', 'index.php?act=provider&op=index');
|
|
|
|
+ } else {
|
|
|
|
+ showMessage('通道编辑失败', "index.php?act=provider&op=provider_edit&id={$provider_id}");
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ $provider_id = intval($_GET['id']) ?? '';
|
|
|
|
+ $provider = $provider_model->getProviderInfo(['provider_id' => $provider_id]);
|
|
|
|
+ if (empty($provider)) {
|
|
|
|
+ showMessage('通道信息有误');
|
|
|
|
+ }
|
|
|
|
+ $type_text = ['油卡', '手机充值卡'];
|
|
|
|
+ $refill_company = $this->refill_companys(['co_type' => refill_companyModel::co_type_provider]);
|
|
|
|
+ Tpl::output('refill_company', $refill_company);
|
|
|
|
+ Tpl::output('type_text', $type_text);
|
|
|
|
+ Tpl::output('provider', $provider);
|
|
|
|
+ Tpl::showpage('provider.edit');
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ public function provider_delOp()
|
|
|
|
+ {
|
|
|
|
+ $provider_model = Model('refill_provider');
|
|
|
|
+ $provider_id = intval($_GET['id']) ?? '';
|
|
|
|
+ $provider = $provider_model->getProviderInfo(['provider_id' => $provider_id]);
|
|
|
|
+ if (empty($provider)) {
|
|
|
|
+ showMessage('通道信息有误');
|
|
|
|
+ }
|
|
|
|
+ $result = $provider_model->delProvider(['provider_id' => $provider_id]);
|
|
|
|
+ if ($result) {
|
|
|
|
+ $this->log('删除通道:' . '[ ' . $provider['name'] . ']', 1);
|
|
|
|
+ showMessage('通道删除成功', 'index.php?act=provider&op=index');
|
|
|
|
+ } else {
|
|
|
|
+ showMessage('通道删除失败', "index.php?act=provider&op=index");
|
|
|
|
+ }
|
|
|
|
+ }
|
|
}
|
|
}
|