Example #1
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');
     }
 }
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', '');
         //根据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, 'ctime' => time(), 'tjapptype' => $tjapptype);
         $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;
     }
 }