Push.php 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. <?php
  2. namespace app\store\controller\market;
  3. use app\store\controller\Controller;
  4. use app\store\model\wxapp\Formid as FormidModel;
  5. use app\store\service\wxapp\Message as MessageService;
  6. /**
  7. * 消息推送
  8. * Class Push
  9. * @package app\store\controller\market
  10. */
  11. class Push extends Controller
  12. {
  13. /**
  14. * 发送消息
  15. * @return array|mixed
  16. * @throws \app\common\exception\BaseException
  17. * @throws \think\exception\DbException
  18. */
  19. public function send()
  20. {
  21. if (!$this->request->isAjax()) {
  22. return $this->fetch('send');
  23. }
  24. // 执行发送
  25. $MessageService = new MessageService;
  26. $MessageService->send($this->postData('send'));
  27. return $this->renderSuccess('', '', [
  28. 'stateSet' => $MessageService->getStateSet()
  29. ]);
  30. }
  31. /**
  32. * 活跃用户列表
  33. * @return mixed
  34. * @throws \think\exception\DbException
  35. */
  36. public function user()
  37. {
  38. $list = (new FormidModel)->getUserList();
  39. return $this->fetch('user', compact('list'));
  40. }
  41. }