Commit b8c6c914 authored by hujun's avatar hujun

随机图片

parent 1d4af662
......@@ -646,13 +646,6 @@ class GHouses extends BaseModel
$save_data['shop_sign'] = $data['shop_sign'];
}
//C端随机图片
if (empty($data['is_show']) && !empty($save_data['shop_sign'])) {
$shop_sign = explode(',', $save_data['shop_sign']);
$image = new ImageDepotService();
$save_data['external_image_id'] = $image->getImage($shop_sign[0]);
}
//物业管理费 金额 存分
if (isset($data['management_fee'])) {
$save_data['management_fee'] = $data['management_fee'] * 100;
......@@ -762,6 +755,14 @@ class GHouses extends BaseModel
if (empty($data['id'])) {
$save_data['upload_id'] = $agent_id; //上传人
$save_data['create_time'] = date('Y-m-d H:i:s');
//C端随机图片
if (empty($data['is_show']) && !empty($save_data['industry_type'])) {
$industry_type = explode(',', $save_data['industry_type']);
$image = new ImageDepotService();
$save_data['external_image_id'] = $image->getImage($industry_type[0]);
}
$house_id = $this->insertGetId($save_data);
} else {
//操作人
......@@ -769,9 +770,23 @@ class GHouses extends BaseModel
$save_data['operation_id'] = $data['user_id'];
}
$save_data['update_time'] = date('Y-m-d H:i:s');
$this->where('id', $data['id'])->update($save_data);
$house_id = $data['id'];
try {
$house_data = $this->field('id,external_image_id')->where('id', $data['id'])->find();
//C端随机图片
if (empty($data['is_show']) && !empty($save_data['industry_type']) && empty($house_data['external_image_id'])) {
$industry_type = explode(',', $save_data['industry_type']);
$image = new ImageDepotService();
$save_data['external_image_id'] = $image->getImage($industry_type[0]);
}
$save_data['update_time'] = date('Y-m-d H:i:s');
$this->where('id', $data['id'])->update($save_data);
$house_id = $data['id'];
} catch (\Exception $e) {
$house_id = 0;
}
}
return $house_id;
......@@ -1367,12 +1382,6 @@ class GHouses extends BaseModel
$shop_sign[$k] = '百货超市';
}
}
//C端随机图片
if (empty($data['is_show']) && !empty($params['shop_sign'])) {
$image = new ImageDepotService();
$params['external_image_id'] = $image->getImage($shop_sign[0]);
}
}
$params['shop_sign'] = implode(',', $shop_sign);
......@@ -1380,12 +1389,29 @@ class GHouses extends BaseModel
//新增或编辑
if (empty($params['id'])) {
$params['upload_id'] = $agent_id;
//C端随机图片
if (empty($data['is_show']) && !empty($params['industry_type'])) {
$industry_type = explode(',', $params['industry_type']);
$image = new ImageDepotService();
$params['external_image_id'] = $image->getImage($industry_type[0]);
}
$this->allowField(true)->save($params);
$house_id = $this->id;
$result['house_id'] = $this->id;
$result['internal_title'] = $params['internal_title'];
} else {
$house_data = $this->field('id,internal_title,residue_num,total')->where('id', $params['id'])->where('status', '<>', 3)->find();
$house_data = $this->field('id,internal_title,residue_num,total,external_image_id')->where('id', $params['id'])->where('status', '<>', 3)->find();
//C端随机图片
if (empty($data['is_show']) && !empty($save_data['industry_type']) && empty($house_data['external_image_id'])) {
$industry_type = explode(',', $save_data['industry_type']);
$image = new ImageDepotService();
$save_data['external_image_id'] = $image->getImage($industry_type[0]);
}
if (!empty($house_data['id'])) {
$params['operation_id'] = $params['userId'];
$this->allowField(true)->isUpdate(true)->save($params, [ 'id' => $params['id'] ]);
......
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