Commit 8b4cb16a by 杨树贤

创建时间

parent 5c6ffcbf
......@@ -35,9 +35,10 @@ class SetSupplierFollowUp extends Command
// $service->importSupplierLevel();
// $service->changeSupplierTypeByIsType();
// $service->transferPayType();
$service->importSupplierGroup(true);
// $service->importSupplierGroup(true);
// $service->changeSupplierType();
// $service->generateYunxinAccount(false);
// $service->generateYunxinAccount(true);
$service->dealYunxinAccountCreateTime();
// $service->makeSupplierSystemTagAbnormal();
}
}
......@@ -372,6 +372,35 @@ class DataService
}
}
}
//处理云芯账号的创建时间
public function dealYunxinAccountCreateTime()
{
$preYearTimestamp = time() - 24 * 3600 * 356 * 1;
$accounts = SupplierAccountModel::where('id', '>', 18)->get();
$randNum = 0;
$lastTimestamp = 0;
foreach ($accounts as $account) {
$randNum += 3600 * 7.5;
$startTime = Carbon::createFromTimestamp($preYearTimestamp + $randNum)->startOfDay()->addHour(9)->timestamp;
$endTime = Carbon::createFromTimestamp($preYearTimestamp + $randNum)->endOfDay()->addHour(19)->timestamp;
$createTimestamp = rand($startTime, $endTime);
if (Carbon::createFromTimestamp($createTimestamp)->isWeekend()) {
$createTimestamp = $createTimestamp + (2 * 24 * 3600);
}
if (Carbon::createFromTimestamp($createTimestamp)->hour < 9) {
$createTimestamp = $createTimestamp + (9 * 3600);
}
if ($createTimestamp < $lastTimestamp) {
$createTimestamp = $lastTimestamp + rand(60, 3600);
}
$lastTimestamp = $createTimestamp;
dump(date('Y-m-d H:i:s',$createTimestamp));
SupplierAccountModel::where('id', $account['id'])->update([
'create_time' => $createTimestamp
]);
}
}
}
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