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
582b7524
Commit
582b7524
authored
Jan 12, 2019
by
zhuwei
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
收藏客户
parent
143e2580
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
20 additions
and
11 deletions
+20
-11
CollectUser.php
application/api_broker/controller/CollectUser.php
+19
-10
ACollectUser.php
application/model/ACollectUser.php
+1
-1
No files found.
application/api_broker/controller/CollectUser.php
View file @
582b7524
...
@@ -55,19 +55,28 @@ class CollectUser extends Basic
...
@@ -55,19 +55,28 @@ class CollectUser extends Basic
}
}
if
(
$params
[
"status"
]
==
1
){
//先判断是否已经存在数据
//收藏
$field
=
'id,status'
;
$get_params
[
'agents_id'
]
=
$params
[
"agents_id"
];
$get_params
[
'user_id'
]
=
$params
[
"user_id"
];
$res
=
$this
->
aCollectUser
->
getCollectUser
(
$field
,
$get_params
);
if
(
$res
&&
(
count
(
$res
)
==
1
)){
//如果存在
if
(
$res
[
0
][
'status'
]
!=
$params
[
"status"
]
){
//如果存在-并且状态一致 不作处理 不一致则更新状态
$insert
[
"id"
]
=
$res
[
0
][
'id'
];
$insert
[
"status"
]
=
$params
[
"status"
];
$res
=
$this
->
aCollectUser
->
updateCollectUser
(
$insert
);
//int(1)
}
else
{
$res
=
true
;
}
}
else
{
//不存在则新增数据
if
(
count
(
$res
)
>
1
){
$this
->
aCollectUser
->
updateStatus
(
$params
[
"agents_id"
],
$params
[
"user_id"
]);
}
$insert
[
"agents_id"
]
=
$params
[
'agents_id'
];
$insert
[
"agents_id"
]
=
$params
[
'agents_id'
];
$insert
[
"user_id"
]
=
$params
[
'user_id'
];
$insert
[
"user_id"
]
=
$params
[
'user_id'
];
$insert
[
"status"
]
=
1
;
$insert
[
"status"
]
=
1
;
$is_saved
=
$this
->
aCollectUser
->
getCollectUser
(
'id'
,
$insert
);
$res
=
$this
->
aCollectUser
->
saveCollectUser
(
$insert
);
//int(1)
if
(
$is_saved
){
return
$this
->
response
(
"200"
,
"成功"
);
}
$res
=
$this
->
aCollectUser
->
saveCollectUser
(
$insert
);
}
else
{
//取消收藏
$res
=
$this
->
aCollectUser
->
updateStatus
(
$params
[
'agents_id'
],
$params
[
'user_id'
]);
}
}
if
(
$res
)
{
if
(
$res
)
{
...
...
application/model/ACollectUser.php
View file @
582b7524
...
@@ -85,7 +85,7 @@ class ACollectUser extends Model
...
@@ -85,7 +85,7 @@ class ACollectUser extends Model
{
{
$result
=
$this
->
where
([
'agents_id'
=>
$agents_id
,
'user_id'
=>
$user_id
])
->
update
([
'status'
=>
2
]);
$result
=
$this
->
where
([
'agents_id'
=>
$agents_id
,
'user_id'
=>
$user_id
])
->
update
([
'status'
=>
2
]);
//dump($this->getLastSql());
//dump($this->getLastSql());
big_log
(
$this
->
getLastSql
());
//
big_log($this->getLastSql());
return
$result
;
return
$result
;
}
}
...
...
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