This commit is contained in:
youda 2025-05-12 16:24:11 +08:00
parent e98e61c241
commit bfa5e94f89
3 changed files with 69 additions and 49 deletions

View File

@ -795,7 +795,9 @@ class Login extends Base
// 获取设备信息 // 获取设备信息
$device = request()->param('device', ''); // 设备类型 $device = request()->param('device', ''); // 设备类型
$device_info = request()->param('device_info', ''); // 设备详细信息 $device_info = request()->param('device_info', ''); // 设备详细信息
if ($device == "") {
$device = request()->header('client');
}
// 获取IP和地理位置信息 // 获取IP和地理位置信息
$ip = $this->getRealIp(); $ip = $this->getRealIp();
$location = ''; $location = '';

View File

@ -40,9 +40,14 @@ class UserLoginLog extends Model
->where('login_time', '<=', $today_end) ->where('login_time', '<=', $today_end)
->find(); ->find();
// 如果今天已记录,则不再记录 // 如果今天已记录,则更新最后登录时间
if ($exist) { if ($exist) {
return false; return self::where('id', $exist['id'])->update([
'last_login_time' => time(),
'device' => $device,
'ip' => $ip
]);
} }
// 添加登录记录 // 添加登录记录
@ -56,6 +61,7 @@ class UserLoginLog extends Model
'year' => date('Y'), 'year' => date('Y'),
'month' => date('m'), 'month' => date('m'),
'week' => date('W'), 'week' => date('W'),
'last_login_time' => time()
]); ]);
} }

View File

@ -61,8 +61,8 @@ class MiniProgramPlatform extends BasePlatform
*/ */
public function pay(array $data): array public function pay(array $data): array
{ {
$currentHour = (int)date('H'); $currentHour = (int) date('H');
$currentMinute = (int)date('i'); $currentMinute = (int) date('i');
$currentTime = $currentHour * 100 + $currentMinute; $currentTime = $currentHour * 100 + $currentMinute;
if ($currentTime < 800 || $currentTime >= 2200) { if ($currentTime < 800 || $currentTime >= 2200) {
@ -72,6 +72,11 @@ class MiniProgramPlatform extends BasePlatform
'msg' => '支付未开放请在08:00-22:00范围内购买' 'msg' => '支付未开放请在08:00-22:00范围内购买'
]; ];
} }
return [
'status' => 0,
'data' => [],
'msg' => '小程序支付通道维护中请联系客服下载app。'
];
$data += ['user' => null, 'price' => 0, 'title' => '', 'attach' => 'order_wxs', 'pre' => 'MH_']; $data += ['user' => null, 'price' => 0, 'title' => '', 'attach' => 'order_wxs', 'pre' => 'MH_'];
[ [
'user' => $user, 'user' => $user,
@ -112,7 +117,10 @@ class MiniProgramPlatform extends BasePlatform
// 生成新的支付通知URL // 生成新的支付通知URL
$notifyUrl = generatePayNotifyUrl($payment_type, $order_type, $user_id, $order_no, $callback_nonce_str); $notifyUrl = generatePayNotifyUrl($payment_type, $order_type, $user_id, $order_no, $callback_nonce_str);
$is_test = $user['istest']; $is_test = $user['istest'];
// $randomNumber = random_int(1, 10) / 100;
// if ($price > $randomNumber) {
// $price = $price - $randomNumber;
// }
// throw new \Exception('支付未开放'); // throw new \Exception('支付未开放');
// if ($is_test == 2) { // if ($is_test == 2) {
// $price = 0.01; // $price = 0.01;
@ -591,9 +599,11 @@ class MiniProgramPlatform extends BasePlatform
*/ */
private function switchToAlternativeMerchant(): void private function switchToAlternativeMerchant(): void
{ {
if (empty($this->mp_miniprogram) || if (
empty($this->mp_miniprogram) ||
empty($this->mp_miniprogram['merchants']) || empty($this->mp_miniprogram['merchants']) ||
!is_array($this->mp_miniprogram['merchants'])) { !is_array($this->mp_miniprogram['merchants'])
) {
return; return;
} }
@ -614,9 +624,11 @@ class MiniProgramPlatform extends BasePlatform
} }
// 检查商户是否被启用且在小程序配置中 // 检查商户是否被启用且在小程序配置中
if (isset($merchant['is_enabled'], $merchant['mch_id']) && if (
isset($merchant['is_enabled'], $merchant['mch_id']) &&
$merchant['is_enabled'] === "1" && $merchant['is_enabled'] === "1" &&
in_array($merchant['mch_id'], $this->mp_miniprogram['merchants'])) { in_array($merchant['mch_id'], $this->mp_miniprogram['merchants'])
) {
// 检查商户是否被临时停用 // 检查商户是否被临时停用
$disable_key = 'merchant:payment:disabled:' . $merchant['mch_id']; $disable_key = 'merchant:payment:disabled:' . $merchant['mch_id'];