Example #1
0
 /**
  * 更新游戏信息
  */
 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;
     }
 }
Example #2
0
 /**
  * 更新广告位信息
  */
 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;
     }
 }
Example #3
0
 public function importAction()
 {
     /*设置上传路径*/
     define('INSTALL', str_replace('\\', '/', dirname(dirname(dirname(dirname(dirname(__FILE__)))))));
     $savePath = INSTALL . '/traindata_appui/imgs/video/Excel/';
     $action = !empty($_GET['action']) ? trim($_GET['action']) : '';
     $file = !empty($_GET['file']) ? trim($_GET['file']) : '';
     if ($action == 'del') {
         $myfile = $savePath . $file;
         if (file_exists($myfile)) {
             if (unlink($myfile)) {
                 echo '<script type="text/javascript">alert("删除成功;返回列表");window.location.href="/res/import";</script>';
                 exit;
             }
             echo '<script type="text/javascript">alert("删除失败;返回列表");window.location.href="/res/import";</script>';
             exit;
         } else {
             echo '<script type="text/javascript">alert("文件不存在;返回列表");window.location.href="/res/import";</script>';
             exit;
         }
     } elseif (!empty($_FILES['file_stu']['name']) or $action == 'import') {
         if ($action == 'import' and !empty($file)) {
             $file_name = $file;
         } elseif (!empty($_FILES['file_stu']['name'])) {
             $tmp_file = $_FILES['file_stu']['tmp_name'];
             $file_types = explode(".", $_FILES['file_stu']['name']);
             $file_type = $file_types[count($file_types) - 1];
             /*判别是不是.xls文件,判别是不是excel文件*/
             if (strtolower($file_type) != "xls") {
                 $this->error('不是Excel文件,重新上传');
             }
             if (!is_dir($savePath)) {
                 mkdir($savePath, 0777, true);
             }
             /*以时间来命名上传的文件*/
             $str = date('Ymdhis');
             $file_name = $str . "." . $file_type;
             /*是否上传成功*/
             if (!copy($tmp_file, $savePath . $file_name)) {
                 $this->error('上传失败');
             }
         }
         //echo $savePath . $file_name;exit;
         $res = $this->read($savePath . $file_name);
         /*对生成的数组进行数据库的写入*/
         $errmsg = '';
         $noimpor = '';
         $okmsg = '';
         $m = new Psys_ResModel();
         foreach ($res as $k => $v) {
             if ($k > 1) {
                 $data = array('vname' => $v['1'], 'cast' => $v['6'], 'direcotr' => $v['10'], 'runtimes' => $v['11'], 'hits' => $v['11'], 'price' => $v['14'], 'sectionnum' => $v['15'], 'vpath' => $v['2'], 'vimg' => $v['3'], 'parter' => $v['21'], 'sortid' => $v['18'], 'area' => $v['9'], 'colid' => $v['7'], 'vyear' => $v['8'], 'iftj' => $v['16'], 'flag' => $v['17'], 'vdesc' => $v['4'], 'vdetail' => $v['5'], 'ctime' => time());
                 echo '<pre>';
                 print_r($data);
                 exit;
                 $svl = $obj->GetOne(array('value' => $v[1]), '*', 'rhi_packvalue');
                 if (empty($svl)) {
                     $result = $m->AddVideo($data);
                     if (!$result) {
                         $str = pring_r($data, true);
                         $errmsg .= date('Y-m-d H:i:s') . $str . "\r\n";
                     }
                 } else {
                     $noimpor .= $v[1] . ':在数据库中已存在' . "\r\n";
                 }
             }
         }
         if ($noimpor) {
             $logpas = ERRLOG_PATH . 'video' . DIRECTORY_SEPARATOR . date('Ymd') . DIRECTORY_SEPARATOR;
             if (!is_dir($logpas)) {
                 mkdir($logpas, 0777, true);
             }
             $log = $logpas . 'video_noimport.log';
             $str = $noimpor . "\r\n";
             error_log($str, 3, $log);
         }
         if ($errmsg) {
             $logpas = ERRLOG_PATH . 'video' . DIRECTORY_SEPARATOR . date('Ymd') . DIRECTORY_SEPARATOR;
             if (!is_dir($logpas)) {
                 mkdir($logpas, 0777, true);
             }
             $log = $logpas . 'video_error.log';
             $str = $errmsg . "\r\n";
             error_log($str, 3, $log);
         }
         echo '<script>alert("导入成功,自动过滤从复数据!");window.location.href="/video/valuelist"</script>';
         exit;
     } else {
         //开始运行
         $files = $this->listDir($savePath);
         $this->smarty->assign('files', $files);
         $this->forward = "import";
     }
 }
