Times.php 842 B

1234567891011121314151617181920212223242526272829303132333435363738
  1. <?php
  2. namespace User\Lib;
  3. use Dever;
  4. class Times
  5. {
  6. public function getData($uid, $id)
  7. {
  8. $where['info_id'] = $id;
  9. $where['uid'] = $uid;
  10. return Dever::db('user/times')->getData($where);
  11. }
  12. # 记录用户时光选择操作
  13. public function up($uid, $id, $times_id, $day)
  14. {
  15. $where['info_id'] = $id;
  16. $where['uid'] = $uid;
  17. $where['times_id'] = $times_id;
  18. $record = Dever::db('user/times')->one($where);
  19. if (!$day) {
  20. $where['day'] = 0;
  21. } else {
  22. $where['day'] = $day;
  23. }
  24. if ($record) {
  25. $where['where_id'] = $record['id'];
  26. Dever::db('user/times')->update($where);
  27. } else {
  28. Dever::db('user/times')->insert($where);
  29. }
  30. return 'yes';
  31. }
  32. }