belongsTo(LhcLottery::class, 'issue', 'issue') ->select('issue', 'type', 'open_code', 'open_time', 'is_settlement'); } public function items() { return $this->hasMany(LhcOrderItem::class, 'ordernum', 'ordernum'); } /** * 历史订单主表未写入盈亏时,根据派奖金额和总投注额补齐接口返回值。 */ protected function getProfitAndLossAttribute($value): string { if ($value !== null && $value !== '') { return (string)$value; } $status = (int)($this->attributes['lottery_status'] ?? self::STATUS_STAY); if (!in_array($status, [self::STATUS_LOSS, self::STATUS_WIN], true)) { return '0.00'; } $winAmount = (string)($this->attributes['win_amount'] ?? 0); $betAmount = $this->attributes['total_amount'] ?? $this->attributes['amount'] ?? 0; return bcsub($winAmount, (string)$betAmount, 2); } public static function getRemark($type) { if ($type == 1) { return '新澳门六合彩'; } elseif ($type == 2) { return '香港六合彩'; } elseif ($type == 3) { return '澳门六合彩'; } elseif ($type == 4) { return '极速六合彩'; } elseif ($type == 5) { return '加拿大28'; } elseif ($type == 6) { return '极速28'; } elseif ($type == 7) { return '极速赛车'; } elseif ($type == 8) { return '极速时时彩'; } elseif ($type == 9) { return '极速飞艇'; } elseif ($type == 10) { return 'SG时时彩'; } elseif ($type == 11) { return 'SG飞艇'; } elseif ($type == 12) { return '极速快3'; } elseif ($type == 13) { return 'SG快3'; } return ''; } }