development.php
12.7 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
<?php
use yii\helpers\Url;
?>
<?= $this->render("_header", ['tab' => 'wechat_development']) ?>
<script src="<?= Yii::$app->request->baseUrl . "/exts/base/1.0.0/ui/zclip/zclip.min.js" ?>"></script>
<div class="container" style="padding-left: 0px;">
<div class="col-md-12" style="padding-left: 0px;">
<div class="panel panel-default">
<div class="panel-heading">
<b>公众号开发设置</b>
</div>
<div class="panel-body">
<table class="table">
<thead>
<tr>
<td>
<p>登陆<span class="text-danger">微信公众号</span>, 完成以下设置:</p>
<p>1. 进入菜单: 【设置】>【公众号设置】>【功能设置】, 将以下信息填写到公众号: <a
href="<?= Yii::$app->request->BaseUrl ?>/images/wechat-setting-1.png">
<查看示例>
</a></p>
<div>
<div class="col-md-2 text-right">
<b>业务域名</b>
</div>
<div class="col-md-10">
<span class="text-danger"><?= $others->biz_domain ?></span>
<div style="position:relative;display: inline-block">
<a href="javascript:void(0)"
class="copy"
data-url="<?= $others->biz_domain ?>">复制链接</a>
</div>
</div>
</div>
<div class="col-md-12" style="padding-top:10px;"></div>
<div>
<div class="col-md-2 text-right">
<b>JS接口安全域名</b>
</div>
<div class="col-md-10">
<span class="text-danger"><?= $others->js_domain ?></span>
<div style="position:relative;display: inline-block">
<a href="javascript:void(0)"
class="copy"
data-url="<?= $others->js_domain ?>">复制链接</a>
</div>
</div>
</div>
<div class="col-md-12" style="padding-top:10px;"></div>
<div>
<div class="col-md-2 text-right">
<b>授权回调页面域名</b>
</div>
<div class="col-md-10">
<span class="text-danger"><?= $others->oauth_domain ?></span>
<div style="position:relative;display: inline-block">
<a href="javascript:void(0)" class="copy"
data-url="<?= $others->oauth_domain ?>">复制链接</a>
</div>
</div>
</div>
</td>
</tr>
</thead>
<tr>
<td>
<p>2. 进入菜单: 【开发】>【基本配置】, 获取以下【开发者ID】并填写保存: <a
href="<?= Yii::$app->request->BaseUrl ?>/images/wechat-setting-2.png">
<查看示例>
</a></p>
<form id="appForm" class="form-horizontal" role="form">
<div class="form-group">
<label class="col-md-2 control-label"> AppId(应用ID)</label>
<div class="col-md-4">
<input id="appId" type="text" class="form-control" placeholder="输入AppId"
value="<?= $settings->appid ?>">
</div>
</div>
<div class="form-group">
<label class="col-md-2 control-label">AppSecret(应用密钥)</label>
<div class="col-md-4">
<input id="appSecret" type="text" class="form-control" placeholder="输入AppSecret"
value="<?= $settings->appsecret ?>">
</div>
</div>
<div class="form-group">
<div class="col-md-6 col-md-offset-3">
<button id="appSubmit" class="btn btn-primary ladda-button"
data-style="slide-up">保存
</button>
</div>
</div>
</form>
</td>
</tr>
<tr>
<td>
<p>3. 进入菜单: 【开发】>【基本配置】>【填写服务器配置】: <a
href="<?= Yii::$app->request->BaseUrl ?>/images/wechat-setting-3.png">
<查看示例>
</a></p>
<div>
<div class="col-md-2 text-right">
<b>URL</b>
</div>
<div class="col-md-10">
<span class="text-danger"><?= $others->notify_url ?></span>
<div style="position:relative;display: inline-block">
<a href="javascript:void(0)" class="copy"
data-url="<?= $others->notify_url ?>">复制链接</a>
</div>
</div>
</div>
<div class="col-md-12" style="padding-top:10px;"></div>
<div>
<div class="col-md-2 text-right">
<b>Token</b>
</div>
<div class="col-md-10">
<span class="text-danger"><?= $settings->token ?></span>
<div style="position:relative;display: inline-block">
<a href="javascript:void(0)" class="copy"
data-url="<?= $settings->token ?>">复制链接</a>
</div>
</div>
</div>
<div class="col-md-12" style="padding-top:10px;"></div>
<div>
<div class="col-md-2 text-right">
<b>EncodingAESKey</b>
</div>
<div class="col-md-10">
随机生成
</div>
</div>
<div class="col-md-12" style="padding-top:10px;"></div>
<div>
<div class="col-md-2 text-right">
<b>消息加解密方式</b>
</div>
<div class="col-md-10">
明文模式
</div>
</div>
</td>
</tr>
<tr>
<td>
<p>4. 进入菜单: 【添加功能插件】>【模板消息】>【申请】开通模板消息接口, 填写以下信息: <a
href="<?= Yii::$app->request->BaseUrl ?>/images/wechat-setting-5.png">
<查看示例>
</a></p>
<div>
<div class="col-md-2 text-right">
<b>主营行业</b>
</div>
<div class="col-md-10">
<span class="text-danger">IT科技/IT软件与服务</span>
</div>
<div class="col-md-2 text-right">
<b>副营行业</b>
</div>
<div class="col-md-10">
<span class="text-danger">运输与仓储/物流</span>
</div>
<div class="col-md-2 text-right">
<b>申请理由</b>
</div>
<div class="col-md-10">
<span class="text-danger">【范例】: <br/>需要为用户的报修订单状态变化推送模板消息。</span>
</div>
</div>
</td>
</tr>
</table>
</div>
</div>
</div>
</div>
<script>
(function ($, window, document) {
$(document).ready(function () {
//功能设置 更新
$('#appForm #appSubmit').on('click', function () {
var appId = $("#appForm #appId").val();
var appSecret = $('#appForm #appSecret').val();
//AJAX
var l = $.ladda(this);
$.ajax({
url: '<?= Url::toRoute(['/setting/user-mp/development-save']) ?>',
type: 'post',
dataType: 'json',
data: $.csrf({
appId: appId,
appSecret: appSecret,
}),
beforeSend: function () {
l.start();
},
success: function (e) {
//成功返回数据
if (false == e.success) {
if (101 == e.code) {
alert('操作有误,请重新操作');
}
}
location.reload();
},
error: function () {
},
complete: function () {
}
});
});
/* 定义所有class为copy标签,点击后可复制被点击对象的文本 */
$(".copy").zclip({
path: "<?= Yii::$app->request->baseUrl . "/exts/base/1.0.0/ui/zclip/ZeroClipboard.swf" ?>",
copy: function () {
console
return $(this).data('url');
},
beforeCopy: function () {/* 按住鼠标时的操作 */
$(this).css("color", "orange");
},
afterCopy: function () {/* 复制成功后的操作 */
var $copysuc = $("<div class='copy-tips'><div class='copy-tips-wrap'>☺ 复制成功</div></div>");
$("body").find(".copy-tips").remove().end().append($copysuc);
$(".copy-tips").fadeOut(3000);
}
});
});
}(jQuery, window, document));
</script>