12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091 |
- <?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'])->msg($params['code'])->event($params['event'])->params($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;
- }
- }
|