Commit 0f1f1a48 authored by hujun's avatar hujun

is_self

parent 79c4d0b9
......@@ -3193,63 +3193,71 @@ class Finance extends Basic
$pageNo = empty($this->params['pageNo']) ? 1 : $this->params['pageNo'];
$pageSize = empty($this->params['pageSize']) ? 10 : $this->params['pageSize'];
$where['is_del'] = 0;
$where['a.is_del'] = 0;
if (!empty($this->params['id'])) {
$where['id'] = $this->params['id'];
$where['a.id'] = $this->params['id'];
}
if (!empty($this->params['start_time']) && empty($this->params['end_time'])) {
$where['create_time'] = [ '> time', $this->params['start_time'] . ' 00:00:00' ];
$where['a.create_time'] = [ '> time', $this->params['start_time'] . ' 00:00:00' ];
}
if (!empty($this->params['end_time']) && empty($this->params['start_time'])) {
$where['create_time'] = [ '< time', $this->params['end_time'] . ' 23:59:59' ];
$where['a.create_time'] = [ '< time', $this->params['end_time'] . ' 23:59:59' ];
}
if (!empty($this->params['end_time']) && !empty($this->params['start_time'])) {
$where['create_time'] = [ 'between time', [ $this->params['start_time'] . ' 00:00:00', $this->params['end_time'] . ' 23:59:59' ] ];
$where['a.create_time'] = [ 'between time', [ $this->params['start_time'] . ' 00:00:00', $this->params['end_time'] . ' 23:59:59' ] ];
}
if (!empty($this->params['daily_start_time']) && empty($this->params['daily_end_time'])) {
$where['daily_date'] = [ '> time', $this->params['daily_start_time']];
$where['a.daily_date'] = [ '> time', $this->params['daily_start_time']];
}
if (!empty($this->params['daily_end_time']) && empty($this->params['daily_start_time'])) {
$where['daily_date'] = [ '< time', $this->params['daily_end_time']];
$where['a.daily_date'] = [ '< time', $this->params['daily_end_time']];
}
if (!empty($this->params['daily_end_time']) && !empty($this->params['daily_start_time'])) {
$where['daily_date'] = [ 'between time', [ $this->params['daily_end_time'], $this->params['daily_end_time']] ];
$where['a.daily_date'] = [ 'between time', [ $this->params['daily_end_time'], $this->params['daily_end_time']] ];
}
if (!empty($this->params['store_id'])) {
$where['store_id'] = $this->params['store_id'];
$where['a.store_id'] = $this->params['store_id'];
}
if (!empty($this->params['district_id'])) {
$where['district_id'] = $this->params['district_id'];
$where['a.district_id'] = $this->params['district_id'];
}
if (!empty($this->params['agent_id'])) {
$where['agent_id'] = $this->params['agent_id'];
$where['a.agent_id'] = $this->params['agent_id'];
}
if ($this->params['status'] > -1) {
$where['status'] = $this->params['status'];
$where['a.status'] = $this->params['status'];
}
if (isset($this->params['is_self']) && $this->params['is_self'] != -1) {
if ($this->params['is_self']) {
$where['b.operation_id'] = $this->userId;
} else {
$where['b.operation_id'] = ['<>', $this->userId];
}
}
$m_daily = new ODaily();
$m_store = new AStore();
$field = 'id,agent_id,create_time,daily_date,store_id,status,agent_name';
$list = $m_daily->getList($pageNo, $pageSize, 'id desc', $field, $where);
$field = 'a.id,a.agent_id,a.create_time,a.daily_date,a.store_id,a.status,a.agent_name';
$list = $m_daily->getDailyLogList($pageNo, $pageSize, 'id desc', $field, $where);
foreach ($list as $k=>$v) {
$store_name = $m_store->getStoreKeyById('store_name', ['id'=>$v['store_id']]);
$list[$k]['store_name'] = empty($store_name) ? '':$store_name;
}
$data['list'] = $list;
$data['total'] = $m_daily->getTotal($where);
$data['total'] = $m_daily->getDailyLogTotal($where);
return $this->response(200, '', $data);
}
......
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