添加时候需要微信分享标志位
Code Review By Rock Zhang
Showing
1 changed file
with
14 additions
and
1 deletions
@@ -132,7 +132,7 @@ class YuanxiaoController extends HuodongAction | @@ -132,7 +132,7 @@ class YuanxiaoController extends HuodongAction | ||
132 | 132 | ||
133 | $this->_view->display('result', array( | 133 | $this->_view->display('result', array( |
134 | 'staticTitle' => '元宵抽签', | 134 | 'staticTitle' => '元宵抽签', |
135 | - 'weixinShare' => $this->_isApp ? false : true, // 是否需要微信分享 | 135 | + 'needShare' => $this->checkNeedShare(), // 是否需要微信分享 |
136 | 'staticFile' => self::STATIC_FILE, | 136 | 'staticFile' => self::STATIC_FILE, |
137 | 'result' => $result, | 137 | 'result' => $result, |
138 | 'shareUrl' => $shareUrl, | 138 | 'shareUrl' => $shareUrl, |
@@ -187,6 +187,19 @@ class YuanxiaoController extends HuodongAction | @@ -187,6 +187,19 @@ class YuanxiaoController extends HuodongAction | ||
187 | } | 187 | } |
188 | 188 | ||
189 | /** | 189 | /** |
190 | + * 判断是否需要微信分享 | ||
191 | + * @return bool | ||
192 | + */ | ||
193 | + private function checkNeedShare() | ||
194 | + { | ||
195 | + if (strpos($_SERVER['HTTP_USER_AGENT'], 'MicroMessenger') !== false || $this->_isApp) { | ||
196 | + return true; | ||
197 | + } | ||
198 | + | ||
199 | + return false; | ||
200 | + } | ||
201 | + | ||
202 | + /** | ||
190 | * 加密字符串 | 203 | * 加密字符串 |
191 | * | 204 | * |
192 | * @param string $data 需要加密的字符串 | 205 | * @param string $data 需要加密的字符串 |
-
Please register or login to post a comment