Example #1
0
 public function mdelAction()
 {
     $model = new Psys_ResModel();
     if (is_array($_GET['id'])) {
         $id = reqarray('id', array());
         foreach ($id as $v) {
             $where = array('id' => $v);
             $info = $model->GetOne($where, '*', 'rhi_albummusic');
             /*
             //物理文件删除
             $filename = $info['mpath'];
             $musicPath = dirname(dirname(VIDEO_PATH)) . '/' . 'files' . '/' . 'music' . '/' . $filename;
             unlink($musicPath);
             */
             $model->DeleteOneMusic($where);
             //start 写操作日志
             $log = array('logtype' => 1, '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") . "[删除]音乐" . $info['mname'];
             $model->admin_syslog($log);
             //end 日志
         }
         header("Location:/res/mlist");
     } elseif (is_numeric($_GET['id'])) {
         $id = reqnum('id', '0');
         $where = array('id' => $id);
         $info = $model->GetOne($where, '*', 'rhi_albummusic');
         $model->DeleteOneMusic($where);
         //start 写操作日志
         $log = array('logtype' => 1, '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") . "[删除]音乐" . $info['mname'];
         $model->admin_syslog($log);
         //end 日志
         header("Location:/res/mlist");
     } else {
         echo "<script>alert('id 为空');</script>";
     }
 }