Commit 46572527 authored by zhuwei's avatar zhuwei

1

parent ad803d17
......@@ -62,4 +62,34 @@ class Amercement extends Basic
}
public function getAmercementList(){
$params = $this->params;
$params = array(
"type" => 1,
"agent_id" => 5776,
"status" => 0,
"amercement_type" => 0,
);
// $checkResult = $this->validate($params, "AmercementValidate.addAmercement");
// if (true !== $checkResult) {
// 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"];
$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)
if ($result) {
return $this->response("200", "成功",$result);
} else {
return $this->response("101", "失败");
}
}
}
\ No newline at end of file
......@@ -48,4 +48,6 @@ class Amercement extends Basic
return $this->response("101", "失败");
}
}
}
\ No newline at end of file
......@@ -23,13 +23,19 @@ class AmercementService
{
$this->m_amercement = new OAmercementModel();
$this->m_amercement_img = new OAmercementImgModel();
if (CURRENT_URL == 'https://api.tonglianjituan.com/') {
$this->internet_path = IMAGES_URL . '/static/amercement_img/';
} else {
$this->internet_path = 'http://pre2.tonglianjituan.com/static/amercement_img/';
}
}
/**
* 类型
* @return array
*/
public function getAmercementType()
public function getAmercementType()
{
return [
['id'=>'1','name'=>'班主任早会监督'],
......@@ -96,5 +102,61 @@ class AmercementService
}
/**
* 罚款账单
* @param $status
* @param $amercement_type
* @param $agent_id
* @param $page_no
* @param $page_size
* @return false|\PDOStatement|string|\think\Collection
*/
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";
$condition = [];
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);
foreach ($result as $key => $val) {
if($status == 0){//待支付
$forfeit_penalty = 100;
$result[$key]['forfeit_penalty'] = $forfeit_penalty;//滞纳金
$result[$key]['money_sum'] = $forfeit_penalty + $result[$key]['money'];//罚款总金额
}elseif($status == 1){//已支付
$forfeit_penalty = 100;
$result[$key]['forfeit_penalty'] = $forfeit_penalty;
$result[$key]['money_sum'] = $forfeit_penalty + $result[$key]['money'];
$result[$key]['pay_time'] = '';
}
$result[$key]['img'] = $this->getAmercementImage($val['id']);
}
return $result;
}
/**
* 罚款图片
* @param $id
* @return false|null|\PDOStatement|string|\think\Collection
*/
public function getAmercementImage($id)
{
$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'];
}
}
return $img_data ? $img_data : null;
}
}
\ No newline at end of file
......@@ -25,6 +25,16 @@ class OAmercementImgModel extends Model
return $this->db_ ->insert($data);
}
public function getListAll($field, $where)
{
if (!isset($params['status'])) {
$where['status'] = 0;
}
return $this->db_->field($field)
->where($where)
->select();
}
}
......@@ -25,4 +25,16 @@ class OAmercementModel extends Model
return $this->db_->insertGetId($data);
}
public function getAmercementList($params, $field, $page_no, $page_size)
{
$result = $this->db_
->field($field)
->where($params)
->limit($page_size)
->page($page_no)
->order('id desc')
->select();
return $result;
}
}
......@@ -1075,8 +1075,9 @@ Route::group('broker', [
'subletList' => ['api_broker/Sublet/subletList', ['method' => 'GET']],//委托转铺列表
'getUserLookShopList' => ['api_broker/Shop/getUserLookShopList', ['method' => 'GET']],//获取客户浏览商铺数据
'addAmercement' => ['api_broker/Amercement/addAmercement', ['method' => 'GET|POST']],
'getAmercementType' => ['api_broker/Amercement/getAmercementType', ['method' => 'GET|POST']],
'addAmercement' => [ 'api_broker/Amercement/addAmercement', [ 'method' => 'GET|POST' ] ],
'getAmercementType' => [ 'api_broker/Amercement/getAmercementType', [ 'method' => 'GET|POST' ] ],
'getAmercementList' => [ 'api_broker/Amercement/getAmercementList', [ 'method' => 'GET|POST' ] ],
]);
......
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