Skip to content
This repository has been archived by the owner on Oct 29, 2024. It is now read-only.

Commit

Permalink
feat(douyin): ✨ 获取用户数据 (#6)
Browse files Browse the repository at this point in the history
  • Loading branch information
waset authored Apr 18, 2022
1 parent 31bb323 commit 44d719a
Showing 1 changed file with 138 additions and 0 deletions.
138 changes: 138 additions & 0 deletions src/Douyin/Data.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,138 @@
<?php

namespace Waset\Douyin;

class Data extends Application
{
/**
* 获取用户视频情况
*
* @param string $access_token
* @param string $openid
* @param integer $date_type
* @return User
*/
public function item($access_token, $openid, $date_type = 30)
{
$api_url = self::BaseUrl . '/data/external/user/item/';
$headers = [
"access-token: ${access_token}",
'Content-Type: application/json',
];
$params = [
'open_id' => $openid,
"date_type" => 30
];
return $this->https_get($api_url, $params, $headers);
}

/**
* 获取用户粉丝数
*
* @param string $access_token
* @param string $openid
* @param integer $date_type
* @return User
*/
public function fans($access_token, $openid, $date_type = 30)
{
$api_url = self::BaseUrl . '/data/external/user/fans/';
$headers = [
"access-token: ${access_token}",
'Content-Type: application/json',
];
$params = [
'open_id' => $openid,
"date_type" => 30
];
return $this->https_get($api_url, $params, $headers);
}

/**
* 获取用户点赞数
*
* @param string $access_token
* @param string $openid
* @param integer $date_type
* @return User
*/
public function like($access_token, $openid, $date_type = 30)
{
$api_url = self::BaseUrl . '/data/external/user/like/';
$headers = [
"access-token: ${access_token}",
'Content-Type: application/json',
];
$params = [
'open_id' => $openid,
"date_type" => 30
];
return $this->https_get($api_url, $params, $headers);
}

/**
* 获取用户评论数
*
* @param string $access_token
* @param string $openid
* @param integer $date_type
* @return User
*/
public function comment($access_token, $openid, $date_type = 30)
{
$api_url = self::BaseUrl . '/data/external/user/comment/';
$headers = [
"access-token: ${access_token}",
'Content-Type: application/json',
];
$params = [
'open_id' => $openid,
"date_type" => 30
];
return $this->https_get($api_url, $params, $headers);
}

/**
* 获取用户分享数
*
* @param string $access_token
* @param string $openid
* @param integer $date_type
* @return User
*/
public function share($access_token, $openid, $date_type = 30)
{
$api_url = self::BaseUrl . '/data/external/user/share/';
$headers = [
"access-token: ${access_token}",
'Content-Type: application/json',
];
$params = [
'open_id' => $openid,
"date_type" => 30
];
return $this->https_get($api_url, $params, $headers);
}

/**
* 获取用户主页访问数
*
* @param string $access_token
* @param string $openid
* @param integer $date_type
* @return User
*/
public function profile($access_token, $openid, $date_type = 30)
{
$api_url = self::BaseUrl . '/data/external/user/profile/';
$headers = [
"access-token: ${access_token}",
'Content-Type: application/json',
];
$params = [
'open_id' => $openid,
"date_type" => 30
];
return $this->https_get($api_url, $params, $headers);
}
}

0 comments on commit 44d719a

Please sign in to comment.