修复数据导出错误
This commit is contained in:
parent
cc97311323
commit
80d8e0c3cc
@ -115,14 +115,14 @@ class LocalStoreLogic extends Logic
|
||||
$last_where[] = ['is_export', '=', 1];
|
||||
$localStoreOrder->where($last_where)->update(['is_export' => 2]);
|
||||
|
||||
$l_where[] = ['is_checkout', '=', 1];
|
||||
$l_where[] = ['create_time', '<=', $today];
|
||||
$l_where[] = ['is_export', '=', 1];
|
||||
$result = LocalStoreOrder::where($l_where)->limit(1)->select()->toArray();
|
||||
$l_where[] = ['lso.is_checkout', '=', 1];
|
||||
$l_where[] = ['lso.create_time', '<=', $today];
|
||||
$l_where[] = ['lso.is_export', '=', 1];
|
||||
$result = LocalStoreOrder::alias('lso')->where($l_where)->limit(1)->select()->toArray();
|
||||
if ($filter) {
|
||||
$lists = LocalStoreOrder::alias('lso')
|
||||
->join('local_store ls', 'ls.lstore_id = lso.lstore_id')
|
||||
->field('lso.lstore_id, lso.payment_type, lso.account_name, lso.bank_name, lso.bank_card, lso.large_number, lso.separate_account, sum(lso.separate_account) as total, lso.tips, lso.notes, ls.shopName')
|
||||
->field('lso.lstore_id, lso.payment_type, lso.bank_name, lso.bank_card, lso.large_number, lso.separate_account, sum(lso.separate_account) as total, lso.tips, lso.notes, ls.shopName')
|
||||
->group('bank_card')
|
||||
->select()
|
||||
->toArray();
|
||||
@ -137,21 +137,20 @@ class LocalStoreLogic extends Logic
|
||||
->select()
|
||||
->toArray();
|
||||
} else {
|
||||
$where[] = ['is_checkout', '=', 0];
|
||||
$where[] = ['create_time', '<=', $today];
|
||||
$where[] = ['is_export', '=', 0];
|
||||
|
||||
$where[] = ['lso.is_checkout', '=', 0];
|
||||
$where[] = ['lso.create_time', '<=', $today];
|
||||
$where[] = ['lso.is_export', '=', 0];
|
||||
// 获取导出结果的数据集
|
||||
$lists = LocalStoreOrder::alias('lso')
|
||||
->join('local_store ls', 'ls.lstore_id = lso.lstore_id')
|
||||
->where($where)
|
||||
->field('lso.lstore_id, lso.payment_type, lso.bank_name, lso.bank_card, lso.large_number, lso.separate_account, sum(lso.separate_account) as total, lso.tips, lso.notes, ls.shopName')
|
||||
->field('lso.lstore_id, lso.payment_type, lso.bank_name, lso.bank_card, lso.large_number, lso.separate_account, sum(lso.separate_account) as total, lso.tips, lso.notes, lso.is_checkout, lso.create_time, lso.is_export, ls.shopName')
|
||||
->group('bank_card')
|
||||
->select()
|
||||
->toArray();
|
||||
|
||||
// 把导出的数据存放到记录表中
|
||||
$data = $localStoreOrder->field('id, create_time')->where($where)->select()->toArray();
|
||||
$data = $localStoreOrder->alias('lso')->field('id, create_time')->where($where)->select()->toArray();
|
||||
$record = [];
|
||||
$insert_time = date('Y-m-d H:i:s');
|
||||
foreach ($data as &$v) {
|
||||
@ -160,7 +159,7 @@ class LocalStoreLogic extends Logic
|
||||
LocalStoreOrderRecord::insertAll($record);
|
||||
|
||||
// 更新状态数据为已结账和可以继续导出
|
||||
$localStoreOrder->where($where)->update(['is_checkout' => 1, 'is_export' => 1]);
|
||||
$localStoreOrder->alias('lso')->where($where)->update(['is_checkout' => 1, 'is_export' => 1]);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user