OwnerPriceOperationItem.php 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839
  1. <?php
  2. namespace App;
  3. use Illuminate\Database\Eloquent\Model;
  4. use App\Traits\LogModelChanging;
  5. class OwnerPriceOperationItem extends Model
  6. {
  7. use LogModelChanging;
  8. protected $fillable = [
  9. "owner_price_operation_id", //作业计费ID
  10. "strategy", //子策略
  11. "amount", //起步数
  12. "unit_id", //单位ID
  13. "unit_price", //单价
  14. "feature", //特征
  15. "priority", //优先级 值越大越高
  16. ];
  17. public $timestamps=false;
  18. public static $features = null;
  19. public static $columnMapping = null;
  20. public function unit()
  21. { //单位
  22. return $this->hasOne(Unit::class,"id","unit_id");
  23. }
  24. /* 格式化依据静态参数,在调用前设置 */
  25. public function getFeatureFormatAttribute()
  26. {
  27. if ($this->strategy == '默认')return "/";
  28. return app("FeatureService")->formatFeature(self::$features,$this->feature,self::$columnMapping);
  29. }
  30. }