Url.php 2.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  1. <?php
  2. namespace app\admin\controller\special\recharge;
  3. use app\common\controller\Backend;
  4. use think\Controller;
  5. use think\Request;
  6. /**
  7. * 充值链-url
  8. *
  9. * @icon fa fa-circle-o
  10. */
  11. class Url extends Backend
  12. {
  13. /**
  14. * SpecialRechargeUrl 模型对象
  15. */
  16. protected $model = null;
  17. /**
  18. * 是否是关联查询
  19. */
  20. protected $relationSearch = true;
  21. public function _initialize()
  22. {
  23. parent::_initialize();
  24. $this->model = model('SpecialRechargeUrl');
  25. $this->view->assign("orderStatusList", $this->model->getOrderStatusList());
  26. $this->view->assign("statusList", $this->model->getStatusList());
  27. }
  28. /**
  29. * 默认生成的控制器所继承的父类中有index/add/edit/del/multi五个方法
  30. * 因此在当前控制器中可不用编写增删改查的代码,如果需要自己控制这部分逻辑
  31. * 需要将application/admin/library/traits/Backend.php中对应的方法复制到当前控制器,然后进行修改
  32. */
  33. /**
  34. * 查看
  35. */
  36. public function index()
  37. {
  38. //设置过滤方法
  39. $this->request->filter(['strip_tags']);
  40. if ($this->request->isAjax())
  41. {
  42. //如果发送的来源是Selectpage,则转发到Selectpage
  43. if ($this->request->request('pkey_name'))
  44. {
  45. return $this->selectpage();
  46. }
  47. list($where, $sort, $order, $offset, $limit) = $this->buildparams();
  48. $total = $this->model
  49. ->where($where)
  50. ->order($sort, $order)
  51. ->count();
  52. $list = $this->model
  53. ->field("special_recharge_url.*, goods.money as money")
  54. ->join('special_recharge_tpl spt', 'spt.id = special_recharge_url.tpl_id')
  55. ->join('goods', 'goods.id = spt.goods_id')
  56. ->where($where)
  57. ->order($sort, $order)
  58. ->limit($offset, $limit)
  59. ->select();
  60. $result = array("total" => $total, "rows" => $list);
  61. return json($result);
  62. }
  63. return $this->view->fetch();
  64. }
  65. }