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
987c2f98
Commit
987c2f98
authored
Jun 05, 2018
by
hujun
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
数据转换
parent
e1bc76cc
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
94 additions
and
0 deletions
+94
-0
TransferHouseInfo.php
application/api/controller/TransferHouseInfo.php
+91
-0
route.php
application/route.php
+3
-0
No files found.
application/api/controller/TransferHouseInfo.php
View file @
987c2f98
...
@@ -8,7 +8,9 @@
...
@@ -8,7 +8,9 @@
namespace
app\api\controller
;
namespace
app\api\controller
;
use
app\model\GHousesExt
;
use
app\model\Regions
;
use
app\model\Regions
;
use
app\model\Users
;
use
think\Controller
;
use
think\Controller
;
use
think\Db
;
use
think\Db
;
...
@@ -249,4 +251,92 @@ class TransferHouseInfo extends Controller
...
@@ -249,4 +251,92 @@ class TransferHouseInfo extends Controller
$result
=
Db
::
table
(
'g_houses_to_agents'
)
->
insertAll
(
$agent_house_data
);
$result
=
Db
::
table
(
'g_houses_to_agents'
)
->
insertAll
(
$agent_house_data
);
dump
(
$result
);
dump
(
$result
);
}
}
/**
* user_nick同步到user_name
*
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException
*/
public
function
userNickToUserName
()
{
set_time_limit
(
0
);
$m_user
=
new
Users
();
$user_data
=
$m_user
->
field
(
'id,user_nick'
)
->
where
(
'user_nick'
,
'NOT NULL'
)
->
select
();
dump
(
count
(
$user_data
));
foreach
(
$user_data
as
$k
=>
$v
)
{
$insert_data
[
'id'
]
=
$v
[
'id'
];
$insert_data
[
'user_name'
]
=
$v
[
'user_nick'
];
$m_user
->
update
(
$insert_data
);
}
return
;
}
/**
* 房东手机号转换
*
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException
*/
public
function
landlordPhoneToJson
()
{
$this
->
landlordPhoneStar
();
//去除号码中带*号的
$m_house_ext
=
new
GHousesExt
();
$house_data
=
$m_house_ext
->
field
(
'id,landlord_phone'
)
->
where
(
'landlord_phone'
,
'NOT NULL'
)
->
select
();
foreach
(
$house_data
as
$k
=>
$v
)
{
$phone
=
explode
(
','
,
$v
[
'landlord_phone'
]);
if
(
count
(
$phone
)
==
1
)
{
if
(
!
empty
(
$phone
[
0
]))
{
$insert_data
[
'id'
]
=
$v
[
'id'
];
$landlord_phone
[
0
][
'name'
]
=
'房东'
;
$landlord_phone
[
0
][
'phone'
]
=
str_replace
(
' '
,
''
,
$phone
[
0
]);
$insert_data
[
'landlord_phone'
]
=
json_encode
(
$landlord_phone
);
$m_house_ext
->
update
(
$insert_data
);
}
}
else
{
foreach
(
$phone
as
$key
=>
$val
)
{
if
(
!
empty
(
$val
))
{
$landlord_phone
[
$key
][
'name'
]
=
'房东'
;
$landlord_phone
[
$key
][
'phone'
]
=
$val
;
}
}
if
(
!
empty
(
$landlord_phone
[
0
][
'phone'
]))
{
$insert_data
[
'id'
]
=
$v
[
'id'
];
$insert_data
[
'landlord_phone'
]
=
json_encode
(
$landlord_phone
);
$m_house_ext
->
update
(
$insert_data
);
}
}
}
}
/**
* 去除号码中带*号的
*
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException
*/
public
function
landlordPhoneStar
()
{
$m_house_ext
=
new
GHousesExt
();
$house_data
=
$m_house_ext
->
field
(
'id,landlord_phone'
)
->
where
(
'landlord_phone'
,
'NOT NULL'
)
->
select
();
foreach
(
$house_data
as
$k
=>
$v
)
{
$phone
=
explode
(
','
,
$v
[
'landlord_phone'
]);
if
(
count
(
$phone
)
==
1
)
{
if
(
stripos
(
$phone
[
0
],
'*'
)
>
0
)
{
$insert_data
[
'id'
]
=
$v
[
'id'
];
$insert_data
[
'landlord_phone'
]
=
NULL
;
$m_house_ext
->
update
(
$insert_data
);
}
}
else
{
if
(
count
(
$phone
)
>
4
)
{
$insert_data
[
'id'
]
=
$v
[
'id'
];
$insert_data
[
'landlord_phone'
]
=
NULL
;
$m_house_ext
->
update
(
$insert_data
);
}
}
}
}
}
}
\ No newline at end of file
application/route.php
View file @
987c2f98
...
@@ -312,6 +312,9 @@ Route::group('api', [
...
@@ -312,6 +312,9 @@ Route::group('api', [
'houseTable'
=>
[
'api/TransferHouseInfo/table'
,
[
'method'
=>
'post|get'
]
],
//转商铺表
'houseTable'
=>
[
'api/TransferHouseInfo/table'
,
[
'method'
=>
'post|get'
]
],
//转商铺表
'houseImgTable'
=>
[
'api/TransferHouseInfo/houseImg'
,
[
'method'
=>
'post|get'
]
],
//转楼盘表
'houseImgTable'
=>
[
'api/TransferHouseInfo/houseImg'
,
[
'method'
=>
'post|get'
]
],
//转楼盘表
'agentHouse'
=>
[
'api/TransferHouseInfo/agentHouse'
,
[
'method'
=>
'post|get'
]
],
//转楼盘表
'agentHouse'
=>
[
'api/TransferHouseInfo/agentHouse'
,
[
'method'
=>
'post|get'
]
],
//转楼盘表
'userNickToUserName'
=>
[
'api/TransferHouseInfo/userNickToUserName'
,
[
'method'
=>
'post|get'
]
],
//user_nick同步到user_name
'landlordPhoneToJson'
=>
[
'api/TransferHouseInfo/landlordPhoneToJson'
,
[
'method'
=>
'post|get'
]
],
//房东手机号转json
'landlordPhoneStar'
=>
[
'api/TransferHouseInfo/landlordPhoneStar'
,
[
'method'
=>
'post|get'
]
],
//房东手机号转json
]);
]);
Route
::
group
(
'chat'
,
[
Route
::
group
(
'chat'
,
[
...
...
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