示例#1
0
 public function del()
 {
     //删除微博
     $map['id'] = $_POST['w_id'];
     $db = new WorldsModel();
     $db->where($map)->delete();
     //删除回复
     unset($map);
     $map['w_id'] = $_POST['w_id'];
     $db = new WorldsResponsesModel();
     $db->where($map)->delete();
     //删除图片
     $db = new WorldsPicsModel();
     $rs = $db->where($map)->select();
     foreach ($rs as $rs) {
         $file1 = './Public/Upload/' . $rs['name'];
         $file2 = './Public/Upload/wap120_' . $rs['name'];
         $file3 = './Public/Upload/wap160_' . $rs['name'];
         unlink($file1);
         unlink($file2);
         unlink($file3);
     }
     $db->where($map)->delete();
     $this->ajaxReturn(1, '', 1);
 }
示例#2
0
 public function ty()
 {
     $db = new WorldsResponsesModel();
     $map['w_id'] = array('eq', 260);
     $map['name'] = array('neq', '');
     $result = $db->where($map)->select();
     $name = join(' @', $result['name']);
     dump($result);
     echo $db->getLastSql();
 }
示例#3
0
 public function delWorlds()
 {
     $db = new WorldsModel();
     if ($_POST['action'] == 'del') {
         $map['id'] = $_POST['w_id'];
         if (!$db->autoCheckToken($_POST)) {
             $this->gError("非法操作!", "index");
         } else {
             //删除微博
             $step1 = $db->where($map)->delete();
             //echo $db->getLastSql();
             //删除回复
             unset($map);
             $map['w_id'] = $_POST['w_id'];
             $db = new WorldsResponsesModel();
             $step2 = $db->where($map)->find() ? $db->where($map)->delete() : true;
             //删除图片
             $db = new WorldsPicsModel();
             $rs = $db->where($map)->select();
             foreach ($rs as $rs) {
                 $file1 = './Public/Upload/' . $rs['name'];
                 $file2 = './Public/Upload/wap120_' . $rs['name'];
                 $file3 = './Public/Upload/wap160_' . $rs['name'];
                 unlink($file1);
                 unlink($file2);
                 unlink($file3);
             }
             $db->where($map)->delete();
         }
         if ($step1 and $step2) {
             $this->gSuccess("删除成功!", "__APP__/WapAdmin/index");
         } else {
             $this->gError("呃,服务器开小差了~~~稍后再试,", "__APP__/WapAdmin/index");
         }
     }
     $w_id = $_GET['id'];
     $rs = $db->where("id={$w_id}")->relation(false)->find();
     $this->assign('rs', $rs);
     $this->assign('w_id', $_GET['id']);
     $this->display("WapAdmin:delWorlds");
     //dump($rs);
 }