当前位置: 首页>>代码示例>>PHP>>正文


PHP Helpers::SK_isFollowing方法代码示例

本文整理汇总了PHP中Helpers::SK_isFollowing方法的典型用法代码示例。如果您正苦于以下问题:PHP Helpers::SK_isFollowing方法的具体用法?PHP Helpers::SK_isFollowing怎么用?PHP Helpers::SK_isFollowing使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Helpers的用法示例。


在下文中一共展示了Helpers::SK_isFollowing方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: follow_suggestion

 /**
  * Display suggestion list.
  *
  * @return Response
  */
 public function follow_suggestion($userId)
 {
     $user = Account::find($userId);
     $url = "";
     //if($user != null)
     $url = 'http://candychat.net/request.php?t=search&a=follow-suggestions-mobile&user_id=' . $user->id . "&user_pass=" . $user->password . "&token=asdffdsa&q=a";
     $api_response = cURL::get($url);
     $response = $api_response->toArray();
     $response = $response['body'];
     $json = json_decode($response, true);
     //return Response::json($json);
     $total_account = sizeof($json["suggestion"]);
     $users = array();
     foreach ($json["suggestion"] as $user) {
         $the_user = Account::find((int) $user["id"]);
         $the_user->avatar;
         $the_user->cover;
         $the_user->gender;
         $the_user->birthday;
         $the_user->is_following = Helpers::SK_isFollowing($the_user->id, $userId);
         $users[] = $the_user;
     }
     $response = array('status' => '1', 'total' => $total_account, 'users' => $users);
     return Response::json($response);
 }
开发者ID:korrio,项目名称:wouchat-api,代码行数:30,代码来源:AccountController.php

示例2: follow

 public function follow($id)
 {
     $params = array('following_id' => $id);
     $url = 'https://www.vdomax.com/ajax.php?t=follow&a=follow&user_id=' . $this->user->id . "&user_pass=" . $this->user->password . "&token=" . $this->api_token;
     $api_response = cURL::post($url, $params);
     $response = $api_response->toArray();
     $response = $response['body'];
     $json = json_decode($response, true);
     if ($json['status'] == 200) {
         if (Helpers::SK_isFollowing($id, $this->user->id)) {
             $response = array('status' => '1', 'message' => "Follow success", 'user_id' => $id, 'is_following' => Helpers::SK_isFollowing($id, $this->user->id));
         } else {
             $response = array('status' => '1', 'message' => "Unfollow success", 'user_id' => $id, 'is_following' => Helpers::SK_isFollowing($id, $this->user->id));
         }
     } else {
         $response = array('status' => '0', 'message' => "Follow/Unfollow incomplete");
     }
     return Response::json($response);
 }
开发者ID:korrio,项目名称:LASTVMAPI,代码行数:19,代码来源:AccountController.php

