Commit adb514d3 authored by hujun's avatar hujun

方法优化

parent 83edc8ce
......@@ -1059,20 +1059,32 @@ class Finance extends Basic
$fields .= 'd.income_time,a.type,c.store_id';
$list = $refund->getCheckRefundList($pageNo, $pageSize, 'a.id DESC', $fields, $where);
foreach ($list as $k => $v) {
if (empty($v['house_id'])) {
$list[$k]['address'] = '';
} else {
$list[$k]['address'] = $m_house->getHouseValue('internal_address', ['id' => $v['house_id']]);
}
$store_id[] = $v['store_id'];
$house_id[] = $v['house_id'];
}
if (empty($v['store_id'])) {
$list[$k]['store_name'] = '';
} else {
$list[$k]['store_name'] = $m_store->getStoreKeyById('store_name', ['id' => $v['store_id']]);
}
if (isset($store_id)) {
$store_id = array_unique($store_id);
$store_id = array_filter($store_id);
$store_data = $m_store->getColumn('id,store_name', ['id'=>['in', $store_id]]);
} else {
$store_data = [];
}
if (isset($house_id)) {
$house_id = array_unique($house_id);
$house_id = array_filter($house_id);
$house_data = $m_house->getHouseColumn('id,internal_address', ['id'=>['in', $house_id]]);
} else {
$house_data = [];
}
foreach($list as $k2=>$v2) {
$list[$k2]['store_name'] = array_key_exists($v2['store_id'], $store_data) ? $store_data[$v2['store_id']] : '';
$list[$k2]['address'] = array_key_exists($v2['house_id'], $house_data) ? $house_data[$v2['house_id']] : '';
}
$data['data']['list'] = $list;
$data['data']['total_money'] = $refund->getSumMoney($where);
$data['data']['total'] = $refund->getCheckRefundListTotal($where);
......@@ -1091,10 +1103,6 @@ class Finance extends Basic
$data['code'] = 200;
$data['msg'] = "";
$data['data'] = [];
$pageNo = empty($this->params['pageNo']) ? 1 : $this->params['pageNo'];
$pageSize = empty($this->params['pageSize']) ? 15 : $this->params['pageSize'];
$refund = new ORefundModel();
$m_house = new GHouses();
$m_store = new AStore();
......
......@@ -500,8 +500,7 @@ class AStore extends BaseModel
*/
public function getColumn($field, $where)
{
$where['status'] = 0;
return $this->where($where)
return Db::table($this->table)->where($where)
->column($field);
}
......
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 to comment