Commit 290ecf36 authored by clone's avatar clone

bug

parent ac9374c1
......@@ -492,7 +492,6 @@ class Finance extends Basic
$bargain = new OPayLogModel();
$fields = 'create_time,money,type,pay_type,agent_id';
$where['report_id'] = $this->params['id'];
$where['is_del'] = 0;
$data['data'] = $bargain->selectPayLogByOrderNo($fields, $where);
$agent = new AAgents();
foreach ($data['data'] as $k => $v) {
......
......@@ -34,7 +34,9 @@ class OPayLogModel extends Model
return 0;
}
}
public function insertPayLog($params){
public function insertPayLog($params)
{
Db::startTrans();
try {
$id = $this->db_->insertGetId($params);
......@@ -45,17 +47,19 @@ class OPayLogModel extends Model
return 0;
}
}
public function updatePayLog($params){
public function updatePayLog($params)
{
$id = $params["id"];
unset($params["id"]);
Db::startTrans();
try {
$id = $this->where(["id"=>$id])->update($params);
$id = $this->where([ "id" => $id ])->update($params);
Db::commit();
return $id;
} catch (\Exception $e) {
echo $this->getLastSql();
dump("error:".$e);
dump("error:" . $e);
Db::rollback();
return 0;
}
......@@ -71,7 +75,7 @@ class OPayLogModel extends Model
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException
*/
public function selectPayLogByOrderNo($filed , $params)
public function selectPayLogByOrderNo($filed, $params)
{
$where_ = [];
if (isset($params["id"])) {
......@@ -90,6 +94,8 @@ class OPayLogModel extends Model
$where_["agent_id"] = $params["agent_id"];
}
$where_["is_del"] = 0;
return $this->db_
->field($filed)
->where($where_)
......@@ -102,7 +108,7 @@ class OPayLogModel extends Model
* @param $params
* @return false|\PDOStatement|string|\think\Collection
*/
public function getBeforeBillInfo($filed , $params)
public function getBeforeBillInfo($filed, $params)
{
$where_ = [];
......@@ -120,20 +126,22 @@ class OPayLogModel extends Model
}
public function getPayLogByOrderId($field,$params){
public function getPayLogByOrderId($field, $params)
{
$where_ = [];
if(isset($params["order_id"])){
if (isset($params["order_id"])) {
$where_["a.order_id"] = $params["order_id"];
}
if(isset($params["house_title"])){
if (isset($params["house_title"])) {
$where_["b.house_title"] = $params["house_title"];
}
$where_["a.is_del"] = 0;
return Db::table($this->table)
->field($field)
->alias("a")
->join("o_order b","a.order_id = b.id","left")
->join("a_agents c","a.agent_id = c.id","left")
->join("a_store d","c.store_id = d.id","left")
->join("o_order b", "a.order_id = b.id", "left")
->join("a_agents c", "a.agent_id = c.id", "left")
->join("a_store d", "c.store_id = d.id", "left")
->where($where_)
->select();
}
......@@ -145,21 +153,24 @@ class OPayLogModel extends Model
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException
*/
public function getAddPayLogNumGroupTime($params){
public function getAddPayLogNumGroupTime($params)
{
$field = "count(1) as num,DATE(create_time) as day";
$where_ = [];
if(isset($params["agent_id"])){
if (isset($params["agent_id"])) {
$where_["agent_id"] = $params["agent_id"];
}
if(isset($params["create_time"])){
if (isset($params["create_time"])) {
$where_["create_time"] = $params["create_time"];
}
$where_["is_del"] = 0;
return Db::table($this->table)
->field($field)
->where($where_)
->group("day")
->select();
}
/**
* @param $params
* @return false|\PDOStatement|string|\think\Collection
......@@ -167,15 +178,17 @@ class OPayLogModel extends Model
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException
*/
public function getAddPayLogNumGroupTimeNew($params){
public function getAddPayLogNumGroupTimeNew($params)
{
$field = "count(1) as num";
$where_ = [];
if(isset($params["agent_id"])){
if (isset($params["agent_id"])) {
$where_["agent_id"] = $params["agent_id"];
}
if(isset($params["create_time"])){
if (isset($params["create_time"])) {
$where_["create_time"] = $params["create_time"];
}
$where_["is_del"] = 0;
return Db::table($this->table)
->field($field)
->where($where_)
......@@ -189,22 +202,24 @@ class OPayLogModel extends Model
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException
*/
public function getAddPayLogNum($params){
public function getAddPayLogNum($params)
{
$field = "count(1) as num";
$where_ = [];
if(isset($params["agent_id"])){
if (isset($params["agent_id"])) {
$where_["a.agent_id"] = $params["agent_id"];
}
if(isset($params["create_time"])){
if (isset($params["create_time"])) {
$where_["a.create_time"] = $params["create_time"];
}
if(isset($params["house_ids"])){
$where_["b.house_id"] = array("in",$params["house_ids"]);
if (isset($params["house_ids"])) {
$where_["b.house_id"] = array( "in", $params["house_ids"] );
}
$where_["a.is_del"] = 0;
return Db::table($this->table)
->field($field)
->alias("a")
->join("o_order b","a.order_id = b.id","left")
->join("o_order b", "a.order_id = b.id", "left")
->where($where_)
->select();
}
......@@ -216,45 +231,49 @@ class OPayLogModel extends Model
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException
*/
public function getAddPayLogList($params, $field, $page_no, $page_size){
public function getAddPayLogList($params, $field, $page_no, $page_size)
{
$where_ = [];
if(isset($params["agent_id"])){
if (isset($params["agent_id"])) {
$where_["a.agent_id"] = $params["agent_id"];
}
if(isset($params["create_time"])){
if (isset($params["create_time"])) {
$where_["a.create_time"] = $params["create_time"];
}
if(isset($params["house_ids"])){
$where_["b.house_id"] = array("in",$params["house_ids"]);
if (isset($params["house_ids"])) {
$where_["b.house_id"] = array( "in", $params["house_ids"] );
}
$where_["a.is_del"] = 0;
return 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("o_order b", "a.order_id = b.id", "left")
->join("o_report c", "b.f_id = c.id", "left")
->where($where_)
->limit($page_size)
->page($page_no)
->select();
}
public function getAddPayLogListPcInfo($params, $field, $page_no, $page_size){
public function getAddPayLogListPcInfo($params, $field, $page_no, $page_size)
{
$where_ = [];
if(isset($params["agent_id"])){
if (isset($params["agent_id"])) {
$where_["a.agent_id"] = $params["agent_id"];
}
if(isset($params["create_time"])){
if (isset($params["create_time"])) {
$where_["a.create_time"] = $params["create_time"];
}
if(isset($params["house_ids"])){
$where_["b.house_id"] = array("in",$params["house_ids"]);
if (isset($params["house_ids"])) {
$where_["b.house_id"] = array( "in", $params["house_ids"] );
}
$where_["a.is_del"] = 0;
return Db::table($this->table)
->field($field)
->alias("a")
->join("o_order b","a.order_id = b.id","left")
->join("g_houses h","b.house_id = h.id","left")
->join("o_report c","b.f_id = c.id","left")
->join("o_order b", "a.order_id = b.id", "left")
->join("g_houses h", "b.house_id = h.id", "left")
->join("o_report c", "b.f_id = c.id", "left")
->where($where_)
->limit($page_size)
->page($page_no)
......@@ -270,22 +289,24 @@ class OPayLogModel extends Model
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException
*/
public function getAddPayLogOrderList($field,$params){
public function getAddPayLogOrderList($field, $params)
{
$where_ = [];
if(isset($params["agent_id"])){
if (isset($params["agent_id"])) {
$where_["a.agent_id"] = $params["agent_id"];
}
if(isset($params["create_time"])){
if (isset($params["create_time"])) {
$where_["a.create_time"] = $params["create_time"];
}
if(isset($params["house_ids"])){
$where_["b.house_id"] = array("in",$params["house_ids"]);
if (isset($params["house_ids"])) {
$where_["b.house_id"] = array( "in", $params["house_ids"] );
}
$where_["a.is_del"] = 0;
return 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("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($where_)
->group("a.id")
......@@ -305,19 +326,20 @@ class OPayLogModel extends Model
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException
*/
public function getAddPayLogOrderListLmit($pageNo = 1, $pageSize = 15, $order_ = 'id desc', $field = '', $params = ''){
public function getAddPayLogOrderListLmit($pageNo = 1, $pageSize = 15, $order_ = 'id desc', $field = '', $params = '')
{
$params["a.is_del"] = 0;
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','c.report_agent_id=e.id','left')
->join('a_store f','e.store_id=f.id','left')
->join('a_district g','f.district_id=g.id','left')
->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', 'c.report_agent_id=e.id', 'left')
->join('a_store f', 'e.store_id=f.id', 'left')
->join('a_district g', 'f.district_id=g.id', 'left')
->limit($pageSize)
->page($pageNo)
->order($order_)
......@@ -327,12 +349,12 @@ class OPayLogModel extends Model
$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','c.report_agent_id=e.id','left')
->join('a_store f','e.store_id=f.id','left')
->join('a_district g','f.district_id=g.id','left')
->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', 'c.report_agent_id=e.id', 'left')
->join('a_store f', 'e.store_id=f.id', 'left')
->join('a_district g', 'f.district_id=g.id', 'left')
->limit($pageSize)
->page($pageNo)
->order($order_)
......@@ -349,25 +371,27 @@ class OPayLogModel extends Model
* @param string $params
* @return int|string
*/
public function getAddPayLogOrderListLmitTotal($params = ''){
public function getAddPayLogOrderListLmitTotal($params = '')
{
$params["a.is_del"] = 0;
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','c.report_agent_id=e.id','left')
->join('a_store f','e.store_id=f.id','left')
->join('a_district g','f.district_id=g.id','left')
->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', 'c.report_agent_id=e.id', 'left')
->join('a_store f', 'e.store_id=f.id', 'left')
->join('a_district g', 'f.district_id=g.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')
->join('a_agents e','c.report_agent_id=e.id','left')
->join('a_store f','e.store_id=f.id','left')
->join('a_district g','f.district_id=g.id','left')
->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', 'c.report_agent_id=e.id', 'left')
->join('a_store f', 'e.store_id=f.id', 'left')
->join('a_district g', 'f.district_id=g.id', 'left')
->where($params)
->count();
}
......@@ -380,7 +404,9 @@ class OPayLogModel extends Model
* @param $where
* @return float|int
*/
public function getMoneyTotal($where) {
public function getMoneyTotal($where)
{
$where["is_del"] = 0;
return $this->where($where)->sum('money');
}
......@@ -388,13 +414,13 @@ class OPayLogModel extends Model
* 收款列表-查询收款数据
* 朱伟 2018-07-04
*/
public function selectReceiptImgList($filed , $params)
public function selectReceiptImgList($filed, $params)
{
$where_ = [];
if (isset($params["id"])) {
$where_["id"] = $params["id"];
}
$where["is_del"] = 0;
return Db::table($this->table)
->field($filed)
->where($where_)
......
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