| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859 |
- <?php
- /**
- * 测试模块
- * @author wesmiler
- */
- namespace app\api\controller;
- use app\weixin\model\Member;
- use app\weixin\model\Message;
- class PushController extends BaseController
- {
- /**
- * 列表
- * @throws \think\exception\DbException
- */
- public function getList()
- {
- $params = input();
- $pageSize = input('pageSize', 12);
- //$this->userId = $this->userId == 102712? 100968 : $this->userId;
- $params['openid'] = Member::getField(['id'=> $this->userId],'openid');
- // $params['send_at'] = date('Y-m-d',time() - 7*86400);
- $dataList = Message::getList($params, $pageSize);
- showJson(1005, 1001, $dataList);
- }
- /**
- * 详情
- * @throws \think\db\exception\DataNotFoundException
- * @throws \think\db\exception\ModelNotFoundException
- * @throws \think\exception\DbException
- */
- public function getInfo()
- {
- $id = input('id');
- $info = Message::getInfo(['id' => $id],'',true);
- showJson(1005, 1001, $info? $info:['id'=>0]);
- }
- /**
- * 未读数据
- */
- public function getCount()
- {
- $openid = Member::getField(['id'=> $this->userId],'openid');
- $data = Message::where(['openid'=> $openid,'status'=>2,'is_read'=>2])
- // ->where('send_at','>',date('Y-m-d',time() - 7*86400))
- ->count();
- showJson(1005, 1001, $data>99? '99+': $data);
- // showJson(1005, 1001, $data>99? '99+': $data);
- }
- }
- ?>
|