Commit c802b13e authored by wwccw0591's avatar wwccw0591

pc

parent 8a69ceea
......@@ -95,6 +95,7 @@ class MessageHistoryModel extends \DAO\AbstractModel {
public function convertMessage($message){
$message = unserialize($message);
$message['title'] = !empty($message['title']) ? $message['title'] : '';
$message['content'] = !empty($message['content']) ? $message['content'] : '';
if(!empty($message['buttons'])){
$timeDiff=TIMESTAMP-$message['createTime'];
foreach($message['buttons'] as &$button){
......
......@@ -111,9 +111,9 @@ class MessageOneModel extends \DAO\AbstractModel {
$where=Common::format(" (fromUserId={0} and fromType={1} and toUserId={2} and toType={3}) or (fromUserId={4} and fromType={5} and toUserId={6} and toType={7})",$data['fromUserId'],$data['fromType'],$data['toUserId'],$data['toType'],$data['toUserId'],$data['toType'],$data['fromUserId'],$data['fromType']);
$one=$this->getOneByWhereWithField($where,"*",DbNameConst::masterDBConnectName);
if(isset($one['toUserId']) && $one['toUserId']==$data['fromUserId']){
$insertSql=Common::format("insert into {0}(`fromId`,`toUserId`,`toUserName`,`toType`,`fromUserId`,`fromUserName`,`fromType`,`message`,`fromUnReadCount`,`toUnReadCount`,`gmtCreate`,`gmtUpdate`,`toId`) VALUES({1},{2},'{3}',{4},{5},'{6}',{7},'{8}',{9},{10},{11},{12},{13}) ON DUPLICATE KEY UPDATE message='{14}',fromUnReadCount=fromUnReadCount+1,gmtUpdate={15} ",$this->_tableName,$data['toId'],$data['fromUserId'],$data['fromUserName'],$data['fromType'],$data['toId'],$data['toUserName'],$data['toType'],$data['message'],ApiConst::zero,ApiConst::one,TIMESTAMP,TIMESTAMP,$data['toId'],$data['message'],TIMESTAMP);
$insertSql=Common::format("insert into {0}(`fromId`,`toUserId`,`toUserName`,`toType`,`fromUserId`,`fromUserName`,`fromType`,`message`,`fromUnReadCount`,`toUnReadCount`,`gmtCreate`,`gmtUpdate`,`toId`) VALUES({1},{2},'{3}',{4},{5},'{6}',{7},'{8}',{9},{10},{11},{12},{13}) ON DUPLICATE KEY UPDATE message='{14}',fromUnReadCount=fromUnReadCount+1,gmtUpdate={15} ",$this->_tableName,$data['toId'],$data['fromUserId'],$data['fromUserName'],$data['fromType'],$data['toId'],$data['toUserName'],$data['toType'],$data['message'],ApiConst::zero,ApiConst::one,time(),time(),$data['toId'],$data['message'],time());
}else{
$insertSql=Common::format("insert into {0}(`fromId`,`toUserId`,`toUserName`,`toType`,`fromUserId`,`fromUserName`,`fromType`,`message`,`fromUnReadCount`,`toUnReadCount`,`gmtCreate`,`gmtUpdate`,`toId`) VALUES({1},{2},'{3}',{4},{5},'{6}',{7},'{8}',{9},{10},{11},{12},{13}) ON DUPLICATE KEY UPDATE message='{14}',toUnReadCount=toUnReadCount+1,gmtUpdate={15} ",$this->_tableName,$data['fromId'],$data['toUserId'],$data['toUserName'],$data['toType'],$data['fromUserId'],$data['fromUserName'],$data['fromType'],$data['message'],ApiConst::zero,ApiConst::one,TIMESTAMP,TIMESTAMP,$data['toId'],$data['message'],TIMESTAMP);
$insertSql=Common::format("insert into {0}(`fromId`,`toUserId`,`toUserName`,`toType`,`fromUserId`,`fromUserName`,`fromType`,`message`,`fromUnReadCount`,`toUnReadCount`,`gmtCreate`,`gmtUpdate`,`toId`) VALUES({1},{2},'{3}',{4},{5},'{6}',{7},'{8}',{9},{10},{11},{12},{13}) ON DUPLICATE KEY UPDATE message='{14}',toUnReadCount=toUnReadCount+1,gmtUpdate={15} ",$this->_tableName,$data['fromId'],$data['toUserId'],$data['toUserName'],$data['toType'],$data['fromUserId'],$data['fromUserName'],$data['fromType'],$data['message'],ApiConst::zero,ApiConst::one,time(),time(),$data['toId'],$data['message'],time());
}
$res=$this->db->update($this->_tableName)->query($insertSql);
if($res){
......
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