Messagets.php 937 B

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. <?php
  2. namespace app\admin\controller;
  3. use app\common\controller\Backend;
  4. use app\common\library\Easemob;
  5. use think\Db;
  6. /**
  7. * 全部用户环信推送
  8. *
  9. * @icon fa fa-circle-o
  10. */
  11. class Messagets extends Backend
  12. {
  13. /**
  14. * Messagets模型对象
  15. * @var \app\admin\model\Messagets
  16. */
  17. protected $model = null;
  18. public function _initialize()
  19. {
  20. parent::_initialize();
  21. $this->model = new \app\admin\model\Messagets;
  22. }
  23. public function import()
  24. {
  25. parent::import();
  26. }
  27. /**
  28. * 推送
  29. */
  30. public function huanxinpush(){
  31. $id = input('id',0);
  32. $info = Db::name('message_ts')->where('id',$id)->find();
  33. Db::name('message_ts')->where('id',$id)->setInc('times');
  34. //全量推送
  35. $easemob = new Easemob();
  36. $easemob->push_all($info['title'],$info['info']);
  37. $this->success('推送完成');
  38. }
  39. }