问题表现:后台下载小程序码失败
处理方案:
1.打开文件app/controller/admin/v1/wechat/RoutineTemplate.php
2.找到方法getDownloadInfo
修改为图中红圈里的代码
getDownloadInfo方法完整代码
public function getDownloadInfo()
{
$data['routine_name'] = sys_config('routine_name', '');
$appid = sys_config('routine_appId', '');
if (!$appid) {
return $this->fail('请先在设置->系统设置->应用设置,配置小程序相关信息');
}
$name = $data['routine_name'] . '.jpg';
/** @var QrcodeServices $qrcode */
$qrcode = app()->make(QrcodeServices::class);
$resForever = $qrcode->qrCodeForever(0, 'code');
$id = (int)$resForever['id'];
/** @var QrcodeServices $QrcodeService */
$QrcodeService = app()->make(QrcodeServices::class);
//生成小程序地址
$urlCode = $QrcodeService->getRoutineQrcodePath($id, 0, -1, $name);
if ($urlCode) {
$qrcode->update($id, ['status' => 1, 'time' => time(), 'qrcode_url' => $urlCode]);
}
$data['code'] = $urlCode;
$data['appId'] = $appid;
$data['help'] = 'https://doc.crmeb.com/web/pro/crmebprov2/1192';
return $this->success($data);
}