You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
67 lines
1.3 KiB
PHP
67 lines
1.3 KiB
PHP
<?php
|
|
/**
|
|
* Created by PhpStorm.
|
|
* User: xmy 280564871@qq.com
|
|
* Date: 2017/4/26
|
|
* Time: 20:44
|
|
*/
|
|
namespace Open\Model;
|
|
|
|
class OpenMessageModel extends BaseModel{
|
|
const READ = 1;
|
|
const UNREAD = 2;
|
|
|
|
protected $_auto = [
|
|
['status',self::UNREAD,self::MODEL_INSERT],
|
|
['create_time','time',self::MODEL_INSERT,'function'],
|
|
];
|
|
|
|
|
|
/**
|
|
* 发送消息
|
|
* @param $develop_id
|
|
* @param $title
|
|
* @param $content
|
|
* @return mixed
|
|
* author: xmy 280564871@qq.com
|
|
*/
|
|
public function sendMsg($develop_id,$title,$content){
|
|
$data['title'] = $title;
|
|
$data['content'] = $content;
|
|
$data['develop_id'] = $develop_id;
|
|
$data = $this->create($data);
|
|
return $this->add($data);
|
|
}
|
|
|
|
|
|
public function getUserData($develop_id){
|
|
$map['develop_id'] = $develop_id;
|
|
$map['status'] = ['gt',0];
|
|
$data = $this->where($map)->order('create_time desc')->select();
|
|
return $data;
|
|
}
|
|
|
|
/**
|
|
* 用户未读消息
|
|
* @param $develop_id
|
|
* @return mixed
|
|
* author: xmy 280564871@qq.com
|
|
*/
|
|
public function countMsg($develop_id){
|
|
$map['develop_id'] = $develop_id;
|
|
$map['status'] = 2;
|
|
return $this->where($map)->count();
|
|
}
|
|
|
|
/**
|
|
* 设置状态
|
|
* @param $ids
|
|
* @param $status
|
|
* @return bool
|
|
* author: xmy 280564871@qq.com
|
|
*/
|
|
public function setStatus($ids,$status){
|
|
$map['id'] = ['in',$ids];
|
|
return $this->where($map)->setField(['status'=>$status]);
|
|
}
|
|
} |