ShippingTemplatesNoDeliveryDao.php 2.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  1. <?php
  2. // +----------------------------------------------------------------------
  3. // | CRMEB [ CRMEB赋能开发者,助力企业发展 ]
  4. // +----------------------------------------------------------------------
  5. // | Copyright (c) 2016~2023 https://www.crmeb.com All rights reserved.
  6. // +----------------------------------------------------------------------
  7. // | Licensed CRMEB并不是自由软件,未经许可不能去掉CRMEB相关版权
  8. // +----------------------------------------------------------------------
  9. // | Author: CRMEB Team <admin@crmeb.com>
  10. // +----------------------------------------------------------------------
  11. namespace app\dao\shipping;
  12. use app\dao\BaseDao;
  13. use app\model\shipping\ShippingTemplatesNoDelivery;
  14. /**
  15. * 不送达
  16. * Class ShippingTemplatesNoDeliveryDao
  17. * @package app\dao\shipping
  18. */
  19. class ShippingTemplatesNoDeliveryDao extends BaseDao
  20. {
  21. /**
  22. * 设置模型
  23. * @return string
  24. */
  25. protected function setModel(): string
  26. {
  27. return ShippingTemplatesNoDelivery::class;
  28. }
  29. /**
  30. * 获取运费模板列表并按照指定字段进行分组
  31. * @param array $where
  32. * @param string $group
  33. * @param string $field
  34. * @param string $key
  35. * @return mixed
  36. */
  37. public function getShippingGroupArray(array $where, string $group, string $field, string $key)
  38. {
  39. return $this->search($where)->group($group)->column($field, $key);
  40. }
  41. /**
  42. * 获取运费模板列表
  43. * @param array $where
  44. * @param string $field
  45. * @param string $key
  46. * @return array
  47. */
  48. public function getShippingArray(array $where)
  49. {
  50. return $this->search($where)->select()->toArray();
  51. }
  52. /**
  53. * 是否不送达
  54. * @param $tempId
  55. * @param $cityid
  56. * @return int
  57. */
  58. public function isNoDelivery($tempId, $cityid)
  59. {
  60. if (is_array($tempId)) {
  61. return $this->getModel()->where('temp_id', 'in', $tempId)->where('city_id', $cityid)->column('temp_id');
  62. } else {
  63. return $this->getModel()->where('temp_id', $tempId)->where('city_id', $cityid)->count();
  64. }
  65. }
  66. }