Commit 290ecf36 authored by clone's avatar clone

bug

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