This commit is contained in:
wong
2026-03-24 10:38:29 +08:00
parent 1853934d85
commit 29413f57c7
2 changed files with 12 additions and 2 deletions

View File

@@ -283,10 +283,20 @@ Route::group('v1/', function () {
// 旧版场景获客对外接口(计划级 apiKey保持兼容
Route::group('v1/api/scenarios', function () {
Route::any('', 'app\cunkebao\controller\plan\PostExternalApiV1Controller@index');
});
// 新版开放接口(账号级 apiKey + JWT
// ① 公开:用 apiKey + sign 换取 JWT Token
Route::post('v1/open/auth/token', 'app\common\controller\OpenAuthController@getToken');
// ② 需要 JWT所有业务接口
Route::group('v1/open', function () {
Route::post('scenarios', 'app\common\controller\OpenScenariosController@submit'); // 场景获客线索上报
})->middleware(['jwt']);
//小程序
Route::group('v1/frontend', function () {

View File

@@ -21,8 +21,8 @@ class PostCreateAddFriendPlanV1Controller extends BaseController
*/
public function generateApiKey()
{
// 生成5组随机字符串每组5个字符
$chars = 'abcdefghijklmnopqrstuvwxyz0123456789';
// 生成5组随机字符串每组5个字符(包含大小写字母和数字)
$chars = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789';
$apiKey = '';
for ($i = 0; $i < 5; $i++) {