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