Example #4
0
 /**
  * 日期交易
  */
 public function dateListAction()
 {
     //var_dump($_POST);exit;
     global $G_X;
     $page = reqnum('page', 1);
     $pagesize = reqnum('pagesize', 10);
     $order = reqnum('order', 0);
     $ifsucc = reqnum('ifsucc', -1);
     //获取用户输入
     $year = reqnum('year', 0);
     $month = reqnum('month', 0);
     $day = reqnum('day', 0);
     if (!$year || !$month || !$day) {
         $date = '';
     } else {
         $date = $year . '-' . $month . '-' . $day;
     }
     if ($date == '') {
         $date = date('Y-m-d');
     }
     $date = strtotime($date);
     //url拼接
     $url = '';
     $url .= '&date=' . $date;
     $url .= '&order=' . $order;
     $url .= '&ifsucc=' . $ifsucc;
     $model = new Psys_FinModel();
     $list = $model->dateList($date, $order, $ifsucc, $page, $pagesize);
     //资源列表
     $resModel = new Psys_ResModel();
     foreach ($list['allrow'] as &$value) {
         $value['ctime'] = date('Y-m-d H:i:s', $value['ctime']);
         //下单时间格式转换
         $value['cip'] = long2ip($value['cip']);
         //下单地址格式转换
         if ($value['utime'] != '' || $value['uip'] != '') {
             $value['utime'] = date('Y-m-d H:i:s', $value['utime']);
             $value['uip'] = long2ip($value['uip']);
         }
         switch ($value['producttype']) {
             case 1:
                 //视频
                 $value['producttype'] = $G_X['order_type']['video_type'][1];
                 $where = array('id' => $value['productid']);
                 $result = $resModel->GetOneVideo($where);
                 $value['productid'] = $result['vname'];
                 break;
             case 2:
                 //音乐
                 $value['producttype'] = $G_X['order_type']['music_type'][1];
                 $where = array('id' => $value['productid']);
                 $result = $resModel->GetOne($where, 'mname', 'rhi_music');
                 $value['productid'] = $result['mname'];
                 break;
             case 3:
                 //游戏
                 $value['producttype'] = $G_X['order_type']['game_type'][1];
                 $where = array('id' => $value['productid']);
                 $result = $resModel->GetOneGame($where);
                 $value['productid'] = $result['appname'];
                 break;
             case 4:
                 //应用
                 $value['producttype'] = $G_X['order_type']['app_type'][1];
                 $where = array('id' => $value['productid']);
                 $result = $resModel->GetOne($where, 'appname', 'rhi_apps');
                 $value['productid'] = $result['appname'];
                 break;
             case 10:
                 //美食
                 $value['producttype'] = $G_X['order_type']['food_type'][1];
                 $where = array('id' => $value['productid']);
                 $result = $resModel->GetOne($where, 'fname', 'rhi_foodish');
                 $value['productid'] = $result['fname'];
                 break;
         }
     }
     self::inidate($list['allnum'], $page, $pagesize, count($list['allrow']));
     $this->smarty->assign('year', $year);
     $this->smarty->assign('month', $month);
     $this->smarty->assign('day', $day);
     $this->smarty->assign('order', $order);
     $this->smarty->assign('ifsucc', $ifsucc);
     $this->smarty->assign('url', $url);
     $this->smarty->assign('allnum', $list['allnum']);
     $this->smarty->assign('list', $list['allrow']);
     $this->forward = 'dateList';
 }
Example #5
0
 /**
  * 
  * 数据同步表写入
  * @param int $id	类型ID
  * @param bool $isdel	true 删除同步 false 更新同步
  */
 public function syncDb($id, $isdel)
 {
     //获取指定数据
     $data = $this->GetOne(array('id' => $id), '*', 'rhi_apps');
     if ($data['appcol'] == 1) {
         $type = 3;
     } else {
         $type = 4;
     }
     $typeid = $id;
     //选择数据库
     $this->SetDb('db-rht_sync');
     if ($isdel) {
         $method = 3;
         $data = array();
         $oldData = json_encode($data);
         $syncData = array('type' => $type, 'typeid' => $typeid, 'method' => $method, 'dataInfo' => $oldData, 'flag' => 0, 'ctime' => time());
         $num = $this->AddOne($syncData, 'rhs_sync');
         if ($num) {
             return array('result' => 'SUCCESS');
         } else {
             return array('result' => 'ERROR');
         }
     } else {
         //更新同步
         $oldData = json_encode($data);
         if ($data['utime']) {
             $method = 2;
         } else {
             $method = 1;
         }
         //数据写入
         $syncData = array('type' => $type, 'typeid' => $typeid, 'method' => $method, 'dataInfo' => $oldData, 'flag' => 0, 'ctime' => time());
         $num = $this->AddOne($syncData, 'rhs_sync');
         if ($num) {
             $this->SetDb("db-rht_idc");
             $model = new Psys_ResModel();
             $data = array('unconfirm' => 0);
             $model->UpdateGame($data, array('id' => $id));
             return array('result' => 'SUCCESS');
         } else {
             return array('result' => 'ERROR');
         }
     }
 }
Example #6
0
 /**
  * 添加
  */
 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";
 }