Commit 48d40704 authored by clone's avatar clone

1

parent d85f113b
<?php
namespace app\api_broker\controller;
/**
* Created by PhpStorm.
......@@ -17,6 +18,7 @@ use think\Request;
class Amercement extends Basic
{
protected $s_amercement;
public function __construct($request = null)
{
parent::__construct($request);
......@@ -28,27 +30,28 @@ class Amercement extends Basic
* @return \think\Response
* http://showdoc.tonglianjituan.com/index.php?s=/1&page_id=918
*/
public function addAmercement(){
public function addAmercement()
{
$params = $this->params;
/* $params = array(
"type" => 1,
"money" => 200,
"agent_id" => 5776,
"remarks" => '理由',
"img" => '["20190902\\/20190902161242125.jpg","20190902\\/201909021612421258499.jpg"]',
);*/
/* $params = array(
"type" => 1,
"money" => 200,
"agent_id" => 5776,
"remarks" => '理由',
"img" => '["20190902\\/20190902161242125.jpg","20190902\\/201909021612421258499.jpg"]',
);*/
$checkResult = $this->validate($params, "AmercementValidate.addAmercement");
if (true !== $checkResult) {
return $this->response("101", $checkResult);
}
$vip = new VipService();//0:有权限 1:无权限
$vip = new VipService();//0:有权限 1:无权限
$is_can_edit = $vip->checkRule($this->agentId, 'addAmercement');
if($is_can_edit == 1){
if ($is_can_edit == 1) {
return $this->response("101", "暂无权限");
}
$father_id = $this->s_amercement->addAmercement($params,$this->agentId);//int(1)
$father_id = $this->s_amercement->addAmercement($params, $this->agentId);//int(1)
if ($father_id) {
if (isset($params['img']) && !empty($params['img'])) {
$this->s_amercement->addAmercementImg($params['img'], $father_id);
......@@ -64,9 +67,10 @@ class Amercement extends Basic
* 获取类型
* @return \think\Response
*/
public function getAmercementType(){
public function getAmercementType()
{
$res = $this->s_amercement->getAmercementType();
return $this->response("200", "成功",$res);
return $this->response("200", "成功", $res);
}
......@@ -74,7 +78,8 @@ class Amercement extends Basic
* 罚款账单
* @return \think\Response
*/
public function getAmercementList(){
public function getAmercementList()
{
$params = $this->params;
// $params = array(
......@@ -87,14 +92,48 @@ class Amercement extends Basic
return $this->response("300", $checkResult);
}
$page_no = empty($params["page_no"]) ? 1 : $params["page_no"];
$page_size = empty($params["page_size"]) ? 15 : $params["page_size"];
$page_no = empty($params["page_no"]) ? 1 : $params["page_no"];
$page_size = empty($params["page_size"]) ? 15 : $params["page_size"];
$status = $params['status'];
$status = $params['status'];
$amercement_type = $params['amercement_type'];//0我需要支付的 1我提交的
$result = $this->s_amercement->getAmercementList($status,$amercement_type,$params['agent_id'], $page_no, $page_size);//int(1)
return $this->response("200", "成功",$result);
$result = $this->s_amercement->getAmercementList($status, $amercement_type, $params['agent_id'], $page_no, $page_size);//int(1)
return $this->response("200", "成功", $result);
}
public function savePayAmercement()
{
$params = $this->params;
/* $params = array(
"amercement_id" => 11,
"trade_no" => "12323123123",
"pay_type" => 1,//支付类型 1支付宝 2微信
"status" => 0,
"remark" => "qweqweqweqwe",
"pay_money" => 111,
"pay_time" => 111,
);*/
$checkResult = $this->validate($params, "AmercementValidate.savePayAmercement");
if (true !== $checkResult) {
return $this->response("101", $checkResult);
}
$amercement_id = $params["amercement_id"];
$trade_no = $params["trade_no"];
$pay_type = $params["pay_type"];//支付类型 1支付宝 2微信
$status = $params["status"];
$remark = $params["remark"];
$pay_money = $params["pay_money"];
$pay_time = $params["pay_time"];
$result = $this->s_amercement->savePayAmercement($amercement_id, $trade_no, $pay_type, $status, $remark, $pay_money, $pay_time);
if ($result) {
return $this->response("200", "成功", $result);
} else {
return $this->response("101", "保存失败,请求异常");
}
}
......
<?php
namespace app\api_broker\validate;
use think\Validate;
/**
......@@ -8,15 +10,22 @@ use think\Validate;
* Date: 2019-09-02
* Time: 16:27:00
*/
class AmercementValidate extends Validate{
class AmercementValidate extends Validate
{
protected $rule = [
'type' => 'require|number|in:0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17',
'money' => 'require|number|gt:0',
'agent_id' => 'require|number|gt:0',
'remarks' => 'require',
'status' => 'require|number|in:0,1,2',
'amercement_type' => 'require|number|in:0,1',
'type' => 'require|number|in:0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17',
'money' => 'require|number|gt:0',
'agent_id' => 'require|number|gt:0',
'remarks' => 'require',
'status' => 'require|number|in:0,1,2',
'amercement_type' => 'require|number|in:0,1',
'amercement_id' => 'require|number',
'trade_no' => 'require',
'pay_type' => 'require|number|in:1,2',
'pay_money' => 'require|number|gt:0',
'pay_time' => 'require',
];
......@@ -44,10 +53,26 @@ class AmercementValidate extends Validate{
'amercement_type.number' => 'amercement_type只能为数字',
'amercement_type.in' => 'amercement_type范围错误',
'amercement_id.require' => 'amercement_id为必填字段',
'amercement_id.number' => 'amercement_id只能为数字',
'trade_no.require' => 'trade_no只能为数字',
'pay_type.require' => 'pay_type为必填字段',
'pay_type.number' => 'pay_type只能为数字',
'pay_type.in' => 'pay_type范围错误',
'pay_money.require' => 'pay_money为必填字段',
'pay_money.number' => 'pay_money只能为数字',
'pay_money.gt' => 'pay_money必须大于0',
'pay_time.require' => 'pay_time为必填字段',
];
protected $scene = [
'addAmercement' => [ 'type', 'money', 'agent_id', 'remarks'],
'getAmercementList' => [ 'agent_id', 'status', 'amercement_type'],
'addAmercement' => ['type', 'money', 'agent_id', 'remarks'],
'getAmercementList' => ['agent_id', 'status', 'amercement_type'],
'savePayAmercement' => ['amercement_id', 'trade_no', 'pay_type', 'pay_money', 'pay_time'],
];
}
......@@ -26,7 +26,7 @@ class AmercementService
public function __construct()
{
$this->m_amercement = new OAmercementModel();
$this->m_amercement = new OAmercementModel();
$this->m_amercement_img = new OAmercementImgModel();
if (CURRENT_URL == 'https://api.tonglianjituan.com/') {
......@@ -43,23 +43,23 @@ class AmercementService
public function getAmercementType()
{
return [
['id'=>'1','name'=>'班主任早会监督'],
['id'=>'2','name'=>'晚会表监督'],
['id'=>'3','name'=>'学习视频监督'],
['id'=>'4','name'=>'投诉'],
['id'=>'5','name'=>'日报'],
['id'=>'6','name'=>'房源上架'],
['id'=>'7','name'=>'视频审核'],
['id'=>'8','name'=>'商学院评论'],
['id'=>'9','name'=>'弟子班自律'],
['id'=>'10','name'=>'弟子班心得评论'],
['id'=>'11','name'=>'将帅赢心得评论'],
['id'=>'12','name'=>'各项会议处罚机制'],
['id'=>'13','name'=>'五星好评'],
['id'=>'14','name'=>'投诉暂扣'],
['id'=>'15','name'=>'独家协议'],
['id'=>'16','name'=>'其他处罚'],
];
['id' => '1', 'name' => '班主任早会监督'],
['id' => '2', 'name' => '晚会表监督'],
['id' => '3', 'name' => '学习视频监督'],
['id' => '4', 'name' => '投诉'],
['id' => '5', 'name' => '日报'],
['id' => '6', 'name' => '房源上架'],
['id' => '7', 'name' => '视频审核'],
['id' => '8', 'name' => '商学院评论'],
['id' => '9', 'name' => '弟子班自律'],
['id' => '10', 'name' => '弟子班心得评论'],
['id' => '11', 'name' => '将帅赢心得评论'],
['id' => '12', 'name' => '各项会议处罚机制'],
['id' => '13', 'name' => '五星好评'],
['id' => '14', 'name' => '投诉暂扣'],
['id' => '15', 'name' => '独家协议'],
['id' => '16', 'name' => '其他处罚'],
];
}
public function getTypeName($type)
......@@ -136,6 +136,7 @@ class AmercementService
}
return $str;
}
/**
* 新增
*
......@@ -143,15 +144,15 @@ class AmercementService
* @param $submit_agent_id
* @return int|string
*/
public function addAmercement($params,$submit_agent_id)
public function addAmercement($params, $submit_agent_id)
{
$params_['status'] = 0;//'状态 0待支付 1已支付 2已取消'
$params_['type'] = $params['type'];//'罚款类型
$params_['money'] = $params['money'];//罚款金额
$params_['status'] = 0;//'状态 0待支付 1已支付 2已取消'
$params_['type'] = $params['type'];//'罚款类型
$params_['money'] = $params['money'];//罚款金额
$params_['submit_agent_id'] = $submit_agent_id;//提交人
$params_['agent_id'] = $params['agent_id'];//被罚款人
$params_['remarks'] = $params['remarks'];//备注
$id = $this->m_amercement->saveAmercement($params_);
$params_['agent_id'] = $params['agent_id'];//被罚款人
$params_['remarks'] = $params['remarks'];//备注
$id = $this->m_amercement->saveAmercement($params_);
$push = new PushMessageService();
$push->pushAmercementMessage($params['agent_id'], $id, $submit_agent_id); //推送
......@@ -164,16 +165,17 @@ class AmercementService
* @param $father_id
* @return bool
*/
public function addAmercementImg($img_info,$father_id){
if(!$img_info)
public function addAmercementImg($img_info, $father_id)
{
if (!$img_info)
return false;
$sublet_img = json_decode($img_info, true);
if(!$sublet_img)
if (!$sublet_img)
return false;
foreach ($sublet_img as $k=>$v){
$insert=[];
$insert["file_name"] = $v;
foreach ($sublet_img as $k => $v) {
$insert = [];
$insert["file_name"] = $v;
$insert["amercement_id"] = $father_id;
$this->m_amercement_img->saveAmercementImg($insert);
}
......@@ -190,18 +192,18 @@ class AmercementService
* @param $page_size
* @return array|false|\PDOStatement|string|\think\Collection
*/
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";
$field = "id,status,type,money,submit_agent_id,agent_id,remarks,create_time,forfeit_penalty,money_sum";
$condition = [];
if($amercement_type == 0){
$condition ['agent_id']= $agent_id;
}else{
$condition ['submit_agent_id']= $agent_id;
if ($amercement_type == 0) {
$condition ['agent_id'] = $agent_id;
} else {
$condition ['submit_agent_id'] = $agent_id;
}
$condition ['status']= $status;
$result = $this->m_amercement->getAmercementList($condition, $field, $page_no, $page_size);
if(!$result){
$condition ['status'] = $status;
$result = $this->m_amercement->getAmercementList($condition, $field, $page_no, $page_size);
if (!$result) {
return [];
}
......@@ -210,19 +212,19 @@ class AmercementService
foreach ($result as $key => $val) {
$result[$key]['type_name'] = $this->getTypeName($val['type']);
$agent_data = $redis_cache->getRedisCache(2, $val['submit_agent_id']);
$result[$key]['submit_agent_name'] = $agent_data['name'];
$result[$key]['submit_agent_phone'] = $agent_data['phone'];
$result[$key]['type_name'] = $this->getTypeName($val['type']);
$agent_data = $redis_cache->getRedisCache(2, $val['submit_agent_id']);
$result[$key]['submit_agent_name'] = $agent_data['name'];
$result[$key]['submit_agent_phone'] = $agent_data['phone'];
if($status == 0){//待支付
$now_time = date("Y-m-d H:i:s", time());
$forfeit_penalty = $this->updateForfeitPenalty($val['id'],$val['create_time'],$now_time,$val['money']);
if ($status == 0) {//待支付
$now_time = date("Y-m-d H:i:s", time());
$forfeit_penalty = $this->updateForfeitPenalty($val['id'], $val['create_time'], $now_time, $val['money']);
$result[$key]['forfeit_penalty'] = $forfeit_penalty;//滞纳金
$money_sum = $forfeit_penalty + $result[$key]['money'];
$money_sum = $forfeit_penalty + $result[$key]['money'];
$result[$key]['money_sum'] = $money_sum;//罚款总金额
$this->updateAmercement($val['id'],['money_sum'=>$money_sum]);
$this->updateAmercement($val['id'], ['money_sum' => $money_sum]);
}
$result[$key]['img'] = $this->getAmercementImage($val['id']);
}
......@@ -238,15 +240,15 @@ class AmercementService
* @param $money
* @return int|number
*/
public function updateForfeitPenalty($id,$time,$now_time,$money)
public function updateForfeitPenalty($id, $time, $now_time, $money)
{
$forfeit_penalty = 0;
$num = $this->diffBetweenTwoDays ($time, $now_time);
if(($num > 0) && ($money > 0)){
$num = $this->diffBetweenTwoDays($time, $now_time);
if (($num > 0) && ($money > 0)) {
$money_every_day = $money * 0.2;
$forfeit_penalty = $num * $money_every_day;
}
$this->updateAmercement($id,['forfeit_penalty'=>$forfeit_penalty]);
$this->updateAmercement($id, ['forfeit_penalty' => $forfeit_penalty]);
return $forfeit_penalty;
}
......@@ -258,8 +260,8 @@ class AmercementService
*/
public function getAmercementImage($id)
{
$where['amercement_id'] = $id;
$img_data = $this->m_amercement_img->getListAll('id,file_name', $where);
$where['amercement_id'] = $id;
$img_data = $this->m_amercement_img->getListAll('id,file_name', $where);
if ($img_data) {
foreach ($img_data as $k => $v) {
$img_data[$k]['image_path'] = $this->internet_path . $v['file_name'];
......@@ -270,30 +272,30 @@ class AmercementService
public function getAmercementInfo($id)
{
$conditions =[];
$conditions = [];
$conditions["id"] = $id;
$field = "id,status,type,money,submit_agent_id,agent_id,remarks,create_time,
$field = "id,status,type,money,submit_agent_id,agent_id,remarks,create_time,
operation_id,operation_time,forfeit_penalty,money_sum";
$result = $this->m_amercement->getAmercementInfo($conditions, $field);
if(!$result){
if (!$result) {
return false;
}
$redis_cache = new RedisCacheService();
$result['type_name'] = $this->getTypeName($result['type']);
$result['status_name'] = $this->getStatusName($result['status']);
$agent_data = $redis_cache->getRedisCache(2, $result['submit_agent_id']);
$redis_cache = new RedisCacheService();
$result['type_name'] = $this->getTypeName($result['type']);
$result['status_name'] = $this->getStatusName($result['status']);
$agent_data = $redis_cache->getRedisCache(2, $result['submit_agent_id']);
$result['submit_agent_name'] = $agent_data['name'];
$agent_data = $redis_cache->getRedisCache(2, $result['agent_id']);
$result['agent_name'] = $agent_data['name'];
$agent_data = $redis_cache->getRedisCache(2, $result['agent_id']);
$result['agent_name'] = $agent_data['name'];
if ($result['status'] == 1) {//已支付
$result['pay_time'] = '';
$result['pay_time'] = '';
$result['operation_name'] = '';
if ($result['operation_id']) {
$agent_data = $redis_cache->getRedisCache(2, $result['operation_id']);
$agent_data = $redis_cache->getRedisCache(2, $result['operation_id']);
$result['operation_name'] = $agent_data['name'];
}
}
......@@ -310,17 +312,17 @@ class AmercementService
* @param $operation_id
* @return array
*/
public function editAmercement($id,$params,$edit_type,$operation_id)
public function editAmercement($id, $params, $edit_type, $operation_id)
{
switch ($edit_type) {
case 0 :
//0编辑
$this->updateAmercement($id,$params);
$this->updateAmercement($id, $params);
if(isset($params['img']) && !empty($params['img'])){
if (isset($params['img']) && !empty($params['img'])) {
//处理图片
$result_img = $this->getAmercementImage($id);
if(!$result_img){
if (!$result_img) {
break;
}
$list_img = [];
......@@ -329,9 +331,9 @@ class AmercementService
}
$params_img = json_decode($params['img'], true);
foreach ($params_img as $key => $val) {
if(!in_array($val,$list_img)){
$insert=[];
$insert["file_name"] = $val;
if (!in_array($val, $list_img)) {
$insert = [];
$insert["file_name"] = $val;
$insert["amercement_id"] = $id;
$this->m_amercement_img->saveAmercementImg($insert);
}
......@@ -344,9 +346,9 @@ class AmercementService
break;
default :
//2转已支付
$this->consummationAmercement($id,$operation_id);
$this->consummationAmercement($id, $operation_id);
}
return ['code'=>200,'msg'=>'成功'];
return ['code' => 200, 'msg' => '成功'];
}
/**
......@@ -355,13 +357,13 @@ class AmercementService
* @param $params
* @return bool money_sum
*/
public function updateAmercement($id,$params)
public function updateAmercement($id, $params)
{
$data = [];
if ((isset($params['money'])) && ($params['money'] > 0))
$data['money'] = $params['money'];
if ((isset($params['type'])) && (in_array($params['type'], [ 0, 1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16 ])))
if ((isset($params['type'])) && (in_array($params['type'], [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16])))
$data['type'] = $params['type'];
if ((isset($params['remarks'])) && $params['remarks'])
......@@ -389,8 +391,8 @@ class AmercementService
*/
public function cancelAmercement($id)
{
$data = [];
$data['id'] = $id;
$data = [];
$data['id'] = $id;
$data['status'] = 2;
$this->m_amercement->updateAmercementData($data);
return true;
......@@ -403,12 +405,12 @@ class AmercementService
* @param $operation_id
* @return bool
*/
public function consummationAmercement($id,$operation_id)
public function consummationAmercement($id, $operation_id)
{
$data = [];
$data['id'] = $id;
$data['status'] = 1;
$data['operation_id'] = $operation_id;
$data = [];
$data['id'] = $id;
$data['status'] = 1;
$data['operation_id'] = $operation_id;
$data['operation_time'] = date("Y-m-d H:i:s", time());
$this->m_amercement->updateAmercementData($data);
return true;
......@@ -421,31 +423,31 @@ class AmercementService
* @param $page_size
* @return false|\PDOStatement|string|\think\Collection
*/
public function getAmercementListPc($params,$page_no, $page_size)
public function getAmercementListPc($params, $page_no, $page_size)
{
$conditions = $this->buildConditions($params);
$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);
$conditions = $this->buildConditions($params);
$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);
$redis_cache = new RedisCacheService();
foreach ($result as $key => $val) {
if($val['status'] == 0){
$now_time = date("Y-m-d H:i:s", time());
$forfeit_penalty = $this->updateForfeitPenalty($val['id'],$val['create_time'],$now_time,$val['money']);
if ($val['status'] == 0) {
$now_time = date("Y-m-d H:i:s", time());
$forfeit_penalty = $this->updateForfeitPenalty($val['id'], $val['create_time'], $now_time, $val['money']);
$result[$key]['forfeit_penalty'] = $forfeit_penalty;
$money_sum = $forfeit_penalty + $val['money'];
$money_sum = $forfeit_penalty + $val['money'];
$result[$key]['money_sum'] = $money_sum;//罚款总金额
$this->updateAmercement($val['id'],['money_sum'=>$money_sum]);
$this->updateAmercement($val['id'], ['money_sum' => $money_sum]);
}
$result[$key]['type_name'] = $this->getTypeName($val['type']);
$result[$key]['type_name'] = $this->getTypeName($val['type']);
$result[$key]['status_name'] = $this->getStatusName($val['status']);
$agent_data = $redis_cache->getRedisCache(2, $val['submit_agent_id']);
$result[$key]['submit_agent_name'] = $agent_data['name'];
$agent_data = $redis_cache->getRedisCache(2, $val['submit_agent_id']);
$result[$key]['submit_agent_name'] = $agent_data['name'];
$agent_data = $redis_cache->getRedisCache(2, $val['agent_id']);
$result[$key]['agent_name'] = $agent_data['name'];
$agent_data = $redis_cache->getRedisCache(2, $val['agent_id']);
$result[$key]['agent_name'] = $agent_data['name'];
$result[$key]['money_sum'] = $result[$key]['forfeit_penalty'] + $val['money'];//罚款总金额
}
......@@ -462,28 +464,28 @@ class AmercementService
*/
public function getAmercementListExcel($params)
{
$conditions=$this->buildConditions($params);
$field = "id,status,type,money,submit_agent_id,agent_id,remarks,create_time,forfeit_penalty";
$result = $this->m_amercement->getAmercementListExcel($conditions, $field);
$conditions = $this->buildConditions($params);
$field = "id,status,type,money,submit_agent_id,agent_id,remarks,create_time,forfeit_penalty";
$result = $this->m_amercement->getAmercementListExcel($conditions, $field);
$redis_cache = new RedisCacheService();
foreach ($result as $key => $val) {
if($val['status'] == 0){
$now_time = date("Y-m-d H:i:s", time());
$forfeit_penalty = $this->updateForfeitPenalty($val['id'],$val['create_time'],$now_time,$val['money']);
if ($val['status'] == 0) {
$now_time = date("Y-m-d H:i:s", time());
$forfeit_penalty = $this->updateForfeitPenalty($val['id'], $val['create_time'], $now_time, $val['money']);
$result[$key]['forfeit_penalty'] = $forfeit_penalty;
}
$result[$key]['type_name'] = $this->getTypeName($val['type']);
$result[$key]['status_name'] = $this->getStatusName($val['status']);
$agent_data = $redis_cache->getRedisCache(2, $val['submit_agent_id']);
$result[$key]['submit_agent_name'] = $agent_data['name'];
$agent_data = $redis_cache->getRedisCache(2, $val['agent_id']);
$result[$key]['agent_name'] = $agent_data['name'];
$result[$key]['type_name'] = $this->getTypeName($val['type']);
$result[$key]['status_name'] = $this->getStatusName($val['status']);
$agent_data = $redis_cache->getRedisCache(2, $val['submit_agent_id']);
$result[$key]['submit_agent_name'] = $agent_data['name'];
$agent_data = $redis_cache->getRedisCache(2, $val['agent_id']);
$result[$key]['agent_name'] = $agent_data['name'];
$result[$key]['money_sum'] = $result[$key]['forfeit_penalty'] + $val['money'];//罚款总金额
}
$export = new ExportExcelUntil();
$export = new ExportExcelUntil();
$e_data_new = [];
foreach ($result as $key => $v) {
$e_data_old['1'] = $v['id'];
......@@ -495,21 +497,18 @@ class AmercementService
$e_data_old['7'] = $v['status_name'];
$e_data_old['8'] = $v['forfeit_penalty'];
$e_data_old['9'] = $v['money_sum'];
$e_data_new[] = $e_data_old;
$e_data_new[] = $e_data_old;
}
$field_num = 9;
$title = [ '罚款ID', '罚款项目', '提交时间', '提交人', '罚款金额', '被罚款人', '状态', '滞纳金','付款金额'];
$title2 = '罚款账单表';
$title = ['罚款ID', '罚款项目', '提交时间', '提交人', '罚款金额', '被罚款人', '状态', '滞纳金', '付款金额'];
$title2 = '罚款账单表';
$export->exportTable('罚款账单表', $e_data_new, $field_num, $title2, $title);
return '';
}
/**
* 构建搜索条件
* @param $params
......@@ -534,26 +533,25 @@ class AmercementService
}
//罚款ID
if (isset($params['id'])&& is_numeric($params["id"])) {
if (isset($params['id']) && is_numeric($params["id"])) {
$conditions["id"] = $params["id"];
}
//提交人姓名
if (!empty($params['submit_name'])) {
$user_id_str = $this->getAgentIDList($params['submit_name']);
$user_id_str = $this->getAgentIDList($params['submit_name']);
$conditions['submit_agent_id'] = ['in', $user_id_str];
}
//被罚款人姓名
if (!empty($params['name'])) {
$user_id_str = $this->getAgentIDList($params['name']);
$user_id_str = $this->getAgentIDList($params['name']);
$conditions['agent_id'] = ['in', $user_id_str];
}
return $conditions;
}
/**
* 求两个日期之间相差的天数
* (针对1970年1月1日之后,求之前可以采用泰勒公式)
......@@ -561,13 +559,13 @@ class AmercementService
* @param string $day2
* @return number
*/
function diffBetweenTwoDays ($day1, $day2)
function diffBetweenTwoDays($day1, $day2)
{
$second1 = strtotime($day1);
$second2 = strtotime($day2);
if ($second1 < $second2) {
$tmp = $second2;
$tmp = $second2;
$second2 = $second1;
$second1 = $tmp;
}
......@@ -583,11 +581,11 @@ class AmercementService
public function getAgentIDList($name)
{
//查询总监下面门店的所有经纪人
$params = [];
$params['name'] = [ 'LIKE', '%' . $name . '%' ];
$m_agent = new AAgents();
$field = 'id';
$res = $m_agent->getStoreIdByAgentId($field, $params);
$params = [];
$params['name'] = ['LIKE', '%' . $name . '%'];
$m_agent = new AAgents();
$field = 'id';
$res = $m_agent->getStoreIdByAgentId($field, $params);
$user_id_str = "";
if (count($res) > 0) {
......@@ -606,12 +604,27 @@ class AmercementService
* @param $id
* @return int|string
*/
public function delAmercementImage($id){
public function delAmercementImage($id)
{
$params_['status'] = 1;
$res = $this->m_amercement_img->updateImage($id,$params_);//int(1)
$res = $this->m_amercement_img->updateImage($id, $params_);//int(1)
return $res;
}
public function savePayAmercement($amercement_id, $trade_no, $pay_type, $status, $remark, $pay_money, $pay_time)
{
//todo 判断是否有支付过
$arr["amercement_id"] = $amercement_id;
$arr["trade_no"] = $trade_no;
$arr["pay_type"] = $pay_type;
$arr["status"] = $status;
$arr["remark"] = $remark;
$arr["pay_money"] = $pay_money;
$arr["pay_time"] = $pay_time;
}
}
\ No newline at end of file
......@@ -815,6 +815,8 @@ Route::group('task', [
'delAgentUserLog' => ['task/AgentLookUserTask/delAgentUserLog', ['method' => 'get']], //清理经纪人看客户记录
'selectDailyUncommitted' => ['task/DailyUncommittedTask/selectDailyUncommitted', ['method' => 'get']], //未提交财务日报的门店
'saveLookUser' => ['task/SaveLookUserHistoryTask/saveLookUser', ['method' => 'get']], //保存经纪人看客户的记录
]);
Route::group('broker', [
......
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