Merge branch 'feature/mzl_dev' into develop
This commit is contained in:
@@ -0,0 +1,36 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace app\common\controller;
|
||||||
|
|
||||||
|
use support\Request;
|
||||||
|
use app\common\service\CorpService;
|
||||||
|
use app\common\service\CorpFeishuAppService;
|
||||||
|
|
||||||
|
class PresetController extends BaseController
|
||||||
|
{
|
||||||
|
|
||||||
|
protected $noNeedLogin = ['corps', 'feishuApp'];
|
||||||
|
|
||||||
|
public function corps()
|
||||||
|
{
|
||||||
|
try {
|
||||||
|
$result = (new CorpService())->getList();
|
||||||
|
return $this->success($result, '获取公司列表');
|
||||||
|
} catch (\Throwable $e) {
|
||||||
|
return $this->error($e->getMessage());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
public function feishuApp(Request $request)
|
||||||
|
{
|
||||||
|
try {
|
||||||
|
$corpId = $request->get('corp_id');
|
||||||
|
$result = (new CorpFeishuAppService())->getFeishuApp($corpId);
|
||||||
|
return $this->success($result, '获取飞书应用信息');
|
||||||
|
} catch (\Throwable $e) {
|
||||||
|
return $this->error($e->getMessage());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,16 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace app\common\logic;
|
||||||
|
|
||||||
|
use app\common\model\CorpFeishuApp;
|
||||||
|
|
||||||
|
class CorpFeishuAppLogic
|
||||||
|
{
|
||||||
|
|
||||||
|
|
||||||
|
public function getFeishuApp($corpId)
|
||||||
|
{
|
||||||
|
return CorpFeishuApp::where('corp_id', $corpId)->first(['id', 'corp_id', 'name', 'app_id', 'r_url', 'state']);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,14 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace app\common\logic;
|
||||||
|
|
||||||
|
use app\common\model\Corp;
|
||||||
|
|
||||||
|
class CorpLogic
|
||||||
|
{
|
||||||
|
|
||||||
|
public function getList()
|
||||||
|
{
|
||||||
|
return Corp::where('status', 1)->orderBy('sort', 'asc')->get(['id', 'name', 'abbr', 'tenant_key']);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,21 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace app\common\service;
|
||||||
|
|
||||||
|
use app\common\logic\CorpFeishuAppLogic;
|
||||||
|
|
||||||
|
class CorpFeishuAppService
|
||||||
|
{
|
||||||
|
|
||||||
|
protected $logic;
|
||||||
|
|
||||||
|
public function __construct()
|
||||||
|
{
|
||||||
|
$this->logic = (new CorpFeishuAppLogic());
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getFeishuApp(int $corpId)
|
||||||
|
{
|
||||||
|
return $this->logic->getFeishuApp($corpId);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,24 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace app\common\service;
|
||||||
|
|
||||||
|
use app\common\logic\CorpLogic;
|
||||||
|
|
||||||
|
class CorpService
|
||||||
|
{
|
||||||
|
|
||||||
|
protected $logic;
|
||||||
|
|
||||||
|
public function __construct()
|
||||||
|
{
|
||||||
|
$this->logic = (new CorpLogic());
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取公司list
|
||||||
|
*/
|
||||||
|
public function getList()
|
||||||
|
{
|
||||||
|
return $this->logic->getList();
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -41,6 +41,11 @@ Route::group('/common', function () {
|
|||||||
Route::group('/user', function () {
|
Route::group('/user', function () {
|
||||||
Route::any('/info', [app\common\controller\UserController::class, 'info']);
|
Route::any('/info', [app\common\controller\UserController::class, 'info']);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
Route::group('/preset', function () {
|
||||||
|
Route::any('/corps', [app\common\controller\PresetController::class, 'corps']);
|
||||||
|
Route::any('/feishu/app', [app\common\controller\PresetController::class, 'feishuApp']);
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
Route::group('/admin', function () {
|
Route::group('/admin', function () {
|
||||||
|
|||||||
@@ -2,8 +2,10 @@
|
|||||||
|
|
||||||
return [
|
return [
|
||||||
'basi_cdata' => [
|
'basi_cdata' => [
|
||||||
'/',
|
'/', // 首页
|
||||||
'/index/index',
|
'/index/index', // 首页
|
||||||
'/index/view'
|
'/index/view', // 飞书调试
|
||||||
|
'/common/preset/corps', // 公司列表
|
||||||
|
'/common/preset/feishu/app', // 飞书应用信息
|
||||||
]
|
]
|
||||||
];
|
];
|
||||||
Reference in New Issue
Block a user