123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127 |
- <?php
- class MessageDao {
-
- public $id;
-
- public $from;
-
- public $fromuid;
-
- public $touid;
-
- public $new;
-
- public $time;
-
- public $subject;
-
- public $content;
-
- public $status;
-
- public $_table = 'zhask_message';
-
- public $_primarykey = "id";
-
- public $_fields = array ('id', '$from', '$fromuid', '$touid', '$new', 'time', '$subject', 'content', '$status' );
-
- /**
- * 获取用户系统记录数
- * @param unknown_type $uid
- */
- function get_message_count_by_touid($uid = 0) {
-
- $sql = "select count(*) as count from " . t_message . " where new =1 and touid = " . $uid;
-
- $query = Doo::db ()->query ( $sql );
-
- $result = $query->fetch ();
-
- return $result;
- }
-
- /**
- * 获取系统信息的条数
- * @param unknown_type $uid
- * @param unknown_type $fromid
- * @param unknown_type $time
- */
- function get_message_count($uid = 0, $fromuid = 0, $time = 7) {
-
- $sql = "select count(*) as count from " . t_message . " where " . $fromuid . " time>UNIX_TIMESTAMP( SUBDATE( now( ) , INTERVAL ".$time." DAY )) and touid = " . $uid;
-
- $query = Doo::db ()->query ( $sql );
-
- $result = $query->fetch ();
-
- return $result;
- }
-
- /**
- * 获取系统信息
- * @param unknown_type $uid
- * @param unknown_type $limit
- */
- public function get_message_list($uid = 0, $fromid = 0, $time = 7, $limit = array()) {
- $limit = " order by time desc limit " . $limit ['lower'] . ", " . $limit ['size'] . "";
-
- $sql = "select * from " . t_message . " where " . $fromid . " DATE_SUB(CURDATE(), INTERVAL " . $time . " DAY) <= time and touid = " . $uid ." ".$limit;
- $query = Doo::db ()->query ( $sql );
-
- $result = $query->fetchAll ();
-
- return $result;
- }
-
- /**
- * 发送系统信息
- * @param unknown_type $from
- * @param unknown_type $fromuid
- * @param unknown_type $touid
- * @param unknown_type $subject
- * @param unknown_type $content
- */
- public function send_message($from = "", $fromuid = 0, $touid = 0, $subject = "", $content = "",$type=1) {
- $time = get_date ();
- //发送系统信息
- $sql = "INSERT INTO " . t_message . "(fromy,fromuid,touid,new,subject,time,content,status,type) VALUES ('" . $from . "'," . $fromuid . "," . $touid . ",1,'" . $subject . "','" . $time . "','" . $content . "',0,'".$type."')";
- $query = Doo::db ()->query ( $sql );
-
- }
-
- /**
- * 发布信息action
- */
- public function set_MESSAGE_ADD_QUESTION($title = "",$id=0) {
-
- return "问题 <a href=/askpage/".$id." >" . $title . "</a> 新的问题";
- }
-
- /**
- * 发送名师已付款action
- */
- public function set_MESSAGE_ADD_VIP_PAID(){
- return "您对名师答疑进行了付费";
- }
-
- /**
- * 发送名师答疑问题设置成满意
- */
- public function set_MESSAGE_SET_VIP_SATISFY(){
- return "您对名师问题***设置为满意,并且退款机会为1次";
- }
-
- /**
- * 吧信息更新为已查看
- */
- public function update_message_new($uid=0){
- $sql = "UPDATE `" . t_message . "` SET `new` = '0' WHERE `new` = 1 and touid=".$uid." limit 30";
-
- $query = Doo::db ()->query ( $sql );
- }
- }
- ?>
|