| 1234567891011121314151617181920212223242526272829303132333435363738394041 |
- <?php
- namespace App\Models;
- /**
- * @property $id
- * @property $effective_betting_amount
- * @property $date
- * @property $rebate_ratio
- * @property $member_id
- * @property $status
- * @property $amount
- * @property $audited_by
- * @property $grant_time
- */
- class Rebate extends BaseModel
- {
- protected $table = 'rebates';
- protected $fillable = ['date', 'member_id', 'betting_amount', 'rebate_ratio',
- 'amount', 'status', 'first_name', 'username', 'audited_by',
- 'profit', 'huishui_percentage', 'huishui_restriction', 'huishui_amount',
- 'effective_betting_amount', 'grant_time', 'details', 'need_flow', 'granted_amount', 'granted_need_flow'
- ];
- protected $casts = ['details' => 'array'];
- const STATUS_WEI_FAN_YONG = 0;//未返佣
- const STATUS_FAN_YONG = 1; //已返佣
- const STATUS_PARTIAL = 2; // 当天已发放一部分,后续可补发差额
- const OPEN_STATUSES = [self::STATUS_WEI_FAN_YONG, self::STATUS_PARTIAL];
- public function member()
- {
- return $this->belongsTo(User::class, 'member_id', 'member_id')
- ->select(['id', 'member_id', 'username', 'account', 'first_name', 'admin_note', 'status', 'phone', 'visitor_id', 'register_ip']);
- }
- protected function getGrantTimeAttribute($value): string
- {
- if ($value > 0) return date('Y-m-d H:i', $value);
- return "";
- }
- }
|