Esempio n. 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;
     }
 }
Esempio n. 2
0
 /**
  * 删除应用
  */
 public function gdeleteAction()
 {
     $m = new Psys_ResModel();
     if (isset($_GET['page'])) {
         $page = reqnum('page', 1);
     } else {
         $page = 1;
     }
     if (isset($_GET['id'])) {
         if (is_array($_GET['id'])) {
             $id = reqarray('id', array());
             foreach ($id as $v) {
                 $where = array('id' => $v);
                 $data = $m->GetOneGame($where);
                 //-------------物理文件删除开始
                 //物理文件删除判断
                 if ($data['appcol'] == 1) {
                     $pathType = GAME_PATH;
                 } else {
                     $pathType = APP_PATH;
                 }
                 $path = $pathType . '/' . $data['appid'];
                 if (is_dir($path)) {
                     deldir($path);
                 }
                 //----------------------------------物理文件删除结束
                 $affectedNum = $m->DelOneGame($where);
                 // 删除等于当前等于APPID的PPT
                 $w = array('appid' => $data['appid']);
                 $m->DelOneGamePPT($w);
                 // 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") . "[删除]游戏" . $data['appname'];
                 // $m=new Psys_SyslogModel();
                 // $m->admin_syslog($log);
                 $m->admin_syslog($log);
                 // end 日志
             }
             header("Location:/res/glist?page={$page}");
         } elseif (is_numeric($_GET['id'])) {
             $id = reqnum('id', '0');
             $where = array('id' => $id);
             $data = $m->GetOneGame($where);
             //--------------------------------物理文件删除开始
             //物理文件删除判断
             if ($data['appcol'] == 1) {
                 $pathType = GAME_PATH;
             } else {
                 $pathType = APP_PATH;
             }
             $pathAppid = $data['appid'];
             //$list = $m->GetList(array('appid'=>$data['appid']),'','','','*','rhi_apps');
             $path = $pathType . '/' . $data['appid'];
             if (is_dir($path)) {
                 deldir($path);
             }
             //---------------------------------物理文件删除结束
             $m->DelOneGame($where);
             // 删除等于当前等于APPID的PPT
             $w = array('appid' => $data['appid']);
             $m->DelOneGamePPT($w);
             // 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") . "[删除]游戏" . $data['appname'];
             $m->admin_syslog($log);
             // end 日志
             header("Location:/res/glist?page={$page}");
         } else {
             echo "<script>alert('为选择数据,id为空。');</script>";
             header('HTTP/1.1 204 no content');
         }
     } else {
         echo "<script>alert('为选择数据,id为空。');</script>";
         header('HTTP/1.1 204 no content');
     }
 }
Esempio n. 3
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;
     }
 }
Esempio n. 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';
 }