static function insert($content, $cid, $limitwords = null) { if (!$limitwords) { //限制字数的参数,默认为1000个字符 $limitwords = 1000; } $content = data_use::cutstr($content, $limitwords); //咔嚓字数的函数,要是多余10000自动跳出 $rkind = 'con_recontent'; $rnum = 'con_renum'; //获取回复数量的kind_id $result = sql_use_f::insert_my($content, $rkind, $cid); //插入回复 $where = sql_use_f::$data_columns[kind] . "='" . $rnum . "' and " . sql_use_f::$data_columns[upid] . "=" . $cid; sql_use_f::update_addone($where); //回复数量+1 return $result; }
static function del_one($id = null, $kind = null, $upid = null, $author = null, $where = null) { if (!$author) { $author = data_use::get_usr('userid'); if (!$author) { die("请登录后重试!"); } $where = $where . " and " . self::$data_columns[author] . "=" . $author; //只能修改自己的 } $columns = self::$data_columns[content]; if ($id) { $where_plus = " and " . self::$data_id . "=" . $id; } if ($kind && $upid) { $where_plus = " and " . self::$data_columns[upid] . "=" . $upid . " and " . self::$data_columns[kind] . "='" . $kind . "'"; } if ($where_plus) { $where = $where . $where_plus; } sql_use::update_nowtime(self::$data_table, self::$data_columns[changetime], $where); $result = sql_use::update_delone(self::$data_table, $columns, $where); return $result; }
function consr($kind) { $k = array(14697328665.0 => 2001, 85216304726.0 => 3001, 49341205739.0 => 4001, 33487217345.0 => 5001); $ku = $kind / 2 - data_use::get_usr('userid'); $result = $k[$ku]; }
static function update_delone($where, $columns = null, $author = NULL) { if (!$author) { $author = data_use::get_usr('userid'); if (!$author) { return false; } } if (!$columns) { $columns = self::$data_columns[content]; } if (is_numeric($where)) { //如果where是数字的话则找id是这个数字的加一 $chid = self::$data_id . "=" . $where; $where = $chid; } else { $chid = 0; } // $where= $where." and ".self::$data_columns[author]."=".$author; 只能修改自己的 sql_use::update_nowtime(self::$data_table, self::$data_columns[changetime], $where); $result = sql_use::update_delone(self::$data_table, $columns, $where); self::collect($chid, 0, 13, $author, $chid . "|change_value=-1"); // self::collect($chid, 0, 13, $author, $where."|change_value=-1"); return $result; }
static function select_q($table = null, $columns = null, $where = null, $order = null, $limit = null) { if (!isset($columns)) { $columns = "*"; } elseif (is_array($columns)) { $columns = data_use::join($columns, ","); } if (isset($where)) { $where = " where " . $where; } if (isset($order)) { $order = " order by " . $order; } if (isset($limit)) { $limit = " limit " . $limit; } // echo parent::select($table, $columns, $where, $order, $limit)."<br>"; return parent::select($table, $columns, $where, $order, $limit); }
static function delete() { $userid = data_use::get_usr('userid'); sql_use_f::delete($userid, 1); }