Commit d38d7e11 authored by zhuwei's avatar zhuwei

收款操作记录

parent 32cb0270
<?php
namespace app\index\controller;
use app\api\service\AccountBalanceService;
use app\api_broker\service\RedisCacheService;
use app\index\extend\Basic;
use app\model\GReceiptOperatingRecords;
use think\Request;
class ReceiptOperatingRecords extends Basic
{
private $m_receipt_operating_records;
public function __construct(Request $request = null)
{
parent::__construct($request);
$this->m_receipt_operating_records = new GReceiptOperatingRecords();
}
/**
* 收款操作记录
* @return \think\Response
*/
public function receiptOperatingRecordsList()
{
$params = $this->params;
/*$params = array(
"office_name" => '鳖'
);*/
$pageNo = empty($this->params['pageNo']) ? 1 : $this->params['pageNo'];
$pageSize = empty($this->params['pageSize']) ? 10 : $this->params['pageSize'];
$conditions = [];
if (!empty($params['start_date']) && !empty($params['end_date'])) {
$conditions['create_time'] = ['between time', [$params['start_date'].' 00:00:00',$params['end_date'].' 23:59:59']];
}
if (!empty($params['house_id'])) {
$conditions['house_id'] = $params['house_id'];
}
$field = 'id,agents_id,type,remark,house_id,create_time';
$result = $this->m_receipt_operating_records->getOperatingList($field, $conditions, $pageNo, $pageSize);
if (!$result)
return $this->response("200", "成功", []);
$redis_cache = new RedisCacheService();
foreach ($result as $k => $v) {
$agent_data = $redis_cache->getRedisCache(2, $v['agents_id']);
$result[$k]['agents_name'] = $agent_data['name'];
$result[$k]['agents_phone'] = $agent_data['phone'];
}
$result_total = $this->m_receipt_operating_records->getOperatingTotal($field, $conditions);
$data['list'] = $result;
$data['total'] = $result_total;
return $this->response("200", "成功", $data);
}
}
\ No newline at end of file
......@@ -17,159 +17,47 @@ class GReceiptOperatingRecords extends Model
$this->db_ = Db::name($this->table);
}
// public function saveReceiptOperatingRecord($data) {
// public function saveOperating($data) {
// $time = date("Y-m-d H:i:s", time());
// $data['create_time'] = $time;
// $data['update_time'] = $time;
// $data['is_del'] = 0;
// return $this->db_ ->insert($data);
// }
//
// /**
// * 查询数据
// */
// public function getReceiptOperatingRecord($field,$params)
// {
// $params["a.is_del"] = 0;
// $result = $this->db_
// ->field($field)
// ->alias('a')
// ->join('u_users b', 'a.user_id = b.id', 'left')
// ->join('a_agents c', 'a.agent_id = c.id', 'left')
// ->where($params)
// ->find();
// //echo $this->getLastSql();
// return $result;
// }
//
// /**
// * 查客方
// * @param $field
// * @param $params
// * @return array|false|\PDOStatement|string|Model
// */
// public function getReceiptOperatingRecordId($field,$params)
// {
// $params["is_del"] = 0;
// $result = $this->db_
// ->field($field)
// ->alias('a')
// ->join('a_agents b', 'a.agent_id = b.id', 'left')
// ->where($params)
// ->select();
// //echo $this->getLastSql();
// return $result;
// }
//
// public function selectReceiptOperatingRecord($field,$params)
// {
// $params["a.is_del"] = 0;
// $result = $this->db_
// ->field($field)
// ->alias('a')
// ->join('u_users b', 'a.user_id = b.id', 'left')
// ->join('a_agents c', 'a.agent_id = c.id', 'left')
// ->join('a_site d', 'a.site_id = d.id', 'left')
// ->where($params)
// ->select();
// //echo $this->getLastSql();
// return $result;
// }
//
// public function selectUser($field,$params)
// {
// $params["is_del"] = 0;
// $result = $this->db_
// ->field($field)
// ->where($params)
// ->select();
// //echo $this->getLastSql();
// return $result;
// }
// /**
// * 更新数据
// */
// public function updateReceiptOperatingRecord($where,$params)
// {
// $result = $this->db_ ->where($where)->update($params);
// //dump($this->getLastSql());
// return $result;
//
// }
//
// /**
// * @param $field
// * @param $params
// * @return array
// */
// public function getReceiptOperatingRecordColumn($field, $params) {
// $params['is_del'] = 0;
// return $this->db_->where($params)
// ->column($field);
// }
//
// /**
// * 统计客方
// * @param $params
// * @return false|\PDOStatement|string|\think\Collection
// * @throws \think\db\exception\DataNotFoundException
// * @throws \think\db\exception\ModelNotFoundException
// * @throws \think\exception\DbException
// */
// public function getAddUserNumGroupTimeNew($params)
// {
// $field = "count(1) as num";
// $where_['is_del'] = 0;
// if (isset($params["agent_id"])) {
// $where_["agent_id"] = $params["agent_id"];
// }
// if (isset($params["create_time"])) {
// $where_["create_time"] = $params["create_time"];
// }
// return $this->db_
// ->field($field)
// ->where($where_)
// ->select();
// }
//
// public function moveHouseInsertAll($data)
// {
// $result = Db::table($this->table)
// ->insertAll($data);
// return $result;
// }
//
// /**
// * @param $field
// * @param $where
// * @return false|\PDOStatement|string|\think\Collection
// */
// public function getAllData($field, $where)
// {
// $where['is_del'] = 0;
// return $this->db_->field($field)
// ->where($where)
// ->select();
// }
//
// public function getAddUserList($params, $field, $page_no, $page_size)
// {
// $where_ = [];
// if (isset($params["agent_id"])) {
// $where_["a.agent_id"] = $params["agent_id"];
// }
// if (isset($params["create_time"])) {
// $where_["a.create_time"] = $params["create_time"];
// }
// $result = $this->db_
// ->field($field)
// ->alias('a')
// ->join('u_users b', 'a.user_id = b.id', 'left')
// ->join('a_agents c', 'a.agent_id = c.id', 'left')
// ->where($where_)
// ->limit($page_size)
// ->page($page_no)
// ->select();
// return $result;
// }
/**
*收款操作记录
* @param $field
* @param $params
* @param $pageNo
* @param $pageSize
* @return false|\PDOStatement|string|\think\Collection
*/
public function getOperatingList($field,$params,$pageNo, $pageSize)
{
$result = $this->db_
->field($field)
->where($params)
->limit($pageSize)
->page($pageNo)
->order('id desc')
->select();
return $result;
}
/**
* 收款操作记录
* @param $field
* @param $params
* @return int|string
*/
public function getOperatingTotal($field,$params)
{
$result = $this->db_
->field($field)
->where($params)
->count();
return $result;
}
}
......@@ -567,6 +567,8 @@ Route::group('index', [
'editCompanyData' => ['index/CostParameter/editCompanyData', ['method' => 'POST|GET']],
'editDiscounts' => ['index/CostParameter/editDiscounts', ['method' => 'POST|GET']],
'receiptOperatingRecordsList' => ['index/ReceiptOperatingRecords/receiptOperatingRecordsList', ['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