Push.php
1.9 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
<?php
namespace app\notify\controller;
use app\common\controller\Frontend;
use think\Db;
class Push extends Frontend
{
protected $noNeedLogin = [];
protected $noNeedRight = '*';
protected $layout = '';
public function _initialize()
{
parent::_initialize();
}
public function voiceseting()
{
// $model = new \app\admin\model\reservoir\Voice;
// $list = $model->paginate(10);
// $this->view->assign('list',$list);
return $this->view->fetch();
}
public function smsseting()
{
// $model = new \app\admin\model\reservoir\Voice;
// $list = $model->paginate(10);
// $this->view->assign('list',$list);
return $this->view->fetch();
}
public function wxseting()
{
// $model = new \app\admin\model\reservoir\Voice;
// $list = $model->paginate(10);
// $this->view->assign('list',$list);
return $this->view->fetch();
}
public function voicesendmsg($ids=null)
{
$model = new \app\admin\model\reservoir\Voice;
if ($this->request->isPost()) {
$params = $this->request->post();
$mobile = $params['mobile'];
$code = $params['code'];
$data = $params['data'];
$res = \app\common\library\Sms::notice($mobile, $data, $code);
dump($res);
}
$voice = $this->model::get($ids);
if (!$voice) {
$this->error('语音模板不存在');
}
preg_match_all('/\${.*?}/', $sms->message, $matches);
$voicevar = $matches[0];
$values = [];
foreach ($voicevar as $key=>$item) {
$values[] = str_replace(['${', '}'], '', $item);
}
$this->view->assign([
'voicevar'=> $values,
'voice' => $voice
]);
return $this->view->fetch();
}
}