Commit 536fc953 authored by zhuwei's avatar zhuwei

将已支付罚款状态改掉

parent c658313b
...@@ -5,6 +5,7 @@ namespace app\index\controller; ...@@ -5,6 +5,7 @@ namespace app\index\controller;
use app\index\extend\Basic; use app\index\extend\Basic;
use app\index\service\PositionService; use app\index\service\PositionService;
use app\index\service\UserCallStintService; use app\index\service\UserCallStintService;
use app\model\AAgents;
use app\model\GImageDepot; use app\model\GImageDepot;
/** /**
...@@ -180,9 +181,29 @@ class ImageDepot extends Basic ...@@ -180,9 +181,29 @@ class ImageDepot extends Basic
public function ceshi() public function ceshi()
{ {
$predict_see_time = strtotime("+2 hour", strtotime('2019-09-20 16:45:16')); $params["district_id"] = 29;
dump(time() < $predict_see_time);
$params["status"] = array('in','0,1,2,3');
$agentModel = new AAgents();
$agentsArr = $agentModel->getAgentsByStoreId($params);
$agentIds = array_column($agentsArr, 'id');
$agentIds = implode(',',$agentIds);
dump($agentIds);
// $agent_total = count($agentsArr);
// $agentIds = "";
// if ($agent_total > 0) {
// foreach ($agentsArr as $key1 => $value1) {
// $agentIds .= $value1["id"] . ",";
// }
// $agentIds = rtrim($agentIds, ",");//经纪人ID集合
// }//查询总监下面门店的所有经纪人 end
//
// dump($agentIds);
} }
......
...@@ -195,7 +195,8 @@ class AmercementService ...@@ -195,7 +195,8 @@ class AmercementService
*/ */
public function getAmercementList($status, $amercement_type, $agent_id, $page_no, $page_size) public function getAmercementList($status, $amercement_type, $agent_id, $page_no, $page_size)
{ {
$field = "id,status,type,money,submit_agent_id,agent_id,remarks,create_time,forfeit_penalty,money_sum"; $this->updateBeforeAmercement();//将已支付罚款状态改掉
$condition = []; $condition = [];
if ($amercement_type == 0) { if ($amercement_type == 0) {
$condition ['agent_id'] = $agent_id; $condition ['agent_id'] = $agent_id;
...@@ -203,7 +204,9 @@ class AmercementService ...@@ -203,7 +204,9 @@ class AmercementService
$condition ['submit_agent_id'] = $agent_id; $condition ['submit_agent_id'] = $agent_id;
} }
$condition ['status'] = $status; $condition ['status'] = $status;
$result = $this->m_amercement->getAmercementList($condition, $field, $page_no, $page_size); $field = "id,status,type,money,submit_agent_id,agent_id,remarks,create_time,forfeit_penalty,money_sum";
$result = $this->m_amercement->getAmercementList($condition, $field, $page_no, $page_size);
if (!$result) { if (!$result) {
return []; return [];
} }
...@@ -211,13 +214,10 @@ class AmercementService ...@@ -211,13 +214,10 @@ class AmercementService
$redis_cache = new RedisCacheService(); $redis_cache = new RedisCacheService();
foreach ($result as $key => $val) { foreach ($result as $key => $val) {
$result[$key]['type_name'] = $this->getTypeName($val['type']); $result[$key]['type_name'] = $this->getTypeName($val['type']);
$agent_data = $redis_cache->getRedisCache(2, $val['submit_agent_id']); $agent_data = $redis_cache->getRedisCache(2, $val['submit_agent_id']);
$result[$key]['submit_agent_name'] = $agent_data['name']; $result[$key]['submit_agent_name'] = $agent_data['name'];
$result[$key]['submit_agent_phone'] = $agent_data['phone']; $result[$key]['submit_agent_phone'] = $agent_data['phone'];
if ($status == 0) {//待支付 if ($status == 0) {//待支付
$now_time = date("Y-m-d H:i:s", time()); $now_time = date("Y-m-d H:i:s", time());
$forfeit_penalty = $this->updateForfeitPenalty($val['id'], $val['create_time'], $now_time, $val['money']); $forfeit_penalty = $this->updateForfeitPenalty($val['id'], $val['create_time'], $now_time, $val['money']);
...@@ -466,6 +466,8 @@ class AmercementService ...@@ -466,6 +466,8 @@ class AmercementService
*/ */
public function getAmercementListPc($params, $page_no, $page_size) public function getAmercementListPc($params, $page_no, $page_size)
{ {
$this->updateBeforeAmercement();//将已支付罚款状态改掉
$conditions = $this->buildConditions($params); $conditions = $this->buildConditions($params);
$field = "id,status,type,money,submit_agent_id,agent_id,remarks,create_time,forfeit_penalty,money_sum"; $field = "id,status,type,money,submit_agent_id,agent_id,remarks,create_time,forfeit_penalty,money_sum";
$result = $this->m_amercement->getAmercementList($conditions, $field, $page_no, $page_size); $result = $this->m_amercement->getAmercementList($conditions, $field, $page_no, $page_size);
...@@ -473,6 +475,7 @@ class AmercementService ...@@ -473,6 +475,7 @@ class AmercementService
foreach ($result as $key => $val) { foreach ($result as $key => $val) {
if ($val['status'] == 0) { if ($val['status'] == 0) {
//计算滞纳金
$now_time = date("Y-m-d H:i:s", time()); $now_time = date("Y-m-d H:i:s", time());
$forfeit_penalty = $this->updateForfeitPenalty($val['id'], $val['create_time'], $now_time, $val['money']); $forfeit_penalty = $this->updateForfeitPenalty($val['id'], $val['create_time'], $now_time, $val['money']);
$result[$key]['forfeit_penalty'] = $forfeit_penalty; $result[$key]['forfeit_penalty'] = $forfeit_penalty;
...@@ -498,6 +501,34 @@ class AmercementService ...@@ -498,6 +501,34 @@ class AmercementService
} }
/**
* 罚款列表前置操作 将已支付罚款状态改掉
* @return bool
*/
public function updateBeforeAmercement()
{
$conditions["status"] = 0;
$field = "id,status";
$result = $this->m_amercement->getAmercementListAll($conditions, $field);
if (!$result) {
return true;
}
foreach ($result as $key => $val) {
//该记录是否已支付
$payInfo = $this->isPay($val['id']);
if ($payInfo) {//已支付
$data = [];
$data['id'] = $val['id'];
$data['status'] = 1;
$data['operation_id'] = 0;
$data['operation_time'] = date("Y-m-d H:i:s", time());
$this->m_amercement->updateAmercementData($data);
}
}
return true;
}
/** /**
* 后台罚款账单表 导出excel * 后台罚款账单表 导出excel
* @param $params * @param $params
...@@ -505,6 +536,7 @@ class AmercementService ...@@ -505,6 +536,7 @@ class AmercementService
*/ */
public function getAmercementListExcel($params) public function getAmercementListExcel($params)
{ {
$this->updateBeforeAmercement();//将已支付罚款状态改掉
$conditions = $this->buildConditions($params); $conditions = $this->buildConditions($params);
$field = "id,status,type,money,submit_agent_id,agent_id,remarks,create_time,forfeit_penalty"; $field = "id,status,type,money,submit_agent_id,agent_id,remarks,create_time,forfeit_penalty";
$result = $this->m_amercement->getAmercementListExcel($conditions, $field); $result = $this->m_amercement->getAmercementListExcel($conditions, $field);
......
...@@ -46,6 +46,22 @@ class OAmercementModel extends Model ...@@ -46,6 +46,22 @@ class OAmercementModel extends Model
return $result; return $result;
} }
/**
* 罚款列表前置操作 将已支付罚款状态改掉
* @param $params
* @param $field
* @return false|\PDOStatement|string|\think\Collection
*/
public function getAmercementListAll($params, $field)
{
$result = $this->db_
->field($field)
->where($params)
->order('id desc')
->select();
return $result;
}
public function getAmercementTotal($params, $field) public function getAmercementTotal($params, $field)
{ {
$result = $this->db_ $result = $this->db_
......
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