=',1)->find(); if ($admin) return false; $this->createAdmin(); $this->createZoneAmountParam(); $this->createZone(); } public function createAdmin() { AdminUser::createAdmin(); return true; } public function createZoneAmountParam() { $ZoneAmountParam = new ZoneAmountParam(); $query = $ZoneAmountParam->where('id','>=',1)->find(); if ($query) return false; $defaultArr = [ ['amount' => '10.00', 'weight' => 10], ['amount' => '20.00', 'weight' => 10], ['amount' => '30.00', 'weight' => 10], ['amount' => '50.00', 'weight' => 10], ['amount' => '100.00', 'weight' => 10], ['amount' => '500.00', 'weight' => 10], ['amount' => '1000.00', 'weight' => 10], ['amount' => '100000.00', 'weight' => 10], ['amount' => '1000000.00', 'weight' => 1], ]; $ZoneAmountParam->saveAll($defaultArr); return true; } public function createZone() { $Zone = new \app\model\Zone(); $query = $Zone->where('id','>=',1)->find(); if ($query) return false; $defaultArr = [ ['title' => '3元面值'], ['title' => '5元面值'], ['title' => '10元面值'], ['title' => '20元面值'], ['title' => '30元面值'], ['title' => '50元面值'] ]; foreach ($defaultArr as $data) { $zone = \app\model\Zone::create($data); $zone_id = $zone->id; } return true; } }