videouser.php 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. <?php
  2. Doo::loadCore('db/DooModel');
  3. /**
  4. * Created by PhpStorm.
  5. * User: ellisran
  6. * Date: 2016/9/22
  7. * Time: 16:20
  8. */
  9. class Videouser extends DooModel {
  10. public $id;
  11. public $userid;
  12. public $videoid;
  13. public $wyvideoid;
  14. public $seetime;
  15. public $file_time;
  16. public $last_time;
  17. public $issuccess;
  18. public $_table = 'kt_video_user';
  19. public $_primarykey = 'id';
  20. public $_fields = array('id', 'userid', 'videoid', 'wyvideoid', 'seetime', 'file_time', 'last_time', 'issuccess');
  21. public function __construct() {
  22. parent::setupModel(__CLASS__);
  23. }
  24. public function getvideoMsg($uid,$videoid){
  25. return $this->getOne(array('where' => 'userid=? and videoid=?', 'param' => array($uid,$videoid), 'asArray' => TRUE));
  26. }
  27. public function gettimebywyvideo($uid,$wyid){
  28. //不知道doophp为啥无法查询到数据库信息,故采用原生写法
  29. // $result = $this->getOne(array('select' => 'seetime', 'where' => 'userid="'.$uid.'" and wyvideoid="'.$wyid.'"', 'asArray' => TRUE));
  30. $sql = 'select seetime,file_time from ' . $this->_table . ' where userid="'.$uid.'" and wyvideoid="'.$wyid.'"';
  31. $query = Doo::db ()->query ( $sql );
  32. $result = $query->fetch ();
  33. if(!empty($result) && $result['seetime'] != $result['file_time']){
  34. return $result['seetime'];
  35. }else
  36. return 0;
  37. }
  38. }