diff --git a/application/plugins/view/weixinwebauthorization/index/public/auth_button.html b/application/plugins/view/weixinwebauthorization/index/public/auth_button.html
index 5e6140958bc97867ecf9a67329faeb706d4243a0..71454ae93aa4991994bfb8d35c60bbe48bce6028 100755
--- a/application/plugins/view/weixinwebauthorization/index/public/auth_button.html
+++ b/application/plugins/view/weixinwebauthorization/index/public/auth_button.html
@@ -1 +1 @@
-
微信登录
\ No newline at end of file
+
{{if empty($plugins_data['login_name'])}}微信{{else /}}{{$plugins_data.login_name}}{{/if}}
\ No newline at end of file
diff --git a/application/plugins/view/weixinwebauthorization/index/public/auth_text.html b/application/plugins/view/weixinwebauthorization/index/public/auth_text.html
index 4363c7ebc1b112fb79fedf37012fa3310166688c..b84bf337059ea334ccff349772f7c0c22f2511c2 100644
--- a/application/plugins/view/weixinwebauthorization/index/public/auth_text.html
+++ b/application/plugins/view/weixinwebauthorization/index/public/auth_text.html
@@ -1 +1 @@
-
微信登录
\ No newline at end of file
+
{{if empty($plugins_data['login_name'])}}微信{{else /}}{{$plugins_data.login_name}}{{/if}}
\ No newline at end of file
diff --git a/application/plugins/weixinwebauthorization/Hook.php b/application/plugins/weixinwebauthorization/Hook.php
index b5b65d2cbdb6932785e0edb6165abd1069d195b5..f661c431d1832656de7dc0a9a56d46aab759932d 100644
--- a/application/plugins/weixinwebauthorization/Hook.php
+++ b/application/plugins/weixinwebauthorization/Hook.php
@@ -11,6 +11,7 @@
namespace app\plugins\weixinwebauthorization;
use think\Controller;
+use app\service\PluginsService;
/**
* 微信登录 - 钩子入口
@@ -31,14 +32,15 @@ class Hook extends Controller
*/
public function run($params = [])
{
- if(!empty($params['hook_name']))
+ // 目前微信登录只针对手机端
+ if(!empty($params['hook_name']) && IsMobile())
{
switch($params['hook_name'])
{
// 用户登录页面顶部钩子
// 用户注册页面钩子
case 'plugins_view_user_login_info_top' :
- case 'plugins_view_user_reg_info_top' :
+ case 'plugins_view_user_reg_info' :
$ret = $this->ButtonHtml($params);
break;
@@ -47,6 +49,11 @@ class Hook extends Controller
$ret = $this->NavTextHtml($params);
break;
+ // header代码
+ case 'plugins_common_header' :
+ $ret = $this->Style($params);
+ break;
+
default :
$ret = '';
}
@@ -54,6 +61,21 @@ class Hook extends Controller
}
}
+ /**
+ * css
+ * @author Devil
+ * @blog http://gong.gg/
+ * @version 1.0.0
+ * @datetime 2019-02-06T16:16:34+0800
+ * @param [array] $params [输入参数]
+ */
+ public function Style($params = [])
+ {
+ return '';
+ }
+
/**
* 登录登录html
* @author Devil
@@ -65,6 +87,8 @@ class Hook extends Controller
*/
private function ButtonHtml($params = [])
{
+ $ret = PluginsService::PluginsData('weixinwebauthorization');
+ $this->assign('plugins_data', $ret['data']);
return $this->fetch('../../../plugins/view/weixinwebauthorization/index/public/auth_button');
}
@@ -79,6 +103,8 @@ class Hook extends Controller
*/
private function NavTextHtml($params = [])
{
+ $ret = PluginsService::PluginsData('weixinwebauthorization');
+ $this->assign('plugins_data', $ret['data']);
return $this->fetch('../../../plugins/view/weixinwebauthorization/index/public/auth_text');
}
}
diff --git a/application/plugins/weixinwebauthorization/config.json b/application/plugins/weixinwebauthorization/config.json
index 83f519d81d038067a14c5923aa2f1e393c919a1a..9265c2592431073324755e3d950a3e7403e3dfc0 100644
--- a/application/plugins/weixinwebauthorization/config.json
+++ b/application/plugins/weixinwebauthorization/config.json
@@ -20,11 +20,14 @@
"plugins_view_user_login_info_top":[
"app\\plugins\\weixinwebauthorization\\Hook"
],
- "plugins_view_user_reg_info_top":[
+ "plugins_view_user_reg_info":[
"app\\plugins\\weixinwebauthorization\\Hook"
],
"plugins_view_header_navigation_top_left":[
"app\\plugins\\weixinwebauthorization\\Hook"
+ ],
+ "plugins_common_header":[
+ "app\\plugins\\weixinwebauthorization\\Hook"
]
}
}
\ No newline at end of file
diff --git a/application/tags.php b/application/tags.php
index cdcd9c78f9fa694d43e310aceaa773573fdeb932..76dac03e0f36ddf9960c97062aba07b495584a66 100755
--- a/application/tags.php
+++ b/application/tags.php
@@ -87,6 +87,7 @@ return array (
0 => 'app\\plugins\\expressforkdn\\Hook',
1 => 'app\\plugins\\touristbuy\\Hook',
2 => 'app\\plugins\\homemiddleadv\\Hook',
+ 3 => 'app\\plugins\\weixinwebauthorization\\Hook',
),
'plugins_admin_common_header' =>
array (
@@ -113,6 +114,7 @@ return array (
'plugins_view_user_reg_info' =>
array (
0 => 'app\\plugins\\touristbuy\\Hook',
+ 1 => 'app\\plugins\\weixinwebauthorization\\Hook',
),
'plugins_service_buy_handle' =>
array (
@@ -156,9 +158,5 @@ return array (
array (
0 => 'app\\plugins\\wallet\\Hook',
),
- 'plugins_view_user_reg_info_top' =>
- array (
- 0 => 'app\\plugins\\weixinwebauthorization\\Hook',
- ),
);
?>
\ No newline at end of file
diff --git a/extend/payment/Weixin.php b/extend/payment/Weixin.php
index 28c2e9bc9c0f4047e1cf2d643a22a549f1d16edc..82f5a2042a19174c127b187b6ad61e163c122d97 100755
--- a/extend/payment/Weixin.php
+++ b/extend/payment/Weixin.php
@@ -233,15 +233,25 @@ class Weixin
return DataReturn('支付类型不匹配', -1);
}
+ // openid
+ if(APPLICATION == 'app')
+ {
+ $openid = isset($params['user']['weixin_openid']) ? $params['user']['weixin_openid'] : '';
+ } else {
+ $openid = isset($params['user']['weixin_web_openid']) ? $params['user']['weixin_web_openid'] : '';
+ }
+
// appid
- $appid = (APPLICATION_CLIENT_TYPE == 'weixin') ? $this->config['mini_appid'] : $this->config['appid'];
+ $appid = (APPLICATION == 'app') ? $this->config['mini_appid'] : $this->config['appid'];
+
+ // 请求参数
$data = [
'appid' => $appid,
'mch_id' => $this->config['mch_id'],
'body' => $params['site_name'].'-'.$params['name'],
'nonce_str' => md5(time().rand().$params['order_no']),
'notify_url' => (__MY_HTTP__ == 'https') ? 'http'.mb_substr($params['notify_url'], 5, null, 'utf-8') : $params['notify_url'],
- 'openid' => ($trade_type == 'JSAPI') ? $params['user']['weixin_openid'] : '',
+ 'openid' => ($trade_type == 'JSAPI') ? $openid : '',
'out_trade_no' => $params['order_no'].GetNumberCode(6),
'spbill_create_ip' => GetClientIP(),
'total_fee' => intval($params['total_price']*100),