SupplierFlowingWater.php 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114
  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\admin\v1\supplier;
  12. use think\facade\App;
  13. use app\controller\admin\AuthController;
  14. use app\services\supplier\finance\SupplierFlowingWaterServices;
  15. /**
  16. * 供应商流水
  17. * Class SupplierFlowingWater
  18. * @package app\controller\admin\v1\supplier
  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. ['data', '', '', 'time'],
  43. ['supplier_id', '']
  44. ]);
  45. $where['keyword'] = $this->request->param('keyword', '');
  46. $where['is_del'] = 0;
  47. return app('json')->success($this->services->getList($where));
  48. }
  49. /**
  50. * 增加备注
  51. * @param $id
  52. * @return mixed
  53. */
  54. public function mark($id)
  55. {
  56. [$mark] = $this->request->getMore([
  57. ['mark', '']
  58. ], true);
  59. if (!$id || !$mark) {
  60. return app('json')->fail('缺少参数');
  61. }
  62. $info = $this->services->get((int)$id);
  63. if (!$info) {
  64. return app('json')->fail('账单流水不存在');
  65. }
  66. if (!$this->services->update($id, ['remark' => $mark])) {
  67. return app('json')->fail('备注失败');
  68. }
  69. return app('json')->success('备注成功');
  70. }
  71. /**
  72. * 账单记录
  73. * @return mixed
  74. */
  75. public function fundRecord()
  76. {
  77. $where = $this->request->getMore([
  78. ['timeType', 'day'],
  79. ['data', '', '', 'time'],
  80. ['supplier_id', '']
  81. ]);
  82. return app('json')->success($this->services->getFundRecord($where));
  83. }
  84. /**
  85. * 账单详情
  86. * @param $ids
  87. * @return mixed
  88. * @throws \think\db\exception\DataNotFoundException
  89. * @throws \think\db\exception\DbException
  90. * @throws \think\db\exception\ModelNotFoundException
  91. */
  92. public function fundRecordInfo()
  93. {
  94. $where = $this->request->getMore([
  95. ['ids', ''],
  96. ['supplier_id', '']
  97. ]);
  98. $where['keyword'] = $this->request->param('keyword', '');
  99. $where['id'] = $where['ids'] ? explode(',', $where['ids']) : [];
  100. unset($where['ids']);
  101. $where['is_del'] = 0;
  102. return app('json')->success($this->services->getList($where));
  103. }
  104. }