ShippingTemplates.php 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. <?php
  2. namespace app\admin\model\system;
  3. use crmeb\traits\ModelTrait;
  4. use crmeb\basic\BaseModel;
  5. /**
  6. * 菜单 model
  7. * Class SystemMenus
  8. * @package app\admin\model\system
  9. */
  10. class ShippingTemplates extends BaseModel
  11. {
  12. /**
  13. * 数据表主键
  14. * @var string
  15. */
  16. protected $pk = 'id';
  17. /**
  18. * 模型名称
  19. * @var string
  20. */
  21. protected $name = 'shipping_templates';
  22. use ModelTrait;
  23. public function getTypeAttr($value)
  24. {
  25. $status = [1 => '按件数', 2 => '按重量', 3 => '按体积'];
  26. return $status[$value];
  27. }
  28. public function getAppointAttr($value)
  29. {
  30. $status = [1 => '开启', 0 => '关闭'];
  31. return $status[$value];
  32. }
  33. public function getAddTimeAttr($value)
  34. {
  35. $value = date('Y-m-d H:i:s',$value);
  36. return $value;
  37. }
  38. /**
  39. * 运费模板列表
  40. * @param array $where
  41. * @return array
  42. */
  43. public static function getList($where = [])
  44. {
  45. $model = new self();
  46. if(isset($where['name'])&&$where['name']!='') $model = $model->where('name','like',"%$where[name]%");
  47. $data = $model->page($where['page'], $where['limit'])->order('sort','desc')->select()->toArray();
  48. $count = $model->count();
  49. return compact('count', 'data');
  50. }
  51. }