If you find a bug, please raise an issue or PR directly. We apologize for the inconvenience caused.
Many thanks to Jetbrains for providing me with permission to work on this and other open source projects.
Environmental requirements: This package relies on the Laravel framework, and other frameworks are not applicable for the time being.
Install using composer
composer require chowjiawei/laravel-help-plugin
php artisan vendor:publish --provider="ChowjiaweiHelpersProvidersHelpPluginServiceProvider"
php artisan vendor:publish --provider="OvertrueLaravelWeChatServiceProvider"
WeChat package configuration fills in the public account configuration as needed official_account
configuration is omitted
This newspaper provides Laravel Facade for convenience. If you need to use it, you can configure it as follows
Open config/app.php
Find the providers
item and add it
ChowjiaweiHelpersProvidersHelpPluginServiceProvider::class,
Find 'aliases' and add
'Helper'=>ChowjiaweiHelpersFacadeHelper::class
use ChowjiaweiHelpersChannelsDingtalkRobotChannel;
public function via($notifiable)
{
return [DingtalkRobotChannel::class];
}
use ChowjiaweiHelpersChannelsWechatRobotChannel;
public function via($notifiable)
{
return [WechatRobotChannel::class];
}
This driver supports single-user sending and broadcast functions
use ChowjiaweiHelpersChannelsWechatTemplateMessageChannel;
public function via($notifiable)
{
return [WechatTemplateMessageChannel::class];
}
Notification::route('dingtalk_robot', $key)->notify(new YourNotification());
Notification::route('wechat_robot', $key)->notify(new YourNotification());
Notification::route('Wechat_template_message', $key)->notify(new YourNotification());
use ChowjiaweiHelpersChannelsDingtalkRobotChannel;
public function via($notifiable)
{
return [DingtalkRobotChannel::class];
}
use ChowjiaweiHelpersNotificationsDingtalkRobotNotification;
Notification::route('dingtalk_robot', env("DINGTALK_ROBOT")) ->notify(new DingtalkRobotNotification($message,$title));
use ChowjiaweiHelpersNotificationsWechatRobotNotification;
Notification::route('wechat_robot', env("WECHAT_ROBOT)")) ->notify(new WechatRobotNotification($message));
use ChowjiaweiHelpersNotificationsWechatTemplateMessageNotification;
Notification::route('WechatTemplateMessage', null)->notify(new WechatTemplateMessageNotification($data));
$user=['odAYnxOVy7vS266666666','odAYnxEuuTCf66666fov276666'];
$template="iA2V1K45vS8IgUEvE666666EH3R-V-66666";
$data=[
"order_id"=>[
"value"=>"20200414234478934343",
"color"=>"#173177"
],
"package_id"=>[
"value"=>"SF4345454534",
"color"=>"#173177"
],
"remark"=>[
"value"=>'模板消息发送',
"color"=>"#173177"
]
];
Notification::route('WechatTemplateMessage', $user)->notify(new WechatTemplateMessageNotification($data, $template));
use ChowjiaweiHelpersNotificationsLarkRobotNotification;
Notification::route('lark', env("LARK_ROBOT")) ->notify(new DingtalkRobotNotification($message));
Due to different businesses, the tool provides notification templates by default, which can be generated by selecting the code generator through the extend Artisan command.
use ChowjiaweiHelpersPhpHelpsLaravelHelp;
初始化辅助工具
$help=new LaravelHelp();
获取所有国家
$help->getAllCountry();
根据国家代码转国家名字
$help->getCountryName('CN');
根据国家名字转国家代码
$help->getCountryName('China');
or There are more that you can experience after downloading the package.
Helper::allCountry();
use ChowjiaweiHelpersExchangeExchange;
//获取实时汇率
$help->getChangerates();
Complete exchange rate and interface information will be returned to you. The following pages are omitted.
{
"disclaimer": "Usage subject to terms: https://openexchangerates.org/terms",
"license": "https://openexchangerates.org/license",
"timestamp": 1622097300,
"base": "USD",
"rates": {
"AED": 3.6731,
"AFN": 79.130257,
"ALL": 101.073262,
"AMD": 520.828816,
"ANG": 1.796011,
"AOA": 643.121,
"ARS": 94.4963,
"AUD": 1.291358,
"AWG": 1.8,
"AZN": 1.700805,
"BAM": 1.604705,
"BBD": 2,
"BDT": 85.048855,
"BGN": 1.601902,
"BHD": 0.377012,
"BIF": 1974.680206,
use ChowjiaweiHelpersExchangeExchange;
//获取特定汇率
$help->getSymbolChangerates(['GBP','EUR','AED','CAD']);
The specified exchange rate and interface information will be returned to you.
{
disclaimer: "https://openexchangerates.org/terms/",
license: "https://openexchangerates.org/license/",
"timestamp": 1424127600,
"base": "USD",
"rates": {
"AED": 3.67295,
"CAD": 0.99075,
"EUR": 0.793903,
"GBP": 0.62885
}
}
The plug-in provides you with an extended command that supports Chinese and English. You can use the command to call it out. The command provides the following functions
php artisan extend --chinese
中文
php artisan extend
Convert Hanyu Pinyin to Vertex Pinyin
Helper::changeHWWord("zhou");
Convert long sentences from Hanyu Pinyin to Vertex Pinyin
Helper::changeHWWord("zhou jia wei hao shuai");
Convert Hanyu Pinyin to Vertex Pinyin
Helper::changeWHWord("chou");
Convert long sentences from Hanyu Pinyin to Vertex Pinyin
Helper::changeWHWord("chou chia wei hao shuai a");
use ChowjiaweiHelpersServicesTTV2Service;
All tiktok
options in the helpers.php
configuration file need to be configured completely before they can be used.
$ tiktokService = new TTV2Service ();
$ tiktokService -> query ( "站内订单号,非抖音侧订单号" );
正确时返回数组 其余返回空数组
$ tiktokService = new TTV2Service ();
$ tiktokService -> refund ( "站内订单号,非抖音侧订单号" , '价格 为分' , ' $itemOrderId ' );
正确时返回true 其余返回false
$ item = [
[
" item_order_id " => '' ,
" refund_amount " => ( int ) $ price
],
[
" item_order_id " => '' ,
" refund_amount " => ( int ) $ price
],
];
$ tiktokService = new TTV2Service ();
$ tiktokService -> refundManyItem ( "站内订单号,非抖音侧订单号" , $ item );
正确时返回true 其余返回false
$ tiktokService = new TTV2Service ();
$ tiktokService -> agreeRefund ( "站内订单号,非抖音侧订单号" );
正确时返回true 其余返回false
$ tiktokService = new TTV2Service ();
$ tiktokService -> getRefund ( "站内订单号,非抖音侧订单号" );
返回数组
$ tiktokService = new TTV2Service ();
$ tiktokService -> settle ( "站内订单号,非抖音侧订单号" , "分账描述" );
正确时返回true 其余返回false
config
is completed, $settingData
does not need to be passed.If you need to customize again or expand more parameters, you can pass detailed parameters. For more parameters, please refer to Douyin.
$ settingData = [
' create_order_callback ' => "" ,
' refund_callback ' => "" ,
' pay_callback ' => "" ,
];
$ tiktokService = new TTV2Service ();
$ tiktokService -> settingReturn (array $ settingData =[]);
正确时返回true 其余返回false
$ tiktokService = new TTV2Service ();
$ tiktokService -> getSettingReturn ();
正确时返回数组,其余返回空数组
$ tiktokService = new TTV2Service ();
$ tiktokService -> return ( $ request ); //控制器内 直接将接受的Request $request 传入return方法,即可自动验签,并返回接收参数
返回 ` status ` 正确为`true` 附带 `data`数据 错误为 ` false `
If the business processing fails, you need to manually return Douyin success
$ tiktokService -> returnOK ();
If business processing fails, you need to manually return Douyin failure
$ tiktokService -> returnError ( $ result = '失败原因,可省略' );
$ tiktokService = new TTV2Service ();
$ tiktokService -> return ( $ request ); //控制器内 直接将接受的Request $request 传入return方法,即可自动验签,并返回接收参数
If the business processing fails, you need to manually return Douyin success
$ tiktokService -> returnOK ();
If business processing fails, you need to manually return Douyin failure
$ tiktokService -> returnError ( $ result = '失败原因,可省略' );
If a refund is required, item_order_id_list must be stored and obtained as follows:
$ itemOrderId = json_decode ( $ extendItem [ ' msg ' ], true )[ ' goods ' ][ 0 ][ ' item_order_id_list ' ][ 0 ];
$ tiktokService = new TTV2Service ();
$ tiktokService -> refundReturn ( $ request );
If the business processing fails, you need to manually return Douyin success
$ tiktokService -> returnOK ();
If business processing fails, you need to manually return Douyin failure
$ tiktokService -> returnError ( $ result = '失败原因,可省略' );
$ tiktokService = new TTV2Service ();
$ tiktokService -> settleCallback ( $ request );
If the business processing fails, you need to manually return Douyin success
$ tiktokService -> returnOK ();
If business processing fails, you need to manually return Douyin failure
$ tiktokService -> returnError ( $ result = '失败原因,可省略' );