| 123456789101112131415161718192021222324252627282930313233343536 |
- <?php
- namespace app\business;
- use Illuminate\Support\Arr;
- use support\Db;
- use support\Redis;
- use yzh52521\EasyHttp\Http;
- class SmsBusiness
- {
- /** 获取验证码
- * @param $phone
- * @param $code
- * @return void
- */
- static public function sms($phone, $code)
- {
- try {
- $data=Http::post('https://api.huanxun58.com/sms/Api/ReturnJson/Send.do',[
- 'SpCode'=>100428,
- 'LoginName'=>'maerdaifu',
- 'Password'=>'YKx!x4n4cg',
- 'MessageContent'=>'您的验证码是'.$code.',有效期5分钟',
- 'UserNumber'=>$phone,
- ])->array();
- if(Arr::get($data,'result') != 0){
- throw new \Exception(Arr::get($data,'description'));
- }
- }catch (\Exception $exception){
- throw new \Exception($exception->getMessage());
- }
- return true;
- }
- }
|