Export.php 2.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485
  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\serve;
  12. use app\controller\admin\AuthController;
  13. use app\services\serve\ServeServices;
  14. use app\services\other\ExpressServices;
  15. use crmeb\services\SystemConfigService;
  16. use think\facade\App;
  17. /**
  18. * 一号通平台物流服务
  19. * Class Export
  20. * @package app\controller\admin\v1\serve
  21. */
  22. class Export extends AuthController
  23. {
  24. /**
  25. * Export constructor.
  26. * @param App $app
  27. * @param ExpressServices $services
  28. */
  29. public function __construct(App $app, ExpressServices $services)
  30. {
  31. parent::__construct($app);
  32. $this->services = $services;
  33. }
  34. /**
  35. * 物流公司
  36. * @return mixed
  37. */
  38. public function getExportAll()
  39. {
  40. return $this->success($this->services->expressList());
  41. }
  42. /**
  43. *
  44. * 获取面单信息
  45. * @param string $com
  46. * @return mixed
  47. */
  48. public function getExportTemp(ServeServices $services)
  49. {
  50. [$com] = $this->request->getMore([
  51. ['com', ''],
  52. ], true);
  53. return $this->success($services->express()->temp($com));
  54. }
  55. /**
  56. * 打印电子面单是否开启
  57. * @return mixed
  58. */
  59. public function dumpIsOpen(ServeServices $services)
  60. {
  61. $userInfo = $services->user()->getUser();
  62. $res = false;
  63. if ($userInfo['dump']['open']) {
  64. $res = true;
  65. $data = SystemConfigService::more(['config_export_siid', 'config_export_com', 'config_export_to_name', 'config_export_to_tel', 'config_export_to_address']);
  66. if (!$data['config_export_siid']
  67. && !$data['config_export_com']
  68. && !$data['config_export_to_name']
  69. && !$data['config_export_to_tel']
  70. && !$data['config_export_to_address']
  71. ) {
  72. $res = false;
  73. }
  74. }
  75. return $this->success(['isOpen' => $res]);
  76. }
  77. }