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
ce77f00c
Commit
ce77f00c
authored
Dec 21, 2017
by
clone
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
session
parent
13026a05
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
308 additions
and
21 deletions
+308
-21
Sublet.php
application/api/controller/Sublet.php
+21
-17
Basic.php
application/api/extend/Basic.php
+4
-3
Login.php
application/index/controller/Login.php
+5
-0
AdminModel.php
application/model/AdminModel.php
+1
-1
SubletModel.php
application/model/SubletModel.php
+1
-0
route.php
application/route.php
+5
-0
collapse.js
public/resource/lib/js/collapse.js
+212
-0
transition.js
public/resource/lib/js/transition.js
+59
-0
No files found.
application/api/controller/Sublet.php
View file @
ce77f00c
...
...
@@ -26,20 +26,19 @@ class Sublet extends Basic
public
function
addSublet
()
{
$params
=
$this
->
params
;
/* $params = array(
"user_id" => 1,
"manage_type" => 0,
"address_detail" => "shanghaishi",
"province" => "湖南省",
"province_code" => "10001",
"city" => "长沙市",
"city_code" => "200001",
"district" => "芙蓉区",
"district_code" => "300001",
"expected_rent" => 2000,
"appellation" => "zhangsan",
"tel" => 13817616162,
);*/
$params
=
array
(
"user_id"
=>
47
,
"manage_type"
=>
美食
,
"address_detail"
=>
"泗泾"
,
"province"
=>
"上海"
,
"city"
=>
"长沙市"
,
"district"
=>
"芙蓉区"
,
"expected_rent"
=>
2000
,
"appellation"
=>
"zhangsan"
,
"tel"
=>
13817616162
,
"AuthToken"
=>
'eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJkYXRhIjp7ImlkIjo0NywidXNlck5pY2siOm51bGwsInBob25lIjoiMTgyMDU2MjUwMjAifSwidGltZVN0YW1wXyI6MTUxMzU3MzMwMH0.-_tpSDeucA6_V8glS1hfoNBpZU8lRk6J8On3-_Rdf_I'
,
);
if
(
!
isset
(
$params
[
"manage_type"
]))
{
$this
->
response
(
"101"
,
"经营业态不能为空"
);
...
...
@@ -49,8 +48,12 @@ class Sublet extends Basic
$this
->
response
(
"101"
,
"详细地址不能为空"
);
}
if
(
!
isset
(
$params
[
"province"
])
||
!
isset
(
$params
[
"province_code"
])
||
!
isset
(
$params
[
"city"
])
||
!
isset
(
$params
[
"city_code"
])
||
!
isset
(
$params
[
"district"
])
||
!
isset
(
$params
[
"district_code"
]))
{
/* if (!isset($params["province"]) || !isset($params["province_code"]) || !isset($params["city"]) ||
!isset($params["city_code"]) || !isset($params["district"]) || !isset($params["district_code"])) {
$this->response("101", "省市区不能为空");
}*/
if
(
!
isset
(
$params
[
"province"
])
||
!
isset
(
$params
[
"city"
])
||
!
isset
(
$params
[
"district"
]))
{
$this
->
response
(
"101"
,
"省市区不能为空"
);
}
...
...
@@ -62,12 +65,13 @@ class Sublet extends Basic
$this
->
response
(
"101"
,
"称呼不能为空"
);
}
if
(
!
isset
(
$params
[
"tel"
])
||
!
preg_match
(
'/1[345678]\d{9}/'
,
$params
[
"
phone
"
]))
{
if
(
!
isset
(
$params
[
"tel"
])
||
!
preg_match
(
'/1[345678]\d{9}/'
,
$params
[
"
tel
"
]))
{
$this
->
response
(
"101"
,
"手机号检验错误"
);
}
$params
[
"create_time"
]
=
time
();
$params
[
"update_time"
]
=
time
();
unset
(
$params
[
"AuthToken"
]);
$result
=
$this
->
subletMode
->
addSublet
(
$params
);
if
(
$result
[
"code"
]
==
200
)
{
return
$this
->
response
(
"200"
,
"数据保存成功"
,
$result
[
"msg"
]);
...
...
application/api/extend/Basic.php
View file @
ce77f00c
...
...
@@ -76,10 +76,10 @@ class Basic extends Controller
$this
->
timeStamp_
=
$result
->
timeStamp_
;
}
$requestPath
=
$this
->
request
->
routeInfo
()[
"rule"
][
0
]
.
"/"
.
$this
->
request
->
routeInfo
()[
"rule"
][
1
];
$requestPath
=
$this
->
request
->
routeInfo
()[
"rule"
][
0
]
.
"/"
.
$this
->
request
->
routeInfo
()[
"rule"
][
1
];
//过滤掉不需要验证token的接口
if
(
!
in_array
(
trim
(
$requestPath
),
$this
->
filterVerify
))
{
$this
->
tokenVerify
();
$this
->
tokenVerify
();
}
}
...
...
@@ -87,7 +87,8 @@ class Basic extends Controller
/**
* token 验证
*/
public
function
tokenVerify
(){
public
function
tokenVerify
()
{
if
(
!
isset
(
$this
->
params
[
'AuthToken'
]))
{
echo
json_encode
(
array
(
"code"
=>
"300"
,
"msg"
=>
"AuthToken不能为空!"
,
"data"
=>
[],
"type"
=>
"json"
));
exit
;
...
...
application/index/controller/Login.php
View file @
ce77f00c
...
...
@@ -5,6 +5,7 @@ namespace app\index\controller;
use
app\index\extend\Basic
;
use
app\model\AdminModel
;
use
think\Request
;
use
think\Session
;
/**
* Created by PhpStorm.
...
...
@@ -42,6 +43,10 @@ class Login extends Basic
//todo 更新登录信息
if
(
count
(
$result
)
>
0
)
{
Session
::
set
(
"userName"
,
$result
[
0
][
"name"
]);
Session
::
set
(
"userId"
,
$result
[
0
][
"id"
]);
Session
::
set
(
"lastLoginTime"
,
$result
[
0
][
"last_login_time"
]);
$this
->
redirect
(
'banner/banner'
);
}
else
{
return
view
(
"login/login"
,
[
"msg"
=>
"用户名或密码错误"
]);
...
...
application/model/AdminModel.php
View file @
ce77f00c
...
...
@@ -25,7 +25,7 @@ class AdminModel extends Model
public
function
verifyUser
(
$params
)
{
return
$this
->
db
->
field
(
"id"
)
return
$this
->
db
->
field
(
"id
,name,last_login_time
"
)
->
where
(
$params
)
->
select
();
}
...
...
application/model/SubletModel.php
View file @
ce77f00c
...
...
@@ -3,6 +3,7 @@
namespace
app\model
;
use
think\Model
;
use
think\Db
;
class
SubletModel
extends
Model
{
...
...
application/route.php
View file @
ce77f00c
...
...
@@ -130,6 +130,10 @@ Route::group('api', [
//AttentionShop
'addOrUpdateAttention'
=>
[
'api/AttentionShop/addOrUpdateAttention'
,
[
'method'
=>
'post|get'
]
],
'attentionList'
=>
[
'api/AttentionShop/attentionList'
,
[
'method'
=>
'post | get'
]
],
'addSublet'
=>
[
'api/Sublet/addSublet'
,
[
'method'
=>
'post|get'
]
],
]);
//Route::miss('api/index/miss');//处理错误的url
\ No newline at end of file
public/resource/lib/js/collapse.js
0 → 100644
View file @
ce77f00c
/* ========================================================================
* Bootstrap: collapse.js v3.3.7
* http://getbootstrap.com/javascript/#collapse
* ========================================================================
* Copyright 2011-2016 Twitter, Inc.
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
* ======================================================================== */
/* jshint latedef: false */
+
function
(
$
)
{
'use strict'
;
// COLLAPSE PUBLIC CLASS DEFINITION
// ================================
var
Collapse
=
function
(
element
,
options
)
{
this
.
$element
=
$
(
element
)
this
.
options
=
$
.
extend
({},
Collapse
.
DEFAULTS
,
options
)
this
.
$trigger
=
$
(
'[data-toggle="collapse"][href="#'
+
element
.
id
+
'"],'
+
'[data-toggle="collapse"][data-target="#'
+
element
.
id
+
'"]'
)
this
.
transitioning
=
null
if
(
this
.
options
.
parent
)
{
this
.
$parent
=
this
.
getParent
()
}
else
{
this
.
addAriaAndCollapsedClass
(
this
.
$element
,
this
.
$trigger
)
}
if
(
this
.
options
.
toggle
)
this
.
toggle
()
}
Collapse
.
VERSION
=
'3.3.7'
Collapse
.
TRANSITION_DURATION
=
350
Collapse
.
DEFAULTS
=
{
toggle
:
true
}
Collapse
.
prototype
.
dimension
=
function
()
{
var
hasWidth
=
this
.
$element
.
hasClass
(
'width'
)
return
hasWidth
?
'width'
:
'height'
}
Collapse
.
prototype
.
show
=
function
()
{
if
(
this
.
transitioning
||
this
.
$element
.
hasClass
(
'in'
))
return
var
activesData
var
actives
=
this
.
$parent
&&
this
.
$parent
.
children
(
'.panel'
).
children
(
'.in, .collapsing'
)
if
(
actives
&&
actives
.
length
)
{
activesData
=
actives
.
data
(
'bs.collapse'
)
if
(
activesData
&&
activesData
.
transitioning
)
return
}
var
startEvent
=
$
.
Event
(
'show.bs.collapse'
)
this
.
$element
.
trigger
(
startEvent
)
if
(
startEvent
.
isDefaultPrevented
())
return
if
(
actives
&&
actives
.
length
)
{
Plugin
.
call
(
actives
,
'hide'
)
activesData
||
actives
.
data
(
'bs.collapse'
,
null
)
}
var
dimension
=
this
.
dimension
()
this
.
$element
.
removeClass
(
'collapse'
)
.
addClass
(
'collapsing'
)[
dimension
](
0
)
.
attr
(
'aria-expanded'
,
true
)
this
.
$trigger
.
removeClass
(
'collapsed'
)
.
attr
(
'aria-expanded'
,
true
)
this
.
transitioning
=
1
var
complete
=
function
()
{
this
.
$element
.
removeClass
(
'collapsing'
)
.
addClass
(
'collapse in'
)[
dimension
](
''
)
this
.
transitioning
=
0
this
.
$element
.
trigger
(
'shown.bs.collapse'
)
}
if
(
!
$
.
support
.
transition
)
return
complete
.
call
(
this
)
var
scrollSize
=
$
.
camelCase
([
'scroll'
,
dimension
].
join
(
'-'
))
this
.
$element
.
one
(
'bsTransitionEnd'
,
$
.
proxy
(
complete
,
this
))
.
emulateTransitionEnd
(
Collapse
.
TRANSITION_DURATION
)[
dimension
](
this
.
$element
[
0
][
scrollSize
])
}
Collapse
.
prototype
.
hide
=
function
()
{
if
(
this
.
transitioning
||
!
this
.
$element
.
hasClass
(
'in'
))
return
var
startEvent
=
$
.
Event
(
'hide.bs.collapse'
)
this
.
$element
.
trigger
(
startEvent
)
if
(
startEvent
.
isDefaultPrevented
())
return
var
dimension
=
this
.
dimension
()
this
.
$element
[
dimension
](
this
.
$element
[
dimension
]())[
0
].
offsetHeight
this
.
$element
.
addClass
(
'collapsing'
)
.
removeClass
(
'collapse in'
)
.
attr
(
'aria-expanded'
,
false
)
this
.
$trigger
.
addClass
(
'collapsed'
)
.
attr
(
'aria-expanded'
,
false
)
this
.
transitioning
=
1
var
complete
=
function
()
{
this
.
transitioning
=
0
this
.
$element
.
removeClass
(
'collapsing'
)
.
addClass
(
'collapse'
)
.
trigger
(
'hidden.bs.collapse'
)
}
if
(
!
$
.
support
.
transition
)
return
complete
.
call
(
this
)
this
.
$element
[
dimension
](
0
)
.
one
(
'bsTransitionEnd'
,
$
.
proxy
(
complete
,
this
))
.
emulateTransitionEnd
(
Collapse
.
TRANSITION_DURATION
)
}
Collapse
.
prototype
.
toggle
=
function
()
{
this
[
this
.
$element
.
hasClass
(
'in'
)
?
'hide'
:
'show'
]()
}
Collapse
.
prototype
.
getParent
=
function
()
{
return
$
(
this
.
options
.
parent
)
.
find
(
'[data-toggle="collapse"][data-parent="'
+
this
.
options
.
parent
+
'"]'
)
.
each
(
$
.
proxy
(
function
(
i
,
element
)
{
var
$element
=
$
(
element
)
this
.
addAriaAndCollapsedClass
(
getTargetFromTrigger
(
$element
),
$element
)
},
this
))
.
end
()
}
Collapse
.
prototype
.
addAriaAndCollapsedClass
=
function
(
$element
,
$trigger
)
{
var
isOpen
=
$element
.
hasClass
(
'in'
)
$element
.
attr
(
'aria-expanded'
,
isOpen
)
$trigger
.
toggleClass
(
'collapsed'
,
!
isOpen
)
.
attr
(
'aria-expanded'
,
isOpen
)
}
function
getTargetFromTrigger
(
$trigger
)
{
var
href
var
target
=
$trigger
.
attr
(
'data-target'
)
||
(
href
=
$trigger
.
attr
(
'href'
))
&&
href
.
replace
(
/.*
(?=
#
[^\s]
+$
)
/
,
''
)
// strip for ie7
return
$
(
target
)
}
// COLLAPSE PLUGIN DEFINITION
// ==========================
function
Plugin
(
option
)
{
return
this
.
each
(
function
()
{
var
$this
=
$
(
this
)
var
data
=
$this
.
data
(
'bs.collapse'
)
var
options
=
$
.
extend
({},
Collapse
.
DEFAULTS
,
$this
.
data
(),
typeof
option
==
'object'
&&
option
)
if
(
!
data
&&
options
.
toggle
&&
/show|hide/
.
test
(
option
))
options
.
toggle
=
false
if
(
!
data
)
$this
.
data
(
'bs.collapse'
,
(
data
=
new
Collapse
(
this
,
options
)))
if
(
typeof
option
==
'string'
)
data
[
option
]()
})
}
var
old
=
$
.
fn
.
collapse
$
.
fn
.
collapse
=
Plugin
$
.
fn
.
collapse
.
Constructor
=
Collapse
// COLLAPSE NO CONFLICT
// ====================
$
.
fn
.
collapse
.
noConflict
=
function
()
{
$
.
fn
.
collapse
=
old
return
this
}
// COLLAPSE DATA-API
// =================
$
(
document
).
on
(
'click.bs.collapse.data-api'
,
'[data-toggle="collapse"]'
,
function
(
e
)
{
var
$this
=
$
(
this
)
if
(
!
$this
.
attr
(
'data-target'
))
e
.
preventDefault
()
var
$target
=
getTargetFromTrigger
(
$this
)
var
data
=
$target
.
data
(
'bs.collapse'
)
var
option
=
data
?
'toggle'
:
$this
.
data
()
Plugin
.
call
(
$target
,
option
)
})
}(
jQuery
);
public/resource/lib/js/transition.js
0 → 100644
View file @
ce77f00c
/* ========================================================================
* Bootstrap: transition.js v3.3.7
* http://getbootstrap.com/javascript/#transitions
* ========================================================================
* Copyright 2011-2016 Twitter, Inc.
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
* ======================================================================== */
+
function
(
$
)
{
'use strict'
;
// CSS TRANSITION SUPPORT (Shoutout: http://www.modernizr.com/)
// ============================================================
function
transitionEnd
()
{
var
el
=
document
.
createElement
(
'bootstrap'
)
var
transEndEventNames
=
{
WebkitTransition
:
'webkitTransitionEnd'
,
MozTransition
:
'transitionend'
,
OTransition
:
'oTransitionEnd otransitionend'
,
transition
:
'transitionend'
}
for
(
var
name
in
transEndEventNames
)
{
if
(
el
.
style
[
name
]
!==
undefined
)
{
return
{
end
:
transEndEventNames
[
name
]
}
}
}
return
false
// explicit for ie8 ( ._.)
}
// http://blog.alexmaccaw.com/css-transitions
$
.
fn
.
emulateTransitionEnd
=
function
(
duration
)
{
var
called
=
false
var
$el
=
this
$
(
this
).
one
(
'bsTransitionEnd'
,
function
()
{
called
=
true
})
var
callback
=
function
()
{
if
(
!
called
)
$
(
$el
).
trigger
(
$
.
support
.
transition
.
end
)
}
setTimeout
(
callback
,
duration
)
return
this
}
$
(
function
()
{
$
.
support
.
transition
=
transitionEnd
()
if
(
!
$
.
support
.
transition
)
return
$
.
event
.
special
.
bsTransitionEnd
=
{
bindType
:
$
.
support
.
transition
.
end
,
delegateType
:
$
.
support
.
transition
.
end
,
handle
:
function
(
e
)
{
if
(
$
(
e
.
target
).
is
(
this
))
return
e
.
handleObj
.
handler
.
apply
(
this
,
arguments
)
}
}
})
}(
jQuery
);
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