Commit 78dfc5a8 authored by 夏彬's avatar 夏彬

门户添加评论回复消息

parent 8eb8cee6
<?php <?php
require(__DIR__ . '/../../extend/internalApi/autoload.php');
require(__DIR__ . "/../../class/connect.php"); require(__DIR__ . "/../../class/connect.php");
require(__DIR__ . "/../../class/db_sql.php"); require(__DIR__ . "/../../class/db_sql.php");
require(__DIR__ . "/../../member/class/user.php"); require(__DIR__ . "/../../member/class/user.php");
require(__DIR__ . "/../../class/q_functions.php"); require(__DIR__ . "/../../class/q_functions.php");
require __DIR__.'/../../config/config_ibanshou.php'; require __DIR__.'/../../config/config_ibanshou.php';
\internalApi\base\Client::config($config['wxh.internal']['client']);
$link=db_connect(); $link=db_connect();
$empire=new mysqlquery(); $empire=new mysqlquery();
...@@ -85,7 +87,7 @@ function createComment($newsid, $content) { ...@@ -85,7 +87,7 @@ function createComment($newsid, $content) {
//回复评论 //回复评论
function replyComment($plid, $content) { function replyComment($plid, $content) {
global $empire,$dbtbpre; global $empire,$dbtbpre,$ecms_config;
$table = $dbtbpre.'ecms_comments'; $table = $dbtbpre.'ecms_comments';
$user = islogin(); $user = islogin();
...@@ -109,6 +111,20 @@ function replyComment($plid, $content) { ...@@ -109,6 +111,20 @@ function replyComment($plid, $content) {
$tablenews = $dbtbpre.'ecms_news'; $tablenews = $dbtbpre.'ecms_news';
$sql = "update {$tablenews} set plnum=plnum+1 where id={$comment['newsid']}"; $sql = "update {$tablenews} set plnum=plnum+1 where id={$comment['newsid']}";
$empire->query($sql); $empire->query($sql);
//添加消息
$tablenews = $dbtbpre . 'ecms_news';
$newsid = $comment['newsid'];
$sql = "select * from {$tablenews} where id={$newsid}";
$news = $empire->fetchassoc1($sql);
$userId = getucidbyuid($comment['user_id']);
$title = $comment['content'];
$sourceUrl = $ecms_config['site_url'] . $news['titleurl'];
$type = 'comment';
$commentId = $id;
$replyUserId = $user['ucid'];
$replyedComment = $content;
\internalApi\ucenter\Message::addComment($userId, $title, $sourceUrl, 's', $type, $commentId, $replyUserId, $replyedComment);
returnmsg(true, '回复成功', comment($id)); returnmsg(true, '回复成功', comment($id));
} }
} }
......
...@@ -306,4 +306,17 @@ function returnmsg($status=false, $msg='', $data='') { ...@@ -306,4 +306,17 @@ function returnmsg($status=false, $msg='', $data='') {
exit(); exit();
} }
function getucidbyuid($uid){
global $empire;
require_once __DIR__.'/../member/class/user.php';
$member = $empire->fetch1("SELECT ".eReturnSelectMemberF('*')." FROM ".eReturnMemberTable()." WHERE ".egetmf('userid')."={$uid} limit 1");
if (!$member) {
return false;
}
return $member['ucid'];
}
?> ?>
\ No newline at end of file
<?php
/**
* Created by PhpStorm.
* User: pader
* Date: 2017/6/30
* Time: 15:08
*/
namespace internalApi\ucenter;
use internalApi\base\Client;
/**
* 用户中心消息服务
*
* @package internalApi\ucenter
*/
class Message extends Client
{
/**
* 向指定号码发送短信
*
* @param string $tel
* @param string $content
* @param string $signature 短信签名,中括号【】中的内容
* @return bool|string 成功返回 true,失败返回错误文本
*/
public static function sendSms($tel, $content, $signature)
{
return self::call('message.sendSms', compact('tel', 'content', 'signature'));
}
/**
* 向指定用户发送短信
*
* @param int $uid
* @param string $content
* @param string $signature 短信签名,中括号【】中的内容
* @return bool|string 成功返回 true,失败返回错误文本
*/
public static function sendSmsByUid($uid, $content, $signature)
{
return self::call('message.sendSmsByUid', compact('uid', 'content', 'signature'));
}
/***
* @param $userId
* @param $title
* @param $sourceUrl
* @param $from 0:xue 1:bbs 2:s
* @param $type 0:评论 1:帖子
* @param $commentId
* @param $replyUserId
* @param string $replyedComment
* @return mixed
*/
public static function addComment($userId, $title, $sourceUrl, $from, $type, $commentId, $replyUserId, $replyedComment = '')
{
return self::call('message.addComment', compact('userId', 'title', 'sourceUrl', 'from', 'type', 'commentId', 'replyUserId', 'replyedComment'));
}
/**
* @param $userId
* @param $title
* @param $sourceUrl
* @param $from
* @param $type
* @param $sourceId 点赞的评论id
* @param $likeUserId
* @param $likedComment
* @return mixed
*/
public static function addLike($userId, $title, $sourceUrl, $from, $type, $sourceId, $likeUserId, $likedComment = '')
{
return self::call('message.addLike', compact('userId', 'title', 'sourceUrl', 'from', 'type', 'sourceId', 'likeUserId', 'likedComment'));
}
/**
* @param $userId
* @param $title
* @param $desc
* @param $from
* @param $type
* @param string $content
* @param int $toUser 0系统消息其它为用户id,多个用户id数组
* @return mixed
*/
public static function add($userId, $title, $desc, $from, $type, $content = '', $toUser = 0)
{
return self::call('message.add', compact('userId', 'title', 'desc', 'from', 'type', 'content', 'toUser'));
}
/**
* 删除评论消息
* @param $userId
* @param $from
* @param $type
* @param $commentId
* @return mixed
*/
public static function deleteComment($userId, $from, $type, $commentId)
{
return self::call('message.deleteComment', compact('userId', 'from', 'type', 'commentId'));
}
/**
* 删除点赞
* @param $userId
* @param $from
* @param $type
* @param $sourceId
* @return mixed
*/
public static function deleteLiked($userId, $from, $type, $sourceId)
{
return self::call('message.deleteLiked', compact('userId', 'from', 'type', 'sourceId'));
}
}
\ No newline at end of file
File deleted
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment