Commit edae7981 authored by zhuwei's avatar zhuwei

编辑

parent 24fce57b
...@@ -119,7 +119,6 @@ class Amercement extends Basic ...@@ -119,7 +119,6 @@ class Amercement extends Basic
} else { } else {
return $this->response("101", "失败"); return $this->response("101", "失败");
} }
} }
...@@ -129,16 +128,17 @@ class Amercement extends Basic ...@@ -129,16 +128,17 @@ class Amercement extends Basic
*/ */
public function editAmercement(){ public function editAmercement(){
$params = $this->params; $params = $this->params;
// $params = array( // $params = array(
// "id" => 1, // "id" => 1,
// "edit_type" => 0,//0编辑 1取消 2转已支付
// ); // );
$checkResult = $this->validate($params, "AmercementValidate.getAmercementInfo"); $checkResult = $this->validate($params, "AmercementValidate.getAmercementInfo");
if (true !== $checkResult) { if (true !== $checkResult) {
return $this->response("101", $checkResult); return $this->response("101", $checkResult);
} }
$this->s_amercement->editAmercement($params['id']);//int(1) $this->s_amercement->editAmercement($params['id'],$params['edit_type']);//int(1)
return $this->response("200", "成功"); return $this->response("200", "成功");
} }
} }
\ No newline at end of file
...@@ -276,21 +276,39 @@ class AmercementService ...@@ -276,21 +276,39 @@ class AmercementService
/** /**
* 更新数据 * 更新数据
* @param $id * @param $id
* @param $edit_type
* @return bool * @return bool
*/ */
public function editAmercement($id) public function editAmercement($id, $edit_type)
{ {
//0编辑 1取消 2转已支付
switch ($edit_type) {
case 0 :
$this->updateAmercement($id);
break;
case 1 :
$this->cancelAmercement($id);
break;
default :
$this->consummationAmercement($id);
}
return true;
}
public function updateAmercement($id)
{
$data = []; $data = [];
if((isset($params['money'])) && ($params['money'] > 0)) if ((isset($params['money'])) && ($params['money'] > 0))
$data['money'] = $params['money']; $data['money'] = $params['money'];
if((isset($params['type'])) && (in_array($params['type'], [0,1]))) if ((isset($params['type'])) && (in_array($params['type'], [ 0, 1 ])))
$data['type'] = $params['type']; $data['type'] = $params['type'];
if((isset($params['remarks'])) && $params['remarks']) if ((isset($params['remarks'])) && $params['remarks'])
$data['social_security_fee'] = $params['social_security_fee']; $data['social_security_fee'] = $params['social_security_fee'];
if(!$data){ if (!$data) {
return false; return false;
} }
...@@ -299,6 +317,25 @@ class AmercementService ...@@ -299,6 +317,25 @@ class AmercementService
return true; return true;
} }
public function cancelAmercement($id)
{
$data = [];
$data['id'] = $id;
$data['status'] = 3;
$this->m_amercement->updateAmercementData($data);
return true;
}
public function consummationAmercement($id)
{
$data = [];
$data['id'] = $id;
$data['status'] = 2;
$this->m_amercement->updateAmercementData($data);
return true;
}
/** /**
* 后台罚款账单表 * 后台罚款账单表
* @param $params * @param $params
......
...@@ -18,6 +18,8 @@ class AmercementValidate extends Validate { ...@@ -18,6 +18,8 @@ class AmercementValidate extends Validate {
'status' => 'require|number|in:0,1,2', 'status' => 'require|number|in:0,1,2',
'amercement_type' => 'require|number|in:0,1', 'amercement_type' => 'require|number|in:0,1',
'id' => 'require|number|gt:0', 'id' => 'require|number|gt:0',
'edit_type' => 'require|number|in:0,1,2',
]; ];
...@@ -50,11 +52,15 @@ class AmercementValidate extends Validate { ...@@ -50,11 +52,15 @@ class AmercementValidate extends Validate {
'id.number' => 'id只能为数字', 'id.number' => 'id只能为数字',
'id.gt' => 'id必须大于0', 'id.gt' => 'id必须大于0',
'edit_type.require' => 'type为必填字段',
'edit_type.number' => 'type只能为数字',
'edit_type.in' => 'type范围错误',
]; ];
protected $scene = [ protected $scene = [
'addAmercement' => [ 'type', 'money', 'agent_id', 'remarks', 'img' ], 'addAmercement' => [ 'type', 'money', 'agent_id', 'remarks', 'img' ],
'getAmercementInfo' => [ 'id' ], 'getAmercementInfo' => [ 'id' ,'edit_type'],
]; ];
} }
\ No newline at end of file
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