info = MerchantService::instance()->getInfo($id); $this->title = '【' . $this->info['name'] . '】交易明细列表'; $data_type = input('data_type', 1); if ($data_type == 2) { $this->table = 'MerchantAccountLogHistory'; } $this->data_type = $data_type; $query = $this->_query($this->table); $query->where(array('is_yue' => 1)); $query->equal('mid,type,oper,account_type')->like('order_id')->dateBetween('create_at,order_date'); $query->where(['mid' => $id]); // 列表排序并显示 if (input('output') === 'json') { $result = $query->order('id desc')->page(true, false); $this->success('获取数据列表成功', $result); } else { $query->order('id desc')->page(); } } /** * 表单数据处理 * @param array $data * @throws \think\db\exception\DataNotFoundException * @throws \think\db\exception\DbException * @throws \think\db\exception\ModelNotFoundException */ protected function _form_filter(&$data) { } /** * 列表数据处理 * @param array $data * @throws \think\db\exception\DataNotFoundException * @throws \think\db\exception\DbException * @throws \think\db\exception\ModelNotFoundException */ protected function _index_page_filter(array &$data) { $merchant = MerchantService::instance(); $this->type = $this->type(); $this->account_type = $this->account_type(); foreach ($data as $k => $v) { $data[$k]['merchant'] = $this->info; $data[$k]['oper_name'] = $this->type($v['type']); if ($v['account_type'] == 2) { $data[$k]['account_name'] = '授信账户'; } else { $data[$k]['account_name'] = '余额账户'; } if ($data[$k]['num'] > 0) { if ($v['oper'] == 1) { $data[$k]['snum'] = '+' . $data[$k]['num']; } else { $data[$k]['snum'] = '-' . $data[$k]['num']; } } else { $data[$k]['snum'] = $data[$k]['num']; } } if ($this->data_type == 2) { $this->total = MerchantLogHistoryService::instance()->total($this->info['id'], $this->info); } else { $this->total = MerchantLogService::instance()->total($this->info['id'], $this->info); } } protected function type($type = false) { $config = array ( '' => '全部', 1 => '充值', 2 => '扣减', 3 => '下单成功扣减', 4 => '下单失败返还', 5 => '满额返点', 6 => '授信', ); if (!$type) { return $config; } else { return $config[$type]; } } protected function account_type($type = false) { $config = array ( '' => '全部', 2 => '授信账户', 1 => '余额账户', ); if (!$type) { return $config; } else { return $config[$type]; } } }