development.php
17 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
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
<?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 class="form-group">
</div>
<div class="form-group">
<div class="col-md-12 text-center">
<button id="checkWxConfig" class="btn btn-primary ladda-button" data-style="slide-up">检查公众号设置</button>
</div>
</div>
</div>
</div>
</div>
<!--
<div class="col-md-6">
<div class="panel panel-default" style="padding-bottom: 0px;">
<div class="panel-heading">
<b>关注设置</b>
</div>
<div class="panel-body">
<p>登陆<span class="text-danger">微信公号</span>,完成以下设置:进入"设置>公众号设置>进入"设置>公众
号设置>功能设置",填写以下信息功能设置",填写以下信息:</p>
<form id="followForm" class="form-horizontal" role="form">
<div class="form-group">
<label class="col-md-4 control-label" >关注图文消息</label>
<div class="col-md-5">
<input id="followContent" type="text" class="form-control" placeholder="输入关注图文消息链接" value="<?//=$settings->followContent?>">
</div>
</div>
<div class="form-group">
<label class="col-md-4 control-label">关注按钮文字</label>
<div class="col-md-5">
<input id="followLabel" type="text" class="form-control" placeholder="输入关注按钮文字" value="<?//=$settings->followLabel?>">
</div>
</div>
<div class="form-group">
<label class="col-md-4 control-label">自动加息类型</label>
<div class="col-md-5">
<select id="replyType" class="form-control">
<?//php foreach($settings->reply_type as $option): ?>
<option value='<?//=$option->label?>' <?//=$option->selected?>><?//=$option->value?></option>
<?//php endforeach; ?>
</select>
</div>
</div>
<div class="form-group">
<label class="col-md-4 control-label"> 自动文本回复 </label>
<div class="col-md-5">
<textarea id="replyContent" class="form-control" rows="8"><?//=$settings->replyContent?></textarea>
</div>
</div>
<div class="form-group">
<div class="col-md-8 col-md-offset-4">
<button id="followSubmit" class="btn btn-primary ladda-button" data-style="slide-up">保存</button>
</div>
</div>
</form>
</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/wechat/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(){}
});
});
$('#checkWxConfig').on('click', function(){
//AJAX
var l = $.ladda(this);
$.ajax({
url : '<?= Url::toRoute(['/setting/wechat/development-check-wx-config']) ?>',
type : 'post',
dataType : 'json',
data : $.csrf({
}),
beforeSend : function(){
l.start();
},
success : function(e){
//成功返回数据
if (true == e.success) {
alert('公众号设置成功');
}else {
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);
}
});
//
// //关注设置
// $('#followForm #followSubmit').on('click', function(){
// var settingId = '<?//=$settings->settingsId?>//';
// var followContent = $('#followForm #followContent').val();
// var followLabel = $('#followForm #followLabel').val();
// var replyType = $('#followForm #replyType').val();
// var replyContent = $('#followForm #replyContent').val();
//
// //AJAX 保存
// var l = $.ladda(this);//按钮LOCATION
// $.ajax({
// url : '<?//= Url::toRoute(['/setting/wechat/follow-save']) ?>//',
// type : 'post',
// dataType : 'json',
// data : $.csrf({
// settingId : settingId,
// followContent : followContent,
// followLabel : followLabel,
// replyType : replyType,
// replyContent : replyContent
// }),
// beforeSend : function() {
// l.start();
// },
// success : function(e) {
// if (101 == e.code) {
// alert('操作有误,请重新操作');
// }
// location.reload();
// },
// error : function() {
// //获取AJAX错误提示
// },
// complete:function() {}
// });
// });
});
}(jQuery, window, document));
</script>