GithubHelp home page GithubHelp logo

easysms-notification-channel's People

Contributors

jellybool avatar remxcode avatar yl avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

easysms-notification-channel's Issues

怎么捕捉异常

没有正常捕捉到异常信息,重现方式,输入错误的模版或者把签名类型设置为 验证码。
短信通知类型代码如下:

public function via($notifiable)
{
    return ['database', EasySmsChannel::class];
}

public function toEasySms($notifiable)
{
    try{
        return (new EasySmsMessage)
        ->setContent('您提交的企业“123456”认证信息已通过审核,感谢您的使用。')
        ->setTemplate( 'SMS_198920278' ) // 短信阿里云模板
        ->setData(['company_name' => 2222222]);
    } catch (\Overtrue\EasySms\Exceptions\NoGatewayAvailableException $e) {
        dd($e);
    }
}

Readme Demo 运行出错

<?php

namespace App\Notifications;

use Illuminate\Bus\Queueable;
use Illuminate\Notifications\Notification;
use Illuminate\Contracts\Queue\ShouldQueue;
use Illuminate\Notifications\Messages\MailMessage;
use Leonis\Notifications\EasySms\Channels\EasySmsChannel;
use Leonis\Notifications\EasySms\Messages\EasySmsMessage;

class VerificationCode extends Notification
{
    use Queueable;

    public function via($notifiable)
    {
        return [EasySmsChannel::class];
    }

    public function toEasySms($notifiable)
    {
        return (new EasySmsMessage)
            ->setContent('您的验证码为: 6379')
            ->setTemplate('SMS_001')
            ->setData(['code' => 6379]);
    }
}
Notification::route(
    EasySmsChannel::class,
    new PhoneNumber(13333333333, 86)
)->notify(new VerificationCode());

提示 "message": "Undefined index: Leonis\Notifications\EasySms\Channels\EasySmsChannel",

依赖的 overtrue/easy-sms 包已更新至2.0.4,望同步更新

因当前包使用overtrue/easy-sms的1.1版本在php8.1环境会报以下错误提示,望同步更新

PHP Deprecated: Return type of Overtrue\EasySms\PhoneNumber::jsonSerialize() should either be compatible with JsonSerializable::jsonSerialize(): mixed, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /home/vagrant/code/illusplus-server/vendor/overtrue/easy-sms/src/PhoneNumber.php on line 111 PHP Deprecated: Return type of Overtrue\EasySms\Support\Config::offsetExists($offset) should either be compatible with ArrayAccess::offsetExists(mixed $offset): bool, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /home/vagrant/code/illusplus-server/vendor/overtrue/easy-sms/src/Support/Config.php on line 82 PHP Deprecated: Return type of Overtrue\EasySms\Support\Config::offsetGet($offset) should either be compatible with ArrayAccess::offsetGet(mixed $offset): mixed, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /home/vagrant/code/illusplus-server/vendor/overtrue/easy-sms/src/Support/Config.php on line 100 PHP Deprecated: Return type of Overtrue\EasySms\Support\Config::offsetSet($offset, $value) should either be compatible with ArrayAccess::offsetSet(mixed $offset, mixed $value): void, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /home/vagrant/code/illusplus-server/vendor/overtrue/easy-sms/src/Support/Config.php on line 119 PHP Deprecated: Return type of Overtrue\EasySms\Support\Config::offsetUnset($offset) should either be compatible with ArrayAccess::offsetUnset(mixed $offset): void, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /home/vagrant/code/illusplus-server/vendor/overtrue/easy-sms/src/Support/Config.php on line 137

我发送了验证码 怎么去接受我发出的验证码code呢?

消息方法实现
public function toEasySms($notifiable) { $code = str_pad(random_int(1, 9999), 4, 0, STR_PAD_LEFT); return (new EasySmsMessage()) ->setTemplate(env('SMS_TEMPLATE')) ->setData(['code' => $code]); }
发送验证码调用
Notification::route( EasySmsChannel::class, new PhoneNumber($phone,86) )->notify(new SmsVerificationCode());
问题来了 我怎么获取消息方法里面的code啊。。或者我怎么把发送验证码时候的phone传进去

自定义网关怎么弄?

 // 可用的网关配置
    'gateways' => [
        // 失败日志
        'errorlog'   => [
            'channel' => 'daily',
        ],
   
        'san'        => [
            'username' => '000',
            'password' => '000',
        ]
    ],

    'custom_gateways' => [
        'errorlog' => \Leonis\Notifications\EasySms\Gateways\ErrorLogGateway::class,
        'winic'    => \Leonis\Notifications\EasySms\Gateways\WinicGateway::class,
        'san'      => \App\Gateway\SanGateway::class,
    ],

配置了这个之后怎么操作?
我现在发送
加载不了网关

 Overtrue\EasySms\Exceptions\NoGatewayAvailableException

  All the gateways have failed. You can get error details by `$exception->getExceptions()`

老哥 这是什么原因?

storage/logs/sms.log
[2021-12-17 00:57:42] local.ERROR: to: +8618589149677 | message: "" | template: "SMS_230010220" | data: {"code":"111111"}

如何获取通知后的结果

使用阿里云短信服务,如何获取接口返回的结果
例如:是发送成功,还是账户余额不足等,错误代码或者原因,smslog.log 只呈现出来local.ERROR message:""
我使用的laravel的版本是8.26.1

README.md Error

use Leonis\Notifications\Channels\EasySmsChannel;
use Leonis\Notifications\Messages\EasySmsMessage;


use Leonis\Notifications\EasySms\Channels\EasySmsChannel;
use Leonis\Notifications\EasySms\Messages\EasySmsMessage;

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.