Commit 5b285d12 authored by zhuwei's avatar zhuwei

delAmercementImage

parent 9c9fa37b
......@@ -143,4 +143,19 @@ class Amercement extends Basic
}
/**
* 删除图片
* @return \think\Response
*/
public function delAmercementImage(){
$params = $this->params;
$checkResult = $this->validate($params, "AmercementValidate.delAmercementImage");
if (true !== $checkResult) {
return $this->response("101", $checkResult);
}
$res = $this->s_amercement->delAmercementImage($params['id']);//int(1)
return $this->response("200", "成功",['data'=>$res]);
}
}
\ No newline at end of file
......@@ -188,7 +188,7 @@ class AmercementService
* @param $agent_id
* @param $page_no
* @param $page_size
* @return false|\PDOStatement|string|\think\Collection
* @return array|false|\PDOStatement|string|\think\Collection
*/
public function getAmercementList($status,$amercement_type,$agent_id, $page_no, $page_size)
{
......@@ -201,6 +201,10 @@ class AmercementService
}
$condition ['status']= $status;
$result = $this->m_amercement->getAmercementList($condition, $field, $page_no, $page_size);
if(!$result){
return [];
}
$redis_cache = new RedisCacheService();
foreach ($result as $key => $val) {
......@@ -581,5 +585,17 @@ class AmercementService
}
/**
* 删除图片
* @param $id
* @return int|string
*/
public function delAmercementImage($id){
$params_['status'] = 1;
$res = $this->m_amercement_img->updateImage($id,$params_);//int(1)
return $res;
}
}
\ No newline at end of file
......@@ -59,9 +59,10 @@ class AmercementValidate extends Validate {
];
protected $scene = [
'addAmercement' => [ 'type', 'money', 'agent_id', 'remarks', 'img' ],
'getAmercementInfo' => [ 'id' ],
'editAmercement' => [ 'id', 'edit_type' ],
'addAmercement' => [ 'type', 'money', 'agent_id', 'remarks', 'img' ],
'getAmercementInfo' => [ 'id' ],
'editAmercement' => [ 'id', 'edit_type' ],
'delAmercementImage' => [ 'id' ],
];
}
\ No newline at end of file
......@@ -36,5 +36,20 @@ class OAmercementImgModel extends Model
}
/**
* 更新数据
* @param $id
* @param $params
* @return int|string
*/
public function updateImage($id,$params)
{
$result = $this->db_
->where('id', $id)
->update($params);
return $result;
}
}
......@@ -590,6 +590,7 @@ Route::group('index', [
'getAmercementListExcel' => [ 'index/Amercement/getAmercementListExcel', [ 'method' => 'GET|POST' ] ],
'getAmercementInfo' => [ 'index/Amercement/getAmercementInfo', [ 'method' => 'GET|POST' ] ],
'editAmercement' => [ 'index/Amercement/editAmercement', [ 'method' => 'GET|POST' ] ],
'delAmercementImage' => [ 'index/Amercement/delAmercementImage', [ '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