123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384 |
- <?php
-
- namespace app\admin\controller;
-
- use think\Db;
- use think\Page;
-
- class Notify extends Base {
-
-
-
- public function __construct() {
- parent::__construct();
-
- $this->smtp_tpl_db = Db::name('smtp_tpl');
-
- $this->sms_template_db = Db::name('sms_template');
-
- $this->users_notice_tpl_db = Db::name('users_notice_tpl');
-
- $this->users_notice_tpl_content_db = Db::name('users_notice_tpl_content');
- }
-
-
-
- public function notify_tpl()
- {
- $list = array();
- $keywords = input('keywords/s');
-
- $map = array();
- if (!empty($keywords)) {
- $map['tpl_name'] = array('LIKE', "%{$keywords}%");
- }
-
-
- $map['lang'] = array('eq', $this->admin_lang);
-
- $count = $this->users_notice_tpl_db->where($map)->count('tpl_id');
- $pageObj = new Page($count, config('paginate.list_rows'));
- $list = $this->users_notice_tpl_db->where($map)
- ->order('tpl_id asc')
- ->limit($pageObj->firstRow.','.$pageObj->listRows)
- ->select();
- $pageStr = $pageObj->show();
- $this->assign('list', $list);
- $this->assign('page', $pageStr);
- $this->assign('pager', $pageObj);
-
- $shop_open = getUsersConfigData('shop.shop_open');
- $this->assign('shop_open', $shop_open);
-
- return $this->fetch();
- }
-
-
- public function count_unread_notify()
- {
- \think\Session::pause();
- $notice_where = [
- 'is_read' => 0,
- 'admin_id' => ['>', 0],
- ];
- $notice_count = $this->users_notice_tpl_content_db->where($notice_where)->count('content_id');
- $notice_count = intval($notice_count);
- if (IS_AJAX) {
- $this->success('查询成功', null, ['notice_count'=>$notice_count]);
- } else {
- $this->assign('notice_count', $notice_count);
- }
- }
- }
|