v6 v6.0.25
Chaim 4 years ago
parent 6338e13624
commit c77ab7f428

@ -19,13 +19,13 @@
- Github仓库地址https://github.com/GC0202/ThinkLibrary
- 码云仓库地址https://gitee.com/liguangchun/ThinkLibrary
- gitlabhttps://gitlab.com/liguangchun/thinklibrary
- 阿里云仓库地址https://github.com/GC0202/ThinkLibrary
- CODINGhttps://liguangchun-01.coding.net/p/ThinkLibrary/d/ThinkLibrary/git
- CODINGhttps://aizhineng.coding.net/p/ThinkLibrary/d/ThinkLibrary/git
- 腾讯云https://liguangchundt.coding.net/p/ThinkLibrary/d/ThinkLibrary/git
- 微信https://git.weixin.qq.com/liguangchun/ThinkLibrary
- 华为云https://codehub-cn-south-1.devcloud.huaweicloud.com/composer00001/ThinkLibrary.git
- gitlab仓库地址https://gitlab.com/liguangchun/thinklibrary
- 阿里云仓库地址https://code.aliyun.com/liguancghun/ThinkLibrary
- CODING仓库地址https://liguangchun-01.coding.net/p/ThinkLibrary/d/ThinkLibrary/git
- CODING仓库地址https://aizhineng.coding.net/p/ThinkLibrary/d/ThinkLibrary/git
- 腾讯云仓库地址https://liguangchundt.coding.net/p/ThinkLibrary/d/ThinkLibrary/git
- 微信仓库地址https://git.weixin.qq.com/liguangchun/ThinkLibrary
- 华为云仓库地址https://codehub-cn-south-1.devcloud.huaweicloud.com/composer00001/ThinkLibrary.git
### 开发版
```text
@ -49,42 +49,90 @@ composer update liguangchun/think-library -vvv
composer remove liguangchun/think-library -vvv
```
## 获取电脑Mac地址服务使用示例
```php
use DtApp\ThinkLibrary\service\MacService;
dump(MacService::instance()
->get());
```
## 百度地图服务使用示例
```php
use DtApp\ThinkLibrary\exception\CurlException;
use DtApp\ThinkLibrary\service\baidu\LbsYunService;
try {
// 获取天气信息
dump(LbsYunService::instance()
->ak("")
->weather());
} catch (CurlException $e) {
dump($e->getMessage());
}
```
## 高德地图服务使用示例
```php
use DtApp\ThinkLibrary\exception\CurlException;
use DtApp\ThinkLibrary\service\amap\AmApService;
try {
// 获取天气信息
dump(AmApService::instance()
->key("")
->weather());
} catch (CurlException $e) {
dump($e->getMessage());
}
```
## 抖音服务使用示例
```text
```php
use DtApp\ThinkLibrary\service\douyin\DouYinException;
use DtApp\ThinkLibrary\exception\DouYinException;
use DtApp\ThinkLibrary\service\douyin\WatermarkService;
try {
// 方法一 网址
var_dump(WatermarkService::instance()->url('https://v.douyin.com/vPGAdM/')->getAll()->toArray());
dump(WatermarkService::instance()->url('https://v.douyin.com/vPGAdM/')->getAll()->toArray());
// 方法一 粘贴
var_dump(WatermarkService::instance()->url('#在抖音,记录美好生活#美丽电白欢迎您 https://v.douyin.com/vPGAdM/ 复制此链接,打开【抖音短视频】,直接观看视频!')->getAll()->toArray());
dump(WatermarkService::instance()->url('#在抖音,记录美好生活#美丽电白欢迎您 https://v.douyin.com/vPGAdM/ 复制此链接,打开【抖音短视频】,直接观看视频!')->getAll()->toArray());
// 方法二 网址
$dy = WatermarkService::instance()->url('https://v.douyin.com/vPafcr/');
var_dump($dy->getAll()->toArray());
dump($dy->getAll()->toArray());
// 方法二 粘贴
$dy = WatermarkService::instance()->url('#在抖音,记录美好生活#2020茂名加油广州加油武汉加油中国加油众志成城#航拍 #茂名#武汉 #广州 #旅拍 @抖音小助手 https://v.douyin.com/vPafcr/ 复制此链接,打开【抖音短视频】,直接观看视频!');
var_dump($dy->getAll()->toArray());
dump($dy->getAll()->toArray());
// 获取全部信息
var_dump(WatermarkService::instance()->url('https://v.douyin.com/vPGAdM/')->getAll()->toArray());
dump(WatermarkService::instance()->url('https://v.douyin.com/vPGAdM/')->getAll()->toArray());
// 获取原全部信息
var_dump(WatermarkService::instance()->url('https://v.douyin.com/vPGAdM/')->getApi()->toArray());
dump(WatermarkService::instance()->url('https://v.douyin.com/vPGAdM/')->getApi()->toArray());
// 获取视频信息
var_dump(WatermarkService::instance()->url('https://v.douyin.com/vPGAdM/')->getVideoInfo()->toArray());
dump(WatermarkService::instance()->url('https://v.douyin.com/vPGAdM/')->getVideoInfo()->toArray());
// 获取音频信息
var_dump(WatermarkService::instance()->url('https://v.douyin.com/vPGAdM/')->getMusicInfo()->toArray());
dump(WatermarkService::instance()->url('https://v.douyin.com/vPGAdM/')->getMusicInfo()->toArray());
// 获取分享信息
var_dump(WatermarkService::instance()->url('https://v.douyin.com/vPGAdM/')->getShareInfo()->toArray());
dump(WatermarkService::instance()->url('https://v.douyin.com/vPGAdM/')->getShareInfo()->toArray());
// 获取作者信息
var_dump(WatermarkService::instance()->url('https://v.douyin.com/vPGAdM/')->getAuthorInfo()->toArray());
dump(WatermarkService::instance()->url('https://v.douyin.com/vPGAdM/')->getAuthorInfo()->toArray());
// 返回数组数据方法
var_dump(WatermarkService::instance()->url('https://v.douyin.com/vPGAdM/')->getAll()->toArray());
dump(WatermarkService::instance()->url('https://v.douyin.com/vPGAdM/')->getAll()->toArray());
// 返回Object数据方法
var_dump(WatermarkService::instance()->url('https://v.douyin.com/vPGAdM/')->getAll()->toObject());
dump(WatermarkService::instance()->url('https://v.douyin.com/vPGAdM/')->getAll()->toObject());
} catch (DouYinException $e) {
// 错误提示
var_dump($e->getMessage());
dump($e->getMessage());
}
```

@ -28,9 +28,7 @@ class Library extends \think\Service
*/
public function register()
{
// 加载语言包
$this->app->lang->load(__DIR__ . '/lang/zh-cn.php', 'zh-cn');
$this->app->lang->load(__DIR__ . '/lang/en-us.php', 'en-us');
}
/**

@ -49,5 +49,16 @@ return [
'key' => '',
// 网址
'panel' => '',
],
// 百度
'baidu' => [
// 地图
'lbs' => [
'ak' => ''
]
],
// 高德地图
'amap' => [
'key' => ''
]
];

@ -0,0 +1,32 @@
<?php
// +----------------------------------------------------------------------
// | ThinkLibrary 6.0 for ThinkPhP 6.0
// +----------------------------------------------------------------------
// | 版权所有 2017~2020 [ https://www.dtapp.net ]
// +----------------------------------------------------------------------
// | 官方网站: https://gitee.com/liguangchun/ThinkLibrary
// +----------------------------------------------------------------------
// | 开源协议 ( https://mit-license.org )
// +----------------------------------------------------------------------
// | gitee 仓库地址 https://gitee.com/liguangchun/ThinkLibrary
// | github 仓库地址 https://github.com/GC0202/ThinkLibrary
// | Packagist 地址 https://packagist.org/packages/liguangchun/think-library
// +----------------------------------------------------------------------
namespace DtApp\ThinkLibrary\exception;
use Exception;
/**
* 阿里错误处理
* Class AliException
* @package DtApp\ThinkLibrary\exception
*/
class AliException extends Exception
{
public function errorMessage()
{
return $this->getMessage();
}
}

@ -0,0 +1,32 @@
<?php
// +----------------------------------------------------------------------
// | ThinkLibrary 6.0 for ThinkPhP 6.0
// +----------------------------------------------------------------------
// | 版权所有 2017~2020 [ https://www.dtapp.net ]
// +----------------------------------------------------------------------
// | 官方网站: https://gitee.com/liguangchun/ThinkLibrary
// +----------------------------------------------------------------------
// | 开源协议 ( https://mit-license.org )
// +----------------------------------------------------------------------
// | gitee 仓库地址 https://gitee.com/liguangchun/ThinkLibrary
// | github 仓库地址 https://github.com/GC0202/ThinkLibrary
// | Packagist 地址 https://packagist.org/packages/liguangchun/think-library
// +----------------------------------------------------------------------
namespace DtApp\ThinkLibrary\exception;
use Exception;
/**
* 百度错误处理
* Class BaiduException
* @package DtApp\ThinkLibrary\exception
*/
class BaiduException extends Exception
{
public function errorMessage()
{
return $this->getMessage();
}
}

@ -1,31 +0,0 @@
<?php
// +----------------------------------------------------------------------
// | ThinkLibrary 6.0 for ThinkPhP 6.0
// +----------------------------------------------------------------------
// | 版权所有 2017~2020 [ https://www.dtapp.net ]
// +----------------------------------------------------------------------
// | 官方网站: https://gitee.com/liguangchun/ThinkLibrary
// +----------------------------------------------------------------------
// | 开源协议 ( https://mit-license.org )
// +----------------------------------------------------------------------
// | gitee 仓库地址 https://gitee.com/liguangchun/ThinkLibrary
// | github 仓库地址 https://github.com/GC0202/ThinkLibrary
// | Packagist 地址 https://packagist.org/packages/liguangchun/think-library
// +----------------------------------------------------------------------
return [
'think_library_not_auth' => 'Sorry, no permission to access the operation.',
'think_library_not_login' => 'Sorry, requiring login to obtain view permission.',
'think_library_delete_success' => 'Data deletion completed.',
'think_library_delete_error' => 'Sorry, data deletion failed, please try again later.',
'think_library_form_success' => 'Data saving completed.',
'think_library_form_error' => 'Sorry, data saving failed, please try again later.',
'think_library_save_success' => 'Data update completed.',
'think_library_save_error' => 'Sorry, data update failed, please try again later.',
'think_library_sort_success' => 'Modification of list sort completed.',
'think_library_sort_error' => 'Sorry, modification of list sort failed, please try again later.',
'think_library_page_html' => 'Total %s records, display %s per page, total %s page current display %s page.',
'think_library_csrf_error' => 'Form token validation failed, please refresh and try again later.',
'think_library_queue_exist' => 'Task has been created, please wait for processing to complete.',
];

@ -1,31 +0,0 @@
<?php
// +----------------------------------------------------------------------
// | ThinkLibrary 6.0 for ThinkPhP 6.0
// +----------------------------------------------------------------------
// | 版权所有 2017~2020 [ https://www.dtapp.net ]
// +----------------------------------------------------------------------
// | 官方网站: https://gitee.com/liguangchun/ThinkLibrary
// +----------------------------------------------------------------------
// | 开源协议 ( https://mit-license.org )
// +----------------------------------------------------------------------
// | gitee 仓库地址 https://gitee.com/liguangchun/ThinkLibrary
// | github 仓库地址 https://github.com/GC0202/ThinkLibrary
// | Packagist 地址 https://packagist.org/packages/liguangchun/think-library
// +----------------------------------------------------------------------
return [
'think_library_not_auth' => '抱歉,没有访问该操作的权限!',
'think_library_not_login' => '抱歉,需要登录获取访问权限!',
'think_library_delete_success' => '恭喜, 数据删除成功!',
'think_library_delete_error' => '抱歉,数据删除失败, 请稍候再试!',
'think_library_form_success' => '恭喜, 数据保存成功!',
'think_library_form_error' => '抱歉,数据保存失败, 请稍候再试!',
'think_library_save_success' => '恭喜,数据更新成功!',
'think_library_save_error' => '抱歉,数据更新失败, 请稍候再试!',
'think_library_sort_success' => '恭喜,列表排序成功!',
'think_library_sort_error' => '抱歉,列表排序失败,请稍候再试!',
'think_library_page_html' => '共 %s 条记录,每页显示 %s 条,共 %s 页当前显示第 %s 页。',
'think_library_csrf_error' => '表单令牌验证失败,请刷新页面再试!',
'think_library_queue_exist' => '任务已创建,请等待处理完成!',
];

@ -25,13 +25,7 @@ use DtApp\ThinkLibrary\Service;
*/
class MacService extends Service
{
private $result = array();
/**
* 所有mac地址
* @var array
*/
private $macAddrs = array();
private $result = [];
/**
* 第一个mac地址

@ -16,6 +16,7 @@
namespace DtApp\ThinkLibrary\service\amap;
use DtApp\ThinkLibrary\exception\AliException;
use DtApp\ThinkLibrary\exception\CurlException;
use DtApp\ThinkLibrary\Service;
use DtApp\ThinkLibrary\service\Curl\HttpService;
@ -40,6 +41,16 @@ class AmApService extends Service
return $this;
}
/**
* 获取配置信息
* @return $this
*/
private function getConfig()
{
$this->key = config('dtapp.amap.key');
return $this;
}
/**
* 天气查询
* https://lbs.amap.com/api/webservice/guide/api/weatherinfo
@ -47,9 +58,12 @@ class AmApService extends Service
* @param string $extensions
* @return array|bool|mixed|string
* @throws CurlException
* @throws AliException
*/
public function weather($city = "110101", $extensions = "base")
{
if (empty($this->key)) $this->getConfig();
if (empty($this->key)) throw new AliException('请检查key参数');
$data = http_build_query([
"city" => $city,
"extensions" => $extensions,

@ -16,6 +16,7 @@
namespace DtApp\ThinkLibrary\service\baidu;
use DtApp\ThinkLibrary\exception\BaiduException;
use DtApp\ThinkLibrary\exception\CurlException;
use DtApp\ThinkLibrary\Service;
use DtApp\ThinkLibrary\service\Curl\HttpService;
@ -40,6 +41,16 @@ class LbsYunService extends Service
return $this;
}
/**
* 获取配置信息
* @return $this
*/
private function getConfig()
{
$this->ak = config('dtapp.baidu.lbs.ak');
return $this;
}
/**
* 国内天气查询
* http://lbsyun.baidu.com/index.php?title=webapi/weather
@ -47,10 +58,12 @@ class LbsYunService extends Service
* @param string $coordtype
* @param string $location
* @return array|bool|mixed|string
* @throws CurlException
* @throws CurlException|BaiduException
*/
public function weather($district_id = 110100, string $coordtype = "bd09ll", string $location = "")
{
if (empty($this->ak)) $this->getConfig();
if (empty($this->ak)) throw new BaiduException('请检查ak参数');
$data = http_build_query([
"district_id" => $district_id,
"coordtype" => $coordtype,
@ -73,9 +86,12 @@ class LbsYunService extends Service
* @param string $language
* @return array|bool|mixed|string
* @throws CurlException
* @throws BaiduException
*/
public function weatherAbroad($district_id = 110100, string $coordtype = "bd09ll", string $location = "", string $language = "cn")
{
if (empty($this->ak)) $this->getConfig();
if (empty($this->ak)) throw new BaiduException('请检查ak参数');
$data = http_build_query([
"district_id" => $district_id,
"coordtype" => $coordtype,

Loading…
Cancel
Save