public function actionweekModify() { if ($_POST['op']) { unset($_POST['op']); $_POST['schedule'] = $_POST['hour'] . ':' . $_POST['minute']; $chninfo = $this->M_chninfo->find($_POST['chnserial']); $_GET['prgname'] = $chninfo['prgname']; if ($this->M_timeinfo->update($_POST)) { $this->_G->show(2002, "time", "Index"); } else { $this->_G->show(2012, "time", "Modify"); } } else { $chninfo = $this->M_chninfo->findall('prgname<>\'\''); $hour = array(); for ($i = 0; $i < 24; $i++) { $hour[$i] = str_pad($i, 2, '0', STR_PAD_LEFT); } $this->_V->assign('hour', $hour); $minute = array(); for ($i = 0; $i < 60; $i++) { $minute[$i] = str_pad($i, 2, '0', STR_PAD_LEFT); } $week = array(1, 2, 3, 4, 5, 6, 7); $this->_V->assign('week', $week); $this->_V->assign('minute', $minute); $this->_V->assign("chninfo", $chninfo); // 内容:主页面 $this->_V->assign("_MainFile", "time_weekedit.htm"); // 表单地址:添加 $this->_V->assign("_acurl", url("time", "weekModify")); // 操作: 添加 $this->_V->assign("op", "m"); // 内容:导航条 $this->_V->assign("_CurrentlyPlace", $this->_N->genNav('c=time&a=weekModify')); //不显示导航条 // $this->_V->assign('noview_navigation',TRUE); $DataList = $this->M_timeinfo->find($_GET['serial']); $time = explode(':', $DataList['schedule']); $DataList['hour'] = $time[0]; $DataList['minute'] = $time[1]; $this->_V->assign('gainArray', $this->socketClient->gainArray); $this->_V->assign("DataList", $DataList); $this->_V->display('sys_container.htm'); } }
/** * 恢复设备默认设置 * */ public function actionResumeDefault() { $devinfo = $this->M_devinfo->find($_GET['serial']); $socket = FLEA::getSingleton('Util_socketclient'); $socket->socketconn($devinfo['ipaddr'], $devinfo['ipport']); $this->log->ip = $devinfo['ipaddr']; switch ($socket->sendmessage('SINITZ')) { case $socket->returntrue: $this->log->writelog($devinfo['devname'], 'SINITZ', $socket->returntrue); $serial = (int) $_GET['serial']; try { $db = FLEA::getDBO(); $db->startTrans(); sleep(1); for ($i = 1; $i < 9; $i++) { $return_socketinfo = $socket->sendmessage("SI{$i}Z"); if (strlen($return_socketinfo) == 13) { $chninfo = $socket->analysisinfo($return_socketinfo); if ($chninfo === FALSE) { exit($this->_G->customshow('获取设备信息出现乱码,请重试', $_GET['socket_C'], 'index', 3, 0)); } //如果有乱码将直接退出 #检测APID是否有相同 $this->M_chninfo->updateByConditions("dev_no='{$serial}' and chn='{$chninfo['chn']}'", $chninfo); $chninfo['prgname'] = " "; $chninfo['chnshort'] = " "; $this->M_chninfo->updateByConditions("dev_no='{$serial}' and chn='{$chninfo['chn']}'", $chninfo); sleep(1); } } fclose($socket->socket); $db->completeTrans(); $this->_G->customshow("该设备已恢复成默认值", 'socket', 'index', 3, 1); } catch (Exception $e) { $db->completeTrans(FALSE); $this->_G->customshow("恢复设备默认值失败,请重试", 'socket', 'index', 3, 0); } break; case $socket->returnfalse: $this->log->writelog($devinfo['devname'], 'SINITZ', $socket->returnfalse); $this->_G->customshow("恢复出错,请重新恢复", 'socket', 'index', 0); break; } }
public function actionclearchn() { $serial = (int) $_GET['serial']; // $chninfo=array( // 'serial'=>$serial, // 'chn'=>'9', // 'chnshort'=>NULL, // 'apid'=>NULL, // 'prgname'=>NULL, // 'agcstat'=>NULL, // 'gain'=>NULL, // 'mutestat'=>NULL, // 'passstat'=>NULL, // ); if ($this->M_chninfo->removeByPkv($serial)) { $this->_G->customshow('删除操作成功', 'edit', 'Index', 3); } else { $this->_G->customshow('删除操作失败', 'edit', 'Index', 3, 1); } }