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
5e40a9f4
Commit
5e40a9f4
authored
Apr 11, 2018
by
hujun
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
预约看铺转为报备
parent
499e15ef
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
135 additions
and
91 deletions
+135
-91
ReportService.php
application/api_broker/service/ReportService.php
+1
-1
Broker.php
application/index/controller/Broker.php
+5
-4
WatchShop.php
application/index/controller/WatchShop.php
+62
-67
AStore.php
application/model/AStore.php
+22
-0
AppointWatchShop.php
application/model/AppointWatchShop.php
+26
-2
GHouses.php
application/model/GHouses.php
+11
-5
watch_shop.js
public/resource/js/watch_shop.js
+8
-12
No files found.
application/api_broker/service/ReportService.php
View file @
5e40a9f4
...
@@ -196,7 +196,7 @@ class ReportService
...
@@ -196,7 +196,7 @@ class ReportService
* @param $predict_see_time
* @param $predict_see_time
* @return array
* @return array
*/
*/
p
rivate
function
reportBin
(
$report_agent_id
,
$agent_phone
,
$report_agent_name
,
$report_store_id
,
$user_id
,
$user_phone
,
$user_name
,
p
ublic
function
reportBin
(
$report_agent_id
,
$agent_phone
,
$report_agent_name
,
$report_store_id
,
$user_id
,
$user_phone
,
$user_name
,
$vehicle
,
$intro
,
$predict_see_time
)
$vehicle
,
$intro
,
$predict_see_time
)
{
{
$param
[
"report_agent_id"
]
=
$report_agent_id
;
$param
[
"report_agent_id"
]
=
$report_agent_id
;
...
...
application/index/controller/Broker.php
View file @
5e40a9f4
...
@@ -37,14 +37,15 @@ class Broker extends Basic
...
@@ -37,14 +37,15 @@ class Broker extends Basic
$pageNo
=
empty
(
$this
->
params
[
'pageNo'
])
?
1
:
$this
->
params
[
'pageNo'
];
$pageNo
=
empty
(
$this
->
params
[
'pageNo'
])
?
1
:
$this
->
params
[
'pageNo'
];
$pageSize
=
empty
(
$this
->
params
[
'pageSize'
])
?
10
:
$this
->
params
[
'pageSize'
];
$pageSize
=
empty
(
$this
->
params
[
'pageSize'
])
?
10
:
$this
->
params
[
'pageSize'
];
$where
=
''
;
$where
=
''
;
if
(
$this
->
params
[
'phone'
])
{
if
(
$this
->
params
[
'phone'
])
{
$where
=
'phone like "'
.
$this
->
params
[
'phone'
]
.
'%" or realname like "'
.
$this
->
params
[
'phone'
]
.
'%"'
;
$where
=
'id != 1 AND concat(phone,name) like "%'
.
$this
->
params
[
'phone'
]
.
'%"'
;
;
}
}
if
(
$where
)
{
if
(
$where
)
{
$agent
=
new
Agents
();
$agent
=
new
A
A
gents
();
$field
=
'id,
father_id,real
name,phone'
;
$field
=
'id,
store_id,
name,phone'
;
$data
[
'data'
]
=
$agent
->
get
Agents
(
$pageNo
,
$pageSize
,
''
,
$field
,
$where
);
$data
[
'data'
]
=
$agent
->
get
List
(
$pageNo
,
$pageSize
,
''
,
''
,
$field
,
$where
);
}
else
{
}
else
{
$data
[
'msg'
]
=
'没有该楼盘信息'
;
$data
[
'msg'
]
=
'没有该楼盘信息'
;
}
}
...
...
application/index/controller/WatchShop.php
View file @
5e40a9f4
...
@@ -10,13 +10,12 @@ namespace app\index\controller;
...
@@ -10,13 +10,12 @@ namespace app\index\controller;
use
app\api\untils\GeTuiUntils
;
use
app\api\untils\GeTuiUntils
;
use
app\api_broker\service\ReportService
;
use
app\index\extend\Basic
;
use
app\index\extend\Basic
;
use
app\model\Agents
;
use
app\model\Agents
;
use
app\model\Applies
;
use
app\model\AppointWatchShop
;
use
app\model\AppointWatchShop
;
use
app\model\HouseInfos
;
use
app\model\AStore
;
use
app\model\Remarks
;
use
think\Session
;
class
WatchShop
extends
Basic
class
WatchShop
extends
Basic
{
{
...
@@ -65,74 +64,70 @@ class WatchShop extends Basic
...
@@ -65,74 +64,70 @@ class WatchShop extends Basic
return
$this
->
response
(
$data
[
'status'
],
$data
[
'msg'
],
$data
);
return
$this
->
response
(
$data
[
'status'
],
$data
[
'msg'
],
$data
);
}
}
/**
* @return \think\Response
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException
*/
public
function
addApplies
()
{
public
function
addApplies
()
{
$data
[
'status'
]
=
200
;
if
(
empty
(
$this
->
params
[
'watch_id'
]))
{
$data
[
'msg'
]
=
''
;
return
$this
->
response
(
101
,
'该看铺信息错误'
);
}
$params
=
$this
->
request
->
param
();
/* $params = array(
"report_agent_id" => 1,//报备经纪人id
"report_agent_phone" => '13817616471',//报备经纪人id
"report_store_id" => 1,//门店id
"user_id" => 1,//用户id
"house_ids" => "1,2,3",//楼盘id
"vehicle" => 10,//交通工具
"intro" => "123123123",//备注
"predict_see_time" => time(),//预计到看时间*/
//todo 检查经纪人状态 basic类做
$appoint_watch
=
new
AppointWatchShop
();
$appoint_watch
->
startTrans
();
$fields
=
'a.id,a.agents_id,b.name,b.phone,b.store_id,house_title,a.house_id,a.expect_time,a.user_id,a.other_require,b.device_id,a.house_title'
;
$where
[
'a.id'
]
=
$this
->
params
[
'watch_id'
];
$appoint_data
=
$appoint_watch
->
getAppointAgent
(
$fields
,
$where
);
if
(
empty
(
$appoint_data
[
'id'
]))
{
return
$this
->
response
(
101
,
'没有预约铺经纪人信息'
);
}
if
(
$params
[
'watch_id'
]
&&
$params
[
'shop_id'
]
&&
$params
[
'agents_id'
])
{
$agent_id
=
$appoint_data
[
"agents_id"
];
$agent_phone
=
$appoint_data
[
"phone"
];
$appoint_watch
=
new
AppointWatchShop
();
$store_id
=
$appoint_data
[
"store_id"
];
$appoint_watch
->
startTrans
();
$user_id
=
$appoint_data
[
"user_id"
];
$apponit_data
=
$appoint_watch
->
lock
(
true
)
->
where
(
'id'
,
$params
[
'watch_id'
])
->
find
();
$house_ids
=
$appoint_data
[
"house_id"
];
$vehicle
=
10
;
if
(
$apponit_data
[
'id'
])
{
$intro
=
$appoint_data
[
"other_require"
];
$apples
=
new
Applies
();
$predict_see_time
=
$appoint_data
[
"expect_time"
];
$apples
->
data
([
'agent_id'
=>
$params
[
'agents_id'
],
$service_
=
new
ReportService
();
'house_id'
=>
$apponit_data
[
'house_id'
],
'customer'
=>
$apponit_data
[
'appellation'
],
//todo 验证用户id是否正常
'phpone'
=>
$apponit_data
[
'phone'
],
$userArr
=
$service_
->
verifyUser
(
$user_id
);
'go_off'
=>
date
(
'Y-m-d H:i:s'
,
strtotime
(
$apponit_data
[
'expect_time'
])),
$is_ok
=
$service_
->
reportBin
(
$agent_id
,
$agent_phone
,
$appoint_data
[
'name'
],
$store_id
,
$user_id
,
$userArr
[
"user_phone"
],
'agent_shop_id'
=>
$params
[
'shop_id'
],
$userArr
[
"user_name"
],
$house_ids
,
$vehicle
,
$intro
,
$predict_see_time
);
'transaction_status'
=>
0
,
'invite_id'
=>
0
,
if
(
$is_ok
>
0
)
{
'marketgroup_id'
=>
0
,
$appoint_watch
->
where
(
'id'
,
$this
->
params
[
'watch_id'
])
->
update
([
'applies_id'
=>
$is_ok
]);
'created'
=>
date
(
"Y-m-d H:i:s"
)
die
;
])
->
save
();
//推送报备信息
$store
=
new
AStore
();
$remark
=
new
Remarks
();
$store_name
=
$store
->
getStoreDistrictName
(
$appoint_data
[
'store_id'
]);
$remark
->
data
([
'apply_id'
=>
$apples
->
id
,
$title
=
'报备提醒'
;
'shopuser_id'
=>
$params
[
'agents_id'
],
$content
=
'【'
.
$store_name
.
'-'
.
$appoint_data
[
'name'
]
.
'】报备了【'
.
$appoint_data
[
'house_title'
]
.
'】'
;
'shop_id'
=>
$params
[
'shop_id'
],
$get
=
new
GeTuiUntils
();
'house_id'
=>
$apponit_data
[
'house_id'
],
$req
=
$get
->
public_push_message_for_one
(
$appoint_data
[
'agents_id'
],
$appoint_data
[
'device_id'
],
$title
,
$content
);
'transaction_status'
=>
0
,
$data
[
'msg'
]
=
$req
[
'result'
]
==
'ok'
?
'报备成功并通知经纪人'
:
'报备成功,请通知经纪人'
;
'created'
=>
date
(
"Y-m-d H:i:s"
)
return
$this
->
response
(
"200"
,
$data
[
'msg'
]);
])
->
save
();
$appoint_watch
->
save
([
'agents_id'
=>
$params
[
'agents_id'
],
'applies_id'
=>
$apples
->
id
],[
'id'
=>
$apponit_data
[
'id'
]]);
if
(
$apples
->
id
&&
$remark
->
id
)
{
$appoint_watch
->
commit
();
//推送报备信息
$agent
=
new
Agents
();
$agentData
=
$agent
->
field
(
'id,device_id,realname,agentshopname,sub_shopname'
)
->
where
(
'id'
,
$params
[
'agents_id'
])
->
find
();
$title
=
'报备提醒'
;
$content
=
'【'
.
$agentData
[
'agentshopname'
]
.
$agentData
[
'sub_shopname'
]
.
'-'
.
$agentData
[
'realname'
]
.
'】报备了【'
.
$apponit_data
[
'house_title'
]
.
'】'
;
$get
=
new
GeTuiUntils
();
$req
=
$get
->
public_push_message_for_one
(
$params
[
'agents_id'
],
$agentData
[
'device_id'
],
$title
,
$content
);
$data
[
'status'
]
=
200
;
$data
[
'msg'
]
=
$req
[
'result'
]
==
'ok'
?
'报备成功并通知经纪人'
:
'报备成功,请通知经纪人'
;
}
else
{
$appoint_watch
->
rollback
();
$data
[
'status'
]
=
101
;
$data
[
'msg'
]
=
'报备失败'
;
}
}
else
{
$data
[
'msg'
]
=
'没有该铺信息'
;
$data
[
'status'
]
=
101
;
}
}
else
{
}
else
{
$data
[
'msg'
]
=
'该看铺信息错误'
;
return
$this
->
response
(
"101"
,
"save exception"
)
;
}
}
return
$this
->
response
(
$data
[
'status'
],
$data
[
'msg'
],
$data
[
'data'
]);
}
}
public
function
test
(){
public
function
test
(){
...
...
application/model/AStore.php
View file @
5e40a9f4
...
@@ -161,4 +161,25 @@ class AStore extends BaseModel
...
@@ -161,4 +161,25 @@ class AStore extends BaseModel
}
}
return
$store_num
;
return
$store_num
;
}
}
/**
* @param $id
* @return array|false|\PDOStatement|string|\think\Model
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException
*/
public
function
getStoreDistrictName
(
$id
,
$return_type
=
'string'
)
{
$name
=
$this
->
field
(
'b.district_name,a.store_name'
)
->
alias
(
'a'
)
->
join
(
'a_district b'
,
'a.district_id = b.id'
,
'left'
)
->
where
(
'a.id'
,
$id
)
->
find
();
if
(
$return_type
==
'string'
)
{
$name
=
$name
[
'district_name'
]
.
'-'
.
$name
[
'store_name'
];
}
return
$name
;
}
}
}
\ No newline at end of file
application/model/AppointWatchShop.php
View file @
5e40a9f4
...
@@ -11,12 +11,17 @@ class AppointWatchShop extends Model
...
@@ -11,12 +11,17 @@ class AppointWatchShop extends Model
protected
$table
=
'u_appoint_watch_shop'
;
protected
$table
=
'u_appoint_watch_shop'
;
protected
$db
;
protected
$db
;
/**
* AppointWatchShop constructor.
*/
function
__construct
()
function
__construct
()
{
{
$this
->
db
=
Db
(
$this
->
table
);
$this
->
db
=
Db
(
$this
->
table
);
}
}
/** 保存预约看铺信息
/**
* 保存预约看铺信息
*
* @param $arr
* @param $arr
* @return array
* @return array
*/
*/
...
@@ -41,7 +46,10 @@ class AppointWatchShop extends Model
...
@@ -41,7 +46,10 @@ class AppointWatchShop extends Model
* @param string $order_
* @param string $order_
* @param $field
* @param $field
* @param $params
* @param $params
* @return mixed
* @return false|\PDOStatement|string|\think\Collection
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException
*/
*/
public
function
getAppointWatchShopList
(
$pageNo
=
1
,
$pageSize
=
15
,
$order_
=
'id desc'
,
$field
,
$params
)
public
function
getAppointWatchShopList
(
$pageNo
=
1
,
$pageSize
=
15
,
$order_
=
'id desc'
,
$field
,
$params
)
{
{
...
@@ -64,4 +72,20 @@ class AppointWatchShop extends Model
...
@@ -64,4 +72,20 @@ class AppointWatchShop extends Model
{
{
return
$this
->
where
(
$params
)
->
count
();
return
$this
->
where
(
$params
)
->
count
();
}
}
/**
* @param $field
* @param $params
* @return array|false|\PDOStatement|string|Model
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException
*/
public
function
getAppointAgent
(
$field
,
$params
)
{
return
$this
->
field
(
$field
)
->
alias
(
'a'
)
->
join
(
'a_agents b'
,
'a.agents_id = b.id'
,
'left'
)
->
where
(
$params
)
->
find
();
}
}
}
application/model/GHouses.php
View file @
5e40a9f4
...
@@ -636,11 +636,17 @@ class GHouses extends BaseModel
...
@@ -636,11 +636,17 @@ class GHouses extends BaseModel
$params
[
'upload_id'
]
=
$params
[
'userId'
];
$params
[
'upload_id'
]
=
$params
[
'userId'
];
$this
->
allowField
(
true
)
->
save
(
$params
);
$this
->
allowField
(
true
)
->
save
(
$params
);
$house_id
=
$this
->
id
;
$house_id
=
$this
->
id
;
$result
[
'house_id'
]
=
$this
->
id
;
$result
[
'internal_title'
]
=
$params
[
'internal_title'
];
}
else
{
}
else
{
$params
[
'operation_id'
]
=
$params
[
'userId'
];
$internal_title
=
$this
->
where
(
'id'
,
$params
[
'id'
])
->
where
(
'status'
,
'<>'
,
3
)
->
value
(
'internal_title'
);
$params
[
'status'
]
=
1
;
if
(
!
empty
(
$internal_title
))
{
$this
->
allowField
(
true
)
->
isUpdate
(
true
)
->
save
(
$params
,
[
'id'
=>
$params
[
'id'
]
]);
$params
[
'operation_id'
]
=
$params
[
'userId'
];
$house_id
=
$this
->
id
;
$params
[
'status'
]
=
1
;
$this
->
allowField
(
true
)
->
isUpdate
(
true
)
->
save
(
$params
,
[
'id'
=>
$params
[
'id'
]
]);
$house_id
=
$this
->
id
;
}
$result
[
'internal_title'
]
=
$internal_title
;
}
}
$params
[
'house_id'
]
=
$house_id
;
$params
[
'house_id'
]
=
$house_id
;
...
@@ -673,6 +679,6 @@ class GHouses extends BaseModel
...
@@ -673,6 +679,6 @@ class GHouses extends BaseModel
$agents
->
addAgents
(
$params
[
'exclusive_ids'
],
$house_id
,
3
);
$agents
->
addAgents
(
$params
[
'exclusive_ids'
],
$house_id
,
3
);
}
}
return
$
house_id
;
return
$
result
;
}
}
}
}
public/resource/js/watch_shop.js
View file @
5e40a9f4
...
@@ -2,8 +2,7 @@ define (['doT', 'text!temp/watch_template_tpl.html', 'css!style/home.css','pagin
...
@@ -2,8 +2,7 @@ define (['doT', 'text!temp/watch_template_tpl.html', 'css!style/home.css','pagin
user
=
{
user
=
{
pageNo
:
1
,
/*第几页*/
pageNo
:
1
,
/*第几页*/
pageSize
:
10
,
/*每页显示多少条*/
pageSize
:
10
,
/*每页显示多少条*/
store_id
:
''
,
father_id
:
''
,
agents_id
:
''
,
agents_id
:
''
,
watch_id
:
''
,
watch_id
:
''
,
urls
:
''
,
urls
:
''
,
...
@@ -130,11 +129,11 @@ define (['doT', 'text!temp/watch_template_tpl.html', 'css!style/home.css','pagin
...
@@ -130,11 +129,11 @@ define (['doT', 'text!temp/watch_template_tpl.html', 'css!style/home.css','pagin
var
_html
=
''
;
var
_html
=
''
;
$
.
each
(
data
.
data
,
function
(
i
,
data
)
{
$
.
each
(
data
.
data
,
function
(
i
,
data
)
{
_html
+=
'<li class="addphone"><span class="id">'
+
data
[
'id'
]
_html
+=
'<li class="addphone"><span class="id">'
+
data
[
'id'
]
+
'-</span><span class="phone_name">'
+
data
[
'
real
name'
]
+
'-</span><span class="phone_name">'
+
data
[
'name'
]
+
'</span><span class="phone_span">-</span><span class="phone-phone">'
+
'</span><span class="phone_span">-</span><span class="phone-phone">'
+
data
[
'phone'
]
+
'</span><span class="hidden
father
_id">'
+
data
[
'phone'
]
+
'</span><span class="hidden
store
_id">'
+
data
[
'
father
_id'
]
+
'</span></li>'
;
+
data
[
'
store
_id'
]
+
'</span></li>'
;
});
});
$
(
"#agents_list"
).
html
(
_html
);
$
(
"#agents_list"
).
html
(
_html
);
}
}
},
},
...
@@ -166,15 +165,12 @@ define (['doT', 'text!temp/watch_template_tpl.html', 'css!style/home.css','pagin
...
@@ -166,15 +165,12 @@ define (['doT', 'text!temp/watch_template_tpl.html', 'css!style/home.css','pagin
alert
(
'报备人信息不能为空'
);
alert
(
'报备人信息不能为空'
);
return
;
return
;
}
}
var
params
=
{};
params
.
shop_id
=
user
.
father_id
;
params
.
agents_id
=
user
.
agents_id
;
params
.
watch_id
=
user
.
watch_id
;
$
.
ajax
({
$
.
ajax
({
url
:
'/index/add_applies'
,
url
:
'/index/add_applies'
,
type
:
'POST'
,
type
:
'POST'
,
async
:
true
,
async
:
true
,
data
:
params
,
data
:
{
"watch_id"
:
user
.
watch_id
}
,
dataType
:
'json'
,
dataType
:
'json'
,
success
:
function
(
data
)
{
success
:
function
(
data
)
{
if
(
data
.
code
==
200
)
{
if
(
data
.
code
==
200
)
{
...
@@ -250,7 +246,7 @@ define (['doT', 'text!temp/watch_template_tpl.html', 'css!style/home.css','pagin
...
@@ -250,7 +246,7 @@ define (['doT', 'text!temp/watch_template_tpl.html', 'css!style/home.css','pagin
var
phone_span
=
$
(
obj
).
find
(
".phone_span"
).
html
();
var
phone_span
=
$
(
obj
).
find
(
".phone_span"
).
html
();
var
id
=
$
(
obj
).
find
(
".id"
).
html
();
var
id
=
$
(
obj
).
find
(
".id"
).
html
();
var
val
=
id
+
phone_name
+
phone_span
+
phone_phone
;
var
val
=
id
+
phone_name
+
phone_span
+
phone_phone
;
user
.
father_id
=
$
(
obj
).
find
(
".father
_id"
).
html
();
user
.
store_id
=
$
(
obj
).
find
(
".store
_id"
).
html
();
user
.
agents_id
=
id
.
substring
(
0
,
id
.
length
-
1
)
user
.
agents_id
=
id
.
substring
(
0
,
id
.
length
-
1
)
$
(
"input[name='phone']"
).
val
(
val
);
$
(
"input[name='phone']"
).
val
(
val
);
$
(
obj
).
parent
().
hide
();
$
(
obj
).
parent
().
hide
();
...
...
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