本文整理汇总了PHP中insert_topic函数的典型用法代码示例。如果您正苦于以下问题:PHP insert_topic函数的具体用法?PHP insert_topic怎么用?PHP insert_topic使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了insert_topic函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: index
public function index()
{
require_once APP_ROOT_PATH . "system/libs/user.php";
$root = array();
$share_id = intval($GLOBALS['request']['share_id']);
//没有分享ID直接退出
if ($share_id == 0) {
$root['status'] = -2;
output($root);
}
$content = strim($GLOBALS['request']['content']);
$source = strim($GLOBALS['request']['source']);
$source = str_replace("来自", "", $source);
$email = strim($GLOBALS['request']['email']);
$pwd = strim($GLOBALS['request']['pwd']);
$is_relay = intval($GLOBALS['request']['is_relay']);
$parent_id = intval($GLOBALS['request']['parent_id']);
if ($parent_id > 0) {
$parent_reply = $GLOBALS['db']->getRow("select id,user_id,user_name from " . DB_PREFIX . "topic_reply where id = " . $parent_id);
}
$result = do_login_user($email, $pwd);
$GLOBALS['user_info'] = $user_data = es_session::get('user_info');
$user_data['id'] = intval($user_data['id']);
if (intval($user_data['id']) == 0) {
$root['return'] = 0;
$root['user_login_status'] = 0;
$root['info'] = "请先登录";
output($root);
}
$root['user_login_status'] = 1;
$topic = $GLOBALS['db']->getRow("select * from " . DB_PREFIX . "topic where is_effect = 1 and is_delete = 0 and id = " . $share_id);
if (empty($topic)) {
$root['status'] = -3;
output($root);
}
$reply_data = array();
$reply_data['topic_id'] = $share_id;
$reply_data['user_id'] = intval($user_data['id']);
$reply_data['user_name'] = $user_data['user_name'];
$reply_data['reply_id'] = intval($parent_reply['id']);
$reply_data['reply_user_id'] = intval($parent_reply['user_id']);
$reply_data['reply_user_name'] = strim($parent_reply['user_name']);
$reply_data['create_time'] = get_gmtime();
$reply_data['is_effect'] = 1;
$reply_data['is_delete'] = 0;
$reply_data['content'] = valid_str($content);
$GLOBALS['db']->autoExecute(DB_PREFIX . "topic_reply", $reply_data);
$GLOBALS['db']->query("update " . DB_PREFIX . "topic set reply_count = reply_count + 1,last_time = " . get_gmtime() . ",last_user_id=" . $user_data['id'] . " where id = " . $share_id);
increase_user_active($user_data['id'], "转发了一则分享");
if ($is_relay == 1) {
$cnt = $topic['content'] . "@" . $user_data['user_name'] . " 评论:" . valid_str($content);
$id = insert_topic($cnt, $title = "", $type = "", $group = "", $relay_id = $share_id, $fav_id = 0);
if ($id) {
$GLOBALS['db']->query("update " . DB_PREFIX . "topic set source_name = '" . $source . "' where id = " . intval($id));
}
}
$root['return'] = 1;
$root['status'] = 1;
output($root);
}
开发者ID:YouthAndra,项目名称:huaitaoo2o,代码行数:60,代码来源:addcomment.action.php
示例2: index
public function index()
{
require_once APP_ROOT_PATH . "system/libs/user.php";
$root = array();
$event_id = intval($GLOBALS['request']['event_id']);
//没有分享ID直接退出
if ($event_id == 0) {
$root['status'] = 0;
$root['info'] = "不存在的活动ID";
output($root);
}
$content = strim($GLOBALS['request']['content']);
$source = strim($GLOBALS['request']['source']);
$source = str_replace("来自", "", $source);
$email = strim($GLOBALS['request']['email']);
$pwd = strim($GLOBALS['request']['pwd']);
$result = do_login_user($email, $pwd);
$GLOBALS['user_info'] = $user_data = es_session::get('user_info');
$user_data['id'] = intval($user_data['id']);
if (intval($user_data['id']) == 0) {
$root['status'] = 0;
$root['user_login_status'] = 0;
$root['info'] = "请先登录";
output($root);
}
$root['user_login_status'] = 1;
$event_info = $GLOBALS['db']->getRow("select * from " . DB_PREFIX . "event where is_effect = 1 and id = " . $event_id);
if (empty($event_info)) {
$root['status'] = 0;
$root['info'] = "不存在的活动ID";
output($root);
}
$reply_data = array();
$reply_data['rel_table'] = "event";
$reply_data['rel_id'] = intval($event_id);
$reply_data['content'] = valid_str($content);
if (app_conf("USER_MESSAGE_AUTO_EFFECT") == 0) {
$message_effect = 0;
} else {
$message_effect = 1;
//$message_type['is_effect'];
}
$reply_data['is_effect'] = $message_effect;
$reply_data['create_time'] = get_gmtime();
$reply_data['user_id'] = intval($user_data['id']);
$GLOBALS['db']->autoExecute(DB_PREFIX . "message", $reply_data);
increase_user_active($user_data['id'], "点评了一个活动");
$title = "对" . $event_info['name'] . "发表了点评";
$url_route = array('rel_app_index' => 'youhui', 'rel_route' => 'edetail', 'rel_param' => 'id=' . $event_info['id']);
$tid = insert_topic($reply_data['content'], $title, "eventcomment", $group = "", $relay_id = 0, $fav_id = 0, $group_data = "", $attach_list = array(), $url_route);
if ($tid) {
$GLOBALS['db']->query("update " . DB_PREFIX . "topic set source_name = '" . $source . "' where id = " . intval($tid));
}
$GLOBALS['db']->query("update " . DB_PREFIX . "event set reply_count = reply_count+1 where id =" . $event_id);
$root['status'] = 1;
$root['info'] = "感谢您的点评";
output($root);
}
开发者ID:YouthAndra,项目名称:huaitaoo2o,代码行数:58,代码来源:addeventcomment.action.php
示例3: index
public function index()
{
$root = array();
$email = strim($GLOBALS['request']['email']);
//用户名或邮箱
$pwd = strim($GLOBALS['request']['pwd']);
//密码
$id = intval($GLOBALS['request']['id']);
//检查用户,用户密码
$user = user_check($email, $pwd);
$user_id = intval($user['id']);
if ($user_id > 0) {
$root['user_login_status'] = 1;
$goods_info = $GLOBALS['db']->getRow("select id from " . DB_PREFIX . "deal where id = " . $id . " and is_effect = 1 and is_delete = 0");
if ($goods_info) {
$sql = "INSERT INTO `" . DB_PREFIX . "deal_collect` (`id`,`deal_id`, `user_id`, `create_time`) select '0','" . $id . "','" . $user_id . "','" . TIME_UTC . "' from dual where not exists (select * from `" . DB_PREFIX . "deal_collect` where `deal_id`= '" . $id . "' and `user_id` = " . $user_id . ")";
$GLOBALS['db']->query($sql);
if ($GLOBALS['db']->affected_rows() > 0) {
//添加到动态
insert_topic("deal_collect", $id, $user_id, $GLOBALS['user_info']['user_name']);
$root['show_err'] = $GLOBALS['lang']['COLLECT_SUCCESS'];
} else {
$root['show_err'] = $GLOBALS['lang']['GOODS_COLLECT_EXIST'];
}
$root['response_code'] = 1;
} else {
$root['response_code'] = 0;
$root['show_err'] = $GLOBALS['lang']['INVALID_GOODS'];
}
} else {
$root['response_code'] = 0;
$root['show_err'] = "未登录";
$root['user_login_status'] = 0;
}
output($root);
}
开发者ID:workplayteam,项目名称:P2P,代码行数:36,代码来源:uc_do_collect.action.php
示例4: syn_deal_status
function syn_deal_status($id)
{
$deals_time = TIME_UTC;
$deal_info = $GLOBALS['db']->getRow("select *,(start_time + enddate*24*3600 - " . $deals_time . ") as remain_time,(load_money/borrow_amount*100) as progress_point from " . DB_PREFIX . "deal where id = " . $id);
if ($deal_info['deal_status'] == 5) {
return true;
}
if ($deal_info['deal_status'] != 3) {
if ($deal_info['progress_point'] < 100) {
$data['load_money'] = $GLOBALS['db']->getOne("SELECT sum(money) FROM " . DB_PREFIX . "deal_load WHERE deal_id={$id} ");
$data['progress_point'] = $deal_info['progress_point'] = round($data['load_money'] / $deal_info['borrow_amount'] * 100, 2);
}
if (($deal_info['progress_point'] >= 100 || $data['progress_point'] >= 100) && floatval($deal_info['load_money']) >= floatval($deal_info['borrow_amount'])) {
if ($GLOBALS['db']->getOne("SELECT count(*) FROM " . DB_PREFIX . "deal_inrepay_repay WHERE deal_id={$id}") > 0) {
$data['deal_status'] = 5;
$repay_info = $GLOBALS['db']->getRow("SELECT sum(repay_money) As all_repay_money FROM " . DB_PREFIX . "deal_repay WHERE has_repay = 1 AND deal_id={$id}");
if ($repay_info) {
$data['repay_money'] = $repay_info['all_repay_money'];
}
$data['last_repay_time'] = $GLOBALS['db']->getOne("SELECT true_repay_time FROM " . DB_PREFIX . "deal_inrepay_repay WHERE deal_id={$id}");
} elseif ($deal_info['deal_status'] == 4 && $deal_info['repay_start_time'] > 0 || $deal_info['deal_status'] == 2 && $deal_info['repay_start_time'] > 0 && $deal_info['repay_start_time'] <= $deals_time) {
$repay_info = $GLOBALS['db']->getRow("SELECT sum(repay_money) As all_repay_money ,MAX(repay_time) AS last_repay_time FROM " . DB_PREFIX . "deal_repay WHERE has_repay=1 AND deal_id={$id}");
if (!empty($repay_info['all_repay_money'])) {
$data['repay_money'] = $repay_info['all_repay_money'];
$data['last_repay_time'] = $repay_info['last_repay_time'];
$data['next_repay_time'] = next_replay_month($repay_info['last_repay_time']);
} elseif ($deal_info['deal_status'] == 4) {
if ($deal_info['repay_time_type'] == 0) {
$data['next_repay_time'] = $deal_info['repay_start_time'] + $deal_info['repay_time'] * 24 * 3600;
} else {
if (is_last_repay($deal_info['loantype'])) {
$data['next_repay_time'] = next_replay_month($deal_info['repay_start_time'], $deal_info['repay_time']);
} else {
$data['next_repay_time'] = next_replay_month($deal_info['repay_start_time']);
}
}
}
$deal_rs = deal_repay_money($deal_info);
//判断是否完成还款
$need_repay_money = $deal_rs['remain_repay_money'];
if (floatval(round($data['repay_money'], 2)) >= floatval(round($need_repay_money, 2)) && $need_repay_money > 0) {
$data['deal_status'] = 5;
} else {
$data['deal_status'] = 4;
}
} else {
//获取最后一次的投标记录
if ($deal_info['success_time'] == 0) {
$data['success_time'] = $deal_info['success_time'] = $GLOBALS['db']->getOne("SELECT max(create_time) FROM " . DB_PREFIX . "deal_load WHERE deal_id={$id} ");
}
$data['deal_status'] = 2;
}
} elseif ($deal_info['remain_time'] <= 0 && $deal_info['deal_status'] == 1) {
//投标时间超出 更新为流标
$data['deal_status'] = 3;
//$data['bad_time'] = $deal_info['start_time'] + $deal_info['enddate']*24*3600;
$data['bad_time'] = TIME_UTC;
}
/*elseif($deal_info['remain_time'] > 0 && $deal_info['deal_status']==0){
$data['deal_status'] = 1;
}*/
}
//投标人数
$sdata = $GLOBALS['db']->getRow("SELECT count(*) as buy_count,sum(money) as load_money FROM " . DB_PREFIX . "deal_load WHERE deal_id={$id}");
$data['buy_count'] = $sdata['buy_count'];
$data['load_money'] = floatval($sdata['load_money']);
//流标 移入后台手动操作
/*if($deal_info['deal_status'] ==3 || $data['deal_status']==3){
//流标时返还
require_once APP_ROOT_PATH."system/libs/user.php";
$r_load_list = $GLOBALS['db']->getAll("SELECT id,user_id,money FROM ".DB_PREFIX."deal_load WHERE is_repay=0 AND deal_id=$id");
foreach($r_load_list as $k=>$v){
modify_account(array("money"=>$v['money']),$v['user_id'],"标:".$deal_info['id'].",流标返还");
$GLOBALS['db']->query("UPDATE ".DB_PREFIX."deal_load SET is_repay=1 WHERE id=".$v['id']);
}
//发送流标通知
if($deal_info['is_send_bad_msg']==0){
$data['is_send_bad_msg'] = 1;
//发邮件
send_deal_faild_mail_sms($id,$deal_info,$deal_info['user_id']);
//站内信
send_deal_faild_site_sms($id,$deal_info,$deal_info['user_id']);
//添加到动态
insert_topic("deal_bad",$id,$deal_info['user_id'],get_user_name($deal_info['user_id'],false),0);
}
}*/
//发送流标通知
if (($deal_info['deal_status'] == 3 || $data['deal_status'] == 3) && $deal_info['is_send_bad_msg'] == 0) {
$data['is_send_bad_msg'] = 1;
//发邮件
send_deal_faild_mail_sms($id, $deal_info, $deal_info['user_id']);
//站内信
send_deal_faild_site_sms($id, $deal_info, $deal_info['user_id']);
//添加到动态
insert_topic("deal_bad", $id, $deal_info['user_id'], get_user_name($deal_info['user_id'], false), 0);
}
//放款给用户 移入后台手动操作
/*if($deal_info['is_has_loans']==0 && $data['deal_status']==4){
$data['is_has_loans'] = 1;
//.........这里部分代码省略.........
开发者ID:neteasy-work,项目名称:fanwei_xindai_3.2,代码行数:101,代码来源:common.php
示例5: do_event_submit
public function do_event_submit()
{
if ($GLOBALS['user_info']) {
$event_id = intval($_REQUEST['event_id']);
$event = $GLOBALS['db']->getRow("select * from " . DB_PREFIX . "event where id = " . $event_id . " and is_effect = 1");
if ($event) {
if ($event['submit_begin_time'] > get_gmtime()) {
$result['status'] = 1;
$result['info'] = $GLOBALS['lang']['EVENT_NOT_START'];
} elseif ($event['submit_end_time'] < get_gmtime() && $event['submit_end_time'] != 0) {
$result['status'] = 1;
$result['info'] = $GLOBALS['lang']['EVENT_SUBMIT_END'];
} else {
$submit_id = intval($_REQUEST['submit_id']);
$submit_id = intval($GLOBALS['db']->getOne("select id from " . DB_PREFIX . "event_submit where event_id = " . $event_id . " and user_id = " . intval($GLOBALS['user_info']['id'])));
if ($submit_id) {
//已经报名,仅作修改
$GLOBALS['db']->query("delete from " . DB_PREFIX . "event_submit_field where submit_id = " . $submit_id);
$field_ids = $_REQUEST['field_id'];
foreach ($field_ids as $field_id) {
$current_result = addslashes(htmlspecialchars(trim($_REQUEST['result'][$field_id])));
$field_data = array();
$field_data['submit_id'] = $submit_id;
$field_data['field_id'] = $field_id;
$field_data['event_id'] = $event_id;
$field_data['result'] = $current_result;
$GLOBALS['db']->autoExecute(DB_PREFIX . "event_submit_field", $field_data, "INSERT");
}
$result['status'] = 2;
$result['info'] = "报名修改成功";
ajax_return($result);
}
//开始提交报名
$user_id = intval($GLOBALS['user_info']['id']);
$count = $GLOBALS['db']->getOne("select count(*) from " . DB_PREFIX . "event_submit where event_id = " . $event_id . " and user_id = " . $user_id);
if (intval($count) > 0) {
$result['status'] = 1;
$result['info'] = $GLOBALS['lang']['EVENT_SUBMITTED'];
} else {
$submit_data = array();
$submit_data['user_id'] = $user_id;
$submit_data['event_id'] = $event_id;
$submit_data['create_time'] = get_gmtime();
$GLOBALS['db']->autoExecute(DB_PREFIX . "event_submit", $submit_data, "INSERT");
$submit_id = $GLOBALS['db']->insert_id();
if ($submit_id) {
$field_ids = $_REQUEST['field_id'];
foreach ($field_ids as $field_id) {
$current_result = addslashes(htmlspecialchars(trim($_REQUEST['result'][$field_id])));
$field_data = array();
$field_data['submit_id'] = $submit_id;
$field_data['field_id'] = $field_id;
$field_data['event_id'] = $event_id;
$field_data['result'] = $current_result;
$GLOBALS['db']->autoExecute(DB_PREFIX . "event_submit_field", $field_data, "INSERT");
}
$GLOBALS['db']->query("update " . DB_PREFIX . "event set submit_count = submit_count+1 where id=" . $event_id);
//同步分享
$title = "报名参加了" . $event['name'];
$content = "报名参加了" . $event['name'] . " - " . $event['brief'];
$url_route = array('rel_app_index' => 'youhui', 'rel_route' => 'edetail', 'rel_param' => 'id=' . $event['id']);
$tid = insert_topic($content, $title, $type = "eventsubmit", $group = "", $relay_id = 0, $fav_id = 0, $group_data = "", $attach_list = array(), $url_route);
if ($tid) {
$GLOBALS['db']->query("update " . DB_PREFIX . "topic set source_name = '网站' where id = " . intval($tid));
}
$result['status'] = 2;
$result['info'] = $GLOBALS['lang']['EVENT_SUBMIT_SUCCESS'];
} else {
$result['status'] = 1;
$result['info'] = $GLOBALS['lang']['EVENT_SUBMIT_FAILED'];
}
}
}
} else {
$result['status'] = 1;
$result['info'] = $GLOBALS['lang']['EVENT_NOT_EXIST'];
}
} else {
$result['status'] = 0;
}
ajax_return($result);
}
开发者ID:YouthAndra,项目名称:huaitaoo2o,代码行数:82,代码来源:ajaxModule.class.php
示例6: manage_block_topic
</div>
<br />
<div class="table_main">
<div id="container">
<?php
// blocco topic
if (@$_POST['block'] == 1) {
manage_block_topic($username, $id);
}
// cancello topic
if (@$_POST['delete_topic'] == 1) {
delete_topic($username, $id);
}
// aggiunta nuovo messaggio
if (@$_GET['send'] == 1) {
insert_topic(@$_POST['reply'], $id);
}
// sposto topic
if (@$_GET['move_topic'] == 1) {
move_topic(@$_POST['move_t_id'], @$_POST['to_forum']);
}
// setta topic
if (@$_GET['set_topic'] == 1) {
set_topic(@$_POST['set_topic'], $id);
}
$t_id = check_t_id($id);
$query = "SELECT id, f_id, t_id, author, title, data, replyof, last, ora, date \n\t\t FROM " . __PREFIX__ . "topic \n\t\t WHERE id = '" . $id . "' \n\t\t OR replyof = '" . $id . "' \n\t\t ORDER BY id, last DESC";
$res = mysql_query($query);
while ($row = mysql_fetch_row($res)) {
$query_2 = "SELECT email, web_site, msn, level, id, firma \n\t\t\t\t FROM " . __PREFIX__ . "users \n\t\t\t\t WHERE username = '" . $row[3] . "'";
$row_info = mysql_fetch_row(mysql_query($query_2));
开发者ID:KinG-InFeT,项目名称:0xBB,代码行数:31,代码来源:viewtopic.php
示例7: add
public function add()
{
$ajax = intval($_REQUEST['ajax']);
if (!$GLOBALS['user_info']) {
showErr($GLOBALS['lang']['PLEASE_LOGIN_FIRST'], $ajax);
}
if ($_REQUEST['content'] == '') {
showErr($GLOBALS['lang']['MESSAGE_CONTENT_EMPTY'], $ajax);
}
//验证码
if (app_conf("VERIFY_IMAGE") == 1) {
$verify = md5(trim($_REQUEST['verify']));
$session_verify = es_session::get('verify');
if ($verify != $session_verify) {
showErr($GLOBALS['lang']['VERIFY_CODE_ERROR'], $ajax);
}
}
es_session::delete("verify");
if (!check_ipop_limit(get_client_ip(), "message", intval(app_conf("SUBMIT_DELAY")), 0)) {
showErr($GLOBALS['lang']['MESSAGE_SUBMIT_FAST'], $ajax);
}
$rel_table = $_REQUEST['rel_table'];
// $message_type = $GLOBALS['db']->getRow("select * from ".DB_PREFIX."message_type where type_name='".$rel_table."' and type_name <> 'supplier'");
// if(!$message_type)
// {
// showErr($GLOBALS['lang']['INVALID_MESSAGE_TYPE'],$ajax);
// }
$message_group = $_REQUEST['message_group'];
//添加留言
$message['title'] = $_REQUEST['title'] ? htmlspecialchars(addslashes(valid_str($_REQUEST['title']))) : htmlspecialchars(addslashes(valid_str($_REQUEST['content'])));
$message['content'] = htmlspecialchars(addslashes(valid_str($_REQUEST['content'])));
$message['title'] = valid_str($message['title']);
if ($message_group) {
$message['title'] = "[" . $message_group . "]:" . $message['title'];
$message['content'] = "[" . $message_group . "]:" . $message['content'];
}
$message['create_time'] = get_gmtime();
$message['rel_table'] = $rel_table;
$rel_id = $message['rel_id'] = intval($_REQUEST['rel_id']);
$message['user_id'] = intval($GLOBALS['user_info']['id']);
if (isset($_REQUEST['is_effect'])) {
$message_effect = intval($_REQUEST['is_effect']);
} else {
if (app_conf("USER_MESSAGE_AUTO_EFFECT") == 0) {
$message_effect = 0;
} else {
$message_effect = $message_type['is_effect'];
}
}
$message['is_effect'] = $message_effect;
$message['is_buy'] = intval($_REQUEST['is_buy']);
$message['contact'] = $_REQUEST['contact'] ? htmlspecialchars(addslashes($_REQUEST['contact'])) : '';
$message['contact_name'] = $_REQUEST['contact_name'] ? htmlspecialchars(addslashes($_REQUEST['contact_name'])) : '';
if ($message['is_buy'] == 1) {
if ($GLOBALS['db']->getOne("select count(*) from " . DB_PREFIX . "deal_order_item as doi left join " . DB_PREFIX . "deal_order as do on doi.order_id = do.id where doi.deal_id = " . intval($message['rel_id']) . " and do.user_id = " . intval($message['user_id']) . " and do.pay_status = 2") == 0) {
showErr($GLOBALS['lang']['AFTER_BUY_MESSAGE_TIP'], $ajax);
}
}
$message['point'] = intval($_REQUEST['point']);
$GLOBALS['db']->autoExecute(DB_PREFIX . "message", $message);
$message_id = $GLOBALS['db']->insert_id();
if ($message['is_buy'] == 1) {
$deal_info = $GLOBALS['db']->getRow("select id,is_shop,name,sub_name from " . DB_PREFIX . "deal where id = " . $rel_id);
if ($deal_info) {
$attach_list = get_topic_attach_list();
if ($deal_info['is_shop'] == 0) {
$url_route = array('rel_app_index' => 'tuan', 'rel_route' => 'deal', 'rel_param' => 'id=' . $deal_info['id']);
$type = "tuancomment";
$locations = $GLOBALS['db']->getAll("select * from " . DB_PREFIX . "deal_location_link where deal_id = " . intval($deal_info['id']));
$dp_title = "对" . $deal_info['sub_name'] . "的消费点评";
foreach ($locations as $location) {
insert_dp($dp_title, $message['content'], $location['location_id'], $message['point'], $is_buy = 1, $from = "tuan", $url_route, $message_id);
}
}
if ($deal_info['is_shop'] == 1) {
$url_route = array('rel_app_index' => 'shop', 'rel_route' => 'goods', 'rel_param' => 'id=' . $deal_info['id']);
$type = "shopcomment";
$locations = $GLOBALS['db']->getAll("select * from " . DB_PREFIX . "deal_location_link where deal_id = " . intval($deal_info['id']));
$dp_title = "对" . $deal_info['sub_name'] . "的消费点评";
foreach ($locations as $location) {
insert_dp($dp_title, $message['content'], $location['location_id'], $message['point'], $is_buy = 1, $from = "shop", $url_route, $message_id);
}
}
if ($deal_info['is_shop'] == 2) {
$url_route = array('rel_app_index' => 'youhui', 'rel_route' => 'ydetail', 'rel_param' => 'id=' . $deal_info['id']);
$type = "youhuicomment";
$locations = $GLOBALS['db']->getAll("select * from " . DB_PREFIX . "deal_location_link where deal_id = " . intval($deal_info['id']));
$dp_title = "对" . $deal_info['sub_name'] . "的消费点评";
foreach ($locations as $location) {
insert_dp($dp_title, $message['content'], $location['location_id'], $message['point'], $is_buy = 1, $from = "daijin", $url_route, $message_id);
}
}
increase_user_active(intval($GLOBALS['user_info']['id']), "点评了一个商品");
$title = "对" . $deal_info['sub_name'] . "发表了点评";
$tid = insert_topic($message['content'], $title, $type, $group = "", $relay_id = 0, $fav_id = 0, $group_data = "", $attach_list = array(), $url_route);
if ($tid) {
$GLOBALS['db']->query("update " . DB_PREFIX . "topic set source_name = '网站' where id = " . intval($tid));
}
}
}
//.........这里部分代码省略.........
开发者ID:YouthAndra,项目名称:huaitaoo2o,代码行数:101,代码来源:commentModule.class.php
示例8: index
//.........这里部分代码省略.........
//file_put_contents(APP_ROOT_PATH. "sjmapi/log/bm_".strftime("%Y%m%d%H%M%S",time()).".txt",print_r($GLOBALS['request'],true));
//$bm = (unserialize($GLOBALS['request']['bm']));
foreach ($bm as $field_id => $bm_result) {
$field_data = array();
$field_data['submit_id'] = $submit_id;
$field_data['field_id'] = $field_id;
$field_data['event_id'] = $event_id;
$field_data['result'] = strim($bm_result);
$GLOBALS['db']->autoExecute(DB_PREFIX . "event_submit_field", $field_data, "INSERT");
}
$GLOBALS['db']->query("update " . DB_PREFIX . "event set submit_count = submit_count+1 where id=" . $event_id);
if ($event['is_auto_verify'] == 1) {
//自动审核,发券
$sn = verify_event_submit($submit_id);
}
//同步分享
// $title = "报名参加了".$event['name'];
// $content = "报名参加了".$event['name']." - ".$event['brief'];
// $url_route = array(
// 'rel_app_index' => 'youhui',
// 'rel_route' => 'edetail',
// 'rel_param' => 'id='.$event['id']
// );
// $tid = insert_topic($content,$title,$type="eventsubmit",$group="", $relay_id = 0, $fav_id = 0,$group_data ="",$attach_list=array(),$url_route);
// if($tid)
// {
// $GLOBALS['db']->query("update ".DB_PREFIX."topic set source_name = '".$GLOBALS['request']['source']."' where id = ".intval($tid));
// }
//同步分享
$title = "报名参加了" . $event['name'];
$content = "报名参加了" . $event['name'] . " - " . $event['brief'];
$url_route = array('rel_app_index' => 'index', 'rel_route' => 'event#' . $event['id'], 'rel_param' => '');
require_once APP_ROOT_PATH . "system/model/topic.php";
$tid = insert_topic($content, $title, $type = "eventsubmit", $group = "", $relay_id = 0, $fav_id = 0, $group_data = "", $attach_list = array(), $url_route);
if ($tid) {
$GLOBALS['db']->query("update " . DB_PREFIX . "topic set source_name = '" . $GLOBALS['request']['source'] . "' where id = " . intval($tid));
}
require_once APP_ROOT_PATH . "system/model/user.php";
modify_account(array("score" => "-" . $event['score_limit']), $user_id, "活动报名:" . $event['name']);
$root['return'] = 1;
$root['info'] = "报名成功";
if ($sn) {
$root['info'] .= " 验证码:" . $sn;
} else {
$root['info'] .= " 请等待审核";
}
rm_auto_cache("event", array("id" => $event['id']));
} else {
$root['return'] = 0;
$root['info'] = "报名失败";
}
}
}
} else {
$root['return'] = 0;
$root['info'] = "没有该活动数据";
}
} else {
$root['return'] = 0;
$root['user_login_status'] = 0;
$root['info'] = "请先登录";
}
output($root);
//报名
}
//报名结束
开发者ID:macall,项目名称:jsd,代码行数:67,代码来源:eventdetail.action.php
示例9: add
public function add()
{
global $user_info;
$ajax = intval($_REQUEST['ajax']);
if (!$user_info) {
showErr($GLOBALS['lang']['PLEASE_LOGIN_FIRST'], $ajax);
}
if ($_REQUEST['content'] == '') {
showErr($GLOBALS['lang']['MESSAGE_CONTENT_EMPTY'], $ajax);
}
if (!check_ipop_limit(get_client_ip(), "message", intval(app_conf("SUBMIT_DELAY")), 0)) {
showErr($GLOBALS['lang']['MESSAGE_SUBMIT_FAST'], $ajax);
}
$rel_table = addslashes(trim($_REQUEST['rel_table']));
$message_type = $GLOBALS['db']->getRow("select * from " . DB_PREFIX . "message_type where type_name='" . $rel_table . "' and type_name <> 'supplier'");
if (!$message_type) {
showErr($GLOBALS['lang']['INVALID_MESSAGE_TYPE'], $ajax);
}
$message_group = addslashes(trim($_REQUEST['message_group']));
//添加留言
$message['title'] = $_REQUEST['title'] ? htmlspecialchars(addslashes(valid_str($_REQUEST['title']))) : htmlspecialchars(addslashes(valid_str($_REQUEST['content'])));
$message['content'] = htmlspecialchars(addslashes(valid_str($_REQUEST['content'])));
$message['title'] = valid_str($message['title']);
if ($message_group) {
$message['title'] = "[" . $message_group . "]:" . $message['title'];
$message['content'] = "[" . $message_group . "]:" . $message['content'];
}
$message['create_time'] = get_gmtime();
$message['rel_table'] = $rel_table;
$rel_id = $message['rel_id'] = addslashes(trim($_REQUEST['rel_id']));
$message['user_id'] = intval($GLOBALS['user_info']['id']);
if (intval($_REQUEST['city_id']) == 0) {
$message['city_id'] = $GLOBALS['deal_city']['id'];
} else {
$message['city_id'] = intval($_REQUEST['city_id']);
}
if (app_conf("USER_MESSAGE_AUTO_EFFECT") == 0) {
$message_effect = 0;
} else {
$message_effect = $message_type['is_effect'];
}
$message['is_effect'] = $message_effect;
$message['is_buy'] = intval($_REQUEST['is_buy']);
$message['contact'] = $_REQUEST['contact'] ? htmlspecialchars(addslashes($_REQUEST['contact'])) : '';
$message['contact_name'] = $_REQUEST['contact_name'] ? htmlspecialchars(addslashes($_REQUEST['contact_name'])) : '';
if ($message['is_buy'] == 1) {
if ($GLOBALS['db']->getOne("select count(*) from " . DB_PREFIX . "deal_order_item as doi left join " . DB_PREFIX . "deal_order as do on doi.order_id = do.id where doi.deal_id = " . intval($message['rel_id']) . " and do.user_id = " . intval($message['user_id']) . " and do.pay_status = 2") == 0) {
showErr($GLOBALS['lang']['AFTER_BUY_MESSAGE_TIP'], $ajax);
}
}
$message['point'] = intval($_REQUEST['point']);
$GLOBALS['db']->autoExecute(DB_PREFIX . "message", $message);
$message_id = intval($GLOBALS['db']->insert_id());
if ($message['is_buy'] == 1) {
$message_id = $GLOBALS['db']->insert_id();
$attach_list = get_topic_attach_list();
$deal_info = $GLOBALS['db']->getRow("select id,is_shop,name,sub_name from " . DB_PREFIX . "deal where id = " . $rel_id);
if ($deal_info['is_shop'] == 0) {
$url_route = array('rel_app_index' => 'tuan', 'rel_route' => 'deal', 'rel_param' => 'id=' . $deal_info['id']);
$type = "tuancomment";
$locations = $GLOBALS['db']->getAll("select * from " . DB_PREFIX . "deal_location_link where deal_id = " . $deal_info['id']);
$dp_title = "对" . $deal_info['sub_name'] . "的消费点评";
foreach ($locations as $location) {
insert_dp($dp_title, $message['content'], $location['location_id'], $message['point'], $is_buy = 1, $from = "tuan", $url_route, $message_id);
}
}
if ($deal_info['is_shop'] == 1) {
$url_route = array('rel_app_index' => 'shop', 'rel_route' => 'goods', 'rel_param' => 'id=' . $deal_info['id']);
$type = "shopcomment";
}
if ($deal_info['is_shop'] == 2) {
$url_route = array('rel_app_index' => 'youhui', 'rel_route' => 'ydetail', 'rel_param' => 'id=' . $deal_info['id']);
$type = "youhuicomment";
}
increase_user_active(intval($GLOBALS['user_info']['id']), "点评了一个团购");
$title = "对" . $deal_info['sub_name'] . "发表了点评";
$tid = insert_topic($message['content'], $title, $type, "share", $relay_id = 0, $fav_id = 0, $group_data = "", $attach_list = array(), $url_route);
if ($tid) {
$GLOBALS['db']->query("update " . DB_PREFIX . "topic set source_name = '网站' where id = " . intval($tid));
}
}
showSuccess($GLOBALS['lang']['MESSAGE_POST_SUCCESS'], $ajax);
}
开发者ID:YouthAndra,项目名称:huaitaoo2o,代码行数:83,代码来源:messageModule.class.php
示例10: savereview
public function savereview()
{
$return["status"] = 0;
if (!$GLOBALS['user_info']) {
$return["status"] = 2;
$return["message"] = $GLOBALS['LANG']["PLEASE_LOGIN_FIRST"];
ajax_return($return);
exit;
}
//验证码
if (app_conf("VERIFY_IMAGE") == 1) {
$verify = md5(trim($_REQUEST['verify']));
$session_verify = es_session::get('verify');
if ($verify != $session_verify) {
$return["message"] = $GLOBALS['lang']['VERIFY_CODE_ERROR'];
ajax_return($return);
exit;
}
}
es_session::delete("verify");
//创建基础点评数据
$dp_data = array();
$dp_data['title'] = addslashes(htmlspecialchars($_REQUEST['dp_title']));
$dp_data['content'] = addslashes(htmlspecialchars($_REQUEST['content']));
$dp_data['create_time'] = get_gmtime();
$dp_data['point'] = intval($_REQUEST['dp_point']);
$dp_data['user_id'] = intval($GLOBALS['user_info']['id']);
$dp_data['supplier_location_id'] = intval($_REQUEST['supplier_location_id']);
$dp_data['status'] = 1;
if (count($_REQUEST['pics']) > 0) {
$dp_data['is_img'] = 1;
}
$dp_data['avg_price'] = floatval($_REQUEST['avg_price']);
$GLOBALS['db']->autoExecute(DB_PREFIX . "supplier_location_dp", $dp_data, "INSERT");
$dp_id = $GLOBALS['db']->insert_id();
if ($dp_id > 0) {
increase_user_active(intval($GLOBALS['user_info']['id']), "发表了一则商户点评");
$GLOBALS['db']->query("update " . DB_PREFIX . "user set dp_count = dp_count + 1 where id = " . intval($GLOBALS['user_info']['id']));
//创建点评图库
if (isset($_REQUEST['pics']) && is_array($_REQUEST['pics']) && count($_REQUEST['pics']) > 0) {
$photos = $_REQUEST['pics'];
foreach ($photos as $pkey => $photo) {
$c_data = array();
$c_data['image'] = $photo;
$c_data['sort'] = 10;
$c_data['create_time'] = get_gmtime();
$c_data['user_id'] = intval($GLOBALS['user_info']['id']);
$c_data['supplier_location_id'] = intval($_REQUEST['supplier_location_id']);
$c_data['dp_id'] = $dp_id;
$c_data['brief'] = addslashes(htmlspecialchars($_REQUEST['brief'][$pkey]));
$c_data['status'] = 0;
$c_data['image_type'] = intval($_REQUEST['type'][$pkey]);
$GLOBALS['db']->autoExecute(DB_PREFIX . "supplier_location_images", $c_data, "INSERT");
}
}
//创建点评评分
$point_Group = $_REQUEST['dp_point_group'];
foreach ($point_Group as $group_id => $point) {
$point_data = array();
$point_data['group_id'] = $group_id;
$point_data['dp_id'] = $dp_id;
$point_data['supplier_location_id'] = intval($_REQUEST['supplier_location_id']);
$point_data['point'] = intval($point);
$GLOBALS['db']->autoExecute(DB_PREFIX . "supplier_location_dp_point_result", $point_data, "INSERT");
}
//创建点评分组的标签
$tag_group = $_REQUEST['dp_tags'];
foreach ($tag_group as $group_id => $tag_row) {
if (trim($tag_row) != '') {
$arr_rer = array(",", ",");
$arr_rep = array(" ", " ");
$tag_row = str_replace($arr_rer, $arr_rep, $tag_row);
$tag_row_data = array();
$tag_row_data['tags'] = $tag_row;
$tag_row_data['dp_id'] = $dp_id;
$tag_row_data['supplier_location_id'] = intval($_REQUEST['supplier_location_id']);
$tag_row_data['group_id'] = $group_id;
$GLOBALS['db']->autoExecute(DB_PREFIX . "supplier_location_dp_tag_result", $tag_row_data, "INSERT");
review_supplier_location_match(intval($_REQUEST['supplier_location_id']), $tag_row, $group_id);
}
}
//分享
$supplier_info = $GLOBALS['db']->getRow("select name,id,new_dp_count_time from " . DB_PREFIX . "supplier_location where id = " . $dp_data['supplier_location_id']);
$title = "对" . $supplier_info['name'] . "发表了点评";
$url_route = array('rel_app_index' => 'youhui', 'rel_route' => 'store#view', 'rel_param' => 'id=' . $supplier_info['id']);
$tid = insert_topic($dp_data['content'], $title, "slocationcomment", $group = "", $relay_id = 0, $fav_id = 0, $group_data = "", $attach_list = array(), $url_route);
if ($tid) {
$GLOBALS['db']->query("update " . DB_PREFIX . "topic set source_name = '网站' where id = " . intval($tid));
}
//更新统计
syn_supplier_locationcount($supplier_info);
cache_store_point($supplier_info['id']);
$cache_id = md5("store" . "view" . $supplier_info['id']);
$GLOBALS['tmpl']->clear_cache('store_view.html', $cache_id);
$return['status'] = 1;
} else {
$return['message'] = "数据库异常,提交失败";
}
ajax_return($return);
exit;
//.........这里部分代码省略.........
开发者ID:YouthAndra,项目名称:huaitaoo2o,代码行数:101,代码来源:reviewModule.class.php
示例11: save
//.........这里部分代码省略.........
$info = $imagecls->getImageInfo(APP_ROOT_PATH . $deal_info['icon']);
$image_data['width'] = intval($info[0]);
$image_data['height'] = intval($info[1]);
$image_data['name'] = $deal_info['sub_name'];
$image_data['filesize'] = filesize(APP_ROOT_PATH . $deal_info['icon']);
$image_data['create_time'] = NOW_TIME;
$image_data['user_id'] = intval($GLOBALS['user_info']['id']);
$image_data['user_name'] = strim($GLOBALS['user_info']['user_name']);
$image_data['path'] = $deal_info['icon'];
$image_data['o_path'] = $deal_info['icon'];
$GLOBALS['db']->autoExecute(DB_PREFIX . "topic_image", $image_data);
$img_id = intval($GLOBALS['db']->insert_id());
$attach_list[] = array("type" => "image", "id" => intval($img_id));
}
} elseif ($result['youhui_id'] > 0) {
require_once APP_ROOT_PATH . "system/model/youhui.php";
$youhui_info = get_youhui($result['youhui_id']);
$type = "youhuicomment";
$url_route = array('rel_app_index' => 'index', 'rel_route' => 'youhui#' . $result['youhui_id'], 'rel_param' => '');
//同步图片
if ($youhui_info['icon']) {
require_once APP_ROOT_PATH . "system/utils/es_imagecls.php";
$imagecls = new es_imagecls();
$info = $imagecls->getImageInfo(APP_ROOT_PATH . $youhui_info['icon']);
$image_data['width'] = intval($info[0]);
$image_data['height'] = intval($info[1]);
$image_data['name'] = $youhui_info['name'];
$image_data['filesize'] = filesize(APP_ROOT_PATH . $youhui_info['icon']);
$image_data['create_time'] = NOW_TIME;
$image_data['user_id'] = intval($GLOBALS['user_info']['id']);
$image_data['user_name'] = strim($GLOBALS['user_info']['user_name']);
$image_data['path'] = $youhui_info['icon'];
$image_data['o_path'] = $youhui_info['icon'];
$GLOBALS['db']->autoExecute(DB_PREFIX . "topic_image", $image_data);
$img_id = intval($GLOBALS['db']->insert_id());
$attach_list[] = array("type" => "image", "id" => intval($img_id));
}
} elseif ($result['event_id'] > 0) {
require_once APP_ROOT_PATH . "system/model/event.php";
$event_info = get_event($result['youhui_id']);
$type = "eventcomment";
$url_route = array('rel_app_index' => 'index', 'rel_route' => 'event#' . $result['event_id'], 'rel_param' => '');
//同步图片
if ($event_info['icon']) {
require_once APP_ROOT_PATH . "system/utils/es_imagecls.php";
$imagecls = new es_imagecls();
$info = $imagecls->getImageInfo(APP_ROOT_PATH . $event_info['icon']);
$image_data['width'] = intval($info[0]);
$image_data['height'] = intval($info[1]);
$image_data['name'] = $event_info['name'];
$image_data['filesize'] = filesize(APP_ROOT_PATH . $event_info['icon']);
$image_data['create_time'] = NOW_TIME;
$image_data['user_id'] = intval($GLOBALS['user_info']['id']);
$image_data['user_name'] = strim($GLOBALS['user_info']['user_name']);
$image_data['path'] = $event_info['icon'];
$image_data['o_path'] = $event_info['icon'];
$GLOBALS['db']->autoExecute(DB_PREFIX . "topic_image", $image_data);
$img_id = intval($GLOBALS['db']->insert_id());
$attach_list[] = array("type" => "image", "id" => intval($img_id));
}
} else {
require_once APP_ROOT_PATH . "system/model/supplier.php";
$location_info = get_location($result['location_id']);
$type = "slocationcomment";
$url_route = array('rel_app_index' => 'index', 'rel_route' => 'store#' . $result['location_id'], 'rel_param' => '');
//同步图片
if ($location_info['preview']) {
require_once APP_ROOT_PATH . "system/utils/es_imagecls.php";
$imagecls = new es_imagecls();
$info = $imagecls->getImageInfo(APP_ROOT_PATH . $location_info['preview']);
$image_data['width'] = intval($info[0]);
$image_data['height'] = intval($info[1]);
$image_data['name'] = $location_info['name'];
$image_data['filesize'] = filesize(APP_ROOT_PATH . $location_info['preview']);
$image_data['create_time'] = NOW_TIME;
$image_data['user_id'] = intval($GLOBALS['user_info']['id']);
$image_data['user_name'] = strim($GLOBALS['user_info']['user_name']);
$image_data['path'] = $location_info['preview'];
$image_data['o_path'] = $location_info['preview'];
$GLOBALS['db']->autoExecute(DB_PREFIX . "topic_image", $image_data);
$img_id = intval($GLOBALS['db']->insert_id());
$attach_list[] = array("type" => "image
|
请发表评论