Email.php 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. <?php
  2. /**
  3. * Created by PhpStorm.
  4. * User: Kevin
  5. * Date: 2018/11/14
  6. * Time: 15:51
  7. */
  8. namespace app\admin\controller;
  9. use think\Db;
  10. class Email extends Base
  11. {
  12. public function index(){
  13. return $this->fetch('email/index');
  14. }
  15. /*
  16. * 发送邮件
  17. */
  18. public function sendEmail(){
  19. extract(input());
  20. $res = sendMail($mailTo,$subject,$body);
  21. if($res == true){
  22. return json(['code'=>200,'msg'=>'发送成功']);
  23. }else{
  24. return json(['code'=>100,'msg'=>'发送失败']);
  25. }
  26. }
  27. /*
  28. * 发送云之讯短信
  29. */
  30. public function sendYzxCode(){
  31. extract(input());
  32. $res = YzxSms($code,$phone);
  33. if($res['code'] == 000000){
  34. return json(['code'=>200,'msg'=>'发送成功']);
  35. }else{
  36. return json(['code'=>100,'msg'=>$res['msg']]);
  37. }
  38. }
  39. /*
  40. * 发送阿里短信
  41. */
  42. public function sendAliCode(){
  43. extract(input());
  44. $res = alisms($phone,$code);
  45. if($res['Code'] == 'OK'){
  46. return json(['code'=>200,'msg'=>'发送成功']);
  47. }else{
  48. return json(['code'=>100,'msg'=>$res['Message']]);
  49. }
  50. }
  51. }