信呼OA版本v2.3.8
This commit is contained in:
86
webmain/system/wxgzh/rock_wxgzh_cog.php
Normal file
86
webmain/system/wxgzh/rock_wxgzh_cog.php
Normal file
@@ -0,0 +1,86 @@
|
||||
<?php if(!defined('HOST'))die('not access');?>
|
||||
<script >
|
||||
$(document).ready(function(){
|
||||
|
||||
var c={
|
||||
init:function(){
|
||||
$.get(js.getajaxurl('getset','{mode}','{dir}'), function(s){
|
||||
var a=js.decode(s);
|
||||
get('wxgzhappid_{rand}').value=a.appid;
|
||||
get('wxgzhsecret_{rand}').value=a.secret;
|
||||
get('wxgzhtplmess_{rand}').value=a.tplmess;
|
||||
|
||||
});
|
||||
},
|
||||
save:function(o){
|
||||
var d={};
|
||||
d.appid = get('wxgzhappid_{rand}').value;
|
||||
d.secret = get('wxgzhsecret_{rand}').value;
|
||||
d.tplmess = get('wxgzhtplmess_{rand}').value;
|
||||
js.msg('wait','保存中...');
|
||||
js.ajax(js.getajaxurl('setsave','{mode}','{dir}'), d, function(s){
|
||||
js.msg('success','保存成功');
|
||||
},'post');
|
||||
}
|
||||
,
|
||||
testss:function(o1,lx){
|
||||
if(ISDEMO){js.msg('success','demo上就不要测试,我们都测试通过的');return;}
|
||||
js.msg('wait','测试中...');
|
||||
js.ajax(js.getajaxurl('testsend','{mode}','{dir}'),{lx:lx}, function(a){
|
||||
if(a.success){
|
||||
js.msg('success',a.msg);
|
||||
}else{
|
||||
js.msg('msg',a.msg);
|
||||
}
|
||||
},'get,json');
|
||||
}
|
||||
};
|
||||
js.initbtn(c);
|
||||
c.init();
|
||||
});
|
||||
</script>
|
||||
|
||||
<div align="left">
|
||||
<div style="padding:10px;">
|
||||
|
||||
|
||||
|
||||
<table cellspacing="0" width="600" border="0" cellpadding="0">
|
||||
|
||||
|
||||
<tr>
|
||||
<td align="right"><font color=red>*</font> AppID(应用ID):</td>
|
||||
<td class="tdinput"><input id="wxgzhappid_{rand}" class="form-control"></td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td align="right" width="180"><font color=red>*</font>AppSecret(应用密钥):</td>
|
||||
<td class="tdinput">
|
||||
<textarea id="wxgzhsecret_{rand}" style="height:60px" class="form-control"></textarea>
|
||||
<font color="#888888">可以使用公众号的订阅号/服务号都可以,到公众号后台【开发→基本配置】下获取,<a href="<?=URLY?>view_wxgzh.html" target="_blank">[帮助]</a></font>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td align="right">使用模版消息:</td>
|
||||
<td class="tdinput"><select id="wxgzhtplmess_{rand}" class="form-control"><option value="">否</option><option value="1">是(需认证的服务号,OA系统安装企业微信插件)</option></select></td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td align="right"></td>
|
||||
<td class="tdinput" align="left"><button click="testss,0" class="btn btn-default" type="button">测试是否有效</button>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
|
||||
<tr>
|
||||
<td align="right"></td>
|
||||
<td style="padding:15px 0px" colspan="3" align="left"><button click="save" class="btn btn-success" type="button"><i class="icon-save"></i> 保存</button>
|
||||
</span>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
|
||||
|
||||
</div>
|
||||
</div>
|
||||
1
webmain/system/wxgzh/rock_wxgzh_tpl.php
Normal file
1
webmain/system/wxgzh/rock_wxgzh_tpl.php
Normal file
@@ -0,0 +1 @@
|
||||
<div style="font-size:30px;padding:100px">信呼的微信公众模版消息,需要购买,去<a href="http://www.rockoa.com/view_weixinqy.html" target="_blank" style="font-size:30px">【看看】</a></div>
|
||||
142
webmain/system/wxgzh/rock_wxgzh_tpledit.php
Normal file
142
webmain/system/wxgzh/rock_wxgzh_tpledit.php
Normal file
@@ -0,0 +1,142 @@
|
||||
<?php if(!defined('HOST'))die('not access');?>
|
||||
<script >
|
||||
$(document).ready(function(){
|
||||
{params}
|
||||
var id = params.id;
|
||||
|
||||
var c = {
|
||||
init:function(){
|
||||
js.ajax(js.getajaxurl('gettpledit','{mode}','{dir}',{id:id}),false,function(ret){
|
||||
c.showdatas(ret);
|
||||
},'get,json');
|
||||
$('#mosel_{rand}').change(function(){
|
||||
c.moselchang(this.value);
|
||||
});
|
||||
},
|
||||
save:function(){
|
||||
var soi = get('mosel_{rand}').value;
|
||||
if(soi==''){
|
||||
js.msg('msg','请选择关联OA系统模版');
|
||||
return;
|
||||
}
|
||||
var i,len=this.farr.length,fid,s1='',v1,c1;
|
||||
if(len==0){
|
||||
js.msg('msg','无法设置没有参数的模版消息');
|
||||
return;
|
||||
}
|
||||
for(i=0;i<len;i++){
|
||||
fid = this.farr[i];
|
||||
v1 = get('selectcan{rand}_'+i+'').value;
|
||||
c1 = get('selectcol{rand}_'+i+'').value;
|
||||
if(v1==''){
|
||||
js.msg('msg','请设置参数'+fid+'的值');
|
||||
get('selectcan{rand}_'+i+'').focus();
|
||||
return;
|
||||
}
|
||||
s1+=',"'+fid+'":{"value":"'+v1+'","color":"'+c1+'"}';
|
||||
}
|
||||
s1='{'+s1.substr(1)+'}';
|
||||
js.msg('wait','处理中...');
|
||||
js.ajax(js.getajaxurl('savetpledit','{mode}','{dir}'),{
|
||||
'modename' : this.marr[soi].title,
|
||||
'modeparams':s1,
|
||||
'id':id
|
||||
},function(){
|
||||
js.msg('success','保存成功');
|
||||
});
|
||||
},
|
||||
showdatas:function(ret){
|
||||
get('tplid_{rand}').value = ret.data.title;
|
||||
get('tpl_cont{rand}').value = ret.data.content;
|
||||
var i,s='',fid,v1,c1;
|
||||
s='<table class="table table-striped table-bordered" ><tr><th>参数</th><th><font color=red>*</font>设置参数</th><th>显示颜色</th></tr>';
|
||||
this.farr = [];
|
||||
this.marr = ret.marr;
|
||||
var sdt = [],xsl='';
|
||||
for(i=0;i<this.marr.length;i++){
|
||||
sdt.push({'value':i,'name':this.marr[i].title});
|
||||
if(this.marr[i].title==ret.data.modename)xsl=''+i+'';
|
||||
}
|
||||
js.setselectdata(get('mosel_{rand}'),sdt,'value');
|
||||
get('mosel_{rand}').value=xsl;
|
||||
this.moselchang(xsl);
|
||||
var csnse = {};
|
||||
if(!isempt(ret.data.modeparams))csnse=js.decode(ret.data.modeparams);
|
||||
for(i=0;i<ret.farr.length;i++){
|
||||
fid = ret.farr[i].replace('{','').replace('.DATA','');
|
||||
this.farr.push(fid);
|
||||
v1='';
|
||||
c1='';
|
||||
if(csnse[fid]){
|
||||
v1=csnse[fid].value;
|
||||
c1=csnse[fid].color;
|
||||
}
|
||||
s+='<tr><td>'+fid+'</td><td><input value="'+v1+'" onfocus="welecewete{rand}(this,1)" id="selectcan{rand}_'+i+'" style="width:300px" class="form-control"></td><td><input id="selectcol{rand}_'+i+'" value="'+c1+'" class="form-control" maxlength="7" style="width:100px" ></td></tr>';
|
||||
}
|
||||
s+='</table>';
|
||||
$('#setview{rand}').html(s);
|
||||
|
||||
},
|
||||
moselchang:function(v){
|
||||
var s = '',v1;
|
||||
if(v!=''){
|
||||
var da = this.marr[v].params;
|
||||
for(v1 in da)s+='<a href="javascript:;" onclick="welecewete{rand}(\''+v1+'\',0)">+'+da[v1]+'('+v1+')</a> ';
|
||||
}
|
||||
$('#moselv_{rand}').html(s);
|
||||
}
|
||||
};
|
||||
js.initbtn(c);
|
||||
c.init();
|
||||
welecewete{rand}=function(ov,lx){
|
||||
if(lx==1){
|
||||
c.selobj = ov;
|
||||
}else{
|
||||
if(c.selobj)c.selobj.value=''+c.selobj.value+'{'+ov+'}';
|
||||
}
|
||||
}
|
||||
});
|
||||
</script>
|
||||
|
||||
|
||||
<div align="left">
|
||||
<div style="padding:10px;">
|
||||
|
||||
|
||||
|
||||
<table cellspacing="0" width="700" border="0" cellpadding="0">
|
||||
<tr>
|
||||
<td align="right">模版标题:</td>
|
||||
<td class="tdinput"><input id="tplid_{rand}" readonly class="form-control"></td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td align="right" width="180">模版内容:</td>
|
||||
<td class="tdinput">
|
||||
<textarea id="tpl_cont{rand}" readonly style="height:150px" class="form-control"></textarea>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td align="right"><font color=red>*</font> 关联OA系统模版:</td>
|
||||
<td class="tdinput"><select id="mosel_{rand}" style="width:200px" class="form-control"><option value="">-请选择-</option></select><div id="moselv_{rand}"></div></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td align="right" width="180">设置模版参考:</td>
|
||||
<td class="tdinput" id="setview{rand}">
|
||||
|
||||
|
||||
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td align="right"></td>
|
||||
<td style="padding:15px 0px" colspan="3" align="left"><button click="save" class="btn btn-success" type="button"><i class="icon-save"></i> 保存</button>
|
||||
</span>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
|
||||
|
||||
</div>
|
||||
</div>
|
||||
91
webmain/system/wxgzh/rock_wxgzh_user.php
Normal file
91
webmain/system/wxgzh/rock_wxgzh_user.php
Normal file
@@ -0,0 +1,91 @@
|
||||
<?php if(!defined('HOST'))die('not access');?>
|
||||
<script >
|
||||
$(document).ready(function(){
|
||||
|
||||
|
||||
var a = $('#veiw_{rand}').bootstable({
|
||||
tablename:'wouser',fanye:true,
|
||||
modedir:'{mode}:{dir}',
|
||||
storebeforeaction:'wouser_before',
|
||||
columns:[{
|
||||
text:'头像',dataIndex:'headimgurl',renderer:function(v){
|
||||
return '<img src="'+v+'" width="40">';
|
||||
}
|
||||
},{
|
||||
text:'微信昵称',dataIndex:'nickname'
|
||||
},{
|
||||
text:'openid',dataIndex:'openid'
|
||||
},{
|
||||
text:'性别',dataIndex:'sex',sortable:true,renderer:function(v){
|
||||
if(v=='1')v='男';
|
||||
if(v=='2')v='女';
|
||||
return v;
|
||||
}
|
||||
},{
|
||||
text:'国家',dataIndex:'country'
|
||||
},{
|
||||
text:'省份',dataIndex:'province',sortable:true
|
||||
},{
|
||||
text:'城市',dataIndex:'city',sortable:true
|
||||
},{
|
||||
text:'授权时间',dataIndex:'adddt',sortable:true
|
||||
},{
|
||||
text:'操作时间',dataIndex:'optdt',sortable:true
|
||||
},{
|
||||
text:'ID',dataIndex:'id',sortable:true
|
||||
}],
|
||||
itemclick:function(){
|
||||
btn(false);
|
||||
},
|
||||
beforeload:function(){
|
||||
btn(true);
|
||||
}
|
||||
});
|
||||
|
||||
//编辑和删除按钮可用状态切换
|
||||
function btn(bo){
|
||||
|
||||
}
|
||||
|
||||
|
||||
var c={
|
||||
|
||||
|
||||
refresh:function(){
|
||||
a.reload();//刷新列表的方法
|
||||
},
|
||||
search:function(){
|
||||
var s=get('key_{rand}').value;
|
||||
a.setparams({key:s},true);
|
||||
}
|
||||
};
|
||||
|
||||
js.initbtn(c); //这个是将上面的方法绑定到对应按钮上
|
||||
});
|
||||
</script>
|
||||
<div>
|
||||
|
||||
|
||||
<table width="100%"><tr>
|
||||
<td nowrap>
|
||||
<button class="btn btn-default" click="refresh" type="button"><i class="icon-refresh"></i> 刷新</button>
|
||||
</td>
|
||||
|
||||
<td width="80%">
|
||||
|
||||
<div class="input-group" style="width:220px;">
|
||||
<input class="form-control" id="key_{rand}" placeholder="昵称/城市/省份">
|
||||
<span class="input-group-btn">
|
||||
<button class="btn btn-default" click="search" type="button"><i class="icon-search"></i></button>
|
||||
</span>
|
||||
</div>
|
||||
|
||||
</td>
|
||||
<td align="right" nowrap>
|
||||
<button class="btn btn-default" id="fstest_{rand}" disabled click="testcs" type="button">测试发模板消息</button>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</div>
|
||||
<div class="blank10"></div>
|
||||
<div id="veiw_{rand}"></div>
|
||||
97
webmain/system/wxgzh/rock_wxgzh_xcyuser.php
Normal file
97
webmain/system/wxgzh/rock_wxgzh_xcyuser.php
Normal file
@@ -0,0 +1,97 @@
|
||||
<?php if(!defined('HOST'))die('not access');?>
|
||||
<script >
|
||||
$(document).ready(function(){
|
||||
|
||||
|
||||
var a = $('#veiw_{rand}').bootstable({
|
||||
tablename:'wxxcyus',fanye:true,
|
||||
modedir:'{mode}:{dir}',
|
||||
storebeforeaction:'wouser_before',
|
||||
storeafteraction:'wxxcyus_after',
|
||||
columns:[{
|
||||
text:'头像',dataIndex:'avatarUrl',renderer:function(v){
|
||||
return '<img src="'+v+'" width="40">';
|
||||
}
|
||||
},{
|
||||
text:'微信昵称',dataIndex:'nickName'
|
||||
},{
|
||||
text:'openid',dataIndex:'openid'
|
||||
},{
|
||||
text:'性别',dataIndex:'gender',sortable:true,renderer:function(v){
|
||||
if(v=='1')v='男';
|
||||
if(v=='2')v='女';
|
||||
return v;
|
||||
}
|
||||
},{
|
||||
text:'类型',dataIndex:'xcytype',sortable:true
|
||||
},{
|
||||
text:'省份',dataIndex:'province',sortable:true
|
||||
},{
|
||||
text:'城市',dataIndex:'city',sortable:true
|
||||
},{
|
||||
text:'绑定手机号',dataIndex:'mobile'
|
||||
},{
|
||||
text:'推送提醒',dataIndex:'dingyue'
|
||||
},{
|
||||
text:'授权时间',dataIndex:'adddt',sortable:true
|
||||
},{
|
||||
text:'最后操作',dataIndex:'optdt',sortable:true
|
||||
},{
|
||||
text:'ID',dataIndex:'id',sortable:true
|
||||
}],
|
||||
itemclick:function(){
|
||||
btn(false);
|
||||
},
|
||||
beforeload:function(){
|
||||
btn(true);
|
||||
}
|
||||
});
|
||||
|
||||
//编辑和删除按钮可用状态切换
|
||||
function btn(bo){
|
||||
get('del_{rand}').disabled=bo;
|
||||
}
|
||||
|
||||
|
||||
var c={
|
||||
del:function(){
|
||||
a.del();
|
||||
},
|
||||
refresh:function(){
|
||||
a.reload();//刷新列表的方法
|
||||
},
|
||||
search:function(){
|
||||
var s=get('key_{rand}').value;
|
||||
a.setparams({key:s},true);
|
||||
}
|
||||
};
|
||||
|
||||
js.initbtn(c); //这个是将上面的方法绑定到对应按钮上
|
||||
});
|
||||
</script>
|
||||
<div>
|
||||
|
||||
|
||||
<table width="100%"><tr>
|
||||
<td nowrap>
|
||||
<button class="btn btn-default" click="refresh" type="button"><i class="icon-refresh"></i> 刷新</button>
|
||||
</td>
|
||||
|
||||
<td width="95%" align="left">
|
||||
|
||||
<div class="input-group" style="width:220px;">
|
||||
<input class="form-control" id="key_{rand}" placeholder="昵称/城市/省份">
|
||||
<span class="input-group-btn">
|
||||
<button class="btn btn-default" click="search" type="button"><i class="icon-search"></i></button>
|
||||
</span>
|
||||
</div>
|
||||
|
||||
</td>
|
||||
<td align="right" nowrap>
|
||||
<button class="btn btn-danger" id="del_{rand}" click="del" disabled type="button"><i class="icon-trash"></i> 删除</button>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</div>
|
||||
<div class="blank10"></div>
|
||||
<div id="veiw_{rand}"></div>
|
||||
121
webmain/system/wxgzh/wxgzhAction.php
Normal file
121
webmain/system/wxgzh/wxgzhAction.php
Normal file
@@ -0,0 +1,121 @@
|
||||
<?php
|
||||
class wxgzhClassAction extends Action
|
||||
{
|
||||
|
||||
public function setsaveAjax()
|
||||
{
|
||||
m('wxgzh:index')->clearalltoken();
|
||||
$pid = m('wxgzh:index')->optionpid;
|
||||
$this->option->setval('wxgzh_appid@'.$pid.'', $this->post('appid'));
|
||||
$this->option->setval('wxgzh_secret@'.$pid.'', $this->post('secret'));
|
||||
$this->option->setval('wxgzh_tplmess@'.$pid.'', $this->post('tplmess'));
|
||||
$this->backmsg();
|
||||
}
|
||||
|
||||
public function getsetAjax()
|
||||
{
|
||||
$arr= array();
|
||||
$arr['appid'] = $this->option->getval('wxgzh_appid');
|
||||
$arr['secret'] = $this->option->getval('wxgzh_secret');
|
||||
$arr['tplmess'] = $this->option->getval('wxgzh_tplmess');
|
||||
echo json_encode($arr);
|
||||
}
|
||||
|
||||
public function testsendAjax()
|
||||
{
|
||||
$lx = (int)$this->get('lx');
|
||||
if($lx==0){
|
||||
$val = m('wxgzh:wxgzh')->getticket();
|
||||
}else{
|
||||
$val = 'ok';
|
||||
}
|
||||
if($val==''){
|
||||
showreturn('','测试失败');
|
||||
}else{
|
||||
showreturn('','测试成功');
|
||||
}
|
||||
}
|
||||
|
||||
//获取模版消息列表
|
||||
public function getlisttplAjax()
|
||||
{
|
||||
return m('wxgzh:index')->gettpllist();
|
||||
}
|
||||
|
||||
|
||||
public function wotpl_before($table)
|
||||
{
|
||||
return array(
|
||||
'order' => 'status desc'
|
||||
);
|
||||
}
|
||||
|
||||
public function wouser_before($table)
|
||||
{
|
||||
$where = '';
|
||||
$key = $this->post('key');
|
||||
if(!isempt($key)){
|
||||
$where=" and (`nickname` like '%$key%' or `province`='$key' or `city`='$key')";
|
||||
}
|
||||
return $where;
|
||||
}
|
||||
|
||||
public function wotpl_after($table, $rows)
|
||||
{
|
||||
|
||||
return array(
|
||||
'rows' => $rows
|
||||
);
|
||||
}
|
||||
|
||||
public function wxxcyus_after($table, $rows)
|
||||
{
|
||||
$dm = getconfig('systype');
|
||||
foreach($rows as $k=>$rs){
|
||||
if(!isempt($rs['mobile'])){
|
||||
$rows[$k]['mobile'] = substr($rs['mobile'],0,3).'****'.substr($rs['mobile'],-4);
|
||||
if($dm=='demo')$rows[$k]['mobile']='已绑定';
|
||||
}
|
||||
|
||||
}
|
||||
return array(
|
||||
'rows' => $rows
|
||||
);
|
||||
}
|
||||
public function gettpleditAjax()
|
||||
{
|
||||
$id = (int)$this->get('id','0');
|
||||
$rs = m('wotpl')->getone($id);
|
||||
$cont = $rs['content'];
|
||||
$farr = $this->rock->matcharr($cont);
|
||||
|
||||
return array(
|
||||
'data' => $rs,
|
||||
'farr' => $farr,
|
||||
'marr' => m('wxgzh:index')->getxinhutpl()
|
||||
);
|
||||
}
|
||||
public function savetpleditAjax()
|
||||
{
|
||||
$id = (int)$this->post('id','0');
|
||||
m('wotpl')->update(array(
|
||||
'modename' => $this->post('modename'),
|
||||
'modeparams' => $this->post('modeparams')
|
||||
),$id);
|
||||
}
|
||||
|
||||
public function testsendtplAjax()
|
||||
{
|
||||
$id = (int)$this->post('id','0');
|
||||
$openid = $this->post('openid');
|
||||
if(isempt($openid))return returnerror('没有输入openid');
|
||||
|
||||
$urs = m('wouser')->getone("`openid`='$openid'");
|
||||
if(!$urs)return returnerror('没有找到此授权的微信人');
|
||||
|
||||
$barr = m('wxgzh:index')->sendtpl($openid, $id, array(), true);
|
||||
if($barr['errcode']!=0)return returnerror($barr['errcode'].'.'.$barr['msg']);
|
||||
|
||||
return returnsuccess($barr['msg']);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user