Commit 94b4b793 authored by zhuwei's avatar zhuwei

更新数据

parent 059a7bf6
......@@ -304,7 +304,6 @@ class AmercementService
/**
* 更新数据
* @param $agent_id
* @param $id
* @param $params
* @param $edit_type
......@@ -315,27 +314,27 @@ class AmercementService
{
switch ($edit_type) {
case 0 :
if(isset($params['img']) && empty($params['img'])){
return ['code'=>200,'msg'=>'图片至少一张'];
}
//0编辑
$this->updateAmercement($id,$params);
//处理图片
$result_img = $this->getAmercementImage($id);
if(!$result_img){
break;
}
$list_img = [];
foreach ($result_img as $key => $val) {
$list_img[] = $val['file_name'];
}
$params_img = json_decode($params['img'], true);
foreach ($params_img as $key => $val) {
if(!in_array($val,$list_img)){
$insert=[];
$insert["file_name"] = $val;
$insert["amercement_id"] = $id;
$this->m_amercement_img->saveAmercementImg($insert);
if(isset($params['img']) && !empty($params['img'])){
//处理图片
$result_img = $this->getAmercementImage($id);
if(!$result_img){
break;
}
$list_img = [];
foreach ($result_img as $key => $val) {
$list_img[] = $val['file_name'];
}
$params_img = json_decode($params['img'], true);
foreach ($params_img as $key => $val) {
if(!in_array($val,$list_img)){
$insert=[];
$insert["file_name"] = $val;
$insert["amercement_id"] = $id;
$this->m_amercement_img->saveAmercementImg($insert);
}
}
}
break;
......
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