GoodsSeeder.php 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. <?php
  2. /**
  3. * Created by PhpStorm.
  4. * Author: 芸众商城 www.yunzshop.com
  5. * Date: 2017/3/10
  6. * Time: 09:50
  7. */
  8. class GoodsSeeder extends \Illuminate\Database\Seeder
  9. {
  10. protected $oldGoodsTable = 'sz_yi_goods';
  11. protected $oldGoodsParamTable = 'sz_yi_goods_param';
  12. protected $oldGoodsSpecTable = 'sz_yi_goods_spec';
  13. protected $oldGoodsSpecItemTable = 'sz_yi_goods_spec_item';
  14. protected $oldGoodsOptionTable = 'sz_yi_goods_option';
  15. protected $goodsTable = 'yz_goods';
  16. protected $goodsParamTable = 'yz_goods_param';
  17. protected $goodsSpecTable = 'yz_goods_spec';
  18. protected $goodsSpecItemTable = 'yz_goods_spec_item';
  19. protected $goodsOptionTable = 'yz_goods_option';
  20. protected $goodsCategoryTable = 'yz_goods_category';
  21. public function run()
  22. {
  23. return;
  24. if (!Schema::hasTable($this->oldGoodsTable)) {
  25. echo $this->oldGoodsTable." 不存在 跳过\n";
  26. return;
  27. }
  28. $dataList = \Illuminate\Support\Facades\DB::table($this->goodsTable)->get();
  29. if($dataList->isNotEmpty()){
  30. echo "{$this->goodsTable}已经有数据了跳过\n";
  31. return ;
  32. }
  33. $list = \Illuminate\Support\Facades\DB::table($this->oldGoodsTable)->get();
  34. if($list){
  35. }
  36. }
  37. }