Order.php 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. <?php
  2. /**
  3. *
  4. * @copyright ©2020 点小铺
  5. * @author hanj
  6. * @link: https://dyuit.com
  7. * Created by VSCode
  8. */
  9. namespace app\api\controller\user\dealer;
  10. use app\api\controller\Controller;
  11. use app\api\model\dealer\Setting;
  12. use app\api\model\dealer\User as DealerUserModel;
  13. use app\api\model\dealer\Order as OrderModel;
  14. /**
  15. * 分销商订单
  16. * Class Order
  17. * @package app\api\controller\user\dealer
  18. */
  19. class Order extends Controller
  20. {
  21. /* @var \app\api\model\User $user */
  22. private $user;
  23. private $dealer;
  24. private $setting;
  25. /**
  26. * 构造方法
  27. * @throws \app\common\exception\BaseException
  28. * @throws \think\exception\DbException
  29. */
  30. public function _initialize()
  31. {
  32. parent::_initialize();
  33. // 用户信息
  34. $this->user = $this->getUser();
  35. // 分销商用户信息
  36. $this->dealer = DealerUserModel::detail($this->user['user_id']);
  37. // 分销商设置
  38. $this->setting = Setting::getAll();
  39. }
  40. /**
  41. * 分销商订单列表
  42. * @param int $settled
  43. * @return array
  44. * @throws \think\exception\DbException
  45. */
  46. public function lists($settled = -1)
  47. {
  48. $model = new OrderModel;
  49. return $this->renderSuccess([
  50. // 提现明细列表
  51. 'list' => $model->getList($this->user['user_id'], (int)$settled),
  52. // 页面文字
  53. 'words' => $this->setting['words']['values'],
  54. ]);
  55. }
  56. }