get('event-config', 'refill-'); if (!empty($cfgs)) { $cfgs = unserialize($cfgs); } if (empty($cfgs['cfgs_crash'])) { $cfgs['open_crash'] = false; $cfgs['cfgs_crash'] = [ 'channels' => "", 'succ_interval' => 900 ]; } if (chksubmit()) { $channels = $channels_reader($_POST['channels']); $cfgs['open_crash'] = boolval($_POST['open_crash'] ?? false); $cfgs['cfgs_crash'] = [ 'channels' => $channels, 'succ_interval' => intval($_POST['succ_interval']) ]; $cacher->set('event-config', serialize($cfgs), 'refill-'); showMessage('编辑成功'); } Tpl::output('cfgs', $cfgs); Tpl::showpage('refill_event.index'); } public function notifyOp() { $osns_reader = function ($input) { $sns = []; $data = explode(',', $input); foreach ($data as $val) { $val = trim($val); if (!empty($val)) { $sns[] = $val; } } return implode(',', $sns); }; $mchids_reader = function ($input) { $ids = []; $data = explode(',', $input); foreach ($data as $val) { $val = trim($val); $val = intval($val); if ($val > 0) { $ids[] = $val; } } return implode(',', $ids); }; $cacher = Cache::getInstance('cacheredis'); $cfgs = $cacher->get('event-config', 'refill-'); if (!empty($cfgs)) { $cfgs = unserialize($cfgs); } if (empty($cfgs['cfgs_notify_osn'])) { $cfgs['open_notify_osn'] = false; $cfgs['cfgs_notify_osn'] = [ 'exclude_sns_start' => '', 'exclude_mchids' => '' ]; } if (empty($cfgs['cfgs_sms'])) { $cfgs['open_sms'] = false; $cfgs['cfgs_sms'] = [ 'include_mchids' => '' ]; } if (chksubmit()) { $cfgs['open_notify_osn'] = boolval($_POST['open_notify_osn'] ?? false); $cfgs['cfgs_notify_osn'] = [ 'exclude_sns_start' => $osns_reader($_POST['exclude_sns_start']), 'exclude_mchids' => $mchids_reader($_POST['exclude_mchids']) ]; $cfgs['open_sms'] = boolval($_POST['open_sms'] ?? false); $cfgs['cfgs_sms'] = [ 'include_mchids' => $mchids_reader($_POST['include_mchids']) ]; $cacher->set('event-config', serialize($cfgs), 'refill-'); showMessage('编辑成功'); } Tpl::output('cfgs', $cfgs); Tpl::showpage('refill_event.notify'); } public function delcacheOp() { } }