Skip to content

Commit

Permalink
refactor(wechat-oa): 接口移到 api 目录中
Browse files Browse the repository at this point in the history
  • Loading branch information
twinh committed Jun 24, 2023
1 parent 02fbcb1 commit 25743f2
Show file tree
Hide file tree
Showing 6 changed files with 12 additions and 11 deletions.
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
"@miaoxing/dev": "miaoxing/dev",
"jest-preset-miaoxing": "miaoxing/jest-preset-miaoxing",
"@mxjs/a-form": "miaoxing/mxjs-a-form",
"@mxjs/a-clink": "miaoxing/mxjs-a-clink"
"@mxjs/a-clink": "miaoxing/mxjs-a-clink",
"@mxjs/app": "miaoxing/mxjs-app"
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ exports[`admin/wechat-oa/account index 1`] = `
Object {
"loading": true,
"method": "get",
"url": "/admin-api/wechat-oa/account",
"url": "/api/admin/wechat-oa/account",
},
],
],
Expand All @@ -30,7 +30,7 @@ exports[`admin/wechat-oa/account index 2`] = `
Object {
"loading": true,
"method": "get",
"url": "/admin-api/wechat-oa/account",
"url": "/api/admin/wechat-oa/account",
},
],
Array [
Expand All @@ -43,7 +43,7 @@ exports[`admin/wechat-oa/account index 2`] = `
},
"loading": true,
"method": "patch",
"url": "/admin-api/wechat-oa/account",
"url": "/api/admin/wechat-oa/account",
},
],
],
Expand Down
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion src/WechatOaPlugin.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ public function onPermissionGetMap(PermissionMap $map)

public function onCheckAuth()
{
if (0 !== strpos($this->req->getRouterPathInfo(), '/m-api/')) {
if (0 !== strpos($this->req->getRouterPathInfo(), '/api/')) {
return;
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php

namespace MiaoxingTest\WechatOa\Pages\MApi\WechatOa\Login;
namespace MiaoxingTest\WechatOa\Pages\Api\WechatOa\Login;

use Miaoxing\Plugin\Service\Tester;
use Miaoxing\Plugin\Test\BaseTestCase;
Expand All @@ -25,7 +25,7 @@ public function testGet()
->method('findBy')
->willReturn($account);

$ret = Tester::request(['url' => 'https://test.com'])->get('/m-api/wechat-oa/login');
$ret = Tester::request(['url' => 'https://test.com'])->get('/api/wechat-oa/login');

$this->assertRetSuc($ret);
$this->assertSame(
Expand All @@ -52,7 +52,7 @@ public function testPost()
'unionid' => 'test-unionid',
]));

$ret = Tester::request(['code' => 'test-code', 'url' => 'https://test.com'])->post('/m-api/wechat-oa/login');
$ret = Tester::request(['code' => 'test-code', 'url' => 'https://test.com'])->post('/api/wechat-oa/login');
$this->assertRetSuc($ret);
$this->assertArrayHasKey('token', $ret);
}
Expand All @@ -79,7 +79,7 @@ public function testPostWechatFail()
'applicationSecret' => 'y',
]));

$ret = Tester::request(['code' => 'test-code', 'url' => 'https://test.com'])->post('/m-api/wechat-oa/login');
$ret = Tester::request(['code' => 'test-code', 'url' => 'https://test.com'])->post('/api/wechat-oa/login');
$this->assertRetErr($ret);

$this->assertSame('很抱歉,微信授权失败,请返回再试。(error)', $ret['message']);
Expand All @@ -106,7 +106,7 @@ public function testPostRetryLimit()
$ret = Tester::request([
'code' => 'test-code',
'url' => 'https://test.com?retry=3',
])->post('/m-api/wechat-oa/login');
])->post('/api/wechat-oa/login');
$this->assertRetErr($ret);

$this->assertSame('很抱歉,微信授权失败,请返回再试。(error)', $ret['message']);
Expand Down Expand Up @@ -145,7 +145,7 @@ public function testPostCreateUser()
'privilege' => ['privilege1', 'privilege2'],
]));

$ret = Tester::request(['code' => 'test-code', 'url' => 'https://test.com'])->post('/m-api/wechat-oa/login');
$ret = Tester::request(['code' => 'test-code', 'url' => 'https://test.com'])->post('/api/wechat-oa/login');
$this->assertRetSuc($ret);
$this->assertArrayHasKey('token', $ret);

Expand Down

0 comments on commit 25743f2

Please sign in to comment.