0
0

更新代码

This commit is contained in:
2020-08-04 10:09:42 +08:00
parent 6118b5b63b
commit c2ac5d964e
478 changed files with 34410 additions and 0 deletions

View File

@@ -0,0 +1,31 @@
<?php
namespace App\Api\Resources;
use Illuminate\Http\Resources\Json\JsonResource;
class GoodsParamsListResource extends JsonResource
{
/**
* Transform the resource into an array.
*
* @param \Illuminate\Http\Request $request
* @return array
*/
public function toArray($request)
{
return [
'id' => $this->goods_id,
'title' => $this->goods->title,
'img' => $this->goods->storage_id ? $this->goods->storage ? 'http://www.bohaimingpin.com' . $this->storage->path : '' : '',
'price' => number_format($this->price - $this->score,2),
'score' => number_format($this->score,2),
'original' => number_format($this->original,2),
'stock' => $this->stock,
'description' => mb_substr($this->goods->description, 0, 60),
'tag'=> $this->score == 0 ? '现金购' : $this->price == $this->score ? '积分购' : '积分+现金购',
'type'=> $this->score == 0 ? 'cash' : $this->price == $this->score ? 'score' : 'cashScore'
];
}
}