Browse Source

Merge branch 'phoenix' of http://120.24.33.109:11081/hyzjshwo/lanzu_api_hyperf into phoenix

master
lanzu_qinsheng 6 years ago
parent
commit
b70f34ae51
  1. 10
      app/Model/v3/GoodsActivity.php
  2. 4
      app/Model/v3/GoodsActivityBanner.php
  3. 9
      app/Model/v3/OrderMain.php
  4. 3
      app/Service/v3/Implementations/OrderListService.php

10
app/Model/v3/GoodsActivity.php

@ -44,6 +44,7 @@ class GoodsActivity extends Model
'is_effective', 'is_effective',
'noneffective_note', 'noneffective_note',
'total_seconds', 'total_seconds',
'details_imgs_url',
]; ];
// protected $visible = [ // protected $visible = [
@ -101,4 +102,13 @@ class GoodsActivity extends Model
return $this->morphMany(ShoppingCart::class, 'goods'); return $this->morphMany(ShoppingCart::class, 'goods');
} }
public function getDetailsImgsUrlAttribute()
{
$details_imgs = $this->details_imgs;
$img_host = config('alioss.img_host').'/';
return collect($details_imgs)->map(function($item) use ($img_host){
return $img_host . $item;
});
}
} }

4
app/Model/v3/GoodsActivityBanner.php

@ -11,6 +11,10 @@ class GoodsActivityBanner extends Model
use SoftDeletes; use SoftDeletes;
protected $table = 'lanzu_goods_activity_banners'; protected $table = 'lanzu_goods_activity_banners';
protected $appends = [
'banner_url',
];
public function getBannerUrlAttribute() public function getBannerUrlAttribute()
{ {

9
app/Model/v3/OrderMain.php

@ -91,6 +91,15 @@ class OrderMain extends Model
return Shipping::getMessage($this->attributes['shipping_type']); return Shipping::getMessage($this->attributes['shipping_type']);
} }
public function getNoteAttribute($value)
{
if ($this->attributes['refuse_refund_note'] || $this->attributes['total_refund_note']) {
return $this->attributes['refuse_refund_note'] ?: $this->attributes['total_refund_note'];
}
return $value;
}
public function market() public function market()
{ {
return $this->belongsTo(Market::class, 'market_id', 'id'); return $this->belongsTo(Market::class, 'market_id', 'id');

3
app/Service/v3/Implementations/OrderListService.php

@ -161,7 +161,8 @@ class OrderListService implements OrderListServiceInterface
->with(['orders' => function($query) { ->with(['orders' => function($query) {
$query->with('store'); $query->with('store');
}]) }])
->where(['user_id' => $userId, 'type' => OrderType::OFFLINE]);
->where(['user_id' => $userId, 'type' => OrderType::OFFLINE])
->whereIn('state', [OrderState::PAID,OrderState::DELIVERY,OrderState::COMPLETED]);
$paginate = $builder->orderBy('created_at', 'desc')->paginate($pagesize); $paginate = $builder->orderBy('created_at', 'desc')->paginate($pagesize);
$orders = $paginate->toArray(); $orders = $paginate->toArray();

Loading…
Cancel
Save