Account.php 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. <?php
  2. /**
  3. * Niushop商城系统 - 团队十年电商经验汇集巨献!
  4. * =========================================================
  5. * Copy right 2019-2029 杭州牛之云科技有限公司, 保留所有权利。
  6. * ----------------------------------------------
  7. * 官方网址: https://www.niushop.com
  8. * =========================================================
  9. */
  10. namespace addon\fenxiao\api\controller;
  11. use addon\fenxiao\model\FenxiaoAccount;
  12. use addon\fenxiao\model\Fenxiao as FenxiaoModel;
  13. use app\api\controller\BaseApi;
  14. /**
  15. * 分销商流水
  16. */
  17. class Account extends BaseApi
  18. {
  19. /**
  20. * 分销商流水分页
  21. * @return false|string
  22. */
  23. public function page()
  24. {
  25. $token = $this->checkToken();
  26. if ($token['code'] < 0) return $this->response($token);
  27. $page = isset($this->params['page']) ? $this->params['page'] : 1;
  28. $page_size = isset($this->params['page_size']) ? $this->params['page_size'] : PAGE_LIST_ROWS;
  29. $model = new FenxiaoModel();
  30. $fenxiao_info = $model->getFenxiaoInfo([['member_id', '=', $this->member_id]], 'fenxiao_id');
  31. $fenxiao_info = $fenxiao_info['data'];
  32. if (!empty($fenxiao_info['fenxiao_id'])) {
  33. $condition = [
  34. ['fenxiao_id', '=', $fenxiao_info['fenxiao_id']]
  35. ];
  36. $account_model = new FenxiaoAccount();
  37. $list = $account_model->getFenxiaoAccountPageList($condition, $page, $page_size);
  38. return $this->response($list);
  39. }
  40. return $this->response($this->error('', 'FENXIAO_NOT_EXIST'));
  41. }
  42. }