You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
95 lines
2.5 KiB
95 lines
2.5 KiB
<?php
|
|
|
|
namespace app\logic;
|
|
|
|
use app\model\AdminUser;
|
|
use app\model\ZoneAmountParam;
|
|
use app\model\ZoneGoodsPlay;
|
|
|
|
class InitData
|
|
{
|
|
|
|
public function init()
|
|
{
|
|
$admin = AdminUser::where('id','>=',1)->find();
|
|
if ($admin) return false;
|
|
|
|
$this->createAdmin();
|
|
$this->createZoneAmountParam();
|
|
$this->createZone();
|
|
$this->createZoneGoodsPlay();
|
|
}
|
|
|
|
|
|
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;
|
|
}
|
|
|
|
public function createZoneGoodsPlay()
|
|
{
|
|
$ZoneGoodsPlay = new ZoneGoodsPlay();
|
|
$query = $ZoneGoodsPlay->where('id','>=',1)->find();
|
|
if ($query) return false;
|
|
$defaultArr = [
|
|
['id' => 1, 'name' => '数字+中奖号码', 'play_code' => 'digit_number'],
|
|
['id' => 2, 'name' => '数字+图标', 'play_code' => 'digit_icon'],
|
|
['id' => 3, 'name' => '数字+中奖号码+图标', 'play_code' => 'digit_number_icon'],
|
|
['id' => 4, 'name' => '图标', 'play_code' => 'icon']
|
|
];
|
|
$ZoneGoodsPlay->saveAll($defaultArr);
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
}
|