StoreOrder.php 2.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394
  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\order\StoreOrderServices;
  15. use app\common\controller\Order as CommonOrder;
  16. use app\services\order\supplier\SupplierOrderServices;
  17. /**
  18. * Class StoreOrder
  19. * @package app\controller\admin\v1\supplier
  20. */
  21. class StoreOrder extends AuthController
  22. {
  23. use CommonOrder;
  24. /**
  25. * @var StoreOrderServices
  26. */
  27. protected $services;
  28. /**
  29. * StoreOrder constructor.
  30. * @param App $app
  31. * @param StoreOrderServices $services
  32. */
  33. public function __construct(App $app, StoreOrderServices $services)
  34. {
  35. parent::__construct($app);
  36. $this->services = $services;
  37. }
  38. /**
  39. * 订单列表
  40. * @return mixed
  41. * @throws \think\db\exception\DataNotFoundException
  42. * @throws \think\db\exception\DbException
  43. * @throws \think\db\exception\ModelNotFoundException
  44. */
  45. public function index()
  46. {
  47. $where = $this->request->getMore([
  48. ['status', ''],
  49. ['real_name', ''],
  50. ['is_del', ''],
  51. ['data', '', '', 'time'],
  52. ['type', ''],
  53. ['pay_type', ''],
  54. ['order', ''],
  55. ['field_key', ''],
  56. ['supplier_id', -1]
  57. ]);
  58. if ($where['supplier_id'] < 1) {
  59. $where['supplier_id'] = -1;
  60. }
  61. $where['type'] = trim($where['type']);
  62. $where['is_system_del'] = 0;
  63. $where['store_id'] = 0;
  64. $where['type'] = trim($where['type'], ' ');
  65. return $this->success($this->services->getOrderList($where, ['*'], ['split' => function ($query) {
  66. $query->field('id,pid');
  67. }, 'pink', 'invoice', 'supplier']));
  68. }
  69. /**
  70. * 提醒发货
  71. * @param $id
  72. * @return mixed
  73. */
  74. public function deliverRemind(int $supplierId, int $id)
  75. {
  76. if (!$supplierId || !$id) return $this->fail('参数异常');
  77. /** @var SupplierOrderServices $supplierOrderServices */
  78. $supplierOrderServices = app()->make(SupplierOrderServices::class);
  79. $supplierOrderServices->deliverRemind($supplierId, $id);
  80. return $this->success('提醒成功');
  81. }
  82. }