AdminEdmController.php
2.2 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
<?php
/**
* EDM订阅
* Author : xiaojie
* DateTime: 2018/12/03 11:06
*/
namespace app\portal\controller;
use app\portal\model\EdmModel;
use cmf\controller\AdminBaseController;
/**
* Class AdminEdmController
* @package app\portal\controller
* @adminMenuRoot(
* 'name' =>'EDM订阅',
* 'action' =>'default',
* 'parent' =>'',
* 'display'=> true,
* 'order' => 30,
* 'icon' =>'th',
* 'remark' =>'EDM订阅'
* )
*/
class AdminEdmController extends AdminBaseController
{
/**
* EDM订阅
* @adminMenu(
* 'name' => 'EDM订阅',
* 'parent' => 'portal/AdminEdm/default',
* 'display'=> true,
* 'hasView'=> true,
* 'order' => 10000,
* 'icon' => '',
* 'remark' => 'EDM订阅',
* 'param' => ''
* )
*/
public function index()
{
$edmModel = new EdmModel();
$param = $this->request->param();
$map = $this->search($param,'create_time','email');
$list = $edmModel
->where($map)
->order('id DESC')
->paginate(30);
$this->assign('list',$list);
$this->assign('page',$list->render());
return $this->fetch();
}
/**
* 删除
* @adminMenu(
* 'name' => '删除',
* 'parent' => 'index',
* 'display'=> false,
* 'hasView'=> true,
* 'order' => 10000,
* 'icon' => '',
* 'remark' => '删除',
* 'param' => ''
* )
*/
public function delete()
{
$edmModel = new EdmModel();
$res = $this->del($edmModel);
if($res){
$this->success('删除成功');
}
$this->error('请稍后重试');
}
/**
* 参展登记导出
*/
public function export()
{
$edmModel = new EdmModel();
$data = $edmModel
->field('email,create_time')
->select()->each(function ($item){
$item['create_time'] = date('Y-m-d',$item['create_time']);
})->toArray();
$this->exportExcel(array('订阅邮箱','申请时间'), $data, 'EDM订阅', './', true);
}
}