1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586 |
- <?php
- class refill_configControl extends SystemControl
- {
- public function __construct()
- {
- parent::__construct();
- }
- public function indexOp()
- {
- if (chksubmit()) {
- foreach ($_POST as $key => $value) {
- $cache[$key] = $value;
- }
- wcache('config', ['data' => serialize($_POST)], 'refill-');
- showMessage('编辑成功');
- } else {
- $config = rcache('config', 'refill-');
- if (empty($config)) {
- $config = [];
- } else {
- $config = unserialize($config['data']);
- }
- Tpl::output('config', $config);
- Tpl::showpage('refill.config');
- }
- }
- public function interceptOp()
- {
- $qualitys = [refill\Quality::Normal => '普充',
- refill\Quality::Quick => '快充',
- refill\Quality::CardKey => '卡密',
- refill\Quality::ThirdShop => '三方',
- refill\Quality::SlowTwentyFour => '慢24'];
- $card_types = [mtopcard\ChinaMobileCard => '移动',
- mtopcard\ChinaUnicomCard => '联通',
- mtopcard\ChinaTelecomCard => '电信'];
- $province_list = mtopcard\ProvinceList;
- $province_list[-1] = '全国';
- ksort($province_list);
- if (chksubmit())
- {
- $intercept = [];
- foreach ($qualitys as $quality_key => $quality_txt)
- {
- foreach ($card_types as $card_type_key => $card_type_text)
- {
- $key = $quality_key . '-' . $card_type_key;
- foreach ($province_list as $province_key => $province_text)
- {
- $data_key = $key . '-' . $province_key;
- if (array_key_exists($data_key, $_POST)) {
- $intercept[$key][$province_key] = intval($_POST[$data_key]);
- }
- }
- }
- }
- $intercept = serialize($intercept);
- Log::record("intercept={$intercept}",Log::DEBUG);
- wkcache('refill-intercept',$intercept);
- showMessage('编辑成功');
- }
- else
- {
- $intercept = rkcache('refill-intercept');
- if (empty($intercept)) {
- $intercept = [];
- } else {
- $intercept = unserialize($intercept);
- }
- Tpl::output('quality_txt', $qualitys);
- Tpl::output('card_type_text', $card_types);
- Tpl::output('province_list', $province_list);
- Tpl::output('intercept', $intercept);
- Tpl::showpage('refill.intercept');
- }
- }
- }
|