Commit a03d0458 authored by hujun's avatar hujun

商铺编辑日志记录

parent 22b30a9b
......@@ -413,7 +413,7 @@ class Houses extends Basic
}
$data['data']['list'] = $this->house->getHouseListDish($pageNo, $pageSize, 'id DESC', $fields, $where, $this->userId);
$data['data']['total'] = $this->house->getHouseListDishTotal($where);
$data['data']['total'] = $this->house->getHouseListTotal($where);
$look_shop = new LookShopService();
......
......@@ -128,14 +128,14 @@ class OperationData extends Basic
}
$where['status'] = array( 'neq', 3 );//排除删除的商铺
// 商铺总量
$house_res = $this->gHousesModel->getHouseNum($where);
$house_res = $this->gHousesModel->getHouseListTotal($where);
$result["house_num"] = $house_res;
// 待租商铺数量
/*$where['residue_num'] = array( 'neq', 0 );
$where['total'] = array( 'neq', 0 );*/
$where['status'] = 1;
$house_res = $this->gHousesModel->getHouseNum($where);
$house_res = $this->gHousesModel->getHouseListTotal($where);
$result["have_not_rent_num"] = $house_res;
return $this->response(200, 'success', $result);
......
......@@ -73,17 +73,65 @@ class HouseService
return $result;
}
$house_id = $this->house->addHouse($data, $agent_id);
if (!empty($data['id'])) {
$house_data = $this->house->getHouseInfo('id,internal_address,internal_title', ['id'=>$data['id']]);
if (empty($house_data[0]['id'])) {
$result['status'] = 'fail';
$result['msg'] = '没有该商铺信息';
return $result;
}
$m_operating = new GOperatingRecords();
$remark = '修改为:剩余铺数'.$data['residue_num'];
if ($data['is_exclusive_type'] == 1) {
$remark .= ',独家有效期 '.$data['agent_start_time'].'—'.$data['agent_end_time'];
}
$m_operating->record($agent_id, 6, $remark, $house_id);
if ($data['internal_title'] != $house_data[0]['internal_title']) {
$remark .= ',商铺名改为:'.$data['internal_title'];
}
if ($data['internal_address'] != $house_data[0]['internal_address']) {
$remark .= ',地址改为:'.$data['internal_address'];
}
$house_ext = new GHousesExt();
$house_data_ext = $house_ext->getInfo('landlord_phone', ['house_id'=>$data['id']]);
if (!empty($house_data_ext['landlord_phone'])) {
$landlord_phone_arr = $landlord_phone_new_arr = $landlord_phone_old = [];
$landlord_phone = json_decode($house_data_ext['landlord_phone'], true);
if ($is_app == 1) {
$landlord_phone_new = json_decode($data['landlord_phone'], true);
} else {
$landlord_phone_new = $data['landlord_phone'];
}
foreach ($landlord_phone as $v) {
$landlord_phone_arr[] = $v['phone'];
}
foreach ($landlord_phone_new as $v2) {
$landlord_phone_new_arr[] = $v2['phone'];
}
foreach ($landlord_phone_arr as $v3) {
if (!empty($v3) && !in_array($v3, $landlord_phone_new_arr)) {
$landlord_phone_old[] = $v3;
}
}
if (!empty($landlord_phone_old)) {
$remark .= ',删除房东手机号:'. implode(',', $landlord_phone_old);
}
}
$m_operating->record($agent_id, 6, $remark, $data['id']);
}
$house_id = $this->house->addHouse($data, $agent_id);
if (empty($house_id)) {
$result['status'] = 'fail';
$result['msg'] = '新增或编辑商铺失败';
......
......@@ -176,7 +176,6 @@
<div class="panel panel-default">
<div class="panel-heading breadcrumb">
<li><a href="#">商铺列表</a></li>
<li class="active">新增商铺</li>
<div class="pull-right">
<ul class="bread_btn">
<li>
......
......@@ -258,8 +258,7 @@ class GHouses extends BaseModel
*/
public function getHouseListTotal($params = '')
{
return $this->alias('a')
->where($params)
return $this->where($params)
->count();
}
......@@ -349,25 +348,6 @@ class GHouses extends BaseModel
return $result;
}
/**
* 查询属于盘方的商铺列表总记录数
*
* @param string $params
* @return int|string
*/
public function getHouseListDishTotal($params = '')
{
// $data = $this->alias('a')
// ->join('g_houses_to_agents b', 'a.id=b.houses_id', 'left')
// ->join('a_agents c', 'b.agents_id=c.id', 'left')
// ->join('g_houses_ext d', 'a.id=d.house_id', 'left')
// ->where($params)
// ->group('a.id')
// ->count();
// return $data;
return $this->where($params)->count();
}
/**
* 添加和编辑商铺
*
......@@ -1567,20 +1547,5 @@ class GHouses extends BaseModel
->select();
return $result;
}
public function getHouseNum($params)
{
$result = Db::table($this->table)
->field($field)
->where($params)
->count();
return $result;
}
}
......@@ -236,9 +236,9 @@ class GHousesExt extends BaseModel
$ext_id = $this->where('house_id', $house_id)->value('id');
if ($ext_id > 0) {
$num = $this->where('id', $ext_id)->update($save_data);
$num = $this->db_->where('id', $ext_id)->update($save_data);
} else {
$num = $this->insert($save_data);
$num = $this->db_->insert($save_data);
}
if ($num > 0) {
......@@ -249,4 +249,18 @@ class GHousesExt extends BaseModel
return $result;
}
/**
* @param $field
* @param $where
* @return array|false|\PDOStatement|string|\think\Model
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException
*/
public function getInfo($field, $where) {
return $this->db_->field($field)
->where($where)
->find();
}
}
\ No newline at end of file
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