<?php /** * 根据type返回推荐信息,json格式 **/ $action = $_REQUEST['action'] ? jointFlushStr($_REQUEST['action']) : 'follow'; $type = $_REQUEST['type'] ? jointFlushStr($_REQUEST['type']) : 'user'; $uid = jointFlushStr($_REQUEST['uid']); if ($action == 'follow') { $login_user = $_G['uid']; $time = time(); $sql_tmp = "INSERT INTO pre_jf_follow SET user_id={$login_user},relation_id={$uid},type='{$type}',time={$time};"; $data_tmp = DB::query($sql_tmp); setUserMessage($uid, 4, jointGetJfNiceByUsername($_G['username']), $_G['uid']); echo 'create'; } else { $login_user = $_G['uid']; $sql_tmp = "DELETE FROM pre_jf_follow WHERE user_id={$login_user} AND relation_id={$uid} AND type='{$type}'"; $data_tmp = DB::query($sql_tmp); echo 'delete'; }
function setUserMessageToAllPoster($me_type, $me_body, $tid) { $sql = "SELECT `authorid` from pre_forum_post where tid='{$tid}'"; $re = DB::query($sql); $arr = array(); while ($data = mysql_fetch_assoc($re)) { $arr[] = $data['authorid']; } $arr = array_unique($arr); foreach ($arr as $v) { setUserMessage($v, $me_type, $me_body, $tid); } }
public function aadd() { // 如果是提交操作 if (IS_POST) { $data = I('post.'); if ($_FILES['img']["size"]) { $img = $this->saveimage($_FILES['img'], 500000, __DIR__ . '/../../../Upload/'); $data['img'] = '/JointForce/Upload/' . $img; } $data_m = M('jf_data'); $re = $data_m->add($data); if ($re) { // 20151118 消息通知 - 推荐首页等 preg_match('/tid\\=(\\d{1,20})/is', $data['url'], $tid); $tid = $tid[1]; if (is_numeric($tid)) { // 20151118 消息通知 - 高亮等 $userid = getUseridByTid($tid); setUserMessage($userid, 7, iconv('utf-8', 'gb2312', $data['title']), $tid, 1, 22); } //var_dump($data);exit; $this->success('添加成功', C('BASE_URL') . '/index.php/Joint'); } else { $this->error('添加失败', C('BASE_URL') . '/index.php/Joint'); } exit; } $this->display(); }