Пример #1
0
 /**
  * @param $user_id
  */
 public function delete($user_id)
 {
     $user_id = intval($user_id);
     if ($user_id < 1) {
         if (!login_user()->Permission('Control')) {
             $this->throwMsg(-4);
         }
     }
     if (!$this->existsCheck($this->post_id, $user_id)) {
         $this->throwMsg(-5);
     }
     $rt = $this->db->delete("posts", ['id' => $this->post_id]);
     if ($rt < 1) {
         Log::write(_("delete post error."), Log::SQL);
         $this->throwMsg(-6);
     }
 }
Пример #2
0
 public function SystemDelete($id)
 {
     if (!login_user()->Permission('MessageSystem')) {
         $this->throwMsg(-2);
     }
     $status = $this->db->delete("message", ['id' => intval($id)]);
     if ($status < 1) {
         $this->throwMsg(-20);
     }
 }
Пример #3
0
 /**
  * @param $list
  */
 public function remove_pic($list)
 {
     $list = array_flip(array_flip(array_map('intval', explode(",", $list))));
     if (empty($list)) {
         $this->throwMsg(-9);
     }
     $this->galleryOwnerCheck($this->gallery_id, $this->user_id);
     if ($this->db->delete("gallery_has_pictures", ['AND' => ['gallery_id' => $this->gallery_id, 'pictures_id' => $list]]) === false) {
         $this->throwMsg(-12);
     }
 }
Пример #4
0
 public function delete($id, $uid)
 {
     $id = +$id;
     $uid = +$uid;
     if (!$this->db->has("feed", ['AND' => ['id' => $id, 'users_id' => $uid]])) {
         $this->throwMsg(-1);
     }
     $status = $this->db->delete("feed", ['AND' => ['id' => $id, 'users_id' => $uid]]);
     if ($status === false) {
         Log::write(_("Delete feed error."), Log::SQL);
         $this->throwMsg(-2);
     }
     if ($status != 1) {
         $this->throwMsg(-3);
     }
 }
Пример #5
0
 /**
  * 取消或者喜欢某一评论
  * @param int $c_id
  * @param int $u_id
  */
 public function like($c_id, $u_id)
 {
     $c_id = intval($c_id);
     $u_id = intval($u_id);
     if ($this->db->has("users_like_comments", ['AND' => ['users_id' => $u_id, 'comments_id' => $c_id]])) {
         if ($this->db->delete("users_like_comments", ['AND' => ['users_id' => $u_id, 'comments_id' => $c_id]]) === false) {
             $this->throwMsg(-6);
         }
         hook()->apply('CommentManagement_unlike', NULL, $c_id, $u_id);
     } else {
         if ($this->db->insert("users_like_comments", ['users_id' => $u_id, 'comments_id' => $c_id, 'like_time' => date("Y-m-d H:i:s")]) < 0) {
             $this->throwMsg(-7);
         }
         hook()->apply('CommentManagement_like', NULL, $c_id, $u_id);
     }
 }
Пример #6
0
 public function admin_delete($id)
 {
     return $this->driver->delete("admin", ['a_id' => $id]);
 }