Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
T
tl_estate
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
hujun
tl_estate
Commits
6383ecca
Commit
6383ecca
authored
Jan 25, 2018
by
hujun
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
案场联系人
parent
eeef527a
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
128 additions
and
44 deletions
+128
-44
HouseInfo.php
application/index/controller/HouseInfo.php
+3
-1
Houses.php
application/index/controller/Houses.php
+3
-41
ACase.php
application/model/ACase.php
+58
-0
GHouses.php
application/model/GHouses.php
+62
-0
GHousesToAgents.php
application/model/GHousesToAgents.php
+2
-2
No files found.
application/index/controller/HouseInfo.php
View file @
6383ecca
...
...
@@ -3,6 +3,8 @@
namespace
app\index\controller
;
use
app\index\extend\Basic
;
use
app\model\HouseInfos
;
use
think\Request
;
/**
* Description of HouseInfo
*
...
...
@@ -13,7 +15,7 @@ use app\model\HouseInfos;
class
HouseInfo
extends
Basic
{
protected
$house_infos
;
public
function
__construct
()
{
public
function
__construct
(
Request
$request
)
{
parent
::
__construct
(
$request
);
$this
->
house_infos
=
new
HouseInfos
();
}
...
...
application/index/controller/Houses.php
View file @
6383ecca
...
...
@@ -11,8 +11,6 @@ namespace app\index\controller;
use
app\index\extend\Basic
;
use
app\model\GHouses
;
use
app\model\GHousesExt
;
use
app\model\GHousesImgs
;
use
think\Request
;
...
...
@@ -42,50 +40,14 @@ class Houses extends Basic
$result
[
'msg'
]
=
''
;
$params
=
$this
->
request
->
param
();
if
(
$this
->
request
->
isPost
())
{
$date
=
date
(
'Y-m-d H:i:s'
);
if
(
$params
[
'id'
])
{
$params
[
'update_time'
]
=
$date
;
}
$this
->
house
->
startTrans
();
//新增或编辑
if
(
$params
[
'id'
]
==
''
)
{
$house_id
=
$this
->
house
->
allowField
(
true
)
->
save
(
$params
);
}
else
{
$house_id
=
$this
->
house
->
allowField
(
true
)
->
isUpdate
(
true
)
->
save
(
$params
,
[
'id'
=>
$params
[
'id'
]]);
}
$params
[
'house_id'
]
=
$house_id
;
$house_ext
=
new
GHousesExt
();
if
(
$params
[
'start_business_date'
])
{
$params
[
'start_business_date'
]
=
date
(
'Y-m-d H:i:s'
,
strtotime
(
$params
[
'start_business_date'
]));
}
//新增或编辑根据id
if
(
$params
[
'id'
]
==
''
)
{
$house_ext
->
allowField
(
true
)
->
save
(
$params
);
}
else
{
$house_ext_data
=
$house_ext
->
field
(
'id'
)
->
where
(
'house_id'
,
$params
[
'id'
])
->
find
();
$house_ext
->
allowField
(
true
)
->
isUpdate
(
true
)
->
save
(
$params
,
[
'id'
=>
$house_ext_data
[
'id'
]]);
}
/***保存图片 hujun 2018.1.19 start***/
$house_img
=
new
GHousesImgs
();
if
(
$params
[
'id'
]
==
''
)
{
$house_img
->
add
(
$params
,
$house_id
);
}
else
{
$house_img
->
edit
(
$params
,
$house_id
);
}
/***保存图片 hujun 2018.1.19 end***/
$house_id
=
$this
->
house
->
add
(
$params
);
//添加或编辑商铺
if
(
$house_id
)
{
$this
->
house
->
commit
();
$return
=
$this
->
response
(
$result
[
'code'
],
$result
[
'msg'
]);
$return
=
$this
->
response
(
$result
[
'code'
],
$result
[
'msg'
]
,[
'id'
,
$house_id
]
);
}
else
{
$this
->
house
->
rollback
();
$return
=
$this
->
response
(
101
,
$result
[
'msg'
]
);
$return
=
$this
->
response
(
101
,
'add houses is error'
);
}
}
elseif
(
$params
[
'id'
]){
...
...
application/model/ACase.php
0 → 100644
View file @
6383ecca
<?php
/**
* Created by PhpStorm.
* User: fuju
* Date: 2018/1/20
* Time: 17:52
*/
namespace
app\model
;
class
ACase
extends
BaseModel
{
/**
* 添加案场联系人
*
* @param $data
* @return string
* @throws \Exception
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException
*/
public
function
addCase
(
$data
)
{
$date
=
date
(
'Y-m-d H:i:s'
);
$data
=
array_unique
(
$data
);
$case_arr
=
array
();
$id_str
=
''
;
foreach
(
$data
as
$k
=>
$v
)
{
$data_arr
=
explode
(
'-'
,
$v
);
if
(
count
(
$data_arr
)
==
3
)
{
$check
=
$this
->
field
(
'id'
)
->
where
([
'name'
=>
$data_arr
[
'1'
],
'phone'
=>
$data_arr
[
'2'
],
'status'
=>
0
])
->
find
();
if
(
$check
)
{
$id_str
.=
$check
[
'id'
]
.
','
;
continue
;
}
else
{
$case_arr
[
$k
][
'name'
]
=
$data_arr
[
'1'
];
$case_arr
[
$k
][
'phone'
]
=
$data_arr
[
'2'
];
$case_arr
[
$k
][
'create_time'
]
=
$date
;
$case_arr
[
$k
][
'update_time'
]
=
$date
;
}
}
}
$res
=
$this
->
saveAll
(
$case_arr
);
foreach
(
$res
as
$k
=>
$v
)
{
$id_str
.=
$v
->
id
.
','
;
}
$id_str
=
rtrim
(
$id_str
,
','
);
return
$id_str
;
}
}
\ No newline at end of file
application/model/GHouses.php
View file @
6383ecca
...
...
@@ -175,4 +175,66 @@ class GHouses extends BaseModel
->
count
();
return
$data
;
}
/**
* 添加和编辑商铺
*
* @param $params
* @return mixed
* @throws \Exception
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException
*/
public
function
add
(
$params
)
{
$date
=
date
(
'Y-m-d H:i:s'
);
if
(
$params
[
'id'
])
{
$params
[
'update_time'
]
=
$date
;
}
else
{
$params
[
'create_time'
]
=
$date
;
$params
[
'update_time'
]
=
$date
;
}
$case
=
new
ACase
();
$case_id
=
$case
->
addCase
(
$params
[
'phone'
]);
$params
[
'case_id'
]
=
$case_id
;
//新增或编辑
if
(
$params
[
'id'
]
==
''
)
{
$this
->
allowField
(
true
)
->
save
(
$params
);
$house_id
=
$this
->
id
;
}
else
{
$this
->
allowField
(
true
)
->
isUpdate
(
true
)
->
save
(
$params
,
[
'id'
=>
$params
[
'id'
]]);
$house_id
=
$this
->
id
;
}
$params
[
'house_id'
]
=
$house_id
;
if
(
$params
[
'start_business_date'
])
{
$params
[
'start_business_date'
]
=
date
(
'Y-m-d H:i:s'
,
strtotime
(
$params
[
'start_business_date'
]));
}
$houses_ext
=
new
GHousesExt
();
//新增或编辑根据id
if
(
$params
[
'id'
]
==
''
)
{
$houses_ext
->
allowField
(
true
)
->
save
(
$params
);
}
else
{
$house_ext_data
=
$houses_ext
->
field
(
'id'
)
->
where
(
'house_id'
,
$params
[
'id'
])
->
find
();
$houses_ext
->
allowField
(
true
)
->
isUpdate
(
true
)
->
save
(
$params
,
[
'id'
=>
$house_ext_data
[
'id'
]]);
}
/***保存图片 hujun 2018.1.19 start***/
$house_img
=
new
GHousesImgs
();
if
(
$params
[
'id'
]
==
''
)
{
$house_img
->
add
(
$params
,
$house_id
);
}
else
{
$house_img
->
edit
(
$params
,
$house_id
);
}
/***保存图片 hujun 2018.1.19 end***/
$agents
=
new
GHousesToAgents
();
$agents
->
addAgents
(
$params
[
'agent_data'
],
$house_id
,
1
);
$agents
->
addAgents
(
$params
[
'agent_dish'
],
$house_id
,
2
);
return
$house_id
;
}
}
application/model/GHousesToAgents.php
View file @
6383ecca
...
...
@@ -15,10 +15,10 @@ class GHousesToAgents extends BaseModel
}
/**
* @param $
data
* @param $
agents_id
* @param $houses_id
* @param $type 案场权限人:0,盘方:1,独家:2
* @return array|false
|int
* @return array|false
* @throws \Exception
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\ModelNotFoundException
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment