Invcodeuser.php 2.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  1. <?php
  2. namespace app\admin\controller\csminvite;
  3. use app\common\controller\Backend;
  4. use addons\csminvite\library\CsmBackend;
  5. /**
  6. * 用户接受邀请码邀请函
  7. *
  8. * @icon fa fa-circle-o
  9. */
  10. class Invcodeuser extends CsmBackend
  11. {
  12. /**
  13. * Invcodeuser模型对象
  14. * @var \app\admin\model\csminvite\Invcodeuser
  15. */
  16. protected $model = null;
  17. public function _initialize()
  18. {
  19. parent::_initialize();
  20. $this->model = new \app\admin\model\csminvite\Invcodeuser;
  21. $this->view->assign("codestatusList", $this->model->getCodestatusList());
  22. $this->view->assign("statusList", $this->model->getStatusList());
  23. }
  24. /**
  25. * 默认生成的控制器所继承的父类中有index/add/edit/del/multi五个基础方法、destroy/restore/recyclebin三个回收站方法
  26. * 因此在当前控制器中可不用编写增删改查的代码,除非需要自己控制这部分逻辑
  27. * 需要将application/admin/library/traits/Backend.php中对应的方法复制到当前控制器,然后进行修改
  28. */
  29. /**
  30. * 查看(从邮件邀请跳转过来)
  31. */
  32. public function index()
  33. {
  34. // 当前页面必须从活动页面跳转过来
  35. $parentid = $this->csmreq("parentid", true);
  36. $parent = $this->csmGetDbRowByReqest(new \app\admin\model\csminvite\Invcode(), "parentid");
  37. $this->assign('parent', $parent);
  38. // 设置过滤方法
  39. $this->request->filter([
  40. 'strip_tags'
  41. ]);
  42. if ($this->request->isAjax()) {
  43. // 如果发送的来源是Selectpage,则转发到Selectpage
  44. if ($this->request->request('keyField')) {
  45. return $this->selectpage();
  46. }
  47. list ($where, $sort, $order, $offset, $limit) = $this->buildparams();
  48. $total = $this->model->where($where)
  49. ->where("csminvite_invcode_id", "=", $parentid)
  50. ->order($sort, $order)
  51. ->count();
  52. $list = $this->model->where($where)
  53. ->where("csminvite_invcode_id", "=", $parentid)
  54. ->order($sort, $order)
  55. ->limit($offset, $limit)
  56. ->select();
  57. $list = collection($list)->toArray();
  58. $result = array(
  59. "total" => $total,
  60. "rows" => $list
  61. );
  62. return json($result);
  63. }
  64. return $this->view->fetch();
  65. }
  66. }