条件错误排查

This commit is contained in:
邓皓元 2019-08-12 14:19:46 +08:00
parent 1c1fc8976c
commit 840349d22e
3 changed files with 11 additions and 6 deletions

View File

@ -37,7 +37,7 @@ class CompanySync extends Command
$array = [];
foreach ($data as $item) {
$item = (array)$item;
$item = (array) $item;
$item['name'] = trim($item['name']);
$item['created_at'] = is_numeric($item['created_at']) ? Carbon::createFromTimestamp($item['created_at']) : Carbon::parse($item['created_at']);
$item['updated_at'] = is_numeric($item['updated_at']) ? Carbon::createFromTimestamp($item['updated_at']) : Carbon::parse($item['updated_at']);

View File

@ -988,9 +988,9 @@ class OrderService extends Service
$data = [];
foreach ($array as $card) {
$data[] = [
$data[$card['sim']] = [
'sim' => $card['sim'],
'counts' => $card['counts'],
'counts' => $data[$card['sim']] ? $data[$card['sim']] + $card['counts'] : $card['counts'],
'type' => $node['type'],
'order_id' => $node['id'],
'company_id' => $node['company_id'],
@ -1005,6 +1005,8 @@ class OrderService extends Service
return;
}
$data = array_values($data);
foreach (array_chunk($data, 1000) as $value) {
if ($table === 'virtual_order_cards' && DB::table($table)->whereIn('sim', array_pluck($value, 'sim'))->whereNull('deleted_at')->count()) {
throw new ExistedException('出现重复销售卡');

View File

@ -4,8 +4,11 @@ use App\Domains\Real\Services\OrderService;
require_once realpath(dirname(__FILE__) . '/TestCase.php');
$service = app(OrderService::class);
$res = DB::connection('real')->select("call proc_child('No00000000768')");
$res = $service->index(['type' => 2, 'id' => 253371]);
foreach ($res as $key => &$value) {
$value = (array) $value;
}
dd($res);
$res = array_pluck($res, 'custom_no');
dd(in_array('No00000003080', $res));