belongsTo(Unit::class,"unit_id","id")->bind(["unit"]); } public function brand(){ return $this->belongsTo(Brand::class,'brand_id','id')->bind(['brand_name']); } public function cat(){ return $this->belongsTo(Cat::class,'cat_id','id')->bind(["cat_name"=>'search']); } public function platform(){ return $this->belongsTo(Platform::class,'platform_id','id')->bind(['platform_name']); } public function GetStatusCnAttr($v,$row){ return self::$status_cn[$row['status']]??""; } public function GetGoodImgAttr($v,$row){ if($row['fill_type']==3)$img=(new GoodZixun())->where(["spuCode"=>$row['spuCode']])->value("good_img",''); else $img=(new GoodBasic())->where(['spuCode'=>$row['spuCode']])->value('good_thumb_img',''); return $img; } public function GetWtransNumAttr($v,$row){ return bcsub($row['good_num'],$row['transfer_num']); } }