1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495 |
- <?php
- namespace addons\aliyunsms;
- use app\common\library\Menu;
- use app\common\model\Sms;
- use think\Addons;
- /**
- * Aliyunsms插件
- */
- class Aliyunsms extends Addons
- {
- /**
- * 插件安装方法
- * @return bool
- */
- public function install()
- {
- return true;
- }
- /**
- * 插件卸载方法
- * @return bool
- */
- public function uninstall()
- {
- return true;
- }
- /**
- * 插件启用方法
- * @return bool
- */
- public function enable()
- {
- return true;
- }
- /**
- * 插件禁用方法
- * @return bool
- */
- public function disable()
- {
- return true;
- }
- /**
- * 短信发送
- * @param Sms $params
- * @return mixed
- * @throws \AlibabaCloud\Client\Exception\ClientException
- * @throws \AlibabaCloud\Client\Exception\ServerException
- */
- public function smsSend(&$params)
- {
- $smsbao = new library\Aliyunsms();
- return $smsbao->mobile($params['mobile'])
- ->tempCode($params['temp'])
- ->code($params['code'])
- ->bind($params['params'])
- ->send();
- }
- /**
- * 短信发送通知(msg参数直接构建实际短信内容即可)
- * @param array $params
- * @return boolean
- * @throws \AlibabaCloud\Client\Exception\ClientException
- * @throws \AlibabaCloud\Client\Exception\ServerException
- */
- public function smsNotice(&$params)
- {
- $smsbao = new library\Aliyunsms();
- $result = $smsbao->mobile($params['mobile'])->msg($params['msg'])->send();
- return $result;
- }
- /**
- * 检测验证是否正确
- * @param Sms $params
- * @return boolean
- */
- public function smsCheck(&$params)
- {
- return TRUE;
- }
- }
|