Commit b5aeddc2 authored by clone's avatar clone

bug

parent 1489ef8f
...@@ -111,11 +111,11 @@ class Finance extends Basic ...@@ -111,11 +111,11 @@ class Finance extends Basic
} }
if (!empty($this->params['agent_phone'])) { if (!empty($this->params['agent_phone'])) {
$agent_where['a.phone'] = ['LIKE', '%'.$this->params['agent_phone'].'%']; $agent_where['a.phone'] = [ 'LIKE', '%' . $this->params['agent_phone'] . '%' ];
} }
if (!empty($this->params['agent_name'])) { if (!empty($this->params['agent_name'])) {
$agent_where['a.name'] = ['LIKE', '%'.$this->params['agent_name'].'%']; $agent_where['a.name'] = [ 'LIKE', '%' . $this->params['agent_name'] . '%' ];
} }
if (!empty($agent_where)) { if (!empty($agent_where)) {
...@@ -126,26 +126,26 @@ class Finance extends Basic ...@@ -126,26 +126,26 @@ class Finance extends Basic
return $this->response(200, ''); return $this->response(200, '');
} else { } else {
$where_id = []; $where_id = [];
foreach ($where_bargain_id as $k=>$v) { foreach ($where_bargain_id as $k => $v) {
$where_id[] = $v['id']; $where_id[] = $v['id'];
} }
$where['a.id'] = ['in', $where_id]; $where['a.id'] = [ 'in', $where_id ];
} }
} }
//分佣方姓名 //分佣方姓名
if (!empty($this->params['partial_id'])) { if (!empty($this->params['partial_id'])) {
$m_agent = new AAgents(); $m_agent = new AAgents();
$where_bargain_id = $m_agent->agentBargainAll('b.id', ['a.id' =>$this->params['partial_id']]); $where_bargain_id = $m_agent->agentBargainAll('b.id', [ 'a.id' => $this->params['partial_id'] ]);
if (empty($where_bargain_id)) { if (empty($where_bargain_id)) {
return $this->response(200, ''); return $this->response(200, '');
} else { } else {
$where_id = []; $where_id = [];
foreach ($where_bargain_id as $k=>$v) { foreach ($where_bargain_id as $k => $v) {
$where_id[] = $v['id']; $where_id[] = $v['id'];
} }
$where['a.id'] = ['in', $where_id]; $where['a.id'] = [ 'in', $where_id ];
} }
} }
...@@ -211,7 +211,7 @@ class Finance extends Basic ...@@ -211,7 +211,7 @@ class Finance extends Basic
$data['data']['total'] = $bargain->getBargainTotal($where); $data['data']['total'] = $bargain->getBargainTotal($where);
$data['data']['step'] = $check_status; $data['data']['step'] = $check_status;
} catch (\Exception $e) { } catch (\Exception $e) {
return $this->response(101, '内部错误,获取列表失败!请联系运营。'.$e->getMessage()); return $this->response(101, '内部错误,获取列表失败!请联系运营。' . $e->getMessage());
} }
return $this->response($data['code'], $data['msg'], $data['data']); return $this->response($data['code'], $data['msg'], $data['data']);
...@@ -503,6 +503,24 @@ class Finance extends Basic ...@@ -503,6 +503,24 @@ class Finance extends Basic
return $this->response($data['code'], $data['msg'], $data['data']); return $this->response($data['code'], $data['msg'], $data['data']);
} }
/**
* 删除收款记录
* @return \think\Response
*/
public function updatePayLog()
{
$params = $this->params;
if (!isset($params["id"])) {
return $this->response("101", "请求参数错误");
}
$where_["id"] = $params["id"];
$where_["is_del"] = 1;
$order = new OPayLogModel();
$id = $order->updatePayLog($where_);
return $this->response("200", "success", $id);
}
/** /**
* 报备时间轴 * 报备时间轴
* *
...@@ -694,7 +712,7 @@ class Finance extends Basic ...@@ -694,7 +712,7 @@ class Finance extends Basic
} }
if (!empty($this->params['bargain_id'])) { if (!empty($this->params['bargain_id'])) {
$where[] = ['EXP', 'b.id ='.$this->params['bargain_id'] .' or father_id='.$this->params['bargain_id']]; $where[] = [ 'EXP', 'b.id =' . $this->params['bargain_id'] . ' or father_id=' . $this->params['bargain_id'] ];
} }
$field = 'a.id,b.id as bargain_id,a.confirm_date,a.practical_fee,b.scale_fee,d.internal_address,b.agent_id,b.house_number,b.father_id,b.order_id'; $field = 'a.id,b.id as bargain_id,a.confirm_date,a.practical_fee,b.scale_fee,d.internal_address,b.agent_id,b.house_number,b.father_id,b.order_id';
...@@ -813,7 +831,7 @@ class Finance extends Basic ...@@ -813,7 +831,7 @@ class Finance extends Basic
//确认分佣加时间 否则 只是保存分佣数据 //确认分佣加时间 否则 只是保存分佣数据
if ($this->params['is_account_commission'] == 1) { if ($this->params['is_account_commission'] == 1) {
if ($check->vip($this->userId, 'account_commission')) { if ($check->vip($this->userId, 'account_commission')) {
return $this->response(101,'没有权限!'); return $this->response(101, '没有权限!');
} }
$update_arr[$i]['confirm_date'] = date("Y-m-d H:i:s", time()); $update_arr[$i]['confirm_date'] = date("Y-m-d H:i:s", time());
$update_arr[$i]['confirm_status'] = 1; $update_arr[$i]['confirm_status'] = 1;
...@@ -838,7 +856,7 @@ class Finance extends Basic ...@@ -838,7 +856,7 @@ class Finance extends Basic
//确认分佣加时间 否则 只是保存分佣数据 //确认分佣加时间 否则 只是保存分佣数据
if ($this->params['is_account_commission'] == 1) { if ($this->params['is_account_commission'] == 1) {
if ($check->vip($this->userId, 'account_commission')) { if ($check->vip($this->userId, 'account_commission')) {
return $this->response(101,'没有权限!'); return $this->response(101, '没有权限!');
} }
$add_arr[$j]['confirm_date'] = date("Y-m-d H:i:s", time()); $add_arr[$j]['confirm_date'] = date("Y-m-d H:i:s", time());
...@@ -1266,8 +1284,8 @@ class Finance extends Basic ...@@ -1266,8 +1284,8 @@ class Finance extends Basic
$m_bargain = new OBargainModel(); $m_bargain = new OBargainModel();
$update_data['status'] = 10; $update_data['status'] = 10;
$update_data['audit_level'] = 0; $update_data['audit_level'] = 0;
$where[] = ['EXP', 'id='.$this->params['bargain_id'] .' or father_id='.$this->params['bargain_id']]; $where[] = [ 'EXP', 'id=' . $this->params['bargain_id'] . ' or father_id=' . $this->params['bargain_id'] ];
$where['status'] = ['<>', 30]; $where['status'] = [ '<>', 30 ];
$m_bargain->updateBargainByWhere($update_data, $where); $m_bargain->updateBargainByWhere($update_data, $where);
$msg = ''; $msg = '';
if ($data > 0) { if ($data > 0) {
...@@ -1340,15 +1358,15 @@ class Finance extends Basic ...@@ -1340,15 +1358,15 @@ class Finance extends Basic
$where = []; $where = [];
if (!empty($this->params['create_time']) && empty($this->params['end_time'])) { if (!empty($this->params['create_time']) && empty($this->params['end_time'])) {
$where['a.create_time'] = [ '> time', $this->params['create_time'].' 00:00:00' ]; $where['a.create_time'] = [ '> time', $this->params['create_time'] . ' 00:00:00' ];
} }
if (!empty($this->params['end_time']) && empty($this->params['create_time'])) { if (!empty($this->params['end_time']) && empty($this->params['create_time'])) {
$where['a.create_time'] = [ '< time', $this->params['create_time'].' 23:59:59' ]; $where['a.create_time'] = [ '< time', $this->params['create_time'] . ' 23:59:59' ];
} }
if (!empty($this->params['create_time']) && !empty($this->params['end_time'])) { if (!empty($this->params['create_time']) && !empty($this->params['end_time'])) {
$where['a.create_time'] = [ 'between time', [ $this->params['create_time']. ' 00:00:00', $this->params['end_time']. ' 23:59:59'] ]; $where['a.create_time'] = [ 'between time', [ $this->params['create_time'] . ' 00:00:00', $this->params['end_time'] . ' 23:59:59' ] ];
} }
//商铺号 //商铺号
...@@ -1470,7 +1488,7 @@ class Finance extends Basic ...@@ -1470,7 +1488,7 @@ class Finance extends Basic
return $this->response(101, '参数错误'); return $this->response(101, '参数错误');
$m_taxes = new OTaxes(); $m_taxes = new OTaxes();
$num = $m_taxes->updateTaxesById(['id_or_father_id'=>$this->params['taxes_id']],['is_del'=>1]); $num = $m_taxes->updateTaxesById([ 'id_or_father_id' => $this->params['taxes_id'] ], [ 'is_del' => 1 ]);
if ($num > 0) { if ($num > 0) {
$result['code'] = 200; $result['code'] = 200;
$result['msg'] = '删除成功'; $result['msg'] = '删除成功';
...@@ -1490,7 +1508,8 @@ class Finance extends Basic ...@@ -1490,7 +1508,8 @@ class Finance extends Basic
* @throws \think\db\exception\ModelNotFoundException * @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException * @throws \think\exception\DbException
*/ */
public function getBargainCommission() { public function getBargainCommission()
{
if (empty($this->params['bargain_id'])) { if (empty($this->params['bargain_id'])) {
return $this->response(101, '成交报告id为空'); return $this->response(101, '成交报告id为空');
} }
...@@ -1499,7 +1518,7 @@ class Finance extends Basic ...@@ -1499,7 +1518,7 @@ class Finance extends Basic
if ($this->request->isGet()) { if ($this->request->isGet()) {
$field = 'a.id,a.scale,a.agent_id,a.role,a.scale_fee,b.scale as new_scale,b.should_commission'; $field = 'a.id,a.scale,a.agent_id,a.role,a.scale_fee,b.scale as new_scale,b.should_commission';
$data = $m_bargain->getBargainPartialDetail($field, ['id'=>$this->params['bargain_id']]); $data = $m_bargain->getBargainPartialDetail($field, [ 'id' => $this->params['bargain_id'] ]);
return $this->response(200, '', $data); return $this->response(200, '', $data);
} }
...@@ -1512,7 +1531,7 @@ class Finance extends Basic ...@@ -1512,7 +1531,7 @@ class Finance extends Basic
} }
//检查成交报告是否存在 //检查成交报告是否存在
$data_arr = $m_bargain->getBargainPartialDetail('a.id,a.agent_id,a.create_time', ['id'=>$this->params['bargain_id']]); $data_arr = $m_bargain->getBargainPartialDetail('a.id,a.agent_id,a.create_time', [ 'id' => $this->params['bargain_id'] ]);
if (empty($data_arr['id'])) { if (empty($data_arr['id'])) {
return $this->response(101, '没有成交报告信息'); return $this->response(101, '没有成交报告信息');
...@@ -1533,7 +1552,7 @@ class Finance extends Basic ...@@ -1533,7 +1552,7 @@ class Finance extends Basic
$this->updatePerformance(0, $data_arr['agent_id']); $this->updatePerformance(0, $data_arr['agent_id']);
/*记录日志 start*/ /*记录日志 start*/
$bargain_data = $m_bargain->selectBargainByOrderNo('agent_id,father_id', ['id'=>$this->params['bargain_id']]); $bargain_data = $m_bargain->selectBargainByOrderNo('agent_id,father_id', [ 'id' => $this->params['bargain_id'] ]);
$father_id = $this->params['bargain_id']; $father_id = $this->params['bargain_id'];
if ($bargain_data[0]['father_id'] != 0) { if ($bargain_data[0]['father_id'] != 0) {
$father_id = $bargain_data[0]['father_id']; $father_id = $bargain_data[0]['father_id'];
...@@ -1543,10 +1562,10 @@ class Finance extends Basic ...@@ -1543,10 +1562,10 @@ class Finance extends Basic
$agent_id[1] = $this->params['agent_id']; $agent_id[1] = $this->params['agent_id'];
$m_agent = new AAgents(); $m_agent = new AAgents();
$agent_data = $m_agent->getAgentById('id,name,phone', ['in_id'=>$agent_id]); $agent_data = $m_agent->getAgentById('id,name,phone', [ 'in_id' => $agent_id ]);
$content = '修改成交报告【编号:'.$father_id.'】【分佣方:'.$agent_data[0]['name'].'-'.$agent_data[0]['phone'] $content = '修改成交报告【编号:' . $father_id . '】【分佣方:' . $agent_data[0]['name'] . '-' . $agent_data[0]['phone']
.'修改为:'.$agent_data[1]['name'].'-'.$agent_data[1]['phone'].'】'; . '修改为:' . $agent_data[1]['name'] . '-' . $agent_data[1]['phone'] . '】';
$this->editRecordLog($this->params['bargain_id'], $content); $this->editRecordLog($this->params['bargain_id'], $content);
/*记录日志 end*/ /*记录日志 end*/
...@@ -1561,7 +1580,8 @@ class Finance extends Basic ...@@ -1561,7 +1580,8 @@ class Finance extends Basic
* @throws \think\db\exception\ModelNotFoundException * @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException * @throws \think\exception\DbException
*/ */
public function backOutToOne() { public function backOutToOne()
{
if (empty($this->params['bargain_id'])) { if (empty($this->params['bargain_id'])) {
return $this->response(101, '参数错误'); return $this->response(101, '参数错误');
} }
...@@ -1576,7 +1596,7 @@ class Finance extends Basic ...@@ -1576,7 +1596,7 @@ class Finance extends Basic
$this->updatePerformance($this->params['bargain_id']); $this->updatePerformance($this->params['bargain_id']);
$bargain = new OBargainModel(); $bargain = new OBargainModel();
$bargain_data = $bargain->getBargainDetail('order_id,order_no,agent_id', ['id'=>$this->params['bargain_id']]); $bargain_data = $bargain->getBargainDetail('order_id,order_no,agent_id', [ 'id' => $this->params['bargain_id'] ]);
$financial_data['bargain_id'] = $this->params['bargain_id']; $financial_data['bargain_id'] = $this->params['bargain_id'];
$financial_data['audit_name'] = $this->userName; $financial_data['audit_name'] = $this->userName;
$financial_data['audit_id'] = $this->userId; $financial_data['audit_id'] = $this->userId;
...@@ -1604,7 +1624,8 @@ class Finance extends Basic ...@@ -1604,7 +1624,8 @@ class Finance extends Basic
* @param int $agent_id * @param int $agent_id
* @return bool * @return bool
*/ */
private function updatePerformance(int $bargain_id = 0, int $agent_id = 0) : bool{ private function updatePerformance(int $bargain_id = 0, int $agent_id = 0): bool
{
$where = []; $where = [];
if ($bargain_id) { if ($bargain_id) {
...@@ -1618,7 +1639,7 @@ class Finance extends Basic ...@@ -1618,7 +1639,7 @@ class Finance extends Basic
if (!empty($where)) { if (!empty($where)) {
//获取被修改人信息 //获取被修改人信息
$m_agent = new AAgents(); $m_agent = new AAgents();
$agent_data = $m_agent->agentBargainDetail('a.id,a.store_id,a.district_id,b.create_time', ['b.id'=>$bargain_id]); $agent_data = $m_agent->agentBargainDetail('a.id,a.store_id,a.district_id,b.create_time', [ 'b.id' => $bargain_id ]);
//更新业绩统计 //更新业绩统计
$sum = new ResultsSummaryNewTask(); $sum = new ResultsSummaryNewTask();
......
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