示例#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;
     }
 }
示例#2
0
 /**
  * 删除电影
  */
 public function vdeleteAction()
 {
     $m = new Psys_ResModel();
     if (is_array($_GET['id'])) {
         $id = reqarray('id', array());
         foreach ($id as $v) {
             $where = array('id' => $v);
             $data = $m->GetOneVideo($where);
             //在放开注释是得修改表名
             $imgName = $data['vimg'];
             $avName = $data['avpath'];
             $ivName = $data['ivpath'];
             //组建路径
             $imgPath = VIDEO_PATH . $imgName;
             //删除物理图片文件
             if (file_exists($imgPath)) {
                 unlink($imgPath);
             }
             //删除视频文件
             $vPath = dirname(dirname(VIDEO_PATH)) . '/' . 'files' . '/';
             if (file_exists($vPath . $avName)) {
                 unlink($vPath . $avName);
             }
             if (file_exists($vPath . $ivName)) {
                 unlink($vPath . $ivName);
             }
             $m->DelOneVideo($where);
             // 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['vname'];
             // $m=new Psys_SyslogModel();
             // $m->admin_syslog($log);
             $m->admin_syslog($log);
             // end 日志
         }
         header("Location:/res/vlist");
     } elseif (is_numeric($_GET['id'])) {
         $id = reqnum('id', '0');
         $where = array('id' => $id);
         $data = $m->GetOneVideo($where);
         $m->DelOneVideo($where);
         // 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['vname'];
         $m->admin_syslog($log);
         // end 日志
         header("Location:/res/vlist");
     } else {
         echo "<script>alert('id 为空');</script>";
     }
 }