Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in
Toggle navigation
M
my-yaf-project
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
chenchuanwen
my-yaf-project
Commits
0db91099
Commit
0db91099
authored
Dec 01, 2018
by
liuyuzhen
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
用户注册加上省市区
parent
e9373d79
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
5 additions
and
23 deletions
+5
-23
Home.php
application/controllers/Home.php
+0
-20
AreaUtil.php
application/library/Area/AreaUtil.php
+0
-3
Member.php
application/models/DAO/Member.php
+5
-0
No files found.
application/controllers/Home.php
View file @
0db91099
...
...
@@ -192,24 +192,4 @@ class HomeController extends \Our\Controller_AbstractIndex{
$otherGoods
=
$goodsCommonService
->
getIndexHotSalesGoods
(
$currentAddress
);
$this
->
success
(
$otherGoods
);
}
public
function
testCityAction
(){
$cityCode
=
\Area\AreaUtil
::
getInstance
()
->
getIpCityInfo
();
var_dump
(
$cityCode
);
$cityCode1
=
\Area\AreaUtil
::
getInstance
()
->
getIpCityInfo
(
'218.195.219.255'
);
var_dump
(
$cityCode1
);
$cityCode2
=
\Area\AreaUtil
::
getInstance
()
->
getIpCityInfo
(
'61.244.148.166'
);
var_dump
(
$cityCode2
);
$cityCode3
=
\Area\AreaUtil
::
getInstance
()
->
getIpCityInfo
(
'60.246.233.219'
);
var_dump
(
$cityCode3
);
$cityCode4
=
\Area\AreaUtil
::
getInstance
()
->
getIpCityInfo
(
'59.125.39.5'
);
var_dump
(
$cityCode4
);
$cityCode5
=
\Area\AreaUtil
::
getInstance
()
->
getIpCityInfo
(
'169.235.24.133'
);
var_dump
(
$cityCode5
);
}
}
\ No newline at end of file
application/library/Area/AreaUtil.php
View file @
0db91099
...
...
@@ -11,17 +11,14 @@ class AreaUtil {
public
function
getIpCityInfo
(
$ip
=
''
){
if
(
!
$ip
){
$ip
=
\Our\Common
::
getIP
();
var_dump
(
$ip
);
}
$cityData
=
\Our\Common
::
getIpCity
(
$ip
);
var_dump
(
$cityData
);
$provinceId
=
\Our\ApiConst
::
zero
;
$cityId
=
\Our\ApiConst
::
zero
;
switch
(
$cityData
[
'country'
]){
case
\Our\NameConst
::
China
:
if
(
$cityData
[
'region'
]){
$province
=
mb_substr
(
$cityData
[
'region'
],
0
,
2
);
var_dump
(
$province
);
$provinceObj
=
\DAO\AreaModel
::
getInstance
()
->
getOne
(
array
(
'area_deep'
=>
1
,
'area_name'
=>
array
(
'like'
,
$province
.
'%'
)),
'area_id,area_name'
);
if
(
$provinceObj
){
$provinceId
=
$provinceObj
[
'area_id'
];
...
...
application/models/DAO/Member.php
View file @
0db91099
...
...
@@ -158,6 +158,11 @@ class MemberModel extends \DAO\AbstractModel
{
// $this->setDb(\Our\DbNameConst::masterDBConnectName);
// $result = $this->db->insert($this->_tableName)->rows($data)->execute();
$cityCode
=
\Area\AreaUtil
::
getInstance
()
->
getIpCityInfo
();
if
(
is_array
(
$cityCode
)){
$data
=
array_merge
(
$data
,
$cityCode
);
}
$result
=
$this
->
add
(
$data
);
if
(
$result
)
{
$memberDb0Redis
=
\Redis\Db0\MemberRedisModel
::
getInstance
();
...
...
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