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

还差最后一个问题

... ... @@ -361,11 +361,12 @@ class IndexController extends RestBaseController
$activity['button_status']=$status;
$people=$Join->getJoinData($id);
$join1=[];
$work_content=db('work')->column('name');
foreach ($people as $k=>$v){
$join1[$k]['photo']=$v['photo'];
$join1[$k]['name']=$v['name'];
$join1[$k]['level']=$v['level'];
$join1[$k]['duty']=$v['duty'];
$join1[$k]['duty']=$work_content[$v['work_content']]??'';
}
$activity['join']=$join1;
$this->success('获取成功!',$activity);
... ...
... ... @@ -16,6 +16,7 @@ use api\index\model\VolunteerModel;
use api\index\model\UserModel;
use cmf\controller\RestBaseController;
use EasyWeChat\Foundation\Application;
use think\Db;
use think\Validate;
/**
... ... @@ -640,15 +641,58 @@ class MemberCenterController extends RestBaseController
$map['activity_id']=$id;
$map['j.delete_time']=0;
$info=db('join')->alias('j')
/* $info=db('join')->alias('j')
->group('j.user_id')
->field('v.*,j.*,j.id as join_id,j.status as status')
->join('volunteer v','v.user_id=j.user_id')
->where($map)
->order('j.id','asc')
->select()
->toArray();*/
/* $subQuery = db('join')->alias('j')
->field('j.user_id,v.name,v.photo,j.id as join_id,j.status as status,j.delete_time,j.activity_id,j.work_content')
->join('volunteer v','v.user_id=j.user_id')
->where($map)
->order('j.id','desc')
->buildSql();
dump($subQuery);
$info= Db::table($subQuery.'a')
->group('a.user_id')
->select()
->toArray();*/
$subQuery = db('join')->alias('j')
->field('max(j.id)')
->join('volunteer v','v.user_id=j.user_id')
->where($map)
->group('j.user_id')
->select()
->toArray();
if (!empty($subQuery)){
foreach ($subQuery as $k=>$v){
$new_map[]=$v["max(j.id)"];
}
}
$map1['j.id']=['in',implode(',',$new_map)];
$info=db('join')->alias('j')
->group('j.user_id')
->field('v.*,j.*,j.id as join_id,j.status as status')
->join('volunteer v','v.user_id=j.user_id')
->where($map1)
->order('j.id','asc')
->select()
->toArray();
/*$info=db('join_view')
->group('user_id')
->where($map)
->select()
->toArray();*/
// echo db('join')->getLastSql();
$return=[];
$i0=0;
$i1=0;
... ... @@ -904,4 +948,5 @@ class MemberCenterController extends RestBaseController
}
\ No newline at end of file
... ...
... ... @@ -68,6 +68,7 @@ class VolunteerController extends AdminBaseController
public function edit()
{
$id = $this->request->param('id', 0, 'intval');
$volunteer_org=\db('volunteer')->where('id',$id)->find();
if ($this->request->isPost()) {
$param = $this->request->param();
/*更新级别*/
... ... @@ -79,11 +80,11 @@ class VolunteerController extends AdminBaseController
->where('id', $id)
->update($param);
/*发送模板消息进行通知*/
if ($result>0){
$volunteer=\db('volunteer')->where('user_id',$id)->find();
$userMap['user_id']=$id;
if ($result>0 && $volunteer_org['status']!=$param['status']){
$volunteer=\db('volunteer')->where('id',$id)->find();
$userMap['user_id']=$volunteer['user_id'];
$openid=db('third_party_user')->where($userMap)->value('openid');
$formMap['user_id']=$id;
$formMap['user_id']=$volunteer['user_id'];
$formMap['use_time']=0;
$formMap['expire_time']=['>',time()];
$form_id=\db('form_id')->where($formMap)->find();
... ... @@ -143,6 +144,11 @@ class VolunteerController extends AdminBaseController
'app_id' => $appId,
'secret' => $secret,
];
$wechat=new Application($config);
$notice=$wechat->mini_program->notice;
$result= $notice->send($message);
return $result;
try{
$wechat=new Application($config);
$notice=$wechat->mini_program->notice;
... ... @@ -301,12 +307,12 @@ class VolunteerController extends AdminBaseController
$this->error('内容不能为空!');
}
$users=explode(',',$user);
dump($users);
foreach($users as $k=>$v){
send_sms();
$result=send_duanxinbao($content,$users);
if ($result==0){
$this->success('发送成功!');
}else{
$this->error('发送失败!');
}
}
... ...
... ... @@ -79,6 +79,18 @@
</div>
</div>
<div class="form-group">
<label for="input-site_icp" class="col-sm-2 control-label">短信账号</label>
<div class="col-md-6 col-sm-10">
<input type="text" class="form-control" id="input-site_icp" name="options[duanxinbao]" value="{$duanxinbao|default=''}">
</div>
</div>
<div class="form-group">
<label for="input-site_icp" class="col-sm-2 control-label">短信密码</label>
<div class="col-md-6 col-sm-10">
<input type="text" class="form-control" id="input-site_icp" name="options[duanxinbaomima]" value="">
</div>
</div>
<div class="form-group">
<label for="input-site_admin_email" class="col-sm-2 control-label">{:lang('WEBMASTER_EMAIL')}</label>
<div class="col-md-6 col-sm-10">
<input type="text" class="form-control" id="input-site_admin_email" name="options[site_admin_email]" value="{$site_admin_email|default=''}">
... ...
... ... @@ -33,9 +33,6 @@
<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')}";
... ...
... ... @@ -29,10 +29,9 @@
<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}" >
value="{$vo.move_phone}" data-name="{$vo.name}" >
</td>
<td>{$vo.id}</td>
<td>{$vo.name}</td>
<td>{$vo.move_phone}</td>
</tr>
... ...
... ... @@ -1784,6 +1784,24 @@ function send_sms($data){
$return = $sendAPI->sendSMS('GET');
return $return;
}
function send_duanxinbao($content,$phone){
$site_info=cmf_get_option('site_info');
$userName=$site_info['duanxinbao'];
$Password=md5($site_info['duanxinbaomima']);
$content='【白求恩志愿者】'.$content.'退订回N';
/*$phone='17080088824';
$content='志愿者小程序';*/
if (is_array($phone)){
$phone=implode(',',$phone);
}
$url="http://api.smsbao.com/sms?u=".$userName.'&p='.$Password.'&m='.$phone.'&c='.$content;
$return=cmf_curl_get($url);
return $return;
}
/**
* 生成签名
* @param array $param 要加密的数组
... ...