示例3: SK_getSearchMobile

 public static function SK_getSearchMobile($search_query = '', $userId = 0, $from_row = 0, $limit = 50)
 {
     global $dbConnect;
     $dbConnect = Helpers::dbConnect();
     $get = array();
     $get['story'] = array();
     $get['user'] = array();
     $get['hashtag'] = array();
     if (!isset($search_query) or empty($search_query)) {
         return $get;
     }
     if (!isset($from_row) or empty($from_row)) {
         $from_row = 0;
     }
     if (!is_numeric($from_row) or $from_row < 0) {
         return $get;
     }
     if (!isset($limit) or empty($limit)) {
         $limit = 10;
     }
     if (!is_numeric($limit) or $limit < 1) {
         return $get;
     }
     $search_query = Helpers::SK_secureEncode($search_query);
     $from_row = Helpers::SK_secureEncode($from_row);
     $limit = Helpers::SK_secureEncode($limit);
     $query_one = "SELECT id FROM " . DB_ACCOUNTS_API . " WHERE (email LIKE '%{$search_query}%' OR username LIKE '{$search_query}' " . " OR name LIKE '%{$search_query}%'" . ") " . " AND (id IN (SELECT id FROM " . DB_USERS_API . ") " . " OR id IN (SELECT id FROM " . DB_PAGES_API . ") " . " OR id IN (SELECT id FROM " . DB_GROUPS_API . " WHERE group_privacy IN ('open','closed'))) " . "AND type IN ('user','page','group') " . " AND active=1 ORDER BY " . "CASE\n    WHEN username LIKE '{$search_query}%' THEN 1\n    WHEN username LIKE '%{$search_query}' THEN 3\n    ELSE 2\n  END" . " ASC LIMIT {$from_row},{$limit}";
     $sql_query_one = mysqli_query($dbConnect, $query_one);
     if (mysqli_num_rows($sql_query_one) > 0) {
         while ($sql_fetch_one = mysqli_fetch_assoc($sql_query_one)) {
             //$get['user'][] = SK_getUser($sql_fetch_one['id']);
             $user = Account::find($sql_fetch_one['id']);
             $user->avatar;
             $user->cover;
             $user->gender;
             $user->birthday;
             //$data['author'] = $post->account;
             if ($userId != 0) {
                 $user->is_following = Helpers::SK_isFollowing($user->id, $userId);
             } else {
                 $user->is_following = false;
             }
             $user->online = false;
             $get['user'][] = $user;
         }
     }
     //
     $hashdata = Helpers::SK_getHashtag($search_query);
     $postIds = Helpers::SK_getHashtagPostsArray($hashdata);
     foreach ($postIds as $postId) {
         $get['story'][] = Helpers::getPost($postId);
     }
     $query_one = "SELECT id FROM " . DB_POSTS_API . " WHERE youtube_title LIKE '%{$search_query}%' ORDER BY youtube_title ASC LIMIT {$from_row},{$limit}";
     $sql_query_one = mysqli_query($dbConnect, $query_one);
     if (mysqli_num_rows($sql_query_one) > 0) {
         while ($sql_fetch_one = mysqli_fetch_assoc($sql_query_one)) {
             //$get['story'][] = Post::find($sql_fetch_one['id']);
             $get['story'][] = Helpers::getPost($sql_fetch_one['id']);
         }
     }
     $get['hashtag'] = Helpers::SK_getHashtagSearch($search_query);
     if (count($get['story']) == 0 || $get['story'] == null) {
         $get['story'] = array();
     }
     if (count($get['user']) == 0 || $get['user'] == null) {
         $get['user'] = array();
     }
     if (count($get['hashtag']) == 0 || $get['hashtag'] == null) {
         $get['hashtag'] = array();
     }
     //
     return $get;
 }
开发者ID:korrio,项目名称:wouchat-api,代码行数:73,代码来源:Helpers.php

示例4: check

 /**
  * Display the specified by username.
  *
  * @param  int  $username
  * @return Response
  */
 public function check($username)
 {
     if (filter_var($username, FILTER_VALIDATE_EMAIL)) {
         $user = Account::where('email', $username)->get()->first();
     } else {
         $user = Account::where('username', $username)->get()->first();
     }
     if ($user != null) {
         $user->avatar;
         $user->cover;
         $user->birthday;
         $user->gender;
         $params = Input::all();
         if (isset($params['user_id'])) {
             $user->is_following = Helpers::SK_isFollowing($user->id, $params['user_id']);
         }
         return Response::json(array('status' => '1', 'user' => $user));
     } else {
         return Response::json(array('status' => '0', 'user' => null, 'count' => null));
     }
     if ($user->count() > 0) {
         return Response::json(array('status' => '1', 'user' => $user));
     } else {
         return Response::json(array('status' => '0', 'message' => 'No user found'));
     }
 }
开发者ID:korrio,项目名称:wouchat-api,代码行数:32,代码来源:UserController.php


注:本文中的Helpers::SK_isFollowing方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。