public function doAddAction() { $station = reqstr('station'); $acfile = reqstr('acfile'); $logfile = reqstr('logfile'); $logip = reqstr('logip'); $ifconf = reqstr('ifconf'); $data = array('stationname' => $station, 'acfile' => $acfile, 'logfile' => $logfile, 'logip' => $logip, 'ifconf' => $ifconf); $model = new Psys_StationModel(); $re = $model->AddOne($data, "rha_station"); $this->smarty->assign('ck', $re ? 1 : 0); $this->forward = "opration"; }
/** * 添加一键上网报警数据 */ public function gonetalarmaddAction() { $data = reqstr('data'); $data = urldecode($data); $info = array(); parse_str($data, $info); $stationid = (int) $info['stationid'] ? (int) $info['stationid'] : 0; $type = (int) $info['type'] ? (int) $info['type'] : 0; $stime = trim($info['stime']) ? trim($info['stime']) : ''; $etime = trim($info['etime']) ? trim($info['etime']) : ''; $trigger = (int) $info['trigger'] ? (int) $info['trigger'] : 0; $isupdate = $info['isupdate']; if (!$stationid) { return array('code' => 0, 'msg' => '请选择车站'); } if (!$type) { return array('code' => 0, 'msg' => '请选择触发类型'); } if (!$stime) { return array('code' => 0, 'msg' => '请选择起始时间'); } if (!$etime) { return array('code' => 0, 'msg' => '请选择结束时间'); } if (!$trigger) { return array('code' => 0, 'msg' => '请输入触发值'); } $data = array('stationid' => $stationid, 'type' => $type, 'stime' => $stime, 'etime' => $etime, 'trigger' => $trigger); $m = new Psys_StationModel(); //判断是添加还是更新 if (!$isupdate) { $res = $m->AddOne($data, 'rha_gonet_trigger'); } else { $id = $info['id']; $res = $m->UpdateOne($data, array('id' => $id), 'rha_gonet_trigger'); } if ($res) { return array('code' => 1, 'msg' => '操作成功'); } return array('code' => 0, 'msg' => '操作失败'); }