SupplierFlowingWater.php 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122
  1. <?php
  2. // +----------------------------------------------------------------------
  3. // | CRMEB [ CRMEB赋能开发者,助力企业发展 ]
  4. // +----------------------------------------------------------------------
  5. // | Copyright (c) 2016~2020 https://www.crmeb.com All rights reserved.
  6. // +----------------------------------------------------------------------
  7. // | Licensed CRMEB并不是自由软件,未经许可不能去掉CRMEB相关版权
  8. // +----------------------------------------------------------------------
  9. // | Author: CRMEB Team <admin@crmeb.com>
  10. // +----------------------------------------------------------------------
  11. namespace app\controller\supplier\finance;
  12. use app\services\supplier\finance\SupplierFlowingWaterServices;
  13. use think\facade\App;
  14. use app\controller\supplier\AuthController;
  15. /**
  16. * 供应商流水
  17. * Class SupplierFlowingWater
  18. * @package app\controller\supplier\finance
  19. */
  20. class SupplierFlowingWater extends AuthController
  21. {
  22. /**
  23. * SupplierFlowingWater constructor.
  24. * @param App $app
  25. * @param SupplierFlowingWaterServices $services
  26. */
  27. public function __construct(App $app, SupplierFlowingWaterServices $services)
  28. {
  29. parent::__construct($app);
  30. $this->services = $services;
  31. }
  32. /**
  33. * 显示资源列表
  34. * @return mixed
  35. * @throws \think\db\exception\DataNotFoundException
  36. * @throws \think\db\exception\DbException
  37. * @throws \think\db\exception\ModelNotFoundException
  38. */
  39. public function index()
  40. {
  41. $where = $this->request->getMore([
  42. ['type', ''],
  43. ['data', '', '', 'time'],
  44. ]);
  45. $where['keyword'] = $this->request->param('keyword', '');
  46. $where['supplier_id'] = $this->supplierId;
  47. $where['is_del'] = 0;
  48. return app('json')->success($this->services->getList($where));
  49. }
  50. /**
  51. * 增加备注
  52. * @param $id
  53. * @return mixed
  54. */
  55. public function mark($id)
  56. {
  57. [$mark] = $this->request->postMore([
  58. ['mark', '']
  59. ], true);
  60. if (!$id || !$mark) {
  61. return app('json')->fail('缺少参数');
  62. }
  63. $info = $this->services->get((int)$id);
  64. if (!$info) {
  65. return app('json')->fail('流水不存在');
  66. }
  67. if (!$this->services->update($id, ['mark' => $mark])) {
  68. return app('json')->fail('备注失败');
  69. }
  70. return app('json')->success('备注成功');
  71. }
  72. /**获取交易类型
  73. * @return \think\Response
  74. */
  75. public function getType()
  76. {
  77. return app('json')->success($this->services->type);
  78. }
  79. /**
  80. * 账单记录
  81. * @return mixed
  82. */
  83. public function fundRecord()
  84. {
  85. $where = $this->request->getMore([
  86. ['timeType', 'day'],
  87. ['data', '', '', 'time'],
  88. ]);
  89. $where['supplier_id'] = $this->supplierId;
  90. return app('json')->success($this->services->getFundRecord($where));
  91. }
  92. /**
  93. * 账单详情
  94. * @param $ids
  95. * @return mixed
  96. * @throws \think\db\exception\DataNotFoundException
  97. * @throws \think\db\exception\DbException
  98. * @throws \think\db\exception\ModelNotFoundException
  99. */
  100. public function fundRecordInfo()
  101. {
  102. $where = $this->request->getMore([
  103. ['ids', '']
  104. ]);
  105. $where['keyword'] = $this->request->param('keyword', '');
  106. $where['id'] = $where['ids'] ? explode(',', $where['ids']) : [];
  107. unset($where['ids']);
  108. $where['is_del'] = 0;
  109. $where['supplier_id'] = $this->supplierId;
  110. return app('json')->success($this->services->getList($where));
  111. }
  112. }