Commit fb82b414 by 杨树贤

初始化数据脚本

parent 221d6b83
......@@ -31,6 +31,7 @@ use Illuminate\Support\Facades\Redis;
use Maatwebsite\Excel\Facades\Excel;
use PhpAmqpLib\Connection\AMQPStreamConnection;
use PhpAmqpLib\Message\AMQPMessage;
use PhpParser\Node\Stmt\DeclareDeclare;
//这个服务是处理数据的,比如导出信息,或者临时修复数据,所以代码会比较多
class DataService
......@@ -1581,4 +1582,19 @@ class DataService
}
}
//初始化期货有效期
public function initFuturesCpTime()
{
$redis = new RedisModel();
$cpTimeList = $redis->hgetall('supplier_sku_upload_ruler_v2');
foreach ($cpTimeList as $key =>$cpTime) {
$cpTime = json_decode($cpTime, true);
if (empty($cpTime['upload_futures_goods_validity_period'])) {
$cpTime['upload_futures_goods_validity_period'] = 365;
}
$cpTime = json_encode($cpTime);
$redis->hset('supplier_sku_upload_ruler_v2', $key, $cpTime);
}
}
}
\ No newline at end of file
......@@ -81,7 +81,7 @@ Route::group(['middleware' => ['external'], 'namespace' => 'Sync'], function ()
Route::match(['get', 'post'], '/test', function () {
// (new \App\Http\Services\SupplierService())->initialCpTimeDays(15307, 5);
// (new \App\Http\Services\DataService())->initSkuRulers();
(new \App\Http\Services\DataService())->initFuturesCpTime();
// (new \App\Http\Services\DataService())->initialMainBrandsLimit();
// (new \App\Http\Services\DataService())->initialMainBrandsToSkuRuler();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment