Skip to content

Commit

Permalink
refactor(logistics): 初始化数据加入到 Seeder 中
Browse files Browse the repository at this point in the history
  • Loading branch information
twinh committed Mar 28, 2022
1 parent 0c7ca00 commit 6c69819
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions src/Seeder/V20210415002226CreateLogistics.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

namespace Miaoxing\Logistics\Seeder;

use Miaoxing\Logistics\Service\ShippingTplModel;
use Miaoxing\Logistics\Service\ShippingTplRuleModel;
use Miaoxing\Plugin\Seeder\BaseSeeder;

class V20210415002226CreateLogistics extends BaseSeeder
Expand All @@ -11,5 +13,25 @@ class V20210415002226CreateLogistics extends BaseSeeder
*/
public function run()
{
ShippingTplModel::saveAttributes([
'serviceIds' => '1',
'name' => '包邮',
'isFreeShipping' => true,
]);

$shippingTpl = ShippingTplModel::saveAttributes([
'serviceIds' => '1',
'name' => '按件 首件10 加件8',
'isFreeShipping' => false,
]);

ShippingTplRuleModel::save([
'shippingTplId' => $shippingTpl->id,
'isDefault' => true,
'startAmount' => 1,
'startFee' => 10,
'addAmount' => 1,
'addFee' => 10,
]);
}
}

0 comments on commit 6c69819

Please sign in to comment.