tcgunel/asistbt-sms

Asist BT SMS 服务组件

安装: 24

依赖: 0

建议者: 0

安全: 0

星标: 0

关注者: 1

分支: 0

公开问题: 0

类型:php

v1.0.0 2023-03-15 07:53 UTC

This package is not auto-updated.

Last update: 2024-09-22 15:05:50 UTC


README

Asist BT SMS 服务组件

安装

安装此扩展的首选方式是通过 composer

运行

composer require tcgunel/asistbt-sms

发送短信

try {
    
    $asistBtSms = new \Tcgunel\AsistbtSms\AsistBtSms([
        'user_code'  => (int)0000,
        'username'   => 'username',
        'password'   => 'password',
        'account_id' => (int)0000,
        'originator' => 'ORIGINATOR',
    ]);

    $response = $asistBtSms->smsProxy()
        ->addReceiver(['905554443322'])
        ->setMessage(['Message1 text'])
        //->setSendDate('150323001020') // ddMMyyHHmmss
        // For bulk messages parameter is in minutes. Max 3360.
        // For OTP messages parameter is in seconds. Max 300.
        //->setValidityPeriod(60)
        //->setIsCheckBlackList(true)
        ->sendSms();

} catch (AsistException $e) {
        
    $e->getMessage();

}

获取信用

try {
    
    $asistBtSms = new \Tcgunel\AsistbtSms\AsistBtSms([
        'user_code'  => (int)0000,
        'username'   => 'username',
        'password'   => 'password',
        'account_id' => (int)0000,
    ]);

    $response = $asistBtSms->smsProxy()->getCredit();

} catch (AsistException $e) {
        
    $e->getMessage();

}

获取发送者

try {
    
    $asistBtSms = new \Tcgunel\AsistbtSms\AsistBtSms([
        'user_code'  => (int)0000,
        'username'   => 'username',
        'password'   => 'password',
        'account_id' => (int)0000,
    ]);

    $response = $asistBtSms->smsProxy()->getOriginator();

} catch (AsistException $e) {
        
    $e->getMessage();

}

终止短信

try {
    
    $asistBtSms = new \Tcgunel\AsistbtSms\AsistBtSms([
        'user_code'  => (int)0000,
        'username'   => 'username',
        'password'   => 'password',
        'account_id' => (int)0000,
    ]);

    $response = $asistBtSms->smsProxy()->abortSms((int)$packet_id); // $packet_id returns from sendSms.

} catch (AsistException $e) {
        
    $e->getMessage();

}

通过包ID获取状态

try {
    
    $asistBtSms = new \Tcgunel\AsistbtSms\AsistBtSms([
        'user_code'  => (int)0000,
        'username'   => 'username',
        'password'   => 'password',
        'account_id' => (int)0000,
    ]);

    $response = $asistBtSms->smsProxy()->getStatusByPacketId((int)$packet_id); // $packet_id returns from sendSms.

} catch (AsistException $e) {
        
    $e->getMessage();

}

通过消息ID获取状态

try {
    
    $asistBtSms = new \Tcgunel\AsistbtSms\AsistBtSms([
        'user_code'  => (int)0000,
        'username'   => 'username',
        'password'   => 'password',
        'account_id' => (int)0000,
    ]);

    $response = $asistBtSms->smsProxy()->getStatusByMessageId([1,2,3]); // Message_id returns from sendSms.

} catch (AsistException $e) {
        
    $e->getMessage();

}

获取联系人

try {
    
    $asistBtSms = new \Tcgunel\AsistbtSms\AsistBtSms([
        'user_code'  => (int)0000,
        'username'   => 'username',
        'password'   => 'password',
        'account_id' => (int)0000,
    ]);

    $response = $asistBtSms->contactService()->getContact((int)5554443322);

} catch (AsistException $e) {
        
    $e->getMessage();

}

添加联系人

try {
    
    $asistBtSms = new \Tcgunel\AsistbtSms\AsistBtSms([
        'user_code'  => (int)0000,
        'username'   => 'username',
        'password'   => 'password',
        'account_id' => (int)0000,
    ]);

    $response = $asistBtSms
        ->contactService()
        ->addContact(
            'Ad',
            'Soyad',
            (int)5554443322,
            'GROUPID',
            false, // isBlackList
        );

} catch (AsistException $e) {
        
    $e->getMessage();

}