57 lines
1.3 KiB
PHP
57 lines
1.3 KiB
PHP
|
|
<?php
|
||
|
|
|
||
|
|
namespace App\Models;
|
||
|
|
|
||
|
|
use Illuminate\Database\Eloquent\Model;
|
||
|
|
|
||
|
|
class Participant extends Model
|
||
|
|
{
|
||
|
|
protected $fillable = [];
|
||
|
|
protected $guarded = [];
|
||
|
|
|
||
|
|
//参与者key
|
||
|
|
const PART_KEY = 'new_year_';
|
||
|
|
//分享列表key
|
||
|
|
const PART_SHARE_KEY = 'new_year_share_list_';
|
||
|
|
|
||
|
|
//一级红包区间
|
||
|
|
const FIRST_MIN_MONEY = 1;
|
||
|
|
const FIRST_MAX_MONEY = 8;
|
||
|
|
//二级红包区间
|
||
|
|
const SECOND_MIN_MONEY = 8;
|
||
|
|
const SECOND_MAX_MONEY = 15;
|
||
|
|
//三级红包区间
|
||
|
|
const THIRD_MIN_MONEY = 15;
|
||
|
|
const THIRD_MAX_MONEY = 22;
|
||
|
|
//四级红包区间
|
||
|
|
const FOURTH_MIN_MONEY = 22;
|
||
|
|
const FOURTH_MAX_MONEY = 50;
|
||
|
|
public function packet(){
|
||
|
|
return $this->hasOne(ParticipantRedPacket::class, 'participant_id');
|
||
|
|
}
|
||
|
|
public function participant_helper()
|
||
|
|
{
|
||
|
|
return $this->hasOne(FruitHistory::class, 'participant_helper_id');
|
||
|
|
}
|
||
|
|
public function participant_share(){
|
||
|
|
return $this->hasOne(FruitHistory::class,'participant_id');
|
||
|
|
}
|
||
|
|
|
||
|
|
//修改器
|
||
|
|
public function getNicknameAttribute($value)
|
||
|
|
{
|
||
|
|
if($value == ''){
|
||
|
|
return "匿名用户";
|
||
|
|
}
|
||
|
|
return $value;
|
||
|
|
}
|
||
|
|
|
||
|
|
// public function getAvatarAttribute($value)
|
||
|
|
// {
|
||
|
|
// if($value = ''){
|
||
|
|
// return "";
|
||
|
|
// }
|
||
|
|
// return $value;
|
||
|
|
// }
|
||
|
|
}
|