EmailController.class.php 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697
  1. <?php
  2. namespace Admin\Controller;
  3. /**
  4. * 邮箱设置
  5. * @author Devil
  6. * @blog http://gong.gg/
  7. * @version 0.0.1
  8. * @datetime 2016-12-01T21:51:08+0800
  9. */
  10. class EmailController extends CommonController
  11. {
  12. /**
  13. * [_initialize 前置操作-继承公共前置方法]
  14. * @author Devil
  15. * @blog http://gong.gg/
  16. * @version 0.0.1
  17. * @datetime 2016-12-03T12:39:08+0800
  18. */
  19. public function _initialize()
  20. {
  21. // 调用父类前置方法
  22. parent::_initialize();
  23. // 登录校验
  24. $this->Is_Login();
  25. // 权限校验
  26. $this->Is_Power();
  27. }
  28. /**
  29. * [Index 配置列表]
  30. * @author Devil
  31. * @blog http://gong.gg/
  32. * @version 0.0.1
  33. * @datetime 2016-12-06T21:31:53+0800
  34. */
  35. public function Index()
  36. {
  37. // 配置信息
  38. $data = M('Config')->getField('only_tag,name,describe,value,error_tips');
  39. $this->assign('data', $data);
  40. $type = I('type', 'email');
  41. $this->assign('nav_type', $type);
  42. if($type == 'email')
  43. {
  44. $this->display('Index');
  45. } else {
  46. $this->display('Message');
  47. }
  48. }
  49. /**
  50. * [Save 配置数据保存]
  51. * @author Devil
  52. * @blog http://gong.gg/
  53. * @version 0.0.1
  54. * @datetime 2017-01-02T23:08:19+0800
  55. */
  56. public function Save()
  57. {
  58. $this->MyConfigSave();
  59. }
  60. /**
  61. * [EmailTest 邮件测试]
  62. * @author Devil
  63. * @blog http://gong.gg/
  64. * @version 0.0.1
  65. * @datetime 2017-03-10T15:30:10+0800
  66. */
  67. public function EmailTest()
  68. {
  69. // 验证码公共基础参数
  70. $verify_param = array(
  71. 'expire_time' => MyC('common_verify_expire_time'),
  72. 'time_interval' => MyC('common_verify_time_interval'),
  73. );
  74. $obj = new \My\Email($verify_param);
  75. $email_param = array(
  76. 'email' => I('email'),
  77. 'content' => L('email_test_email_send_content'),
  78. 'title' => MyC('home_site_name').' - '.L('common_operation_test'),
  79. );
  80. // 发送
  81. if($obj->SendHtml($email_param))
  82. {
  83. $this->ajaxReturn(L('common_send_success'));
  84. } else {
  85. $this->ajaxReturn(L('common_send_error').'['.$obj->error.']', -100);
  86. }
  87. }
  88. }
  89. ?>