StoreOrder.php 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  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\order;
  12. use app\common\controller\Order;
  13. use app\controller\admin\AuthController;
  14. use app\services\order\{
  15. StoreOrderServices
  16. };
  17. use think\facade\App;
  18. /**
  19. * 订单管理
  20. * Class StoreOrder
  21. * @package app\controller\admin\v1\order
  22. */
  23. class StoreOrder extends AuthController
  24. {
  25. use Order;
  26. /**
  27. * StoreOrder constructor.
  28. * @param App $app
  29. * @param StoreOrderServices $service
  30. */
  31. public function __construct(App $app, StoreOrderServices $service)
  32. {
  33. parent::__construct($app);
  34. $this->services = $service;
  35. }
  36. /**
  37. * 易联云打印机打印
  38. * @param $id
  39. * @return mixed
  40. */
  41. public function order_print($id)
  42. {
  43. if (!$id) return app('json')->fail('缺少参数');
  44. $order = $this->services->get($id);
  45. if (!$order) {
  46. return app('json')->fail('订单没有查到,无法打印!');
  47. }
  48. $res = $this->services->orderPrint((int)$id, 0, 0);
  49. if ($res) {
  50. return app('json')->success('打印成功');
  51. } else {
  52. return app('json')->fail('打印失败');
  53. }
  54. }
  55. }