ShippingLog.php 729 B

123456789101112131415161718192021222324252627282930313233343536
  1. <?php
  2. declare(strict_types=1);
  3. namespace app\common\model;
  4. use think\Model;
  5. //风速-发货记录
  6. class FengsuShip 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. //获取最后一条记录
  17. public static function getLastRecord()
  18. {
  19. return self::order('id','desc')->getByName('createtime');
  20. }
  21. public function stockconfig()
  22. {
  23. return $this->hasOne(StockConfig::class,'id','variety_id')->field('id,title');
  24. }
  25. }