Commit 86b4ff2d authored by hujun's avatar hujun

转铺上架

parent 2928e4d5
...@@ -42,20 +42,31 @@ class Houses extends Basic ...@@ -42,20 +42,31 @@ class Houses extends Basic
* @throws \think\db\exception\ModelNotFoundException * @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException * @throws \think\exception\DbException
*/ */
public function edit() { public function edit()
{
$result['code'] = 200; $result['code'] = 200;
$result['msg'] = ''; $result['msg'] = '';
if ($this->request->isPost()) { if ($this->request->isPost()) {
$house_id = $this->house->add($this->params, $this->userId); //添加或编辑商铺 $house_id = $this->house->add($this->params, $this->userId); //添加或编辑商铺
if (!empty($this->params['sublet_id']) && $this->params['source'] == 'transfer_list') {
$m_sublet = new SubletModel();
$sublet_data['house_id'] = $house_id;
$sublet_data['status'] = 2;
$sublet_data['agents_id'] = $this->userId;
$m_sublet->editData($sublet_data, $this->params['sublet_id']);
}
if ($house_id) { if ($house_id) {
$return = $this->response($result['code'], $result['msg'],['id',$house_id]); $return = $this->response($result['code'], $result['msg'], [ 'id', $house_id ]);
} else { } else {
$return = $this->response(101, 'add houses is error'); $return = $this->response(101, 'add houses is error');
} }
//编辑商铺 //编辑商铺
} elseif ($this->params['id']){ } elseif ($this->params['id']) {
if ($this->request->isAjax()) { if ($this->request->isAjax()) {
//获取商铺详情 //获取商铺详情
$house = new GHouses(); $house = new GHouses();
...@@ -91,7 +102,8 @@ class Houses extends Basic ...@@ -91,7 +102,8 @@ class Houses extends Basic
* @throws \think\db\exception\ModelNotFoundException * @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException * @throws \think\exception\DbException
*/ */
public function getHouseList() { public function getHouseList()
{
if ($this->request->isAjax()) { if ($this->request->isAjax()) {
$data['status'] = 200; $data['status'] = 200;
$data['msg'] = ''; $data['msg'] = '';
...@@ -134,19 +146,19 @@ class Houses extends Basic ...@@ -134,19 +146,19 @@ class Houses extends Basic
$where['rent_type'] = 1; $where['rent_type'] = 1;
switch ($this->params['rent_price']) { switch ($this->params['rent_price']) {
case 1: case 1:
$where['rent_price'] = ['<=', 1000000]; $where['rent_price'] = [ '<=', 1000000 ];
break; break;
case 2: case 2:
$where['rent_price'] = ['between', '1000000,3000000']; $where['rent_price'] = [ 'between', '1000000,3000000' ];
break; break;
default : default :
$where['rent_price'] = ['>', '3000000']; $where['rent_price'] = [ '>', '3000000' ];
} }
} }
/*对内楼盘名*/ /*对内楼盘名*/
if ($this->params['internal_title'] != NULL) { if ($this->params['internal_title'] != NULL) {
$where['internal_title'] = ['LIKE', '%'.$this->params['internal_title'] . '%']; $where['internal_title'] = [ 'LIKE', '%' . $this->params['internal_title'] . '%' ];
} }
/*是否独家0否1是*/ /*是否独家0否1是*/
...@@ -156,17 +168,17 @@ class Houses extends Basic ...@@ -156,17 +168,17 @@ class Houses extends Basic
/*开始时间*/ /*开始时间*/
if ($this->params['start_date'] != NULL && $this->params['end_date'] == NULL) { if ($this->params['start_date'] != NULL && $this->params['end_date'] == NULL) {
$where['a.create_time'] = ['> time', $this->params['start_date'] . ' 00:00:00']; $where['a.create_time'] = [ '> time', $this->params['start_date'] . ' 00:00:00' ];
} }
/*结束时间*/ /*结束时间*/
if ($this->params['end_date'] != NULL && $this->params['start_date'] == NULL) { if ($this->params['end_date'] != NULL && $this->params['start_date'] == NULL) {
$where['a.create_time'] = ['< time', $this->params['end_date'] . ' 23:59:59']; $where['a.create_time'] = [ '< time', $this->params['end_date'] . ' 23:59:59' ];
} }
/*开始结束时间*/ /*开始结束时间*/
if ($this->params['start_date'] != NULL && $this->params['end_date'] != NULL) { if ($this->params['start_date'] != NULL && $this->params['end_date'] != NULL) {
$where['a.create_time'] = ['between time', [$this->params['start_date'] . ' 00:00:00', $this->params['end_date'] . ' 23:59:59']]; $where['a.create_time'] = [ 'between time', [ $this->params['start_date'] . ' 00:00:00', $this->params['end_date'] . ' 23:59:59' ] ];
} }
/*根据库存判断是否已租*/ /*根据库存判断是否已租*/
...@@ -174,13 +186,13 @@ class Houses extends Basic ...@@ -174,13 +186,13 @@ class Houses extends Basic
if ($this->params['leased'] == 0) { if ($this->params['leased'] == 0) {
$where['residue_num'] = 0; $where['residue_num'] = 0;
} else { } else {
$where['residue_num'] = ['<>', 0]; $where['residue_num'] = [ '<>', 0 ];
} }
} }
/*业态*/ /*业态*/
if ($this->params['industry_type'] != NULL) { if ($this->params['industry_type'] != NULL) {
$where['industry_type'] = ['LIKE', '%'.$this->params['industry_type'] . '%']; $where['industry_type'] = [ 'LIKE', '%' . $this->params['industry_type'] . '%' ];
} }
$fields = 'a.id,a.shop_type,a.internal_title,a.rent_price,a.is_show,a.create_time,a.residue_num,a.rent_type'; $fields = 'a.id,a.shop_type,a.internal_title,a.rent_price,a.is_show,a.create_time,a.residue_num,a.rent_type';
...@@ -190,7 +202,7 @@ class Houses extends Basic ...@@ -190,7 +202,7 @@ class Houses extends Basic
if (!empty($this->params['id'])) { if (!empty($this->params['id'])) {
$where['id'] = $this->params['id']; $where['id'] = $this->params['id'];
} }
$where['status'] = ['<>', 3]; $where['status'] = [ '<>', 3 ];
$data['data']['list'] = $this->house->getHouseList($pageNo, $pageSize, 'id DESC', $fields, $where, $this->userId); $data['data']['list'] = $this->house->getHouseList($pageNo, $pageSize, 'id DESC', $fields, $where, $this->userId);
$data['data']['total'] = $this->house->getHouseListTotal($where); $data['data']['total'] = $this->house->getHouseListTotal($where);
} else { } else {
...@@ -199,9 +211,9 @@ class Houses extends Basic ...@@ -199,9 +211,9 @@ class Houses extends Basic
if ($this->params['id'] != NULL) { if ($this->params['id'] != NULL) {
$where['a.id'] = $this->params['id']; $where['a.id'] = $this->params['id'];
} }
$where['a.status'] = ['<>', 3]; $where['a.status'] = [ '<>', 3 ];
$where['c.name'] = ['LIKE', '%'.$this->params['dish'] . '%']; $where['c.name'] = [ 'LIKE', '%' . $this->params['dish'] . '%' ];
$where['b.type'] = ['=', 2]; $where['b.type'] = [ '=', 2 ];
$where['b.is_del'] = 0; $where['b.is_del'] = 0;
$data['data']['list'] = $this->house->getHouseListDish($pageNo, $pageSize, 'a.id DESC', $fields, $where, $this->userId); $data['data']['list'] = $this->house->getHouseListDish($pageNo, $pageSize, 'a.id DESC', $fields, $where, $this->userId);
$data['data']['total'] = $this->house->getHouseListDishTotal($where); $data['data']['total'] = $this->house->getHouseListDishTotal($where);
...@@ -217,13 +229,14 @@ class Houses extends Basic ...@@ -217,13 +229,14 @@ class Houses extends Basic
* *
* @return \think\Response * @return \think\Response
*/ */
public function del() { public function del()
{
$data['status'] = 200; $data['status'] = 200;
$data['msg'] = ''; $data['msg'] = '';
$data['data'] = ''; $data['data'] = '';
if ($this->params['id']) { if ($this->params['id']) {
$this->house->isUpdate(true)->save(['status'=>3],['id'=>$this->params['id']]); $this->house->isUpdate(true)->save([ 'status' => 3 ], [ 'id' => $this->params['id'] ]);
$data['msg'] = 'successfully deleted'; $data['msg'] = 'successfully deleted';
} else { } else {
$data['status'] = 101; $data['status'] = 101;
...@@ -238,10 +251,11 @@ class Houses extends Basic ...@@ -238,10 +251,11 @@ class Houses extends Basic
* *
* @return \think\Response * @return \think\Response
*/ */
public function carefullyChosen() { public function carefullyChosen()
{
if ($this->params['houses_id'] != NULL && $this->params['is_carefully_chosen'] != NULL) { if ($this->params['houses_id'] != NULL && $this->params['is_carefully_chosen'] != NULL) {
$data['is_carefully_chosen'] = $this->params['is_carefully_chosen']; $data['is_carefully_chosen'] = $this->params['is_carefully_chosen'];
$this->data = $this->house->editData($data,$this->params['houses_id'],'id'); $this->data = $this->house->editData($data, $this->params['houses_id'], 'id');
} else { } else {
$this->code = 101; $this->code = 101;
$this->msg = 'houses_id or is_carefully_chosen is null'; $this->msg = 'houses_id or is_carefully_chosen is null';
...@@ -259,9 +273,10 @@ class Houses extends Basic ...@@ -259,9 +273,10 @@ class Houses extends Basic
* @throws \think\db\exception\ModelNotFoundException * @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException * @throws \think\exception\DbException
*/ */
public function editExclusive() { public function editExclusive()
{
if ($this->params['houses_id']) { if ($this->params['houses_id']) {
$this->data = $this->house->exclusive($this->params,$this->params['houses_id']); $this->data = $this->house->exclusive($this->params, $this->params['houses_id']);
} else { } else {
$this->code = 101; $this->code = 101;
$this->msg = 'houses_id is null'; $this->msg = 'houses_id is null';
...@@ -278,7 +293,8 @@ class Houses extends Basic ...@@ -278,7 +293,8 @@ class Houses extends Basic
* @throws \think\db\exception\ModelNotFoundException * @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException * @throws \think\exception\DbException
*/ */
public function getExclusive() { public function getExclusive()
{
if ($this->params['houses_id']) { if ($this->params['houses_id']) {
$this->data = $this->house->getExclusive($this->params['houses_id']); $this->data = $this->house->getExclusive($this->params['houses_id']);
} else { } else {
...@@ -306,7 +322,7 @@ class Houses extends Basic ...@@ -306,7 +322,7 @@ class Houses extends Basic
$params['houses_id'] = $this->params['houses_id']; $params['houses_id'] = $this->params['houses_id'];
$params['type'] = 2; $params['type'] = 2;
$agents = new AAgents(); $agents = new AAgents();
$this->data = $agents->getRecords($pageNo, $pageSize,'id DESC', $field, $params); $this->data = $agents->getRecords($pageNo, $pageSize, 'id DESC', $field, $params);
} else { } else {
$this->code = 101; $this->code = 101;
$this->msg = 'houses_id is null'; $this->msg = 'houses_id is null';
...@@ -325,7 +341,8 @@ class Houses extends Basic ...@@ -325,7 +341,8 @@ class Houses extends Basic
* @throws \think\exception\DbException * @throws \think\exception\DbException
* @throws \think\exception\PDOException * @throws \think\exception\PDOException
*/ */
public function batchChangDish() { public function batchChangDish()
{
if (empty($this->params['old_agents_id']) || empty($this->params['agents_id'])) { if (empty($this->params['old_agents_id']) || empty($this->params['agents_id'])) {
return $this->response(101, '盘方信息错误'); return $this->response(101, '盘方信息错误');
...@@ -342,7 +359,7 @@ class Houses extends Basic ...@@ -342,7 +359,7 @@ class Houses extends Basic
if (count($agent_house) > 0) { if (count($agent_house) > 0) {
$agent_data_arr = []; $agent_data_arr = [];
foreach ($agent_house as $k=>$v) { foreach ($agent_house as $k => $v) {
$agent_data_arr[$k]['id'] = $v['id']; $agent_data_arr[$k]['id'] = $v['id'];
$agent_data_arr[$k]['agents_id'] = $this->params['agents_id']; $agent_data_arr[$k]['agents_id'] = $this->params['agents_id'];
} }
...@@ -350,7 +367,7 @@ class Houses extends Basic ...@@ -350,7 +367,7 @@ class Houses extends Basic
$total = $agent->updateUserAll($agent_data_arr); $total = $agent->updateUserAll($agent_data_arr);
$agent->commit(); $agent->commit();
return $this->response(200, '', ['total'=>count($total)]); return $this->response(200, '', [ 'total' => count($total) ]);
} }
/** /**
......
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