chore: 入库生产基线(2026-10-26 与 shop.douba.top 一致)

- 11 个已跟踪文件的在途改动此前只存在于工作区,生产已在运行
- 补入两个从未入库的文件:InternalController.php(app_03/box_app 内部接口)、
  config/internal.php(内部通信 key,值从 .env 读取,不含硬编码密钥)
- 逐文件 md5 比对过生产,内容一致

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
2026-10-26 17:08:55 +08:00
parent c7f85ffbda
commit fc353899a9
13 changed files with 331 additions and 37 deletions

View File

@@ -98,7 +98,7 @@ class RoutineServices extends BaseServices
$wechatUserServices = app()->make(WechatUserServices::class);
//写入用户信息
$user = $wechatUserServices->wechatOauthAfter([$openid, $wechatInfo, $spread_uid, $login_type, $userType]);
return $this->getReturnInfo($user);
return $this->getReturnInfo($user, 'routine', $openid);
}
/**
@@ -133,7 +133,7 @@ class RoutineServices extends BaseServices
$wechatUserServices = app()->make(WechatUserServices::class);
//写入用户信息
$user = $wechatUserServices->wechatOauthAfter($createData);
return $this->getReturnInfo($user);
return $this->getReturnInfo($user, 'routine', $openid);
}
/**
@@ -289,15 +289,22 @@ class RoutineServices extends BaseServices
* 获取返回信息
* @param $user
* @param string $userType
* @param string $openid
* @return array
*/
public function getReturnInfo($user, string $userType = 'routine')
public function getReturnInfo($user, string $userType = 'routine', string $openid = '')
{
if (!$user || !isset($user['uid']) || !$user['uid']) {
throw new ValidateException('获取用户信息失败');
}
$uid = (int)$user['uid'];
$token = $this->createToken($uid, $userType, $user['pwd']);
// 查询 unionid(从 wechat_user 表)
$unionid = $this->dao->value(['uid' => $uid, 'user_type' => $userType, 'is_del' => 0], 'unionid') ?? '';
$token = $this->createToken($uid, $userType, $user["pwd"] ?? "", [
"phone" => $user["phone"] ?? "",
"openid" => $openid,
"unionid" => $unionid,
]);
if (!$token) {
throw new ValidateException('登录失败!');
}
@@ -347,7 +354,7 @@ class RoutineServices extends BaseServices
//更新用户信息
$wechatUserServices->wechatUpdata([$user['uid'], $wechatInfo]);
}
return $this->getReturnInfo($user);
return $this->getReturnInfo($user, $userType, $openid);
}
/**
@@ -387,7 +394,7 @@ class RoutineServices extends BaseServices
//更新用户信息
$wechatUserServices->wechatUpdata([$user['uid'], $wechatInfo]);
}
return $this->getReturnInfo($user);
return $this->getReturnInfo($user, $userType, $openid);
}
/**
@@ -416,7 +423,13 @@ class RoutineServices extends BaseServices
if ($notLogin || $storeUserMobile) {
$userInfoKey = md5($openid . '_' . time() . '_routine');
CacheService::setTokenBucket($userInfoKey, $createData, 7200);
return ['auth_login' => 1, 'key' => $userInfoKey];
// notLogin=true 时也透传 openid/unionid,让前端(H5/小程序)能拿到稳定身份标识
return [
'auth_login' => 1,
'key' => $userInfoKey,
'openid' => $openid,
'unionid' => $routineInfo['unionid'] ?? '',
];
} else {
//写入用户信息
$user = $wechatUserServices->wechatOauthAfter($createData);
@@ -425,7 +438,7 @@ class RoutineServices extends BaseServices
//更新用户信息
$wechatUserServices->wechatUpdata([$user['uid'], ['spread_uid' => $spread_uid]]);
}
return $this->getReturnInfo($user);
return $this->getReturnInfo($user, 'routine', $openid);
}
@@ -452,7 +465,7 @@ class RoutineServices extends BaseServices
$wechatUserServices = app()->make(WechatUserServices::class);
//写入用户信息
$user = $wechatUserServices->wechatOauthAfter($createData);
return $this->getReturnInfo($user);
return $this->getReturnInfo($user, 'routine', $openid);
}
/**
@@ -493,7 +506,7 @@ class RoutineServices extends BaseServices
$wechatUserServices = app()->make(WechatUserServices::class);
//写入用户信息
$user = $wechatUserServices->wechatOauthAfter([$openid, $wechatInfo, $spread_uid, $login_type, $userType]);
return $this->getReturnInfo($user);
return $this->getReturnInfo($user, 'routine', $openid);
}
/**