Push.php 1.2 KB

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