作者 sgj
1 个管道 的构建 失败 耗费 9 秒

报名后逻辑修改

... ... @@ -816,15 +816,18 @@ class IndexController extends RestBaseController
$userId=$user_id;
}
$map['user_id']=input('user_id');
if (empty($map['user_id'])){
$map['user_id']=$userId;
}
$map['activity_id']=$activity_id;
$map['status']=['in','1,3'];
$map['delete_time']=0;
$result=db('join')->where($map)->find();
// echo db('join')->getLastSql();
$result=db('join')->where($map)->order('id','desc')->find();
if (empty($result)){
$this->error('没有相关信息');
}
$return['work_content']=db('work')->where('id',$result['work_content'])->value('name');
$return['work_report']=$result['work_report'];
/* $return['date']=date('Y-m-d',$result['add_time']);
$return['time']=date('H:i:s',$result['add_time']);*/
$return['time']=json_decode($result['select_time'],true);
... ... @@ -1021,4 +1024,7 @@ class IndexController extends RestBaseController
$app = Factory::officialAccount($config);
}
}
\ No newline at end of file
... ...
... ... @@ -275,7 +275,7 @@ class MemberCenterController extends RestBaseController
'user_id' => $user_id,
];
$form_id=input('form_id');
if (empty($form_id)){
if (!empty($form_id)){
$this->saveFormId($user_id,$form_id);
}
$volunteerModel = new VolunteerModel();
... ...
... ... @@ -334,7 +334,6 @@ class ActivityController extends AdminBaseController
}else{
$this->error("删除失败!", '');
}
}
if (isset($param['ids'])) {
... ... @@ -513,7 +512,6 @@ class ActivityController extends AdminBaseController
}
protected function wxappNotice($message){
$appId = 'wx7a3bf4e0796c070a';
$secret = '755478f064e09a8301345e0c427c6cf3';
$config = [
... ... @@ -558,7 +556,7 @@ class ActivityController extends AdminBaseController
\db('form_id')->where('form_id',$form_id['form_id'])->update(['use_time'=>time()]);
$data['keyword1']= $volunteer['name'];
$data['keyword2']='活动审核';
$data['keyword3']='未通过';
$data['keyword3']='未通过 原因:'.$update['refund_reason'];
$data['keyword4']=$activity['activity_name'];
$message = [
'touser' => $openid,
... ... @@ -570,8 +568,6 @@ class ActivityController extends AdminBaseController
];
$this->wxappNotice($message);
}
$this->success('操作成功!');
}else{
$this->error('操作失败!');
... ...
... ... @@ -75,9 +75,48 @@ class VolunteerController extends AdminBaseController
$level_map['max'] = ['>', $param['work_time']];
$level = db('level')->where($level_map)->value('level');
$param['level'] = $level;
Db::name('volunteer')
$result= Db::name('volunteer')
->where('id', $id)
->update($param);
/*发送模板消息进行通知*/
if ($result>0){
$volunteer=\db('volunteer')->where('user_id',$id)->find();
$userMap['user_id']=$id;
$openid=db('third_party_user')->where($userMap)->value('openid');
$formMap['user_id']=$id;
$formMap['use_time']=0;
$formMap['expire_time']=['>',time()];
$form_id=\db('form_id')->where($formMap)->find();
if (!empty($form_id)&& $param['status']!=1){
\db('form_id')->where('form_id',$form_id['form_id'])->update(['use_time'=>time()]);
$data['keyword1']= $volunteer['name'];
$data['keyword2']='志愿者审核';
if ($param['status']==2){
$data['keyword3']='通过';
}
if ($param['status']==3){
$data['keyword3']='未通过 原因:'.$param['refund_reason'];
}
$data['keyword4']='申请成为志愿者';
$message = [
'touser' => $openid,
'template_id' => '1FYkLuMK8LNKO4_nxJ_DuNQhgIjaaJQlAukgt92C-uw',
'page' => 'pages/index/index',
'form_id' => $form_id['value'],
'data' => $data,
'emphasis_keyword' =>$data['keyword3']='状态',
];
$this->wxappNotice($message);
}
}
$this->success('操作成功!');
$this->success('更新成功!');
} else {
... ... @@ -91,6 +130,28 @@ class VolunteerController extends AdminBaseController
}
}
/**
* 模板消息发送
* @param $message
* @return \EasyWeChat\Support\Collection
* @throws \EasyWeChat\Core\Exceptions\InvalidArgumentException
*/
protected function wxappNotice($message){
$appId = 'wx7a3bf4e0796c070a';
$secret = '755478f064e09a8301345e0c427c6cf3';
$config = [
'app_id' => $appId,
'secret' => $secret,
];
try{
$wechat=new Application($config);
$notice=$wechat->mini_program->notice;
$result= $notice->send($message);
}catch(Exception $e){
$e->getMessage();
}
return $result;
}
//删除
public function delete()
{
... ... @@ -213,4 +274,40 @@ class VolunteerController extends AdminBaseController
$letter = $Excel->excelAcross(count($title));
$Excel->excel($letter, $title, $data, '志愿者列表');
}
public function sendnotice(){
return $this->fetch();
}
public function sendsms(){
$data = Db::name('volunteer')
->where('delete_time', 0)
->order('create_time desc')
->select();
$this->assign([
'list' => $data,
]);
return $this->fetch();
}
public function smsPost(){
$user=input('to_user_id');
$content=input('description');
if (empty($user)||$user==0){
$this->error('请选择用户!');
}
if (empty($content)){
$this->error('内容不能为空!');
}
$users=explode(',',$user);
dump($users);
foreach($users as $k=>$v){
send_sms();
}
}
}
\ No newline at end of file
... ...
... ... @@ -115,7 +115,7 @@ class Excel
$fileName = $name;
$date = date("Y-m-d",time());
$fileName .= "_{$date}.xlsx";
$fileName = iconv("utf-8", "gb2312", $fileName);
$fileName = iconv("utf-8", "GBK", $fileName);
//重命名表
// $objPHPExcel->getActiveSheet()->setTitle('test');
//设置活动单指数到第一个表,所以Excel打开这是第一个表
... ...
... ... @@ -23,3 +23,4 @@ return [
"authcode" => 'alOaS0bMPmbDxRzL1c',
//#COOKIE_PREFIX#
];
... ...
... ... @@ -281,17 +281,39 @@
<tr>
<td>
<div class="checkbox">
<label><input type="radio" name="status" value="1" <eq name="$data.status" value="1">checked</eq> >未审核</label>
<label><input type="radio" name="status" value="2" <eq name="$data.status" value="2">checked</eq> >通过审核</label>
<label><input type="radio" name="status" value="3" <eq name="$data.status" value="3">checked</eq> >未通过审核</label>
<label><input type="radio" onclick="unrefund()" name="status" value="1" <eq name="$data.status" value="1">checked</eq> >未审核</label>
<label><input type="radio" onclick="unrefund()" name="status" value="2" <eq name="$data.status" value="2">checked</eq> >通过审核</label>
<label><input type="radio" onclick="refund()" name="status" value="3" <eq name="$data.status" value="3">checked</eq> >未通过审核</label>
</div>
</td>
</tr>
<tr class="refund_div" <if condition="$data.status neq 3">style="display: none"</if>>
<th><b>审核不通过原因</b></th>
</tr>
<tr class="refund_div" <if condition="$data.status neq 3">style="display: none"</if>>
<td>
<input class="form-control" type="text" name="refund_reason" value="{$data.refund_reason}">
</td>
</tr>
</table>
</div>
</div>
</form>
</div>
<script type="application/javascript">
function refund() {
$('.refund_div').show()
}
function unrefund() {
$('.refund_div').hide()
}
</script>
<script type="text/javascript" src="__STATIC__/js/admin.js"></script>
<script type="text/javascript">
//编辑器路径定义
... ...
... ... @@ -4,7 +4,7 @@
<div class="wrap js-check-wrap">
<ul class="nav nav-tabs">
<li class="active"><a href="{:url('volunteer/index')}">志愿者列表</a></li>
<!--<li><a href="{:url('volunteer/add')}">添加志愿者</a></li>-->
<li><a href="{:url('volunteer/sendNotice')}">发送短信通知</a></li>
</ul>
<form id="forms" class="well form-inline margin-top-20" method="post" action="{:url('volunteer/index')}">
分类:
... ... @@ -33,6 +33,9 @@
<input type="submit" id="search" class="btn btn-primary" value="搜索" />
<input type="submit" id="excel" class="btn btn-primary" value="导出" />
<a class="btn btn-danger" href="{:url('volunteer/index')}">清空</a>
<span onclick="sendSms()" class="btn">
批量发送短信
</span>
</form>
<script type="application/javascript">
var search="{:url('volunteer/index')}";
... ... @@ -59,9 +62,7 @@
data-action="{:url('volunteer/delete')}" data-subcheck="true" data-msg="你确定删除吗?">
{:lang('DELETE')}
</button>
<button onclick="sendSms()" class="btn btn-primary btn-sm js-ajax-submit">
批量发送短信
</button>
</div>
<thead>
<tr>
... ... @@ -139,9 +140,27 @@
$('#forms').action=search;
}
function sendSms() {
function sendSms(res) {
var selectedCategoriesId = res
console.log(res)
openIframeLayer("{:url('volunteer/sendSms')}?id=" + selectedCategoriesId, '选择编号', {
area: ['1000px', '900px'],
btn: ['确定','取消'],
yes: function (index, layero) {
//do something
console.log(index)
console.log(layero)
var iframeWin= window[layero.find('iframe')];
var body = layer.getChildFrame('body', index);
var iframeWin = window[layero.find('iframe')[0]['name']]; //得到iframe页的窗口对象,执行iframe页的方法:
iframeWin.load();
//console.log(layer.getFrameIndex(index));
layer.close(index); //如果设定了yes回调,需进行手工关闭
console.log('reload');
location.reload()
}
});
e.stopPropagation()
}
... ...
<include file="public@header"/>
</head>
<body>
<div class="wrap js-check-wrap">
<ul class="nav nav-tabs">
<li><a href="{:url('index')}">志愿者列表</a></li>
<li class="active"><a href="">添加消息</a></li>
</ul>
<form action="{:url('smsPost')}" method="post" class="form-horizontal js-ajax-form margin-top-20">
<div class="row">
<div class="col-md-9">
<table class="table table-bordered">
<tr id="checkUserTr">
<th>选择用户<span class="form-required">*</span></th>
<td>
<input class="form-control" type="text" required
placeholder="请选择用户" onclick="doSelectUsers();" id="js-users-name-input"
readonly/>
<input class="form-control" type="hidden" name="to_user_id" value="0"
id="js-users-id-input"/>
</td>
</tr>
<tr>
<th>消息内容</th>
<td>
<textarea class="form-control" name="description" id="description"
style="height: 100px;"
placeholder="请输入消息内容"></textarea>
</td>
</tr>
</table>
</div>
</div>
<div class="form-group">
<div class="col-sm-offset-2 col-sm-10">
<button type="submit" class="btn btn-primary js-ajax-submit">发送消息</button>
<a class="btn btn-default" href="{:url('Message/index')}">{:lang('BACK')}</a>
</div>
</div>
</form>
</div>
<script type="text/javascript" src="__STATIC__/js/admin.js"></script>
<script type="text/javascript">
//编辑器路径定义
var editorURL = GV.WEB_ROOT;
</script>
<script type="text/javascript" src="__STATIC__/js/ueditor/ueditor.config.js"></script>
<script type="text/javascript" src="__STATIC__/js/ueditor/ueditor.all.min.js"></script>
<script type="text/javascript">
$(function () {
var to_user_type=$("input[name=to_user_type]").val();
if(to_user_type==0){
$('#checkUserTr').hide();
}else{
$('#checkUserTr').show();
}
editorcontent = new baidu.editor.ui.Editor();
editorcontent.render('content');
try {
editorcontent.sync();
} catch (err) {
}
$('.btn-cancel-thumbnail').click(function () {
$('#thumbnail-preview').attr('src', '__TMPL__/public/assets/images/default-thumbnail.png');
$('#thumbnail').val('');
});
});
function checkedUserType(type) {
if(type===0){
$('#checkUserTr').hide();
}else{
$('#checkUserTr').show();
}
}
function doSelectUsers() {
var selectedUsersId = $('#js-users-id-input').val();
openIframeLayer("{:url('volunteer/sendSms')}?ids=" + selectedUsersId, '请选择用户', {
area: ['1200px', '800px'],
btn: ['确定', '取消'],
yes: function (index, layero) {
//do something
var iframeWin = window[layero.find('iframe')[0]['name']];
var selectedUsers = iframeWin.confirm();
if (selectedUsers.selectedUsersId.length == 0) {
layer.msg('请选择用户');
return;
}
$('#js-users-id-input').val(selectedUsers.selectedUsersId.join(','));
$('#js-users-name-input').val(selectedUsers.selectedUsersName.join(' '));
//console.log(layer.getFrameIndex(index));
layer.close(index); //如果设定了yes回调,需进行手工关闭
}
});
}
</script>
</body>
</html>
\ No newline at end of file
... ...
<include file="public@header"/>
</head>
<body>
<div class="wrap js-check-wrap" style="min-width: inherit">
<form class="well form-inline margin-top-20" method="post" action="">
用户ID:
<input class="form-control" type="text" name="uid" style="width: 200px;" value=""
placeholder="用户id">
<input type="submit" class="btn btn-primary" value="搜索"/>
<a class="btn btn-danger" href="">清空</a>
</form>
<form method="post" class="js-ajax-form" action="">
<table class="table table-hover table-bordered table-list">
<thead>
<tr>
<th width="16">
<label>
<input type="checkbox" class="js-check-all" data-direction="x" data-checklist="js-check-x">
</label>
</th>
<th width="50">ID</th>
<th>名称</th>
<th>手机号</th>
</tr>
</thead>
<tbody id="tb">
<foreach name="list" item="vo">
<tr id="check-tr">
<td >
<input type="checkbox" id="in{$vo.id}" class="js-check" data-yid="js-check-y" data-xid="js-check-x" name="ids[]"
value="{$vo.id}" data-name="{$vo.name}" >
</td>
<td>{$vo.id}</td>
<td>{$vo.name}</td>
<td>{$vo.move_phone}</td>
</tr>
</foreach>
</tbody>
</table>
</form>
</div>
<script src="__STATIC__/js/admin.js"></script>
<script>
// $('.js-check').click(function(e) {
// var sel_id='in'+e.currentTarget.defaultValue;
//
// $( ".js-check" ).each( function(res) {
// console.log(res)
// $(".js-check").eq(res).prop("checked",false)
// $('#'+sel_id).prop("checked",true)
// } );
// }
//
// )
$('.data-item-tr').click(function (e) {
console.log(e);
var $this = $(this);
if ($(e.target).is('input')) {
return;
}
var $input = $this.find('input');
if ($input.is(':checked')) {
$input.prop('checked', false);
} else {
$input.prop('checked', true);
}
});
function confirm() {
var selectedUsersId = [];
var selectedUsersName = [];
var selectedUsers = [];
$('.js-check:checked').each(function () {
var $this = $(this);
selectedUsersId.push($this.val());
selectedUsersName.push($this.data('name'));
selectedUsers.push({
id: $this.val(),
name: $this.data('name')
});
});
return {
selectedUsers: selectedUsers,
selectedUsersId: selectedUsersId,
selectedUsersName: selectedUsersName
};
}
</script>
</body>
</html>
\ No newline at end of file
... ...