1
This commit is contained in:
@@ -37,7 +37,7 @@ class PosterWeChatMiniProgram extends Controller
|
||||
|
||||
|
||||
// 生成小程序码,存客宝-操盘手调用
|
||||
public function generateMiniProgramCodeWithScene($taskId = '')
|
||||
public function generateMiniProgramCodeWithScene($taskId = '', $channelId = 0)
|
||||
{
|
||||
|
||||
if (empty($taskId)) {
|
||||
@@ -48,8 +48,19 @@ class PosterWeChatMiniProgram extends Controller
|
||||
try {
|
||||
$app = Factory::miniProgram($this->config);
|
||||
// scene参数长度限制为32位
|
||||
//$scene = 'taskId=' . $taskId;
|
||||
$scene = sprintf("%s", $taskId);
|
||||
// 如果提供了channelId,格式为:taskId,channelId
|
||||
// 如果没有channelId,格式为:taskId
|
||||
if (!empty($channelId) && $channelId > 0) {
|
||||
$scene = sprintf("%s,%s", $taskId, $channelId);
|
||||
} else {
|
||||
$scene = sprintf("%s", $taskId);
|
||||
}
|
||||
|
||||
// 确保scene长度不超过32位
|
||||
if (strlen($scene) > 32) {
|
||||
$scene = substr($scene, 0, 32);
|
||||
}
|
||||
|
||||
// 调用接口生成小程序码
|
||||
$response = $app->app_code->getUnlimit($scene, [
|
||||
'page' => 'pages/poster/index2', // 必须是已经发布的小程序页面
|
||||
|
||||
Reference in New Issue
Block a user