分销提交
This commit is contained in:
@@ -993,20 +993,13 @@ class ChannelController extends BaseController
|
||||
]);
|
||||
}
|
||||
|
||||
// 生成登录token(只包含公司ID,有效期1小时)
|
||||
// 用户扫码后需要自己输入手机号和密码
|
||||
$tokenData = [
|
||||
'companyId' => $companyId,
|
||||
'expireTime' => time() + 3600 // 1小时后过期
|
||||
];
|
||||
$token = base64_encode(json_encode($tokenData));
|
||||
|
||||
if ($type === 'h5') {
|
||||
// 生成H5登录二维码
|
||||
$h5BaseUrl = Env::get('rpc.H5_FORM_URL', 'https://h5.ckb.quwanzhi.com/#');
|
||||
$h5BaseUrl = rtrim($h5BaseUrl, '/');
|
||||
// H5登录页面路径,需要根据实际项目调整
|
||||
$h5Url = $h5BaseUrl . '/pages/channel/login?token=' . urlencode($token);
|
||||
// 登录入口只需要携带 companyId 参数
|
||||
$h5Url = $h5BaseUrl . '/pages/channel/login?companyId=' . urlencode($companyId);
|
||||
|
||||
// 生成二维码
|
||||
$qrCode = new QrCode($h5Url);
|
||||
@@ -1042,8 +1035,11 @@ class ChannelController extends BaseController
|
||||
|
||||
$app = Factory::miniProgram($miniProgramConfig);
|
||||
|
||||
// scene参数长度限制为32位,使用token的MD5值
|
||||
$scene = substr(md5($token), 0, 32);
|
||||
// scene 参数直接使用 companyId(字符串),并确保长度不超过32
|
||||
$scene = (string)$companyId;
|
||||
if (strlen($scene) > 32) {
|
||||
$scene = substr($scene, 0, 32);
|
||||
}
|
||||
|
||||
// 调用接口生成小程序码
|
||||
// 小程序登录页面路径,需要根据实际项目调整
|
||||
@@ -1064,8 +1060,7 @@ class ChannelController extends BaseController
|
||||
'data' => [
|
||||
'type' => 'miniprogram',
|
||||
'qrCode' => $imgBase64,
|
||||
'scene' => $scene,
|
||||
'token' => $token
|
||||
'scene' => $scene
|
||||
]
|
||||
]);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user