ProductConfig.php 487 B

12345678910111213141516171819202122232425
  1. <?php
  2. declare(strict_types=1);
  3. namespace app\common\model;
  4. use app\common\model\base\BaseModel;
  5. class ProductConfig extends BaseModel
  6. {
  7. //获取规格重量
  8. public static function getWeight(int $id): float|string|null
  9. {
  10. return self::where('id', $id)->value('weight');
  11. }
  12. //获取规格信息
  13. public static function getInfo(int $id): float|string|null
  14. {
  15. return self::where('id', $id)->field('weight,title')->findOrEmpty();
  16. }
  17. }