| | |
| | | |
| | | namespace app\common\model\supplier; |
| | | |
| | | use app\common\enum\supplier\SupplierType; |
| | | use app\common\model\BaseModel; |
| | | |
| | | /** |
| | |
| | | { |
| | | protected $name = 'supplier_category'; |
| | | protected $pk = 'category_id'; |
| | | protected $append = ['type_text']; |
| | | |
| | | /** |
| | | * 所有分类 |
| | |
| | | * @throws \think\db\exception\DbException |
| | | * @throws \think\db\exception\ModelNotFoundException |
| | | */ |
| | | public static function getALL() |
| | | public static function getALL($params = []) |
| | | { |
| | | $model = new static; |
| | | !empty($params['category_type']) && $model=$model->where('category_type','=',$params['category_type']); |
| | | return $model->order(['sort' => 'asc', 'create_time' => 'asc'])->select(); |
| | | } |
| | | /** |
| | | * 分类类型文本 |
| | | */ |
| | | public function getTypeTextAttr($value, $data) |
| | | { |
| | | return (new SupplierType())::getName($data['category_type']); |
| | | } |
| | | |
| | | /** |
| | | * 详情 |
| | | */ |
| | | public static function detail($category_id) |