/** * 更新广告位信息 */ public function updateAction() { $id = reqnum('id', 0); $ispost = reqnum('ispost', 0); $model = new Psys_AdsModel(); if ($ispost == 1) { //广告名 $adname = reqstr('adname'); //显示位置 $colid = reqnum('colid'); //显示系统 $adstype = reqstr('adstype', ''); //是否车站 $isstation = reqnum('isstation', 0); //状态 $flag = reqnum('flag', 0); //图片路径 $imgurl = reqstr('imgurl', ''); //访问路径 $actionurl = reqstr('actionurl', ''); //排序 $orderby = reqnum('orderby', 0); //链接ID $tjappid = reqnum('tjappid', 0); //有效期 $validity = strtotime(reqstr('validity', 0)); //广告描述 $addesc = reqstr('content', ''); //候车厅 $colstr = reqstr('colstr', ''); //根据ID获取app类型 $appmodel = new Psys_ResModel(); $where = array('id' => $tjappid); $app_data = $appmodel->GetOneGame($where); $tjapptype = $app_data ? $app_data['apptype'] : 0; //添加时间 $data = array('adname' => $adname, 'colid' => $colid, 'adstype' => $adstype, 'station' => $isstation, 'flag' => $flag, 'imgurl' => $imgurl, 'actionurl' => $actionurl, 'orderby' => $orderby, 'tjappid' => $tjappid, 'validity' => $validity, 'addesc' => $addesc, 'colstr' => $colstr, 'tjapptype' => $tjapptype, 'ctime' => time()); $result = array('result' => 'ERROR'); if ($imgurl == '') { MsgInfoConst::GetMsg(1041, $result); return $result; } if ($id == 0) { $returnid = $model->AddOne($data); $m = new Psys_ResModel(); $m->Record($data, $returnid, 'db-rht_sync', 'ads', 'rhs_downsync'); // start 写操作日志 $log = array('logtype' => 72, 'guid' => $_SESSION['Cur_X_User']['id'], 'ctime' => time(), 'cip' => real_ip()); $log['logdetail'] = $_SESSION['Cur_X_User']['username'] . "于" . date("Y-m-d H:i:s") . "[添加]广告位" . $adname; $model->admin_syslog($log); // end 日志 $result['result'] = 'SUCCESS'; } else { $w = array('id' => $id); $returnid = $model->UpdateOne($data, $w); $m = new Psys_ResModel(); $m->Record($data, $returnid, 'db-rht_sync', 'ads', 'rhs_downsync'); // start 写操作日志 $log = array('logtype' => 72, 'guid' => $_SESSION['Cur_X_User']['id'], 'ctime' => time(), 'cip' => real_ip()); $log['logdetail'] = $_SESSION['Cur_X_User']['username'] . "于" . date("Y-m-d H:i:s") . "[编辑]广告位" . $adname; $model->admin_syslog($log); // end 日志 $result['result'] = 'SUCCESS'; } if ($result['result'] == 'SUCCESS') { $file = dirname(dirname(dirname(dirname(dirname(__FILE__))))) . '/temp.txt'; $fp = fopen($file, 'w'); fwrite($fp, '1'); fclose($fp); } return $result; } }
/** * 更新游戏信息 */ public function gupdateAction() { $id = reqnum('id', 0); $ispost = reqnum('ispost', 0); $m = new Psys_ResModel(); if ($ispost == 1) { $appname = reqstr('appname'); $appcol = reqstr('appcol'); $appid = reqstr('appid', ''); $appid = $appid ? $appid : $this->getmaxappidAction($appcol); $price = reqstr('price', 0); $downcount = reqstr('downcount', 0); $logourl = reqstr('logourl'); $appurl = reqstr('appurl'); $ver = reqstr('ver', 0); $vernum = reqstr('vernum'); $filesize = reqstr('filesize'); $apppackage = reqstr('package'); $apptype = reqstr('apptype'); $lang = reqstr('lang'); $iftj = reqstr('iftj'); $flag = reqstr('flag'); $adesc = reqstr('adesc'); $adetail = reqstr('adetail'); $typeinfo = reqstr('typeinfo'); $develop = reqstr('develop'); $sig = reqstr('sig'); $pptfilenames = reqstr('pptfilenames'); $pptiosnames = reqstr('pptios'); $sortid = reqnum('sortid', 0); //return array('result'=>$pptfilenames); //转ppt文件名连接成的字符串为数组 if (!empty($pptfilenames)) { $ppt = explode(';', $pptfilenames); } else { $ppt = array(); } if (!empty($pptiosnames)) { $pptios = explode(';', $pptiosnames); } else { $pptios = array(); } //$ext = strrchr($logourl,'.'); $ext = '.png'; $data = array('appname' => $appname, 'appid' => $appid, 'price' => $price, 'downcount' => $downcount, 'sortid' => $sortid, 'imgurl' => 'logo' . $ext, 'appurl' => $appurl, 'ver' => $ver, 'vernum' => $vernum, 'filesize' => $filesize, 'package' => $apppackage, 'appcol' => $appcol, 'apptype' => $apptype, 'lang' => $lang, 'iftj' => $iftj, 'flag' => $flag, 'adesc' => $adesc, 'adetail' => $adetail, 'signature' => $sig, 'ctime' => time(), 'utime' => time(), 'typeinfo' => $typeinfo, 'develop' => $develop); $result = array('result' => 'ERROR'); if ($logourl == '') { MsgInfoConst::GetMsg(1041, $result); return $result; } /* * // 判断APP是否存在 $where = array ( 'appid' => $appid ); $isexit = $m->GetOneGame ( $where ); if ($isexit || count ( $isexit ) > 0) { MsgInfoConst::GetMsg ( 1043, $result ); return $result; } */ if ($id == 0) { $m->AddGame($data); if ($apptype == 2) { $ppt = $pptios; } if (!empty($ppt)) { for ($i = 0; $i < count($ppt); $i++) { // APP对应PPT //$ext = '.png'; //$ext = strrchr($ppt[$i],'.'); $appimg = array('appid' => $appid, 'imgurl' => $ppt[$i], 'ctime' => time()); if (empty($appimg['imgurl'])) { break; } $res = $m->AddGamePPT($appimg); $m->Record($appimg, $res, 'db-rht_sync', 'appimg', 'rhs_downsync'); } } // start 写操作日志 $log = array('logtype' => 71, 'guid' => $_SESSION['Cur_X_User']['id'], 'ctime' => time(), 'cip' => real_ip()); $log['logdetail'] = $_SESSION['Cur_X_User']['username'] . "于" . date("Y-m-d H:i:s") . "[添加]APP" . $appname; $m->admin_syslog($log); $result['result'] = 'SUCCESS'; } else { $w = array('id' => $id); $data['utime'] = time(); //------------------------物理文件更新开始 //获取更新前数据信息 $oldData = $m->GetOneGame($w, 'imgurl,appurl'); if ($data['appcol'] == 1) { $dir = GAME_PATH; } else { $dir = APP_PATH; } $imgurlPath = $dir . '/' . $data['appid'] . '/' . $oldData['imgurl']; $appurlPath = $dir . '/' . $data['appid'] . '/' . $oldData['appurl']; if (file_exists($imgurlPath) && $data['imgurl'] != $oldData['imgurl']) { unlink($imgurlPath); } if (file_exists($appurlPath) && $data['appurl'] != $oldData['appurl']) { unlink($appurlPath); } //------------------------物理文件更新结束 $m->UpdateGame($data, $w); // 先删除PPT表里等于APPID的PPT $w = array('appid' => $appid); $m->DelOneGamePPT($w); for ($i = 0; $i < count($ppt); $i++) { // APP对应PPT //$ext = strrchr($ppt[$i],'.'); //$ext = '.png'; $appimg = array('appid' => $appid, 'imgurl' => $ppt[$i], 'ctime' => time()); if (empty($appimg['imgurl'])) { break; } $res = $m->AddGamePPT($appimg); $m->Record($appimg, $res, 'db-rht_sync', 'appimg', 'rhs_downsync'); } // start 写操作日志 $log = array('logtype' => 71, 'guid' => $_SESSION['Cur_X_User']['id'], 'ctime' => time(), 'cip' => real_ip()); $log['logdetail'] = $_SESSION['Cur_X_User']['username'] . "于" . date("Y-m-d H:i:s") . "[编辑]APP信息" . $appname; $m->admin_syslog($log); // end 日志 $result['result'] = 'SUCCESS'; } return $result; } }
/** * 添加 */ public function addAction() { $traintype = array('K' => '快速', 'Z' => '直达特快', '' => '其他', 'T' => '空调特快', 'D' => '动车组', 'G' => '高速动车'); $id = reqnum('id', 0); $ispost = reqnum('ispost', 0); $trainModel = new Psys_TrainModel(); $one = array(); if ($ispost == 1) { $rtn = array('result' => 'ERROR'); $one['trainno'] = reqstr('checi', ''); if ($one['trainno'] == '') { MsgInfoConst::GetMsg(2001, $rtn); return $rtn; } else { $one['trainno'] = str_ireplace("/", ",", trim($one['trainno'], ',')); $one['trainno'] = ',' . $one['trainno'] . ','; } $one['traintype'] = reqstr('leixin', ''); $one['bstation'] = reqstr('b_station', ''); $one['btime'] = str_ireplace(':', ':', reqstr('btime_station', '')); $one['estation'] = reqstr('e_station', ''); $one['etime'] = str_ireplace(':', ':', reqstr('etime_station', '')); $one['runtime'] = str_ireplace(':', ':', reqstr('runtime', '')); $one['price'] = reqstr('price', ''); $one['mileage'] = reqstr('mileage', ''); if ($id > 0) { $w = array('id' => $id); $res = $trainModel->UpdateOne($one, $w); $m = new Psys_ResModel(); $m->Record($one, $res, 'db-rht_sync', 'trainno', 'rhs_downsync'); } else { $res = $trainModel->AddOne($one); $m = new Psys_ResModel(); $m->Record($one, $res, 'db-rht_sync', 'trainno', 'rhs_downsync'); } $rtn['result'] = 'SUCCESS'; MsgInfoConst::GetMsg(2002, $rtn); return $rtn; } else { $one['trainno'] = ''; $one['traintype'] = ''; $one['bstation'] = ''; $one['btime'] = ''; $one['estation'] = ''; $one['etime'] = ''; $one['runtime'] = ''; $one['price'] = ''; $one['mileage'] = ''; } if ($id > 0) { $one = $trainModel->GetOne(array('id' => $id)); if (!$one) { $id = 0; } else { $one['trainno'] = str_ireplace(",", "/", trim($one['trainno'], ',')); } } $this->smarty->assign('one', $one); $this->smarty->assign('id', $id); $this->smarty->assign('traintype', $traintype); $this->forward = "add"; }