Autoreply.php 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. <?php
  2. namespace app\admin\controller\wechat;
  3. use app\common\controller\Backend;
  4. use app\common\model\WechatResponse;
  5. /**
  6. * 微信自动回复管理
  7. *
  8. * @icon fa fa-circle-o
  9. */
  10. class Autoreply extends Backend
  11. {
  12. protected $model = null;
  13. public function _initialize()
  14. {
  15. parent::_initialize();
  16. $this->model = model('WechatAutoreply');
  17. }
  18. /**
  19. * 编辑
  20. */
  21. public function edit($ids = NULL)
  22. {
  23. $row = $this->model->get(['id' => $ids]);
  24. if (!$row)
  25. $this->error(__('No Results were found'));
  26. if ($this->request->isPost())
  27. {
  28. $this->code = -1;
  29. $params = $this->request->post("row/a");
  30. if ($params)
  31. {
  32. $row->save($params);
  33. $this->code = 1;
  34. }
  35. return;
  36. }
  37. $response = WechatResponse::get(['eventkey' => $row['eventkey']]);
  38. $this->view->assign("response", $response);
  39. $this->view->assign("row", $row);
  40. return $this->view->fetch();
  41. }
  42. }