Beispiel #1
0
 /**
  * 删除广告
  */
 public function deletefulladsAction()
 {
     $ispost = reqnum('ispost', 0);
     if ($ispost == 1) {
         $id = reqnum('id', 0);
         $result = array('result' => 'ERROR');
         if (!$id) {
             return $result;
         }
         $w = array('id' => $id);
         //判断是否广告正在被车站使用
         $m = new Psys_AdsRule();
         $stationads = $m->getonecity($where, 'adsone');
         foreach ($stationads as $key => $val) {
             $match = '/' . $id . '/';
             if (preg_match($match, $val['adsone'])) {
                 $result = array('result' => 'ERROR2');
                 return $result;
             }
             if (preg_match($match, $val['adstwo'])) {
                 $result = array('result' => 'ERROR2');
                 return $result;
             }
         }
         $model = new Psys_AdsModel();
         $data = $model->GetOne($where);
         $res = $model->DeleteOne($w);
         if ($res) {
             $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") . "[删除]广告位" . $data['adname'];
             // $m=new Psys_SyslogModel();
             // $m->admin_syslog($log);
             $model->admin_syslog($log);
             $result['result'] = 'SUCCESS';
         }
         return $result;
     }
 }