SupplierTicketPrint.php 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  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\system;
  12. use app\controller\supplier\AuthController;
  13. use app\services\supplier\SupplierTicketPrintServices;
  14. use think\facade\App;
  15. /**
  16. * Class SupplierTicketPrint
  17. * @package app\controller\supplier
  18. */
  19. class SupplierTicketPrint extends AuthController
  20. {
  21. /**
  22. * 构造方法
  23. * Supplier constructor.
  24. * @param App $app
  25. * @param SupplierTicketPrintServices $services
  26. */
  27. public function __construct(App $app, SupplierTicketPrintServices $services)
  28. {
  29. parent::__construct($app);
  30. $this->services = $services;
  31. }
  32. /**
  33. * 获取打印信息
  34. * @param int $id
  35. * @return void
  36. */
  37. public function read()
  38. {
  39. return $this->success($this->services->getTicketInfo((int)$this->supplierId));
  40. }
  41. /**
  42. * 更新打印信息
  43. * @param int $id
  44. * @return void
  45. */
  46. public function update()
  47. {
  48. $data = $this->request->postMore([
  49. ['develop_id', 0],
  50. ['api_key', ''],
  51. ['client_id', ''],
  52. ['terminal_number', ''],
  53. ['status', 0],
  54. ]);
  55. $this->validate($data, \app\validate\supplier\SupplierTicketPrintValidate::class, 'update');
  56. $this->services->savePrintData((int)$this->supplierId, $data);
  57. return $this->success('保存成功');
  58. }
  59. }