Discuz教程网

[二次开发] Discuz X2插入回复的函数insertpost()

[复制链接]
authicon dly 发表于 2012-11-8 20:11:28 | 显示全部楼层 |阅读模式
  1. function insertpost($data) {
  2.         if(isset($data['tid'])) {
  3.                 $tableid = DB::result_first("SELECT posttableid FROM ".DB::table('forum_thread')." WHERE tid='{$data['tid']}'");
  4.         } else {
  5.                 $tableid = $data['tid'] = 0;
  6.         }
  7.         $pid = DB::insert('forum_post_tableid', array('pid' => null), true);

  8.         if(!$tableid) {
  9.                 $tablename = 'forum_post';
  10.         } else {
  11.                 $tablename = "forum_post_$tableid";
  12.         }

  13.         $data = array_merge($data, array('pid' => $pid));

  14.         DB::insert($tablename, $data);
  15.         if($pid % 1024 == 0) {
  16.                 DB::delete('forum_post_tableid', "pid<$pid");
  17.         }
  18.         save_syscache('max_post_id', $pid);
  19.         return $pid;
  20. }
复制代码




上一篇:Discuz X2 function sendmail 发送邮件函数
下一篇:Discuz X2 uc通信不成功,cache文件的问题
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

1314学习网 ( 浙ICP备10214163号 )

GMT+8, 2025-5-2 03:48

Powered by Discuz! X3.4

© 2001-2013 Comsenz Inc.

快速回复 返回顶部 返回列表