Toggle navigation
Toggle navigation
This project
Loading...
Sign in
fe
/
YOHOBUYWAP
·
Commits
Go to a project
GitLab
Go to group
Project
Activity
Files
Commits
Pipelines
0
Builds
0
Graphs
Milestones
Issues
0
Merge Requests
0
Members
Labels
Wiki
Forks
Network
Create a new issue
Download as
Email Patches
Plain Diff
Browse Files
Authored by
郭成尧
9 years ago
Commit
5beb34b603109f62efecadb6df9737c7225d9ff8
1 parent
8e3626cc
收藏
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
27 additions
and
24 deletions
static/js/guang/info.js
yohobuy/m.yohobuy.com/application/modules/Guang/controllers/Opt.php
static/js/guang/info.js
View file @
5beb34b
...
...
@@ -166,19 +166,18 @@ function initInfosEvt($container) {
},
success
:
function
(
data
)
{
if
(
data
.
code
&&
data
.
code
===
200
)
{
//切换收藏状态
$btn
.
toggleClass
(
'collected'
);
}
if
(
data
.
code
&&
data
.
code
===
400
&&
data
.
data
.
jumpUrl
)
{
if
(
yhChannel
)
{
if
(
data
.
data
.
jump
)
{
if
(
$
(
'#intimacy-link'
).
length
<=
0
)
{
$
(
'body'
).
append
(
'<a href=\''
+
data
.
data
.
jumpUrl
+
'\' style="display:none;" id="intimacy-link">'
+
$
(
'body'
).
append
(
'<a href=\''
+
data
.
data
.
jumpUrl
+
'\' style="display:none;" id="intimacy-link">'
+
'<span class="intimacy-link"></span></a>'
);
}
$
(
'.intimacy-link'
).
click
();
}
else
{
//切换收藏状态
$btn
.
toggleClass
(
'collected'
);
}
}
},
...
...
yohobuy/m.yohobuy.com/application/modules/Guang/controllers/Opt.php
View file @
5beb34b
...
...
@@ -52,19 +52,21 @@ class OptController extends AbstractAction
*/
public
function
collectArticleAction
()
{
$result
=
array
(
'code'
=>
400
,
'message'
=>
'您未登录,无法收藏或者取消收藏。请先登录
!'
,
'data'
=>
''
);
$result
=
array
(
'code'
=>
200
,
'message'
=>
'成功
!'
,
'data'
=>
''
);
$jumpUrl
=
''
;
$isNoLogin
=
false
;
do
{
/* 判断是不是AJAX请求 */
if
(
!
$this
->
isAjax
())
{
$result
=
array
(
'code'
=>
400
,
'message'
=>
'不是Ajax请求!'
,
'data'
=>
''
);
break
;
}
/* 判断参数是否有效 */
$id
=
$this
->
post
(
'id'
);
if
(
!
is_numeric
(
$id
))
{
$result
=
array
(
'code'
=>
400
,
'message'
=>
'没有ID!'
,
'data'
=>
''
);
break
;
}
...
...
@@ -72,29 +74,31 @@ class OptController extends AbstractAction
$uid
=
$this
->
get
(
'uid'
);
$isNoLogin
=
empty
(
$uid
)
||
!
is_numeric
(
$uid
);
/* 如果有 yh_channel 是 app */
if
(
$yhChannel
=
$this
->
post
(
'yh_channel'
))
{
/* 如果没有登录,拼接 App 登录规则 */
if
(
$isNoLogin
)
{
$playUrl
=
Helpers
::
url
(
'/author/index'
,
''
,
'guang'
);
$playUrlEncode
=
strtr
(
$playUrl
,
array
(
'/'
=>
'\\/'
));
$jumpUrl
=
$playUrl
.
'?openby:yohobuy={"action":"go.weblogin","params":{"jumpurl":{"url":"'
.
$playUrlEncode
.
'","param":{"from":"app","id":"'
.
$id
.
'",""yh_channel":"'
.
$yhChannel
.
'",""uid":"'
.
$uid
.
'"}},"requesturl":{"url":"","param":{}},"priority":"N"}}'
;
$result
=
array
(
'code'
=>
200
,
'message'
=>
'未登录'
,
'data'
=>
array
(
'jumpUrl'
=>
$jumpUrl
,
'jump'
=>
true
));
break
;
}
else
{
/* 执行点赞或取消操作 */
$opt
=
$this
->
post
(
'opt'
,
'ok'
);
$data
=
OptData
::
collectArticle
(
$uid
,
$id
,
$opt
);
if
(
!
$data
)
{
$result
=
array
(
'code'
=>
400
,
'message'
=>
'操作失败'
,
'data'
=>
''
);
break
;
}
}
}
/* 执行点赞或取消操作 */
$opt
=
$this
->
post
(
'opt'
,
'ok'
);
$data
=
OptData
::
collectArticle
(
$uid
,
$id
,
$opt
);
if
(
!
$data
)
{
$result
=
array
(
'code'
=>
400
,
'message'
=>
'操作失败'
,
'data'
=>
''
);
break
;
}
if
(
$isNoLogin
)
{
$result
=
array
(
'code'
=>
400
,
'message'
=>
'未登录'
,
'data'
=>
array
(
'jumpUrl'
=>
$jumpUrl
));
}
else
{
$result
=
array
(
'code'
=>
200
,
'message'
=>
'成功'
,
'data'
=>
''
);
}
else
{
/* 非 app 不需要点赞*/
$result
=
array
(
'code'
=>
400
,
'message'
=>
'不是App!'
,
'data'
=>
''
);
}
}
while
(
false
);
\Plugin\DataProcess\CouponFloorProcess
::
debugOut
(
$result
);
$this
->
echoJson
(
$result
);
}
...
...
Please
register
or
login
to post a comment