Commit f283bf83 authored by hujun's avatar hujun

独家附件

parent 93f45068
<?php
/**
* Created by PhpStorm.
* User: fuju
* Date: 2018/9/4
* Time: 13:29
*/
namespace app\model;
use think\Db;
class GHouseFile extends BaseModel
{
protected $table = 'g_house_file';
private $db_;
public function __construct()
{
$this->db_ = Db::name($this->table);
}
/**
* @param $field
* @param $where
* @return bool|false|\PDOStatement|string|\think\Collection
*/
public function getHouseFileAll($field, $where) {
try {
$data = $this->field($field)
->where($where)
->select();
} catch (\Exception $e) {
$data = false;
}
return $data;
}
}
\ No newline at end of file
......@@ -798,6 +798,31 @@ class GHouses extends BaseModel
$agents = new GHousesToAgents();
$agents->addAgents($data['exclusive_id'], $house_id, 3);
//新增附件
if (isset($data['exclusive_file'])) {
$exclusive_file_arr = explode(',', $data['exclusive_file']);
$m_house_file = new GHouseFile();
foreach ($exclusive_file_arr as $k=>$v) {
$save_data['file_name'] = $v;
$save_data['house_id'] = $house_id;
$save_data['type'] = 0;
$save_data['status'] = 0;
$m_house_file->editData($save_data);
}
}
//伪删除附件
if (isset($data['del_file_id'])) {
$file_id_arr = explode(',', $data['del_file_id']);
$m_house_file = new GHouseFile();
foreach ($file_id_arr as $k=>$v) {
$save_data['id'] = $v;
$save_data['status'] = 1;
$m_house_file->editData($save_data);
}
}
}
if ($result == 1 || $ext_result == 1) {
......@@ -846,6 +871,18 @@ class GHouses extends BaseModel
$return['agent_end_time'] = $house_ext['agent_end_time'];
$return['exclusive_img'] = $img;
$return['is_exclusive_type'] = $result['is_exclusive_type'];
$m_house_file = new GHouseFile();
$house_file_where['house_id'] = $houses_id;
$house_file_where['status'] = 0;
$exclusive_file = $m_house_file->getHouseFileAll('id,file_name', $house_file_where);
if ($exclusive_file) {
$return['exclusive_file'] = $exclusive_file;
} else {
$return['exclusive_file'] = [];
}
} else {
$return = false;
}
......@@ -872,17 +909,19 @@ class GHouses extends BaseModel
/******zw start ************/
/**
* 查询商铺列表
*
* @param int $pageNo
* @param int $pageSize
* @param string $order_
* @param $field
* @param $params
* @param $spTagsArr
* @return mixed
* @return false|\PDOStatement|string|\think\Collection
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException
*/
function getHousesList($pageNo = 1, $pageSize = 15, $order_ = 'id desc', $field, $params, $spTagsArr)
{
......
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