82 lines
2.1 KiB
PHP
82 lines
2.1 KiB
PHP
|
|
<?php
|
||
|
|
|
||
|
|
namespace App\Models;
|
||
|
|
use App\Contracts\Collageable;
|
||
|
|
use App\Contracts\Previewable;
|
||
|
|
use App\Models\Live\Anchor;
|
||
|
|
use App\Models\Live\LiveBanner;
|
||
|
|
use App\Models\Server\CommunityActivityMember;
|
||
|
|
use App\Models\Server\MerchantService;
|
||
|
|
use App\Models\TouristOrder;
|
||
|
|
use App\Traits\CanCollage;
|
||
|
|
use App\Traits\HasPreviews;
|
||
|
|
use Illuminate\Database\Eloquent\Model;
|
||
|
|
use App\Contracts\Rewardable;
|
||
|
|
use App\Contracts\Logable;
|
||
|
|
use App\Traits\HasRewards;
|
||
|
|
use App\Traits\Haslog;
|
||
|
|
use Illuminate\Database\Eloquent\SoftDeletes;
|
||
|
|
|
||
|
|
|
||
|
|
|
||
|
|
class CommunityActivity extends Model implements Rewardable,Logable,Previewable,Collageable
|
||
|
|
{
|
||
|
|
use HasRewards, HasPreviews;
|
||
|
|
use Haslog;
|
||
|
|
use SoftDeletes;
|
||
|
|
use CanCollage;
|
||
|
|
protected $fillable = [];
|
||
|
|
protected $guarded = [];
|
||
|
|
public function anchor(){
|
||
|
|
return $this->hasOne(Anchor::class,'id','anchor_id');
|
||
|
|
}
|
||
|
|
|
||
|
|
public function banners(){
|
||
|
|
return $this->hasOne(LiveBanner::class,'class_id','id');
|
||
|
|
}
|
||
|
|
|
||
|
|
public function member(){
|
||
|
|
return $this->hasMany(TouristOrder::class,'type_id','id');
|
||
|
|
}
|
||
|
|
|
||
|
|
public function merchant(){
|
||
|
|
return $this->hasMany(MerchantAccount::class,'id','merchant_id');
|
||
|
|
}
|
||
|
|
|
||
|
|
public function getPicAttribute($value)
|
||
|
|
{
|
||
|
|
if ($this->merchant_id == 491) {
|
||
|
|
if ($value) {
|
||
|
|
if (!strpos('local-pictures', $value) && !strpos($value, 'x-oss-process') && strstr($value, 'ufutx')) {
|
||
|
|
return $value . Config('image.watermark');
|
||
|
|
} else {
|
||
|
|
return $value;
|
||
|
|
}
|
||
|
|
} else {
|
||
|
|
return $value;
|
||
|
|
}
|
||
|
|
}else{
|
||
|
|
return $value;
|
||
|
|
}
|
||
|
|
}
|
||
|
|
|
||
|
|
public function merchantService(){
|
||
|
|
return $this->hasMany(MerchantService::class,'merchant_id','merchant_id');
|
||
|
|
}
|
||
|
|
|
||
|
|
public function getFlowAttribute($value)
|
||
|
|
{
|
||
|
|
return json_decode($value, true);
|
||
|
|
}
|
||
|
|
|
||
|
|
public function getReportAttribute($value)
|
||
|
|
{
|
||
|
|
return json_decode($value, true);
|
||
|
|
}
|
||
|
|
|
||
|
|
public function virtualMembers()
|
||
|
|
{
|
||
|
|
return $this->hasMany(CommunityActivityMember::class, 'activity_id', 'id');
|
||
|
|
}
|
||
|
|
}
|