Commit 8397e40c authored by hujun's avatar hujun

收款记录

parent 2d86a76d
<?php
/**
* Created by PhpStorm.
* User: hu jun
* Date: 2018/4/16
* Time: 10:02
*/
namespace app\index\controller;
use app\index\extend\Basic;
use app\model\OPayLogModel;
class Collection extends Basic
{
/**
* 收款记录
*
* @return \think\Response
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException
*/
public function getCollection() {
if ($this->request->isGet()) {
$order = new OPayLogModel();
$pageNo = empty($this->params['pageNo']) ? 1 : $this->params['pageNo'];
$pageSize = empty($this->params['pageSize']) ? 10 : $this->params['pageSize'];
$where = [];
if (!empty($this->params['start_time']) && empty($this->params['end_time'])) {
$where['a.create_time'] = ['> time',$this->params['start_time']];
}
if (!empty($this->params['end_time']) && empty($this->params['start_time'])) {
$where['a.create_time'] = ['< time',$this->params['start_time']];
}
if (!empty($this->params['end_time']) && !empty($this->params['start_time'])) {
$where['a.create_time'] = ['between time', [
$this->params['end_time'],$this->params['start_time']
]];
}
if (!empty($this->params['internal_title'])) {
$where['d.internal_title'] = ['like', '%'.$where['internal_title'].'%'];
}
if (!empty($this->params['user_name'])) {
$where['c.user_name'] = ['like','%'.$this->params['user_name'].'%'];
}
if (!empty($this->params['user_phone'])) {
$where['c.user_phone'] = ['like','%'.$this->params['user_phone'].'%'];
}
if (!empty($this->params['id'])) {
$where['d.id'] = $this->params['id'];
}
if (!empty($this->params['store_name'])) {
$where['f.store_name'] = ['like','%'.$this->params['store_name'].'%'];
}
if (!empty($this->params['report_phone'])) {
$where['e.phone'] = ['like','%'.$this->params['report_phone'].'%'];
}
if (!empty($this->params['report_name'])) {
$where['e.name'] = ['like','%'.$this->params['report_name'].'%'];
}
$field = 'a.id,a.create_time,c.user_name,c.user_phone,a.money,a.pay_type,a.type,d.internal_title,d.internal_address';
$data['data']['list'] = $order->getAddPayLogOrderListLmit($pageNo, $pageSize, $order_ = 'a.id desc', $field, $where);
$data['data']['total'] = $order->getAddPayLogOrderListLmitTotal($where);
return $this->response($data['status'], $data['msg'], $data['data']);
} elseif ($this->request->isAjax()) {
return view('getCollection');
}
}
}
\ No newline at end of file
{layout name="global/frame_tpl" /}
收款记录
\ No newline at end of file
......@@ -173,4 +173,78 @@ class OPayLogModel extends Model
->where($where_)
->select();
}
/**
* 收款记录
*
* @param int $pageNo
* @param int $pageSize
* @param string $order_
* @param string $field
* @param string $params
* @return false|\PDOStatement|string|\think\Collection
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException
*/
public function getAddPayLogOrderListLmit($pageNo = 1, $pageSize = 15, $order_ = 'id desc', $field = '', $params = ''){
if (isset($params['e.name']) || isset($params['f.store_name']) || isset($params['e.phone'])) {
$data = Db::table($this->table)
->field($field)
->alias("a")
->join("o_order b","a.order_id = b.id","left")
->join("o_report c","b.f_id = c.id","left")
->join('g_houses d','b.house_id = d.id','left')
->join('a_agents e','a.agent_id=e.id','left')
->join('a_store f','e.store_id=f.id','left')
->limit($pageSize)
->page($pageNo)
->order($order_)
->where($params)
->select();
} else {
$data = Db::table($this->table)
->field($field)
->alias("a")
->join("o_order b","a.order_id = b.id","left")
->join("o_report c","b.f_id = c.id","left")
->join('g_houses d','b.house_id = d.id','left')
->limit($pageSize)
->page($pageNo)
->order($order_)
->where($params)
->select();
}
return $data;
}
/**
* 收款记录总数
*
* @param string $params
* @return int|string
*/
public function getAddPayLogOrderListLmitTotal($params = ''){
if (isset($params['e.name']) || isset($params['f.store_name']) || isset($params['e.phone'])) {
$data = Db::table($this->table)->alias("a")
->join("o_order b","a.order_id = b.id","left")
->join("o_report c","b.f_id = c.id","left")
->join('g_houses d','b.house_id = d.id','left')
->join('a_agents e','a.agent_id=e.id','left')
->join('a_store f','e.store_id=f.id','left')
->where($params)
->count();
} else {
$data = Db::table($this->table)->alias("a")
->join("o_order b","a.order_id = b.id","left")
->join("o_report c","b.f_id = c.id","left")
->join('g_houses d','b.house_id = d.id','left')
->where($params)
->count();
}
return $data;
}
}
\ No newline at end of file
......@@ -208,6 +208,7 @@ Route::group('index', [
'test123' => ['index/WatchShop/test123', [ 'method' => 'get|post' ] ], //时间轴
'agent_zhuan_aagent' => [ 'index/agent/agent_zhuan_aagent', [ 'method' => 'post|get' ] ],//经纪人
'shop_a_store' => [ 'index/agent/shop_a_store', [ 'method' => 'post|get' ] ],//经纪人
'getCollection' => [ 'index/Collection/getCollection', [ 'method' => 'post|get' ] ],//收款记录
]);
......
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