Message.php 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. <?php
  2. namespace app\data\controller\user;
  3. use app\data\model\DataUserMessage;
  4. use app\data\service\MessageService;
  5. use think\admin\Controller;
  6. /**
  7. * 短信发送管理
  8. * Class Message
  9. * @package app\data\controller\user
  10. */
  11. class Message extends Controller
  12. {
  13. /**
  14. * 短信发送管理
  15. * @auth true
  16. * @menu true
  17. * @throws \think\db\exception\DataNotFoundException
  18. * @throws \think\db\exception\DbException
  19. * @throws \think\db\exception\ModelNotFoundException
  20. */
  21. public function index()
  22. {
  23. $this->title = '短信发送管理';
  24. $query = DataUserMessage::mQuery();
  25. $query->equal('status')->like('phone,content');
  26. $query->dateBetween('create_at')->order('id desc')->page();
  27. }
  28. /**
  29. * 短信接口配置
  30. * @auth true
  31. * @menu true
  32. * @throws \think\db\exception\DataNotFoundException
  33. * @throws \think\db\exception\DbException
  34. * @throws \think\db\exception\ModelNotFoundException
  35. */
  36. public function config()
  37. {
  38. if ($this->request->isGet()) {
  39. $this->title = '短信接口配置';
  40. $this->result = MessageService::instance()->balance();
  41. $this->fetch();
  42. } else {
  43. $data = $this->request->post();
  44. foreach ($data as $k => $v) sysconf($k, $v);
  45. $this->success('配置保存成功!');
  46. }
  47. }
  48. /**
  49. * 删除短信记录
  50. * @auth true
  51. */
  52. public function remove()
  53. {
  54. DataUserMessage::mDelete();
  55. }
  56. }