Commit 87de2d3e authored by clone's avatar clone

Merge branch 'test' of https://gitee.com/zwyjjc/tl_estate into test

parents 47650b64 a89c33ba
......@@ -395,7 +395,7 @@ class GHouses extends BaseModel
$ext_result = $ext->save($update_data, [ 'house_id' => $data['houses_id'] ]);
$house_img = new GHousesImgs();
$house_img->edit($data, $house_id);
$house_img->editExclusiveImg($data, $house_id);
$agents = new GHousesToAgents();
$agents->addAgents($data['exclusive_id'], $house_id, 3);
......
......@@ -220,4 +220,48 @@ class GHousesImgs extends BaseModel
'img_name' => $data['img_name']
]);
}
/**
* 独家图片新增和编辑
*
* @param $params
* @param $house_id
* @return array|false
* @throws \Exception
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException
*/
public function editExclusiveImg($params, $house_id) {
//编辑图片
$house_img_data = $this->field('id,img_name,img_type')
->where('img_status <> 1 AND img_type = 4 AND house_id = ' . $house_id)->select();
$key = 0;
$house_img_edit = array();
$exclusive_img = $params['exclusive_img'];
foreach ($house_img_data as $k=>$v) {
if ($v->img_type == 4) {
if ($exclusive_img != '') {
foreach ($exclusive_img as $kk => $vv) {
if (in_array($v->img_name,$exclusive_img)) {
$img_key = array_search($v->img_name,$params['exclusive_img']); //根据值查找对应的key
unset($params['exclusive_img'][$img_key]);
} else {
$house_img_edit[$key]['id'] = $v->id;
$house_img_edit[$key]['img_status'] = 1;
$key++;
}
}
} else {
//伪删除全部的独家图片
$house_img_edit[$key]['id'] = $v->id;
$house_img_edit[$key]['img_status'] = 1;
$key++;
}
}
}
$this->add($params, $house_id);
return $this->saveAll($house_img_edit);
}
}
\ No newline at end of file
......@@ -110,12 +110,13 @@ define (['ckfinder','ckfinderStart', 'bootstrapJs'], function () {
_exclusiveTelObj.val(_data['exclusive_name'][i]).attr('data-id',_data['exclusive_name'][i].split('-')[0]);
};
//独家合同
var exclusive_img_str = '';
for(var i in _data['exclusive_img']){
_imgUploadDujia.html('<li><img title="点击查看大图" src="{0}" /><a href="javascript:;" class="delet-pic-btn">删除</a></li>'.stringFormatObj({
exclusive_img_str += '<li><img title="点击查看大图" src="{0}" /><a href="javascript:;" class="delet-pic-btn">删除</a></li>'.stringFormatObj({
'0': _urlCut + _data['exclusive_img'][i]
}));
});
};
_imgUploadDujia.html(exclusive_img_str);
};
//案场人电话
......
......@@ -128,6 +128,7 @@ define (['doT', 'text!temp/house_template_tpl.html', 'css!style/home.css','ckfin
var img_url="";
BrowseServer ('liudan_pic_btn',function(url){
var alt_img=$("#liudan_pic_btn").val();
alt_img = alt_img.replace('images/','');
img_url+=' <img src="'+url+'" class="jai_dujia" data-img="'+alt_img+'">';
$("#liudan_pic_pre").append(img_url);
});
......@@ -171,7 +172,7 @@ define (['doT', 'text!temp/house_template_tpl.html', 'css!style/home.css','ckfin
exclusive_id=data.data.id;
var img_url="";
$.each(data['data']['exclusive_img'], function(i, item) {
var local_img=location.origin+'/resource/lib/Attachments/'+item.img_name;
var local_img=location.origin+'/resource/lib/Attachments/images/'+item.img_name;
img_url +='<img src="'+local_img+'" class="jai_dujia" data-img="'+item.img_name+'" >';
});
$("#liudan_pic_pre").html(img_url);
......
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