Merge branch 'hotfix/guangFav' into release/4.8
Showing
4 changed files
with
17 additions
and
34 deletions
@@ -372,7 +372,14 @@ class Helpers | @@ -372,7 +372,14 @@ class Helpers | ||
372 | if ($isApp) { | 372 | if ($isApp) { |
373 | $result['collect'] = array(); | 373 | $result['collect'] = array(); |
374 | $result['collect']['isCollected'] = isset($articleData['isFavor']) && $articleData['isFavor'] === 'Y'; | 374 | $result['collect']['isCollected'] = isset($articleData['isFavor']) && $articleData['isFavor'] === 'Y'; |
375 | - $result['collect']['url'] = !empty($uid) ? 'javascript:;' : strtr($articleData['url'], array('"islogin":"N"' => '"islogin":"Y"')); | 375 | +// $originUrl = 'http:' . Helpers::url('/author/index',null,'guang') . $_SERVER["QUERY_STRING"]; // 跳转回的链接 https |
376 | + $originUrl = Helpers::url('/author/index',null,'guang') . $_SERVER["QUERY_STRING"]; // 跳转回的链接 | ||
377 | + $collectUrl = 'javascript:;'; // 根据用户是否登录做处理的链接 | ||
378 | + if (empty($uid)) { | ||
379 | + $playUrlEncode = strtr($originUrl, array('/' => '\\/')); | ||
380 | + $collectUrl = $originUrl . '?openby:yohobuy={"action":"go.weblogin","params":{"jumpurl":{"url":"' . $playUrlEncode . '","param":{"from":"app"}},"requesturl":{"url":"","param":{}},"priority":"N"}}'; | ||
381 | + } | ||
382 | + $result['collect']['url'] = $collectUrl; | ||
376 | } // 点赞 | 383 | } // 点赞 |
377 | else { | 384 | else { |
378 | $result['like'] = array(); | 385 | $result['like'] = array(); |
@@ -160,27 +160,17 @@ function initInfosEvt($container) { | @@ -160,27 +160,17 @@ function initInfosEvt($container) { | ||
160 | type: 'POST', | 160 | type: 'POST', |
161 | url: '/guang/opt/collectArticle', | 161 | url: '/guang/opt/collectArticle', |
162 | data: { | 162 | data: { |
163 | - id: getUrlParam('id'), | 163 | + id: $info.data('id'), |
164 | opt: opt, | 164 | opt: opt, |
165 | yh_channel: yhChannel, | 165 | yh_channel: yhChannel, |
166 | uid: getUrlParam('uid') | 166 | uid: getUrlParam('uid') |
167 | }, | 167 | }, |
168 | success: function(data) { | 168 | success: function(data) { |
169 | if (data.code && data.code === 200) { | 169 | if (data.code && data.code === 200) { |
170 | - if (data.data.jump) { | ||
171 | - if ($('#intimacy-link').length <= 0) { | ||
172 | - $('body').append('<a href=\'' + data.data.jumpUrl + | ||
173 | - '\' style="display:none;" id="intimacy-link">' + | ||
174 | - '<span class="intimacy-link"></span></a>'); | ||
175 | - } | ||
176 | - | ||
177 | - $('.intimacy-link').click(); | ||
178 | - } else { | ||
179 | 170 | ||
180 | //切换收藏状态 | 171 | //切换收藏状态 |
181 | $btn.toggleClass('collected'); | 172 | $btn.toggleClass('collected'); |
182 | } | 173 | } |
183 | - } | ||
184 | }, | 174 | }, |
185 | error: function() { | 175 | error: function() { |
186 | tip.show('网络断开连接了~'); | 176 | tip.show('网络断开连接了~'); |
@@ -9,7 +9,9 @@ | @@ -9,7 +9,9 @@ | ||
9 | <span class="like-count">{{count}}</span> | 9 | <span class="like-count">{{count}}</span> |
10 | {{/ like}} | 10 | {{/ like}} |
11 | {{# collect}} | 11 | {{# collect}} |
12 | + <a href={{url}}> | ||
12 | <i class="iconfont collect-btn{{#isCollected}} collected{{/isCollected}}"></i> | 13 | <i class="iconfont collect-btn{{#isCollected}} collected{{/isCollected}}"></i> |
14 | + </a> | ||
13 | {{/ collect}} | 15 | {{/ collect}} |
14 | {{# share}} | 16 | {{# share}} |
15 | <a href="{{.}}" class="iconfont share-btn"></a> | 17 | <a href="{{.}}" class="iconfont share-btn"></a> |
@@ -52,39 +52,25 @@ class OptController extends AbstractAction | @@ -52,39 +52,25 @@ class OptController extends AbstractAction | ||
52 | */ | 52 | */ |
53 | public function collectArticleAction() | 53 | public function collectArticleAction() |
54 | { | 54 | { |
55 | - $result = array('code' => 200, 'message' => '成功!', 'data' => ''); | ||
56 | - $jumpUrl = ''; | ||
57 | - $isNoLogin = false; | 55 | + $result = array('code' => 400, 'message' => '您未登录,无法收藏或者取消收藏。请先登录!', 'data' => ''); |
58 | 56 | ||
59 | do { | 57 | do { |
60 | /* 判断是不是AJAX请求 */ | 58 | /* 判断是不是AJAX请求 */ |
61 | if (!$this->isAjax()) { | 59 | if (!$this->isAjax()) { |
62 | - $result = array('code' => 400, 'message' => '不是Ajax请求!', 'data' => ''); | ||
63 | break; | 60 | break; |
64 | } | 61 | } |
65 | 62 | ||
66 | /* 判断参数是否有效 */ | 63 | /* 判断参数是否有效 */ |
67 | $id = $this->post('id'); | 64 | $id = $this->post('id'); |
68 | if (!is_numeric($id)) { | 65 | if (!is_numeric($id)) { |
69 | - $result = array('code' => 400, 'message' => '没有ID!', 'data' => ''); | ||
70 | break; | 66 | break; |
71 | } | 67 | } |
72 | 68 | ||
73 | /* 判断用户是否登录 */ | 69 | /* 判断用户是否登录 */ |
74 | - $uid = $this->get('uid'); | ||
75 | - $isNoLogin = empty($uid) || !is_numeric($uid); | ||
76 | - | ||
77 | - /* 如果有 yh_channel 是 app */ | ||
78 | - if ($yhChannel = $this->post('yh_channel')) { | ||
79 | - | ||
80 | - /* 如果没有登录,拼接 App 登录规则 */ | ||
81 | - if ($isNoLogin) { | ||
82 | - $playUrl = Helpers::url('/author/index', '', 'guang'); | ||
83 | - $playUrlEncode = strtr($playUrl, array('/' => '\\/')); | ||
84 | - $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"}}&uid=' . $uid; | ||
85 | - $result = array('code' => 200, 'message' => '未登录', 'data' => array('jumpUrl' => $jumpUrl, 'jump' => true)); | 70 | + $uid = $this->post('uid'); |
71 | + if (empty($uid) || !is_numeric($uid)) { | ||
86 | break; | 72 | break; |
87 | - } else { | 73 | + } |
88 | 74 | ||
89 | /* 执行点赞或取消操作 */ | 75 | /* 执行点赞或取消操作 */ |
90 | $opt = $this->post('opt', 'ok'); | 76 | $opt = $this->post('opt', 'ok'); |
@@ -93,10 +79,8 @@ class OptController extends AbstractAction | @@ -93,10 +79,8 @@ class OptController extends AbstractAction | ||
93 | $result = array('code' => 400, 'message' => '操作失败', 'data' => ''); | 79 | $result = array('code' => 400, 'message' => '操作失败', 'data' => ''); |
94 | break; | 80 | break; |
95 | } | 81 | } |
96 | - } | ||
97 | - } else { /* 非 app 不需要点赞*/ | ||
98 | - $result = array('code' => 400, 'message' => '不是App!', 'data' => ''); | ||
99 | - } | 82 | + |
83 | + $result = array('code' => 200, 'message' => '成功', 'data' => ''); | ||
100 | } while (false); | 84 | } while (false); |
101 | 85 | ||
102 | $this->echoJson($result); | 86 | $this->echoJson($result); |
-
Please register or login to post a comment