1234567891011121314151617181920212223242526272829303132333435363738 |
- <?php
- namespace app\common\model;
- /**
- * 用户评价点赞模型
- * Class CommentPraise
- * @package app\common\model
- */
- class CommentPraise extends BaseModel
- {
- protected $name = 'comment_praise';
-
- public function addOne($data) {
- if (empty($data)) {
- return false;
- }
- $this->save($data);
- }
- public function deleteOne($data) {
- $this->where($data)->delete();
- }
- public static function checkPraise($user_id, $comment_id)
- {
- if (empty($user_id)) {
- return false;
- }
- $one = self::where('comment_id', $comment_id)->where('user_id', $user_id)->find();
- if (empty($one)) {
- return false;
- }
- return true;
- }
- }
|