12345678910111213141516171819202122232425262728293031323334353637383940414243444546 |
- <?php
- namespace Act\Lib;
- use Dever;
- class Note
- {
- # 获取当前用户是否预约
- public function get($uid, $id, $type)
- {
- $where['uid'] = $uid;
- $where['type'] = $type;
- $where['data_id'] = $id;
- $where['state'] = 1;
- $info = Dever::db('act/live_note')->one($where);
- if ($info) {
- return 1;
- } else {
- return 2;
- }
- }
- # 预约
- public function submit($uid, $id, $type)
- {
- $where['uid'] = $uid;
- $where['data_id'] = $id;
- $where['type'] = $type;
- $info = Dever::db('act/live_note')->one($where);
- if (!$info) {
- Dever::db('act/live_note')->insert($where);
- } else {
- if ($info['state'] == 1) {
- Dever::db('act/live_note')->update(array('where_id' => $info['id'], 'state' => 2));
- } else {
- Dever::db('act/live_note')->update(array('where_id' => $info['id'], 'state' => 1));
- }
- }
- return true;
- }
- # 提醒 后续实现
- }
|