...
|
...
|
@@ -28,30 +28,42 @@ class Home extends Base { |
|
|
$page = app()->request('page',1,'intval');
|
|
|
$page = $page ? $page : 1;
|
|
|
|
|
|
$size = app()->request('size',20,'intval');
|
|
|
$size = $size ? $size : 1;
|
|
|
$limit = app()->request('limit',20,'intval');
|
|
|
$limit = $limit ? $limit : 1;
|
|
|
|
|
|
// 指定id
|
|
|
$ids = app()->request('mail_id');
|
|
|
$ids = is_array($ids) ? $ids : [$ids];
|
|
|
foreach ($ids as $i=>$d){
|
|
|
if(!is_numeric($d)){
|
|
|
unset($ids[$i]);
|
|
|
}
|
|
|
}
|
|
|
|
|
|
// 邮件文件夹的id
|
|
|
$folder_id = app()->request('folder_id');
|
|
|
$folder_id = (int) app()->request('folder_id');
|
|
|
// 附件
|
|
|
$attachment = app()->request('attachment');
|
|
|
|
|
|
$where = ['email_id'=>$this->getEmails('id')];
|
|
|
if($folder_id) $where['folder_id'] = $folder_id;
|
|
|
if($ids) $where['id'] = $ids;
|
|
|
if($attachment) $where['is_file'] = 1; //附件
|
|
|
|
|
|
$lists = db()->all(
|
|
|
listsSql::lists(
|
|
|
$this->getEmails('id'),
|
|
|
dbWhere($where),
|
|
|
$page,
|
|
|
$size,
|
|
|
(int) $folder_id
|
|
|
$limit
|
|
|
)
|
|
|
);
|
|
|
|
|
|
// 总数
|
|
|
$total = db()->count(
|
|
|
listsSql::listCount(
|
|
|
$this->getEmails('id'),
|
|
|
(int) $folder_id
|
|
|
)
|
|
|
listsSql::listCount(dbWhere($where))
|
|
|
);
|
|
|
|
|
|
app()->_json(listsPage($lists,$total,$page,$size));
|
|
|
app()->_json(listsPage($lists,$total,$page,$limit));
|
|
|
|
|
|
}
|
|
|
|
...
|
...
|
@@ -112,18 +124,18 @@ class Home extends Base { |
|
|
*/
|
|
|
public function sync(){
|
|
|
|
|
|
$where['email'] = web_request_emails();
|
|
|
$emails = web_request_emails();
|
|
|
|
|
|
if(empty($where)){
|
|
|
if(empty($emails)){
|
|
|
app()->e('sync_request_param_error');
|
|
|
}else{
|
|
|
// 查询id
|
|
|
$datas = db()->all(emailSql::getValues($where,'`id`,`email`,`pwd_error`'));
|
|
|
foreach ($datas as &$v){
|
|
|
$datas = db()->all(emailSql::getValues(['email'=>$emails],'`id`,`email`,`pwd_error`'));
|
|
|
foreach ($datas as $k=>$v){
|
|
|
if(!$v['pwd_error']){
|
|
|
redis()->rPush('sync_email_lists', $v['id']);
|
|
|
}
|
|
|
unset($v['id']);
|
|
|
$datas[$k]['have_new'] = redis()->getDel('have_new_mail_'.$v['id']);
|
|
|
}
|
|
|
// 返回成功的参数值
|
|
|
app()->_json($datas);
|
...
|
...
|
|