StoreOrderStatusServices.php 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  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\services\order;
  12. use app\dao\order\StoreOrderStatusDao;
  13. use app\services\BaseServices;
  14. use crmeb\traits\ServicesTrait;
  15. /**
  16. * 订单状态
  17. * Class StoreOrderStatusServices
  18. * @package app\services\order
  19. * @mixin StoreOrderStatusDao
  20. */
  21. class StoreOrderStatusServices extends BaseServices
  22. {
  23. use ServicesTrait;
  24. /**
  25. * 构造方法
  26. * StoreOrderStatusServices constructor.
  27. * @param StoreOrderStatusDao $dao
  28. */
  29. public function __construct(StoreOrderStatusDao $dao)
  30. {
  31. $this->dao = $dao;
  32. }
  33. /**
  34. * 订单状态分页
  35. * @param array $where
  36. * @return array
  37. * @throws \think\db\exception\DataNotFoundException
  38. * @throws \think\db\exception\DbException
  39. * @throws \think\db\exception\ModelNotFoundException
  40. */
  41. public function getStatusList(array $where)
  42. {
  43. $list = $this->dao->getStatusList($where);
  44. foreach ($list as &$item) {
  45. if (is_int($item['change_time'])) $item['change_time'] = date('Y-m-d H:i:s', $item['change_time']);
  46. }
  47. $count = $this->dao->count($where);
  48. return compact('list', 'count');
  49. }
  50. }