Пример #1
0
 /**
  * 获取用户统计信息
  * @param User $user
  * @return array|false
  */
 public function getUserCount($user)
 {
     if (!isset($this->count_info[$user->getId()])) {
         $rt = $this->db->get("user_count", ['picture_count', 'gallery_count', 'comment_count', 'user_follow_count', 'user_fans_count', 'like_gallery_count', 'like_picture_count', 'like_comment_count', 'follow_gallery_count', 'unread_message_count'], ['users_id' => $user->getId()]);
         if ($rt === false) {
             Log::write(_("Get user count info error.") . "USER ID:" . $user->getId(), Log::SQL);
             return false;
         }
         $this->count_info[$user->getId()] =& $rt;
     }
     return $this->count_info[$user->getId()];
 }
Пример #2
0
 /**
  * 获取评论的喜欢人数
  * @param int $id
  * @return int
  */
 public function getCommentLikeCount($id)
 {
     $s = $this->db->get("comments", ['comment_like_count'], ['id' => intval($id)]);
     if (!isset($s['comment_like_count'])) {
         return 0;
     } else {
         return 0 + $s['comment_like_count'];
     }
 }
Пример #3
0
 /**
  * 检查上次发送时间间隔,过短则返回异常
  * @param $uid
  */
 private function checkLastSend($uid)
 {
     $get = $this->db->get("message", ['msg_datetime'], ['from_users_id' => $uid, 'ORDER' => 'id DESC']);
     if (isset($get['msg_datetime'])) {
         $t = strtotime($get['msg_datetime']);
         if (time() - $t < hook()->apply("Message_checkLastSend", 30)) {
             $this->throwMsg(-9);
         }
     }
 }
Пример #4
0
 public function get_role_info($id)
 {
     return $this->driver->get("role", "*", ['r_id' => $id]);
 }
Пример #5
0
 /**
  * 获取最高版本的检测信息
  * @return array|false
  */
 public function get_top_update_info()
 {
     $info = $this->db->get("version_control", "*", ['AND' => ['name' => $this->top_info['name'], 'version_code' => $this->top_info['top_version_code']]]);
     $info['update_info'] = self::parse_info($info['update_info']);
     return $info;
 }