增加菜单迁移脚本
This commit is contained in:
@@ -2,6 +2,7 @@
|
||||
|
||||
namespace app\controller;
|
||||
|
||||
use app\common\model\Resource;
|
||||
use app\common\service\SysDictService;
|
||||
use app\common\service\UploadService;
|
||||
use app\common\utils\scaffold\Generate;
|
||||
@@ -97,71 +98,58 @@ class IndexController
|
||||
}
|
||||
|
||||
|
||||
public function test2(Request $request)
|
||||
{
|
||||
$where[] = ['id', '>', 141];
|
||||
$list = (new \app\common\utils\MigrationResources())->getFullResourceTreeOptimized('resources', $where);
|
||||
|
||||
|
||||
$keys = ['system_id','name','desc','type','code','parent_id','url','icon','open_type','link',
|
||||
'is_hide','is_hide_tab','no_auth','is_home','instance','keep_alive','sort','status'];
|
||||
foreach ($list as $key=>$item) {
|
||||
|
||||
|
||||
$temp = [];
|
||||
|
||||
foreach ($item as $k=>$v) {
|
||||
|
||||
if (isset($item['children']) && count($item['children']) > 0) {
|
||||
$temp = $item['children'];
|
||||
}
|
||||
|
||||
if (!in_array($k, $keys)) {
|
||||
unset($item[$k]);
|
||||
}
|
||||
|
||||
$id = Db::table('resources')->insertGetId($item);
|
||||
|
||||
if ($temp) {
|
||||
foreach ($temp as $kc=>$vc) {
|
||||
|
||||
foreach ($vc as $kk => $vv) {
|
||||
if (!in_array($kk, $keys)) {
|
||||
unset($vc[$kk]);
|
||||
}
|
||||
}
|
||||
|
||||
$vc['parent_id'] = $id;
|
||||
|
||||
Db::table('resources')->insert($vc);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
public function test(Request $request)
|
||||
{
|
||||
// 菜单迁移
|
||||
$where[] = ['id', '>', 141];
|
||||
$list = (new \app\common\utils\MigrationResources())->do('resources_20250916_bak', 'resources_yuanshi', $where);
|
||||
|
||||
|
||||
// $flowType = 'stock_orders';
|
||||
// $bizType = 'stock_orders';
|
||||
// $bizId = 32;
|
||||
// $formData = [];
|
||||
// $initiatorId = 74;
|
||||
|
||||
// $appro = new \app\common\utils\approval\service\ApprovalFlowService();
|
||||
// // $sp = $appro->start($flowType, $bizType, $bizId, $formData, $initiatorId);
|
||||
|
||||
// $sp = $appro->approve(11, 1, 'reject');
|
||||
// var_dump($sp);
|
||||
|
||||
// return json([
|
||||
// 'code' => 0,
|
||||
// 'msg' => 'success'
|
||||
// ]);
|
||||
|
||||
// $param = [
|
||||
// 'path' => public_path().'/pdf/BH20250908014.pdf',
|
||||
// 'scene' => 'stock_orders',
|
||||
// 'category' => 'pdf',
|
||||
// 'original_name' => 'BH20250908014.pdf'
|
||||
// ];
|
||||
|
||||
// $up = new UploadService();
|
||||
// $res = $up->uploadLocalFile($param);
|
||||
// var_dump($res);
|
||||
$param = $request->all();
|
||||
try {
|
||||
// $service = new \app\crm\service\StockOrdersService();
|
||||
// $result = $service->createdPdfFile($param['id']);
|
||||
// return json($result);
|
||||
|
||||
// \Webman\RedisQueue\Redis::send('stock-order-pdf', ['id'=>82]);
|
||||
|
||||
|
||||
// $approvalType = array_flip(\app\common\service\SysDictService::pluckKeyValueByCode('approval_type')->toArray());
|
||||
// $result = $approvalType['stock_orders'];
|
||||
// var_dump($result);
|
||||
|
||||
|
||||
// $list = \app\common\model\User::where('status', 1)->where('email', '!=', '')->pluck('email')->toArray();
|
||||
|
||||
// var_dump($list);
|
||||
|
||||
$approvalType = array_flip(\app\common\service\SysDictService::pluckKeyValueByCode('approval_type')->toArray());
|
||||
|
||||
$title = "【审批】备货单:BH20250911001";
|
||||
$flowType = $approvalType['stock_orders'];
|
||||
$content = "【审批】你有一条审批 待审批:类型 {$flowType},业务单号 BH20250911001";
|
||||
|
||||
noticePush([
|
||||
'title' => $title,
|
||||
'content' => $content,
|
||||
'recipient' => [1,74,78],
|
||||
'email' => 1
|
||||
]);
|
||||
} catch (\Throwable $th) {
|
||||
//throw $th;
|
||||
var_dump($th->getMessage().$th->getLine().$th->getFile());
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user