FengsuSku.php 792 B

1234567891011121314151617181920212223242526272829303132
  1. <?php
  2. declare(strict_types=1);
  3. namespace app\common\model;
  4. use think\Model;
  5. //风速-发货记录
  6. class FengsuSku Extends Model
  7. {
  8. // 自动写入时间戳字段
  9. protected $autoWriteTimestamp = true;
  10. protected $createTime = 'createtime';
  11. protected $updateTime = 'updatetime';
  12. protected $type = [
  13. 'createtime' => 'timestamp:Y-m-d H:i',
  14. 'updatetime' => 'timestamp:Y-m-d H:i',
  15. ];
  16. public function stockconfig()
  17. {
  18. return $this->hasOne(StockConfig::class,'id','variety_id')->field('id,title');
  19. }
  20. //获取店铺下规格
  21. public static function getSpecsIdByShopId(string $shop_id, string $spec_id): object
  22. {
  23. return self::where('shop_id', $shop_id)->where('sku_id', $spec_id)->findOrEmpty();
  24. }
  25. }