16 changed files with 130 additions and 44 deletions
-
2app/Admin/Controllers/v3/BannersController.php
-
2app/Admin/Controllers/v3/CategoryController.php
-
6app/Admin/Controllers/v3/GoodsActivityController.php
-
2app/Admin/Controllers/v3/GoodsCategoryController.php
-
4app/Admin/Controllers/v3/GoodsController.php
-
6app/Admin/Controllers/v3/GoodsNewController.php
-
10app/Admin/Controllers/v3/StoreController.php
-
3app/Console/Commands/MigrateGoods.php
-
2app/Console/Commands/MigrateShoppingCart.php
-
4app/Console/Commands/MigrateStore.php
-
79app/Console/Commands/MigrateStoreImg.php
-
4app/Console/Commands/MigrateStoreWithdrawal.php
-
10app/Console/Commands/MigrateUser.php
-
34app/Console/Commands/MigrateUserCollection.php
-
6config/filesystems.php
-
BINpublic/uploads/mp_images/dic_banner_1.jpg
@ -0,0 +1,79 @@ |
|||
<?php |
|||
|
|||
namespace App\Console\Commands; |
|||
|
|||
use Illuminate\Console\Command; |
|||
use Illuminate\Support\Facades\DB; |
|||
use Illuminate\Support\Facades\Schema; |
|||
|
|||
class MigrateStoreImg extends Command |
|||
{ |
|||
/** |
|||
* The name and signature of the console command. |
|||
* |
|||
* @var string |
|||
*/ |
|||
protected $signature = 'migrateData:storeImg'; |
|||
|
|||
/** |
|||
* The console command description. |
|||
* |
|||
* @var string |
|||
*/ |
|||
protected $description = 'Command 添加店铺小程序码图片路径数据'; |
|||
|
|||
/** |
|||
* Create a new command instance. |
|||
* |
|||
* @return void |
|||
*/ |
|||
public function __construct() |
|||
{ |
|||
parent::__construct(); |
|||
} |
|||
|
|||
/** |
|||
* Execute the console command. |
|||
* |
|||
* @return int |
|||
*/ |
|||
public function handle() |
|||
{ |
|||
|
|||
$newTableName = 'lanzu_store_new'; |
|||
$storeImgPath = 'QR_code/code_store_img/wx_store_';/* 商户小程序码 */ |
|||
$storePayPath = 'QR_code/code_pay_img/wx_pay_';/* 收银二维码 */ |
|||
if(!Schema::hasTable($newTableName)){ |
|||
var_dump('新表不存在'); |
|||
return 0; |
|||
} |
|||
|
|||
$oldData = DB::table($newTableName)->orderBy('id','desc')->get(); |
|||
$bar = $this->output->createProgressBar(count($oldData)); |
|||
$bar->start(); |
|||
$startTime = time(); |
|||
$error = []; |
|||
$newData = []; |
|||
foreach ($oldData as $key => $value){ |
|||
$storeId = $value->id; |
|||
|
|||
$storeData =[ |
|||
'store_applet_img' => $storeImgPath.$storeId.'.jpg', |
|||
'cash_code_img' => $storePayPath.$storeId.'.jpg', |
|||
'updated_at' => time(), |
|||
]; |
|||
|
|||
$newData = $storeData; |
|||
$res = DB::table($newTableName)->where('id',$storeId)->update($newData); |
|||
if(!$res){ |
|||
$error[] = ['id'=>$storeId]; |
|||
break; |
|||
} |
|||
$bar->advance(); |
|||
} |
|||
$bar->finish(); |
|||
var_dump([time()-$startTime]); |
|||
var_dump($error); |
|||
return 0; |
|||
} |
|||
} |
|||
|
After Width: 750 | Height: 280 | Size: 52 KiB |
Write
Preview
Loading…
Cancel
Save
Reference in new issue