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
7274db94
Commit
7274db94
authored
Dec 18, 2017
by
clone
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
savebug
parent
3479e4d2
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
44 additions
and
23 deletions
+44
-23
AttentionShop.php
application/api/controller/AttentionShop.php
+5
-5
Basic.php
application/api/extend/Basic.php
+1
-1
AttentionModel.php
application/model/AttentionModel.php
+26
-7
BannerModel.php
application/model/BannerModel.php
+11
-9
route.php
application/route.php
+1
-1
No files found.
application/api/controller/AttentionShop.php
View file @
7274db94
...
@@ -31,12 +31,12 @@ class AttentionShop extends Basic
...
@@ -31,12 +31,12 @@ class AttentionShop extends Basic
public
function
addOrUpdateAttention
()
public
function
addOrUpdateAttention
()
{
{
$params
=
$this
->
params
;
$params
=
$this
->
params
;
/*
$params = array(
$params
=
array
(
"id" => 2,
//
"id" => 2,
"user_id" =>
1
,
"user_id"
=>
3
,
"house_id"
=>
2
,
"house_id"
=>
2
,
"is_del" => 0
//
"is_del" => 0
);
*/
);
$msg
=
isset
(
$params
[
'id'
])
?
"修改"
:
"新增"
;
$msg
=
isset
(
$params
[
'id'
])
?
"修改"
:
"新增"
;
$result
=
$this
->
attentionModel
->
addOrUpdateAttentionShop
(
$params
);
$result
=
$this
->
attentionModel
->
addOrUpdateAttentionShop
(
$params
);
if
(
$result
[
'code'
]
==
200
)
{
if
(
$result
[
'code'
]
==
200
)
{
...
...
application/api/extend/Basic.php
View file @
7274db94
...
@@ -79,7 +79,7 @@ class Basic extends Controller
...
@@ -79,7 +79,7 @@ class Basic extends Controller
$requestPath
=
$this
->
request
->
routeInfo
()[
"rule"
][
0
]
.
"/"
.
$this
->
request
->
routeInfo
()[
"rule"
][
1
];
$requestPath
=
$this
->
request
->
routeInfo
()[
"rule"
][
0
]
.
"/"
.
$this
->
request
->
routeInfo
()[
"rule"
][
1
];
//过滤掉不需要验证token的接口
//过滤掉不需要验证token的接口
if
(
!
in_array
(
trim
(
$requestPath
),
$this
->
filterVerify
))
{
if
(
!
in_array
(
trim
(
$requestPath
),
$this
->
filterVerify
))
{
$this
->
tokenVerify
();
//
$this->tokenVerify();
}
}
}
}
...
...
application/model/AttentionModel.php
View file @
7274db94
...
@@ -9,10 +9,11 @@ class AttentionModel extends Model
...
@@ -9,10 +9,11 @@ class AttentionModel extends Model
{
{
// 设置当前模型对应的完整数据表名称
// 设置当前模型对应的完整数据表名称
protected
$table
=
'u_attention'
;
protected
$table
=
'u_attention'
;
protected
$db
;
public
function
__construct
()
public
function
__construct
()
{
{
$this
->
db
=
Db
(
$this
->
table
);
}
}
/**
/**
...
@@ -34,22 +35,40 @@ class AttentionModel extends Model
...
@@ -34,22 +35,40 @@ class AttentionModel extends Model
$arr
[
"is_del"
]
=
$params
[
'is_del'
];
$arr
[
"is_del"
]
=
$params
[
'is_del'
];
}
}
$saveWhere
=
array
();
if
(
isset
(
$params
[
'id'
]))
{
if
(
isset
(
$params
[
'id'
]))
{
//取消关注
$result
=
$this
$result
=
$this
->
where
(
"id="
.
$params
[
'id'
])
->
where
(
"id="
.
$params
[
'id'
])
->
select
();
->
select
();
if
(
count
(
$result
)
>
0
)
{
if
(
count
(
$result
)
>
0
)
{
$
arr
[
"id"
]
=
$params
[
"id"
];
$
saveWhere
[
"id"
]
=
$params
[
"id"
];
}
else
{
}
else
{
return
[
"code"
=>
"101"
,
"msg"
=>
"数据不存在"
];
return
[
"code"
=>
"101"
,
"msg"
=>
"数据不存在"
];
}
}
}
else
{
}
else
{
//关注
$arr
[
"create_time"
]
=
time
();
//保存的时候可能是上次取消关注过的所以改遍状态就行了
$where_
[
"user_id"
]
=
$params
[
'user_id'
];
$where_
[
"house_id"
]
=
$params
[
'house_id'
];
$res
=
$this
->
where
(
$where_
)
->
select
();
if
(
count
(
$res
)
>
0
)
{
$saveWhere
[
"id"
]
=
$res
[
0
][
"id"
];
$arr
[
"is_del"
]
=
0
;
}
else
{
$arr
[
"create_time"
]
=
date
(
"Y-m-d H:i:s"
,
time
());
$arr
[
"update_time"
]
=
date
(
"Y-m-d H:i:s"
,
time
());
}
}
}
Db
::
startTrans
();
Db
::
startTrans
();
try
{
try
{
$id
=
$this
->
save
(
$arr
);
if
(
isset
(
$saveWhere
[
"id"
])){
$id
=
$this
->
save
(
$arr
,
$saveWhere
);
}
else
{
$id
=
$this
->
save
(
$arr
);
}
Db
::
commit
();
Db
::
commit
();
return
[
"code"
=>
"200"
,
"msg"
=>
$id
];
return
[
"code"
=>
"200"
,
"msg"
=>
$id
];
}
catch
(
\Exception
$e
)
{
}
catch
(
\Exception
$e
)
{
...
...
application/model/BannerModel.php
View file @
7274db94
...
@@ -52,22 +52,27 @@ class BannerModel extends Model
...
@@ -52,22 +52,27 @@ class BannerModel extends Model
$arr
[
"is_show"
]
=
$param
[
'is_show'
];
$arr
[
"is_show"
]
=
$param
[
'is_show'
];
}
}
$saveWhere
=
array
();
if
(
isset
(
$param
[
'id'
]))
{
if
(
isset
(
$param
[
'id'
]))
{
$result
=
$this
->
db
$result
=
$this
->
db
->
where
(
"id="
.
$param
[
'id'
])
->
where
(
"id="
.
$param
[
'id'
])
->
select
();
->
select
();
if
(
count
(
$result
)
>
0
)
{
if
(
count
(
$result
)
>
0
)
{
$
arr
[
"id"
]
=
$param
[
"id"
];
$
saveWhere
[
"id"
]
=
$param
[
"id"
];
}
else
{
}
else
{
return
[
"code"
=>
"101"
,
"msg"
=>
"数据不存在"
];
return
[
"code"
=>
"101"
,
"msg"
=>
"数据不存在"
];
}
}
}
else
{
}
else
{
$arr
[
"create_time"
]
=
time
();
$arr
[
"create_time"
]
=
date
(
"Y-m-d H:i:s"
,
time
());
$arr
[
"update_time"
]
=
date
(
"Y-m-d H:i:s"
,
time
());
}
}
Db
::
startTrans
();
Db
::
startTrans
();
try
{
try
{
$id
=
$banner
->
save
(
$arr
);
if
(
isset
(
$saveWhere
[
"id"
])){
$id
=
$banner
->
save
(
$arr
,
$saveWhere
);
}
else
{
$id
=
$banner
->
save
(
$arr
);
}
Db
::
commit
();
Db
::
commit
();
return
[
"code"
=>
"200"
,
"msg"
=>
$id
];
return
[
"code"
=>
"200"
,
"msg"
=>
$id
];
}
catch
(
\Exception
$e
)
{
}
catch
(
\Exception
$e
)
{
...
@@ -84,17 +89,14 @@ class BannerModel extends Model
...
@@ -84,17 +89,14 @@ class BannerModel extends Model
*/
*/
function
upIsShow
(
$param
)
function
upIsShow
(
$param
)
{
{
//$this->logger->info('日志信息');
$banner
=
$this
->
db
;
$banner
=
$this
->
db
;
$arr
=
array
(
$arr
=
array
(
"id"
=>
$param
[
'id'
],
"is_show"
=>
$param
[
'is_show'
],
"is_show"
=>
$param
[
'is_show'
],
"update_time"
=>
time
(
)
"update_time"
=>
date
(
"Y-m-d H:i:s"
,
time
()
)
);
);
var_dump
(
$arr
);
exit
;
Db
::
startTrans
();
Db
::
startTrans
();
try
{
try
{
$id
=
$banner
->
save
(
$arr
);
$id
=
$banner
->
save
(
$arr
,[
"id"
=>
$param
[
"id"
]]
);
Db
::
commit
();
Db
::
commit
();
return
[
"code"
=>
"200"
,
"msg"
=>
$id
];
return
[
"code"
=>
"200"
,
"msg"
=>
$id
];
}
catch
(
\Exception
$e
)
{
}
catch
(
\Exception
$e
)
{
...
...
application/route.php
View file @
7274db94
...
@@ -105,7 +105,7 @@ Route::group('api', [
...
@@ -105,7 +105,7 @@ Route::group('api', [
'getTradeList'
=>
[
'api/TradeLog/getTradeList'
,
[
'method'
=>
'get'
]
],
'getTradeList'
=>
[
'api/TradeLog/getTradeList'
,
[
'method'
=>
'get'
]
],
//AttentionShop
//AttentionShop
'addOrUpdateAttention'
=>
[
'api/AttentionShop/addOrUpdateAttention'
,
[
'method'
=>
'post'
]
],
'addOrUpdateAttention'
=>
[
'api/AttentionShop/addOrUpdateAttention'
,
[
'method'
=>
'post
|get
'
]
],
'attentionList'
=>
[
'api/AttentionShop/attentionList'
,
[
'method'
=>
'post | get'
]
],
'attentionList'
=>
[
'api/AttentionShop/attentionList'
,
[
'method'
=>
'post | get'
]
],
...
...
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