Compare commits
2 Commits
4793909b91
...
6782df0028
| Author | SHA1 | Date |
|---|---|---|
|
|
6782df0028 | |
|
|
35373b4bcd |
|
|
@ -18,12 +18,15 @@ class CropYieldSeeder extends Seeder
|
||||||
public function run()
|
public function run()
|
||||||
{
|
{
|
||||||
$type = 2;
|
$type = 2;
|
||||||
|
|
||||||
//假数据逻辑:每个地区,每年随机一种农作物,4个季度随机值;
|
//假数据逻辑:每个地区,每年随机一种农作物,4个季度随机值;
|
||||||
$bases = AgriculturalBase::where('type', $type)->get();
|
$bases = AgriculturalBase::where('type', $type)->get();
|
||||||
foreach ($bases as $base){
|
foreach ($bases as $base){
|
||||||
|
$insertData = [];
|
||||||
|
//随机剔除一个农作物不加数据
|
||||||
|
$uncrop = Crop::where('is_end', 1)->where('crop_type', $type)->inRandomOrder()->first();
|
||||||
|
$crops = Crop::where('is_end', 1)->where('crop_type', $type)->where('id', '<>', $uncrop->id)->get();
|
||||||
|
foreach ($crops as $crop){
|
||||||
for ($i = 2019; $i < 2023; $i++) {
|
for ($i = 2019; $i < 2023; $i++) {
|
||||||
$crop = Crop::where('is_end', 1)->where('crop_type', $type)->inRandomOrder()->first();
|
|
||||||
for ($j = 1; $j< 5; $j++) {
|
for ($j = 1; $j< 5; $j++) {
|
||||||
$insertData[] = [
|
$insertData[] = [
|
||||||
'base_id' => $base->id,
|
'base_id' => $base->id,
|
||||||
|
|
@ -38,10 +41,10 @@ class CropYieldSeeder extends Seeder
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(count($insertData) > 1){
|
if(count($insertData) > 1){
|
||||||
DB::table('crop_yields')->truncate();
|
// DB::table('crop_yields')->truncate();
|
||||||
CropYield::insert($insertData);
|
CropYield::insert($insertData);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -20,7 +20,7 @@ class EndpointPermissionSeeder extends Seeder
|
||||||
'weather' => ['name' => '气象管理', 'curd' => ['index']],
|
'weather' => ['name' => '气象管理', 'curd' => ['index']],
|
||||||
'camera' => ['name' => '智能监控', 'curd' => ['index']],
|
'camera' => ['name' => '智能监控', 'curd' => ['index']],
|
||||||
'soil' => ['name' => '土壤监控', 'curd' => ['index'], 'children' => ['setting' => '设置', 'setting_edit' => '更新设置']],
|
'soil' => ['name' => '土壤监控', 'curd' => ['index'], 'children' => ['setting' => '设置', 'setting_edit' => '更新设置']],
|
||||||
'water' => ['name' => '水质监控', 'curd' => ['index'], 'children' => ['setting' => '设置', 'setting_edit' => '更新设置']]],
|
'water' => ['name' => '水质监控', 'curd' => ['index'], 'children' => ['setting' => '设置', 'setting_edit' => '更新设置']],
|
||||||
]],
|
]],
|
||||||
'base_data' => ['name' => '基础数据管理', 'curd' => false, 'children' => [
|
'base_data' => ['name' => '基础数据管理', 'curd' => false, 'children' => [
|
||||||
'citydata_statistics' => ['name' => '全市基础数据', 'curd' => ['index', 'edit']],
|
'citydata_statistics' => ['name' => '全市基础数据', 'curd' => ['index', 'edit']],
|
||||||
|
|
@ -49,7 +49,7 @@ class EndpointPermissionSeeder extends Seeder
|
||||||
'admin_roles' => ['name' => '角色管理', 'curd' => true],
|
'admin_roles' => ['name' => '角色管理', 'curd' => true],
|
||||||
'operation_log' => ['name' => '操作日志', 'curd' => ['index']],
|
'operation_log' => ['name' => '操作日志', 'curd' => ['index']],
|
||||||
]],
|
]],
|
||||||
]],
|
]]
|
||||||
];
|
];
|
||||||
$this->createPermissionData($permissions);
|
$this->createPermissionData($permissions);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue