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); }
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); }
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); }
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; require_once APP_ROOT_PATH."system/libs/user.php"; modify_account(array("money"=>$deal_info['borrow_amount']),$deal_info['user_id'],"标:".$deal_info['id'].",招标成功"); //扣除服务费 $services_fee = $deal_info['borrow_amount']*floatval(trim($deal_info['services_fee']))/100; modify_account(array("money"=>-$services_fee),$deal_info['user_id'],"服务费"); //发借款成功邮件 send_deal_success_mail_sms($id,$deal_info); //发借款成功站内信 send_deal_success_site_sms($id,$deal_info); //返利给用户 if(floatval(app_conf("USER_BID_REBATE"))!=0){ $load_list = $GLOBALS['db']->getAll("SELECT id,user_id,`money` FROM ".DB_PREFIX."deal_load where deal_id=".$id." and is_rebate = 0 "); foreach($load_list as $lk=>$lv){ $GLOBALS['db']->query("UPDATE ".DB_PREFIX."deal_load SET is_rebate =1 WHERE id=".$lv['id']." AND is_rebate = 0 AND user_id=".$lv['user_id']); if($GLOBALS['db']->affected_rows()){ modify_account(array("money"=>$lv['money']*floatval(app_conf("USER_BID_REBATE"))/100),$lv['user_id'],"标:".$id.",返利"); } } } }*/ $GLOBALS['db']->autoExecute(DB_PREFIX . "deal", $data, "UPDATE", "id=" . $id); //自动投标功能 //2013-8-15 排除了 借贷者在外 and usa.user_id <>'".$deal_info['user_id']."' if (app_conf("OPEN_AUTOBID") == 1 && $deal_info['ips_bill_no'] == "") { if (($deal_info['deal_status'] == 1 || $data['deal_status'] == 1) && $deal_info['remain_time'] > 0 && $deals_time - $deal_info['start_time'] >= 1800 && $deal_info['progress_point'] <= 95 && $deal_info['repay_time_type'] == 1) { //point $user_level_id = $GLOBALS['db']->getOne("SELECT level_id FROM " . DB_PREFIX . "user WHERE id = " . $deal_info['user_id']); $level = load_auto_cache("level"); $deal_user_point = floatval($level['point'][$user_level_id]); $sql = "SELECT usa.user_id,usa.fixed_amount,u.user_name,usa.deal_cates FROM " . DB_PREFIX . "user_autobid usa " . "LEFT JOIN " . DB_PREFIX . "user u ON u.id=usa.user_id AND u.money-usa.retain_amount >= usa.fixed_amount " . "LEFT JOIN " . DB_PREFIX . "deal d ON d.id=" . $deal_info['id'] . " " . "WHERE (usa.fixed_amount >=d.min_loan_money or d.min_loan_money = 0) and usa.fixed_amount <= d.borrow_amount*0.2 AND usa.is_effect = 1 " . "AND (d.rate between usa.min_rate AND usa.max_rate) " . "AND (d.repay_time between usa.min_period AND usa.max_period) " . "AND usa.user_id not in (SELECT user_id FROM " . DB_PREFIX . "deal_load WHERE deal_id={$id}) and usa.user_id <>d.user_id " . "AND ({$deal_user_point} between (SELECT point FROM " . DB_PREFIX . "user_level WHERE id = usa.min_level) AND (SELECT point FROM " . DB_PREFIX . "user_level WHERE id = usa.max_level)) " . "AND usa.fixed_amount <= (d.borrow_amount - " . floatval($data['load_money']) . ") " . "AND d.cate_id != 6 " . "AND (usa.fixed_amount <= d.max_loan_money or d.max_loan_money = 0) and FIND_IN_SET(d.cate_id,usa.deal_cates) " . "GROUP BY usa.user_id ORDER BY usa.last_bid_time ASC"; $autobid_user = $GLOBALS['db']->getRow($sql); //开始投标 if ($autobid_user) { $biddata['user_id'] = $autobid_user['user_id']; $biddata['user_name'] = $autobid_user['user_name']; $biddata['deal_id'] = $id; $biddata['money'] = $autobid_user['fixed_amount']; $biddata['create_time'] = TIME_UTC; $biddata['is_auto'] = 1; $GLOBALS['db']->autoExecute(DB_PREFIX . "deal_load", $biddata, "INSERT"); $load_id = $GLOBALS['db']->insert_id(); if ($load_id > 0) { $msg = '[<a href="' . url("index", "deal", array("id" => $deal_info['id'])) . '" target="_blank">' . $deal_info['name'] . '</a>]的投标,付款单号' . $load_id; require_once APP_ROOT_PATH . "system/libs/user.php"; modify_account(array("money" => -$autobid_user['fixed_amount'], 'lock_money' => $autobid_user['fixed_amount']), $autobid_user['user_id'], $msg, 2); $GLOBALS['db']->query("UPDATE " . DB_PREFIX . "user_autobid SET last_bid_time=" . TIME_UTC . " WHERE user_id=" . $autobid_user['user_id']); } } } } return $data; }
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); }
</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_info = mysql_fetch_row(mysql_query($query_2));
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)); } } } if ($message['rel_table'] == 'youhui') { $youhui_info = $GLOBALS['db']->getRow("select name,id from " . DB_PREFIX . "youhui where id = " . $rel_id); if ($youhui_info) { increase_user_active(intval($GLOBALS['user_info']['id']), "点评了一个优惠券"); $title = "对" . $youhui_info['name'] . "发表了点评"; $url_route = array('rel_app_index' => 'youhui', 'rel_route' => 'fdetail', 'rel_param' => 'id=' . $youhui_info['id']); $tid = insert_topic($message['content'], $title, "fyouhuicomment", $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)); } $locations = $GLOBALS['db']->getAll("select * from " . DB_PREFIX . "youhui_location_link where youhui_id = " . intval($youhui_info['id'])); $dp_title = "对" . $youhui_info['name'] . "的点评"; foreach ($locations as $location) { insert_dp($dp_title, $message['content'], $location['location_id'], 3, $is_buy = 0, $from = "youhui", $url_route, $message_id); } } } if ($message['rel_table'] == 'event') { $event_info = $GLOBALS['db']->getRow("select name,id from " . DB_PREFIX . "event where id = " . $rel_id); if ($event_info) { increase_user_active(intval($GLOBALS['user_info']['id']), "点评了一个活动"); $title = "对" . $event_info['name'] . "发表了点评"; $url_route = array('rel_app_index' => 'youhui', 'rel_route' => 'edetail', 'rel_param' => 'id=' . $event_info['id']); $tid = insert_topic($message['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 = '网站' where id = " . intval($tid)); } $GLOBALS['db']->query("update " . DB_PREFIX . "event set reply_count = reply_count+1 where id =" . $rel_id); $locations = $GLOBALS['db']->getAll("select * from " . DB_PREFIX . "event_location_link where event_id = " . intval($event_info['id'])); $dp_title = "对" . $event_info['name'] . "的点评"; foreach ($locations as $location) { insert_dp($dp_title, $message['content'], $location['location_id'], 3, $is_buy = 0, $from = "event", $url_route, $message_id); } } } if ($message['rel_table'] == 'supplier_location') { $supplier_info = $GLOBALS['db']->getRow("select name,id from " . DB_PREFIX . "supplier_location where id = " . $rel_id); if ($supplier_info) { increase_user_active(intval($GLOBALS['user_info']['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($message['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)); } } } //开始处理为deal时的计分 if ($rel_table == 'deal') { $total_point = $GLOBALS['db']->getOne("select sum(point) from " . DB_PREFIX . "message where rel_table = 'deal' and rel_id = " . intval($_REQUEST['rel_id'])); $total_comment = $GLOBALS['db']->getOne("select count(*) from " . DB_PREFIX . "message where rel_table = 'deal' and rel_id = " . intval($_REQUEST['rel_id'])); $avg_point = round($total_point / $total_comment); $GLOBALS['db']->query("update " . DB_PREFIX . "deal set total_point = " . $total_point . ",avg_point = " . $avg_point . " where id =" . intval($_REQUEST['rel_id'])); } showSuccess($GLOBALS['lang']['MESSAGE_POST_SUCCESS'], $ajax); }
public function index() { require_once APP_ROOT_PATH . "system/model/user.php"; if (strim($GLOBALS['request']['act_2']) == 'bm') { $root['status'] = 1; $city_name = strim($GLOBALS['request']['city_name']); //城市名称 //检查用户,用户密码 $user_data = $GLOBALS['user_info']; //报名 if ($user_data) { $root['user_login_status'] = 1; $event_id = intval($GLOBALS['request']['event_id']); $user_id = intval($GLOBALS['user_info']['id']); require_once APP_ROOT_PATH . "system/model/event.php"; // $event = $GLOBALS['db']->getRow("select * from ".DB_PREFIX."event where id = ".$event_id." and is_effect = 1"); $event = get_event($event_id); if ($event) { if ($event['xpoint'] == '') { $event['xpoint'] = 0; } if ($event['ypoint'] == '') { $event['ypoint'] = 0; } if ($event['submit_begin_time'] > NOW_TIME) { $root['return'] = 0; $root['info'] = "活动未开始"; } elseif ($event['submit_end_time'] > 0 && $event['submit_end_time'] < NOW_TIME) { $root['return'] = 0; $root['info'] = "活动报名已结束"; } elseif ($event['submit_count'] >= $event['total_count'] && $event['total_count'] > 0) { $root['return'] = 0; $root['info'] = "活动名额已满"; } else { //开始提交报名 $user_id = intval($GLOBALS['user_info']['id']); $user_submit = $GLOBALS['db']->getRow("select * from " . DB_PREFIX . "event_submit where user_id = " . $user_id . " and event_id = " . $event_id); if ($user_submit) { if ($user_submit['is_verify'] == 1) { $root['return'] = 0; $root['info'] = "您已经报过名了"; } elseif ($user_submit['is_verify'] == 2) { $root['return'] = 0; $root['info'] = "您的报名审核不通过"; } else { //已经报名,仅作修改 $bm = $GLOBALS['request']['bm']; $GLOBALS['db']->query("delete from " . DB_PREFIX . "event_submit_field where submit_id = " . $user_submit['id']); foreach ($bm as $field_id => $bm_result) { $field_data = array(); $field_data['submit_id'] = $user_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"); } $root['return'] = 1; $root['info'] = "报名修改成功"; } } 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) { $bm = $GLOBALS['request']['bm']; //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); //报名 } //报名结束 $page = intval($GLOBALS['request']['page']); //分页,无用 if ($page == 0) { $page = 1; } $event_id = intval($GLOBALS['request']['event_id']); if ($event_id) { $user_data = $GLOBALS['user_info']; require_once APP_ROOT_PATH . "system/model/event.php"; $event = get_event($event_id); if ($event['xpoint'] == '') { $event['xpoint'] = 0; } if ($event['ypoint'] == '') { $event['ypoint'] = 0; } $pattern = "/<img([^>]*)\\/>/i"; $replacement = "<img width=300 \$1 />"; $event['icon'] = get_abs_img_root($event['icon']); $pattern = "/<[img|IMG].*?src=[\\'|\"](.*?(?:[\\.gif|\\.jpg|\\.png]))[\\'|\"].*?[\\/]?>/i"; //$replacement = "<img width=300 $1 />"; $replacement = "<img src='\$1' width='278' />"; $event['content'] = get_abs_img_root(preg_replace($pattern, $replacement, $event['content'])); //$event['content'] = get_abs_img_root(get_spec_image($event['content'], 278,168,1)); $event['content'] = preg_replace($pattern, $replacement, $event['content']); $event['event_begin_time'] = to_date($event['event_begin_time'], 'Y-m-d'); $event['event_end_time'] = to_date($event['event_end_time'], 'Y-m-d'); //验证是否报名 //$is_submit = $GLOBALS['db']->getOne("select count(*) from ".DB_PREFIX."event_submit where user_id = ".intval($GLOBALS['user_info']['id'])." and event_id = ".$event['id']); // $event_fields = $GLOBALS['db']->getAll("select * from ".DB_PREFIX."event_field where event_id = ".$event_id." order by sort asc"); // foreach($event_fields as $k=>$v) // { // $event_fields[$k]['value_scope'] = explode(" ",$v['value_scope']); // } // $event['field_list'] = $event_fields; // $event['is_submit'] = $is_submit; // $event['field_list_json']=json_encode($event_fields); $user_submit = $GLOBALS['db']->getRow("select * from " . DB_PREFIX . "event_submit where user_id = " . $user_data['id'] . " and event_id = " . $event_id); if ($user_submit) { if ($user_submit['is_verify'] == 1) { $event['is_submit'] = 1; //已报名 $event['is_verify'] = 1; //已审核 } elseif ($user_submit['is_verify'] == 2) { $event['is_submit'] = 1; //已报名 $event['is_verify'] = 2; //审核失败 } else { //未审核 $event_fields = $GLOBALS['db']->getAll("select * from " . DB_PREFIX . "event_field where event_id = " . $event_id . " order by sort asc"); foreach ($event_fields as $k => $v) { $event_fields[$k]['result'] = $GLOBALS['db']->getOne("select result from " . DB_PREFIX . "event_submit_field where submit_id = " . $user_submit['id'] . " and field_id = " . $v['id'] . " and event_id = " . $event_id); $event_fields[$k]['value_scope'] = explode(" ", $v['value_scope']); } $event['event_fields'] = $event_fields; $event['is_submit'] = 1; //已报名 $event['is_verify'] = 0; //未审核 // $GLOBALS['tmpl']->assign("event_fields",$event_fields); // $GLOBALS['tmpl']->assign("user_submit",$user_submit); //表示修改已报名记录 // $GLOBALS['tmpl']->assign("btn_name","修改报名"); } } else { $event_fields = $GLOBALS['db']->getAll("select * from " . DB_PREFIX . "event_field where event_id = " . $event_id . " order by sort asc"); foreach ($event_fields as $k => $v) { $event_fields[$k]['value_scope'] = explode(" ", $v['value_scope']); } $event['event_fields'] = $event_fields; $event['is_submit'] = 0; //已报名 } } //$res = m_get_event_reply($event_id,$page); //$event['comments'] = $res['list']; //$root['page'] = $res['page']; require_once APP_ROOT_PATH . "system/model/review.php"; require_once APP_ROOT_PATH . "system/model/user.php"; $message_re = get_dp_list(3, $param = array("deal_id" => 0, "youhui_id" => 0, "event_id" => $event_id, "location_id" => 0, "tag" => ""), "", ""); foreach ($message_re['list'] as $k => $v) { $message_re['list'][$k]['width'] = $v['point'] / 5 * 100; $uinfo = load_user($v['user_id']); $message_re['list'][$k]['user_name'] = $uinfo['user_name']; foreach ($message_re['list'][$k]['images'] as $kk => $vv) { $message_re['list'][$k]['images'][$kk] = get_abs_img_root(get_spec_image($vv, 60, 60, 1)); $message_re['list'][$k]['oimages'][$kk] = get_abs_img_root($vv); } } $root['message_list'] = $message_re['list']; if (count($message_re['list']) > 0) { $sql = "select count(*) from " . DB_PREFIX . "supplier_location_dp where " . $message_re['condition']; $message_re['count'] = $GLOBALS['db']->getOne($sql); } $root['message_count'] = $message_re['count']; $root['return'] = 1; $root['item'] = $event; $root['page_title'] = "活动详情"; $root['city_name'] = $city_name; output($root); }
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); }
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; }
public function save() { global_run(); if (empty($GLOBALS['user_info'])) { $data['status'] = -1; $data['info'] = ""; ajax_return($data); } require_once APP_ROOT_PATH . "system/model/review.php"; $deal_id = intval($_REQUEST['deal_id']); $youhui_id = intval($_REQUEST['youhui_id']); $event_id = intval($_REQUEST['event_id']); $location_id = intval($_REQUEST['location_id']); $order_item_id = intval($_REQUEST['order_item_id']); $youhui_log_id = intval($_REQUEST['youhui_log_id']); $event_submit_id = intval($_REQUEST['event_submit_id']); $param = array("deal_id" => $deal_id, "youhui_id" => $youhui_id, "event_id" => $event_id, "location_id" => $location_id, "order_item_id" => $order_item_id, "youhui_log_id" => $youhui_log_id, "event_submit_id" => $event_submit_id); $checker = check_dp_status($GLOBALS['user_info']['id'], $param); if (!$checker['status']) { showErr($checker['info'], 1); } $content = strim(valid_str($_REQUEST['content'])); //点评内容 $dp_point = intval($_REQUEST['dp_point']); //总评分 if ($dp_point <= 0) { $data['status'] = 0; $data['info'] = "请为总评打分"; ajax_return($data); } $dp_image = array(); //点评图片 foreach ($_REQUEST['dp_image'] as $k => $v) { if (strim($v) != "") { $dp_image[] = strim($v); } } $tag_group = array(); //标签分组 foreach ($_REQUEST['dp_tags'] as $k => $tags_arr) { foreach ($tags_arr as $v) { if (strim($v) != "") { $v_array = preg_split("/[ ,]/", $v); foreach ($v_array as $kk => $vv) { if (strim($vv) != "") { $tag_group[$k][] = strim(valid_str($vv)); } } } } } $point_group = array(); //评分分组 foreach ($_REQUEST['dp_point_group'] as $k => $v) { if (intval($v) > 0) { $point_group[$k] = intval($v); } else { $name = $GLOBALS['db']->getOne("select name from " . DB_PREFIX . "point_group where id = " . intval($k)); $info = "请打分"; if ($name) { $info = "请为" . $name . "打分"; } $data['status'] = 0; $data['info'] = $info; ajax_return($data); } } $result = save_review($GLOBALS['user_info']['id'], $param, $content, $dp_point, $dp_image, $tag_group, $point_group); if ($result['status']) { //分享 $attach_list = array(); if ($result['deal_id'] > 0) { require_once APP_ROOT_PATH . "system/model/deal.php"; $deal_info = get_deal($result['deal_id']); if ($deal_info['uname'] != "") { $url_key = $deal_info['uname']; } else { $url_key = $deal_info['id']; } $type = "dealcomment"; $url_route = array('rel_app_index' => 'index', 'rel_route' => 'deal#' . $url_key, 'rel_param' => ''); //同步图片 if ($deal_info['icon']) { require_once APP_ROOT_PATH . "system/utils/es_imagecls.php"; $imagecls = new es_imagecls(); $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", "id" => intval($img_id)); } } foreach ($_REQUEST['topic_image_id'] as $att_id) { if (intval($att_id) > 0) { $attach_list[] = array("type" => "image", "id" => intval($att_id)); } } require_once APP_ROOT_PATH . "system/model/topic.php"; $tid = insert_topic($content, "", $type, $group = "", $relay_id = 0, $fav_id = 0, $group_data = "", $attach_list, $url_route); if ($tid) { $GLOBALS['db']->query("update " . DB_PREFIX . "topic set source_name = '网站' where id = " . intval($tid)); } $result['jump'] = url($url_route['rel_app_index'], $url_route['rel_route'], $url_route['rel_param']); ajax_return($result); } else { ajax_return($result); } }
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); } } if (!check_ipop_limit(get_client_ip(), "message", intval(app_conf("SUBMIT_DELAY")), 0)) { showErr($GLOBALS['lang']['MESSAGE_SUBMIT_FAST'], $ajax); } $forum_title = htmlspecialchars(addslashes(trim(valid_str($_REQUEST['forum_title'])))); $group_id = intval($_REQUEST['group_id']); if ($group_id > 0) { if ($forum_title == '') { showErr("请输出发表的主题", $ajax); } $user_id = intval($GLOBALS['user_info']['id']); $group_info = $GLOBALS['db']->getRow("select * from " . DB_PREFIX . "topic_group where id = " . $group_id); if ($group_info['user_id'] != $user_id) { if ($GLOBALS['db']->getOne("select count(*) from " . DB_PREFIX . "user_topic_group where group_id=" . $group_id . " and user_id = " . $user_id) == 0) { showErr("不是本组会员, 不能发表主题", $ajax); } } } $title = htmlspecialchars(addslashes(trim(valid_str($_REQUEST['title'])))); $content = htmlspecialchars(addslashes(trim(valid_str($_REQUEST['content'])))); $group = htmlspecialchars(addslashes(trim($_REQUEST['group']))); $group_data = addslashes(trim($_REQUEST['group_data'])); $type = addslashes(trim($_REQUEST['type'])); $tags_data = $_REQUEST['tag']; $tags = array(); foreach ($tags_data as $tag_row) { $tag_row_arr = explode(" ", $tag_row); foreach ($tag_row_arr as $tag_item) { $tag_item = trim($tag_item); if (!in_array($tag_item, $tags)) { $tags[] = addslashes(htmlspecialchars(trim($tag_item))); } } } $attach_list = get_topic_attach_list(); $id = insert_topic($content, $title, $type, $group, $relay_id = 0, $fav_id = 0, $group_data, $attach_list, $url_route = array(), $tags, '', '', $forum_title, $group_id); if ($id) { $GLOBALS['db']->query("update " . DB_PREFIX . "topic set source_name = '网站' where id = " . intval($id)); increase_user_active(intval($GLOBALS['user_info']['id']), "发表了一则分享"); } //验证码 if (app_conf("VERIFY_IMAGE") == 1) { es_session::delete('verify'); } if ($ajax == 1) { $result['info'] = $GLOBALS['lang']['MESSAGE_POST_SUCCESS']; $result['data'] = intval($id); $result['status'] = 1; ajax_return($result); } else { if ($group_id > 0) { $url = url("shop", "group#forum", array("id" => $group_id)); } showSuccess($GLOBALS['lang']['MESSAGE_POST_SUCCESS'], $ajax, $url); } // showSuccess($GLOBALS['lang']['MESSAGE_POST_SUCCESS'],$ajax); }
function savedebit() { $view["type"] = intval($_REQUEST["type"]); $view["debit_money"] = strim($_REQUEST["debit_money"]); $view["repay_time"] = intval($_REQUEST["repaytime"]); $view["university"] = strim($_REQUEST["university"]); $view["address"] = strim($_REQUEST["address"]); $view["mobile"] = strim($_REQUEST["mobile"]); $is_ajax = intval($_REQUEST["is_ajax"]); if (strim($GLOBALS["user_info"]["u_alipay"]) == "") { showErr("请先绑定支付宝", $is_ajax); } if ($view["university"] == "") { showErr("请填写学校信息", $is_ajax); } if ($view["address"] == "") { showErr("请填写地址", $is_ajax); } if ($view["mobile"] == "") { showErr("请填写联系电话", $is_ajax); } if ($view["type"] == "" || $view["debit_money"] == "" || $view["repay_time"] == "") { showErr("请返回重新提交", $is_ajax); } $is_ajax = intval($_REQUEST['is_ajax']); if (!$GLOBALS['user_info']) { showErr($GLOBALS['lang']['PLEASE_LOGIN_FIRST'], $is_ajax); } $t = trim($_REQUEST['t']); if (!in_array($t, array("save", "publish"))) { showErr($GLOBALS['lang']['ERROR_TITLE'], $is_ajax); } /*读取白条配置*/ $debit_conf = $GLOBALS["db"]->getRow("select * from " . DB_PREFIX . "debit_conf"); /*读取标类别作为商品名*/ $view["deal_loan_type"] = $GLOBALS["db"]->getOne("select name from " . DB_PREFIX . "deal_loan_type"); if ($t == "save") { $data['is_delete'] = 2; } else { $data['is_delete'] = 0; } $data['name'] = $view["deal_loan_type"] . $view["debit_money"] . "元"; if (empty($data['name'])) { showErr("请输入借款标题", $is_ajax); } $data['publish_wait'] = 1; $icon_type = "systemImg"; if ($icon_type == "") { showErr("请选择借款图片类型", $is_ajax); } $icon_type_arr = array('upload' => 1, 'userImg' => 2, 'systemImg' => 3); $data['icon_type'] = $icon_type_arr[$icon_type]; if (intval($data['icon_type']) == 0) { showErr("请选择借款图片类型", $is_ajax); } $_REQUEST['systemimgpath'] = $view["type"]; switch ($data['icon_type']) { case 1: if (strim($_REQUEST['icon']) == '') { showErr("请上传图片", $is_ajax); } else { $data['icon'] = replace_public(strim($_REQUEST['icon'])); } break; case 2: $data['icon'] = replace_public(get_user_avatar($GLOBALS['user_info']['id'], 'big')); break; case 3: if (intval($_REQUEST['systemimgpath']) == 0) { showErr("请选择系统图片", $is_ajax); } else { $data['icon'] = $GLOBALS['db']->getOne("SELECT icon FROM " . DB_PREFIX . "deal_loan_type WHERE id=" . intval($_REQUEST['systemimgpath'])); } break; } //$data['cate_id'] = $data['type_id'] = intval($view["type"]); $data['type_id'] = intval($view["type"]); if ($data['type_id'] == 0) { showErr("请选择借款用途", $is_ajax); } $data['borrow_amount'] = floatval($view["debit_money"]); /*if($data['borrow_amount'] < (int)trim(app_conf('MIN_BORROW_QUOTA')) || $data['borrow_amount'] > (int)trim(app_conf('MAX_BORROW_QUOTA')) || $data['borrow_amount'] %50 != 0){ showErr("请正确选择借款金额",$is_ajax); }*/ //判断是否需要额度 if ($GLOBALS['db']->getOne("SELECT is_quota FROM " . DB_PREFIX . "deal_loan_type WHERE id=" . $data['type_id']) == 1) { if (intval($GLOBALS['user_info']['quota']) != 0) { $can_use_quota = get_can_use_quota($GLOBALS['user_info']['id']); if ($data['borrow_amount'] > intval($can_use_quota)) { showErr("输入借款的借款金额超过您的可用额度<br>您当前可用额度为:" . $can_use_quota, $is_ajax); } } } $data['repay_time'] = intval($_REQUEST['repaytime']); if ($data['repay_time'] == 0) { showErr("借款期限", $is_ajax); } $data['rate'] = floatval($view["rate"]); // $data['repay_time_type'] = 1; //按月 $min_rate = 0; $max_rate = 0; $is_rate_lock = false; $level_list = load_auto_cache("level"); $level_list_info = reset($level_list["repaytime_list"]); foreach ($level_list_info as $k => $v) { if ($v[1] != 0 && $v[0] == $view["repay_time"]) { $min_rate = $v[2]; $max_rate = $v[3]; break; } } if ($debit_conf["rate_cfg"] == 0) { $data["rate"] = $min_rate; } elseif ($debit_conf["rate_cfg"] == 1) { $data["rate"] = floatval(($min_rate + $max_rate) / 2); } elseif ($debit_conf["rate_cfg"] == 2) { $data["rate"] = $max_rate; } if (floatval($data['rate']) <= 0 || floatval($data['rate']) > $max_rate || floatval($data['rate']) < $min_rate) { showErr("请正确输入借款利率", $is_ajax); } $data['enddate'] = intval($debit_conf['enddate']); //筹标期限 $data['description'] = $GLOBALS["user_info"]["user_name"] . "的白条:" . $view["deal_loan_type"] . $view["debit_money"] . "元"; if (trim($data['description']) == '') { showErr("请输入项目描述", $is_ajax); } $datas["university"] = $view["university"]; $datas["address"] = $view["address"]; $datas["mobile"] = $view["mobile"]; //$datas['view_info'] = serialize($user_view_info); $GLOBALS['db']->autoExecute(DB_PREFIX . "user", $datas, "UPDATE", "id=" . $GLOBALS['user_info']['id']); $data["services_fee"] = $debit_conf["services_fee"]; $data["manage_fee"] = $debit_conf["manage_fee"]; $data["manage_impose_fee_day1"] = $debit_conf["manage_impose_fee_day1"]; $data["manage_impose_fee_day2"] = $debit_conf["manage_impose_fee_day2"]; $data["impose_fee_day1"] = $debit_conf["impose_fee_day1"]; $data["impose_fee_day2"] = $debit_conf["impose_fee_day2"]; $data['voffice'] = 1; $data['vposition'] = 1; $data['is_effect'] = 1; $data['deal_status'] = 0; $data['agency_id'] = 0; //担保机构 $data['agency_status'] = 1; $data['warrant'] = 0; //担保类型 $data['guarantor_margin_amt'] = 0; //担保保证金 $data['guarantor_pro_fit_amt'] = 0; //担保收益 $data['user_id'] = intval($GLOBALS['user_info']['id']); $data['loantype'] = intval($view['loantype']); if ($data['repay_time_type'] == 0) { $data['loantype'] = 2; } //当为天的时候 if ($data['repay_time_type'] == 0) { $true_repay_time = 1; } else { $true_repay_time = $data['repay_time']; } //本金担保 if ($data['warrant'] == 1) { $data['guarantor_amt'] = $data['borrow_amount']; } elseif ($data['warrant'] == 2) { //等额本息 if ($data['loantype'] == 0) { $data['guarantor_amt'] = pl_it_formula($data['borrow_amount'], $data['rate'] / 12 / 100, $true_repay_time) * $true_repay_time; } } $data['is_hidden'] = 1; $data['create_time'] = TIME_UTC; //推荐人 $work_id = strim($_REQUEST["work_id"]); if ($work_id) { $data["admin_id"] = $GLOBALS['db']->getOne("select id from " . DB_PREFIX . "admin where work_id = '" . $work_id . "'"); } $module = "INSERT"; $jumpurl = url("debit", "debit_uc_center#order"); $condition = ""; $deal_id = $GLOBALS['db']->getOne("SELECT id FROM " . DB_PREFIX . "deal WHERE ((is_delete=2 or is_delete=3) or (is_delete=0 and publish_wait=1)) AND user_id=" . $GLOBALS['user_info']['id']); if ($deal_id > 0) { $module = "UPDATE"; if ($t == "save") { $jumpurl = url("debit", "debit_uc_center#order"); } $condition = "id = {$deal_id}"; } else { if ($t == "save") { $jumpurl = url("debit", "debit_uc_center#order"); } } $GLOBALS['db']->autoExecute(DB_PREFIX . "deal", $data, $module, $condition); if ($module == "INSERT") { $deal_id = $GLOBALS['db']->insert_id(); } require_once APP_ROOT_PATH . 'app/Lib/deal.php'; $deal = get_deal($deal_id); //发送验证通知 if ($t != "save" && trim(app_conf('CUSTOM_SERVICE')) != '' && ($GLOBALS['user_info']['idcardpassed'] == 0 || $GLOBALS['user_info']['incomepassed'] == 0 || $GLOBALS['user_info']['creditpassed'] == 0 || $GLOBALS['user_info']['workpassed'] == 0)) { $ulist = explode(",", trim(app_conf('CUSTOM_SERVICE'))); $ulist = array_filter($ulist); if ($ulist) { $uuid = $ulist[array_rand($ulist)]; if ($uuid > 0) { $content = app_conf("SHOP_TITLE") . "用户您好,请尽快上传必要信用认证材料(包括身份证认证、工作认证、收入认证、信用报告认证)。另外,多上传一些可选信用认证,有助于您提高借款额度,也有利于出借人更多的了解您的情况,以便让您更快的筹集到所需的资金。请您点击'我要贷款',之后点击相应的审核项目,进入后,可先阅读该项信用认证所需材料及要求,然后按要求上传资料即可。 如果您有任何问题请您拨打客服电话 " . app_conf('SHOP_TEL') . " 或给客服邮箱发邮件 " . app_conf("REPLY_ADDRESS") . " 我们会及时给您回复。"; require_once APP_ROOT_PATH . 'app/Lib/message.php'; //添加留言 $message['title'] = $content; $message['content'] = htmlspecialchars(addslashes(valid_str($content))); $message['title'] = valid_str($message['title']); $message['create_time'] = TIME_UTC; $message['rel_table'] = "deal"; $message['rel_id'] = $deal_id; $message['user_id'] = $uuid; $message['is_effect'] = 1; $GLOBALS['db']->autoExecute(DB_PREFIX . "message", $message); //添加到动态 insert_topic("message", $message['rel_id'], $message['user_id'], get_user_name($message['user_id'], false), $GLOBALS['user_info']['id']); //自己给自己留言不执行操作 if ($deal['user_id'] != $message['user_id']) { $msg_conf = get_user_msg_conf($deal['user_id']); //站内信 if ($msg_conf['sms_asked'] == 1) { $notices['shop_title'] = app_conf("SHOP_TITLE"); $notices['shop_tel'] = app_conf('SHOP_TEL'); $notices['shop_address'] = app_conf("REPLY_ADDRESS"); /*{$notice.shop_title}用户您好,请尽快上传必要信用认证材料(包括身份证认证、工作认证、收入认证、信用报告认证)。另外,多上传一些可选信用认证,有助于您提高借款额度,也有利于出借人更多的了解您的情况,以便让您更快的筹集到所需的资金。请您点击'我要贷款',之后点击相应的审核项目,进入后,可先阅读该项信用认证所需材料及要求,然后按要求上传资料即可。 如果您有任何问题请您拨打客服电话{$notice.shop_tel}或给客服邮箱发邮件{$notice.shop_address}我们会及时给您回复。*/ $notices['url'] = "“<a href=\"" . $deal_info['url'] . "\">" . $deal_info['name'] . "</a>”"; $notices['user_name'] = get_user_name($message['user_id']); $notices['money'] = $user_load_data['true_repay_money'] + $user_load_data['impose_money']; $tmpl_content = $GLOBALS['db']->getRow("select * from " . DB_PREFIX . "msg_template where name = 'TPL_WORDS_MSG'", false); $GLOBALS['tmpl']->assign("notice", $notices); $contents = $GLOBALS['tmpl']->fetch("str:" . $tmpl_content['content']); send_user_msg("", $contents, 0, $deal['user_id'], TIME_UTC, 0, true, 13, $message['rel_id']); } //邮件 if ($msg_conf['mail_asked'] == 1 && app_conf('MAIL_ON') == 1) { $tmpl = $GLOBALS['db']->getRow("select * from " . DB_PREFIX . "msg_template where name = 'TPL_MAIL_DEAL_MSG'"); $tmpl_content = $tmpl['content']; $notice['user_name'] = $GLOBALS['user_info']['user_name']; $notice['msg_user_name'] = get_user_name($message['user_id'], false); $notice['deal_name'] = $deal['name']; $notice['deal_url'] = SITE_DOMAIN . url("index", "deal", array("id" => $deal['id'])); $notice['message'] = $message['content']; $notice['site_name'] = app_conf("SHOP_TITLE"); $notice['site_url'] = SITE_DOMAIN . APP_ROOT; $notice['help_url'] = SITE_DOMAIN . url("index", "helpcenter"); $GLOBALS['tmpl']->assign("notice", $notice); $msg = $GLOBALS['tmpl']->fetch("str:" . $tmpl_content); $msg_data['dest'] = $GLOBALS['user_info']['email']; $msg_data['send_type'] = 1; $msg_data['title'] = get_user_name($message['user_id'], false) . "给您的标留言!"; $msg_data['content'] = addslashes($msg); $msg_data['send_time'] = 0; $msg_data['is_send'] = 0; $msg_data['create_time'] = TIME_UTC; $msg_data['user_id'] = $GLOBALS['user_info']['id']; $msg_data['is_html'] = $tmpl['is_html']; $GLOBALS['db']->autoExecute(DB_PREFIX . "deal_msg_list", $msg_data); //插入 } } } } } if ($is_ajax == 1) { showSuccess("提交成功,请等待管理员审核", $is_ajax, $jumpurl); } else { app_redirect($jumpurl); } }
/** * 快捷发布保存 */ public function publish_save() { global_run(); $ajax = intval($_REQUEST['ajax']); if (check_save_login() == LOGIN_STATUS_NOLOGIN) { 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); } $forum_title = strim(valid_str($_REQUEST['forum_title'])); $group_id = intval($_REQUEST['group_id']); $syn_weibo = intval($_REQUEST['syn_weibo']); if ($group_id > 0) { if ($forum_title == '') { showErr("请输出发表的主题", $ajax); } $user_id = intval($GLOBALS['user_info']['id']); $group_info = $GLOBALS['db']->getRow("select * from " . DB_PREFIX . "topic_group where id = " . $group_id); if ($group_info['user_id'] != $user_id) { if ($GLOBALS['db']->getOne("select count(*) from " . DB_PREFIX . "user_topic_group where group_id=" . $group_id . " and user_id = " . $user_id) == 0) { //不是会员自动加入小组 $ins_user_topic = array('group_id' => $group_id, 'user_id' => $user_id, 'create_time' => NOW_TIME, 'type' => 0); $GLOBALS['db']->autoExecute(DB_PREFIX . "user_topic_group", $ins_user_topic); $id = $GLOBALS['db']->insert_id(); if ($id) { $GLOBALS['db']->query("update " . DB_PREFIX . "topic_group set user_count = user_count + 1 where id=" . $group_id); } } } } $title = strim(valid_str($_REQUEST['title'])); $content = strim(valid_str($_REQUEST['content'])); $group = strim($_REQUEST['group']); $group_data = strim($_REQUEST['group_data']); $type = strim($_REQUEST['type']); $tags_data = $_REQUEST['tags']; $tags = array(); if ($tags_data) { $tag_row_arr = explode(" ", $tags_data); foreach ($tag_row_arr as $tag_item) { $tag_item = strim($tag_item); if (!in_array($tag_item, $tags)) { $tags[] = strim($tag_item); } } } elseif ($forum_title) { $tags = div_str($forum_title); if (count($tags) > 5) { $tags = array_slice($tags, 0, 4); } } $ungroup_date = unserialize(base64_decode($group_data)); $url_route = array('rel_app_index' => $ungroup_date['url']['app_index'], 'rel_route' => $ungroup_date['url']['route'], 'rel_param' => ''); $attach_list = get_topic_attach_list(); require_once APP_ROOT_PATH . '/system/model/topic.php'; $id = insert_topic($content, $title, $type, $group, $relay_id = 0, $fav_id = 0, $group_data, $attach_list, $url_route, $tags, '', '', $forum_title, $group_id, $syn_weibo); if ($id) { $GLOBALS['db']->query("update " . DB_PREFIX . "topic set source_name = '网站' where id = " . intval($id)); increase_user_active(intval($GLOBALS['user_info']['id']), "发表了一则分享"); } if ($ajax == 1) { $result['info'] = $GLOBALS['lang']['MESSAGE_POST_SUCCESS']; $result['data'] = intval($id); $result['status'] = 1; ajax_return($result); } else { if ($group_id > 0) { $url = url("index", "group#forum", array("id" => $group_id)); } showSuccess($GLOBALS['lang']['MESSAGE_POST_SUCCESS'], $ajax, $url); } }
public function do_submit() { global_run(); if (empty($GLOBALS['user_info'])) { $data['status'] = 1000; ajax_return($data); } $event_id = intval($_REQUEST['event_id']); require_once APP_ROOT_PATH . "system/model/event.php"; $event = get_event($event_id); if (!$event) { $data['status'] = 0; $data['info'] = "活动不存在"; ajax_return($data); } if ($event['submit_begin_time'] > NOW_TIME) { $data['status'] = 0; $data['info'] = "活动报名未开始"; ajax_return($data); } if ($event['submit_end_time'] > 0 && $event['submit_end_time'] < NOW_TIME) { $data['status'] = 0; $data['info'] = "活动报名已结束"; ajax_return($data); } if ($event['submit_count'] >= $event['total_count'] && $event['total_count'] > 0) { $data['status'] = 0; $data['info'] = "活动名额已满"; ajax_return($data); } $user_id = intval($GLOBALS['user_info']['id']); $user_submit = $GLOBALS['db']->getRow("select * from " . DB_PREFIX . "event_submit where user_id = " . $user_id . " and event_id = " . $event_id); if ($user_submit) { if ($user_submit['is_verify'] == 1) { $data['status'] = 0; $data['info'] = "您已经报名"; ajax_return($data); } elseif ($user_submit['is_verify'] == 2) { $data['status'] = 0; $data['info'] = "您的报名审核不通过"; ajax_return($data); } else { //已经报名,仅作修改 $GLOBALS['db']->query("delete from " . DB_PREFIX . "event_submit_field where submit_id = " . $user_submit['id']); $field_ids = $_REQUEST['field_id']; foreach ($field_ids as $field_id) { $current_result = strim($_REQUEST['result'][$field_id]); $field_data = array(); $field_data['submit_id'] = $user_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'] = 1; $result['info'] = "报名修改成功"; ajax_return($result); } } else { $GLOBALS['db']->query("update " . DB_PREFIX . "event set submit_count = submit_count+1 where id=" . $event_id . " and submit_count + 1 <= total_count and total_count > 0"); if (!$GLOBALS['db']->affected_rows()) { $data['status'] = 0; $data['info'] = "活动名额已满"; ajax_return($data); } if ($event['score_limit'] > 0 || $event['point_limit'] > 0) { $c_user_info = $GLOBALS['user_info']; if ($c_user_info['score'] < $event['score_limit']) { $data['status'] = 0; $data['info'] = "积分不足,不能报名"; ajax_return($data); } if ($c_user_info['point'] < $event['point_limit']) { $data['status'] = 0; $data['info'] = "经验不足,不能报名"; ajax_return($data); } } $submit_data = array(); $submit_data['user_id'] = $user_id; $submit_data['event_id'] = $event_id; $submit_data['create_time'] = NOW_TIME; $submit_data['event_begin_time'] = $event['event_begin_time']; $submit_data['event_end_time'] = $event['event_end_time']; $submit_data['return_money'] = $event['return_money']; $submit_data['return_score'] = $event['return_score']; $submit_data['return_point'] = $event['return_point']; $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 = strim($_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"); } 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' => '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 = '网站' where id = " . intval($tid)); } require_once APP_ROOT_PATH . "system/model/user.php"; modify_account(array("score" => "-" . $event['score_limit']), $user_id, "活动报名:" . $event['name']); $data['status'] = 1; $data['info'] = "报名成功"; if ($sn) { $data['info'] .= ",验证码:" . $sn; } rm_auto_cache("event", array("id" => $event['id'])); ajax_return($data); } else { $data['status'] = 0; $data['info'] = "报名失败"; ajax_return($data); } } }
public function msg_reply() { $ajax = 1; $user_info = $GLOBALS['user_info']; if (!$user_info) { showErr($GLOBALS['lang']['PLEASE_LOGIN_FIRST'], $ajax); } if ($_REQUEST['content'] == '') { showErr($GLOBALS['lang']['MESSAGE_CONTENT_EMPTY'], $ajax); } if (!check_ipop_limit(CLIENT_IP, "message", intval(app_conf("SUBMIT_DELAY")), 0)) { showErr($GLOBALS['lang']['MESSAGE_SUBMIT_FAST'], $ajax); } $rel_table = strim($_REQUEST['rel_table']); $message_type = $GLOBALS['db']->getRow("select * from " . DB_PREFIX . "message_type where type_name='" . $rel_table . "'"); if (!$message_type) { showErr($GLOBALS['lang']['INVALID_MESSAGE_TYPE'], $ajax); } //添加留言 $message['title'] = $_REQUEST['title'] ? strim($_REQUEST['title']) : btrim(valid_str($_REQUEST['content'])); $message['content'] = btrim(valid_str($_REQUEST['content'])); $message['title'] = valid_str($message['title']); $message['create_time'] = TIME_UTC; $message['rel_table'] = $rel_table; $message['rel_id'] = intval($_REQUEST['rel_id']); $message['user_id'] = intval($GLOBALS['user_info']['id']); $message['pid'] = intval($_REQUEST['pid']); if (app_conf("USER_MESSAGE_AUTO_EFFECT") == 0) { $message_effect = 0; } else { $message_effect = $message_type['is_effect']; } $message['is_effect'] = $message_effect; $GLOBALS['db']->autoExecute(DB_PREFIX . "message", $message); if ($rel_table == "deal") { $l_user_id = $GLOBALS['db']->getOne("SELECT user_id FROM " . DB_PREFIX . "deal WHERE id=" . $message['rel_id']); } else { $l_user_id = $GLOBALS['db']->getOne("SELECT user_id FROM " . DB_PREFIX . "deal_load_transfer WHERE id=" . $message['rel_id']); } //添加到动态 insert_topic($rel_table . "_message_reply", $message['rel_id'], $message['user_id'], $GLOBALS['user_info']['user_name'], $l_user_id); if ($rel_table == "deal") { require_once APP_ROOT_PATH . 'app/Lib/deal.php'; $deal = get_deal($message['rel_id']); $msg_u_id = $GLOBALS['db']->getOne("SELECT user_id FROM " . DB_PREFIX . "message WHERE id=" . $message['pid']); if ($message['user_id'] != $msg_u_id) { $msg_conf = get_user_msg_conf($deal['user_id']); //站内信 if ($msg_conf['sms_answer'] == 1) { $notices['user_name'] = get_user_name($message['user_id']); $notices['url'] = "“<a href=\"" . $deal['url'] . "\">" . $deal['name'] . "</a>”"; $notices['msg'] = "“" . $message['content'] . "”"; $tmpl_contents = $GLOBALS['db']->getRow("select * from " . DB_PREFIX . "msg_template where name = 'TPL_REPLY_MSG'", false); $GLOBALS['tmpl']->assign("notice", $notices); $content = $GLOBALS['tmpl']->fetch("str:" . $tmpl_contents['content']); send_user_msg("", $content, 0, $msg_u_id, TIME_UTC, 0, true, 14, $message['rel_id']); } //邮件 if ($msg_conf['mail_answer'] == 1 && app_conf('MAIL_ON') == 1) { $user_info = $GLOBALS['db']->getRow("select * from " . DB_PREFIX . "user where id = " . $msg_u_id); $tmpl = $GLOBALS['db']->getRow("select * from " . DB_PREFIX . "msg_template where name = 'TPL_MAIL_DEAL_REPLY_MSG'", false); $tmpl_content = $tmpl['content']; $notice['user_name'] = $user_info['user_name']; $notice['msg_user_name'] = get_user_name($message['user_id'], false); $notice['deal_name'] = $deal['name']; $notice['deal_url'] = SITE_DOMAIN . url("index", "deal", array("id" => $deal['id'])); $notice['message'] = $message['content']; $notice['site_name'] = app_conf("SHOP_TITLE"); $notice['site_url'] = SITE_DOMAIN . APP_ROOT; $notice['help_url'] = SITE_DOMAIN . url("index", "helpcenter"); $GLOBALS['tmpl']->assign("notice", $notice); $msg = $GLOBALS['tmpl']->fetch("str:" . $tmpl_content); $msg_data['dest'] = $user_info['email']; $msg_data['send_type'] = 1; $msg_data['title'] = "用户" . get_user_name($message['user_id'], false) . "回复了你的留言!"; $msg_data['content'] = addslashes($msg); $msg_data['send_time'] = 0; $msg_data['is_send'] = 0; $msg_data['create_time'] = TIME_UTC; $msg_data['user_id'] = $user_info['id']; $msg_data['is_html'] = $tmpl['is_html']; $GLOBALS['db']->autoExecute(DB_PREFIX . "deal_msg_list", $msg_data); //插入 } } } showSuccess($GLOBALS['lang']['REPLY_POST_SUCCESS'], $ajax); }
public function index() { require_once APP_ROOT_PATH . "system/libs/user.php"; $email = strim($GLOBALS['request']['email']); $pwd = strim($GLOBALS['request']['pwd']); $id = intval($GLOBALS['request']['share_id']); $result = do_login_user($email, $pwd); $GLOBALS['user_info'] = $user_data = es_session::get('user_info'); $user_data['id'] = intval($user_data['id']); $act2 = strim($GLOBALS['request']['act_2']); $source = strim($GLOBALS['request']['source']); $source = str_replace("来自", "", $source); $topic = $GLOBALS['db']->getRow("select * from " . DB_PREFIX . "topic where id = " . $id); if ($topic) { switch ($act2) { case 'follow': //开始关注 $user_id = intval($user_data['id']); $focus_uid = intval($topic['user_id']); if ($user_id != $focus_uid) { $focus_data = $GLOBALS['db']->getRow("select * from " . DB_PREFIX . "user_focus where focus_user_id = " . $user_id . " and focused_user_id = " . $focus_uid); if (!$focus_data && $user_id > 0 && $focus_uid > 0) { $focused_user_name = $GLOBALS['db']->getOne("select user_name from " . DB_PREFIX . "user where id = " . $focus_uid); $focus_data = array(); $focus_data['focus_user_id'] = $user_id; $focus_data['focused_user_id'] = $focus_uid; $focus_data['focus_user_name'] = $GLOBALS['user_info']['user_name']; $focus_data['focused_user_name'] = $focused_user_name; $GLOBALS['db']->autoExecute(DB_PREFIX . "user_focus", $focus_data, "INSERT"); $GLOBALS['db']->query("update " . DB_PREFIX . "user set focus_count = focus_count + 1 where id = " . $user_id); $GLOBALS['db']->query("update " . DB_PREFIX . "user set focused_count = focused_count + 1 where id = " . $focus_uid); } elseif ($focus_data && $user_id > 0 && $focus_uid > 0) { $GLOBALS['db']->query("delete from " . DB_PREFIX . "user_focus where focus_user_id = " . $user_id . " and focused_user_id = " . $focus_uid); $GLOBALS['db']->query("update " . DB_PREFIX . "user set focus_count = focus_count - 1 where id = " . $user_id); $GLOBALS['db']->query("update " . DB_PREFIX . "user set focused_count = focused_count - 1 where id = " . $focus_uid); } } //开始关注 break; case 'collect': //开始喜欢 if ($topic['user_id'] != intval($user_data['id'])) { $fav_topic = $GLOBALS['db']->getRow("select * from " . DB_PREFIX . "topic where fav_id = " . $id . " and user_id = " . intval($user_data['id'])); if ($fav_topic) { $GLOBALS['db']->query("delete from " . DB_PREFIX . "topic where id = " . $fav_topic['id']); $GLOBALS['db']->query("update " . DB_PREFIX . "topic set fav_count = fav_count - 1 where id = " . $id); if ($id != $topic['origin_id']) { $GLOBALS['db']->query("update " . DB_PREFIX . "topic set fav_count = fav_count - 1 where id = " . $topic['origin_id']); } $GLOBALS['db']->query("delete from " . DB_PREFIX . "topic_image where topic_id = " . $fav_topic['id']); $topic['fav_count'] -= 1; } else { $tid = insert_topic($cnt = "", $title = "", $type = "", $group = "", $r = 0, $f = $id); if ($tid) { $GLOBALS['db']->query("update " . DB_PREFIX . "topic set source_name = '" . $source . "' where id = " . intval($tid)); } $topic['fav_count'] += 1; } } //end喜欢 break; } $share_item = m_get_topic_item($topic); if ($topic['user_id'] == $user_data['id']) { $share_item['is_follow_user'] = -1; } else { $focus_uid = intval($topic['user_id']); $focus_data = $GLOBALS['db']->getRow("select * from " . DB_PREFIX . "user_focus where focus_user_id = " . $user_data['id'] . " and focused_user_id = " . $focus_uid); if ($focus_data) { $share_item['is_follow_user'] = 1; } else { $share_item['is_follow_user'] = 0; } $share_item['is_collect_share'] = $GLOBALS['db']->getOne("select count(id) from " . DB_PREFIX . "topic where fav_id = " . $topic['id'] . " and user_id = " . $user_data['id']); } $share_item['comments'] = m_get_topic_reply($topic['id'], 1); $share_item['collects'] = m_get_topic_fav($topic['id']); $share_item['imgs'] = m_get_topic_img($topic); $root = array(); $root['return'] = 1; $root['item'] = $share_item; } else { $root['return'] = 0; } output($root); }
public function add() { $user_info = $GLOBALS['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 (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); } } if (!check_ipop_limit(get_client_ip(), "message", intval(app_conf("SUBMIT_DELAY")), 0)) { showErr($GLOBALS['lang']['MESSAGE_SUBMIT_FAST'], $ajax); } $rel_table = strim($_REQUEST['rel_table']); $message_type = $GLOBALS['db']->getRow("select * from " . DB_PREFIX . "message_type where type_name='" . $rel_table . "'"); if (!$message_type) { showErr($GLOBALS['lang']['INVALID_MESSAGE_TYPE'], $ajax); } //添加留言 $message['title'] = $_REQUEST['title'] ? strim($_REQUEST['title']) : btrim(valid_str($_REQUEST['content'])); $message['content'] = btrim(valid_str($_REQUEST['content'])); $message['title'] = valid_str($message['title']); $message['create_time'] = TIME_UTC; $message['rel_table'] = $rel_table; $message['rel_id'] = intval($_REQUEST['rel_id']); $message['user_id'] = intval($GLOBALS['user_info']['id']); if (app_conf("USER_MESSAGE_AUTO_EFFECT") == 0) { $message_effect = 0; } else { $message_effect = $message_type['is_effect']; } $message['is_effect'] = $message_effect; $GLOBALS['db']->autoExecute(DB_PREFIX . "message", $message); $l_user_id = $GLOBALS['db']->getOne("SELECT user_id FROM " . DB_PREFIX . "deal WHERE id=" . $message['rel_id']); //添加到动态 insert_topic($rel_table . "_message", $message['rel_id'], $message['user_id'], $GLOBALS['user_info']['user_name'], $l_user_id); if ($rel_table == "deal") { require_once APP_ROOT_PATH . 'app/Lib/deal.php'; $deal = get_deal($message['rel_id']); //自己给自己留言不执行操作 if ($deal['user_id'] != $message['user_id']) { $msg_conf = get_user_msg_conf($deal['user_id']); //站内信 if ($msg_conf['sms_asked'] == 1) { $content = "<p>您好,用户 " . get_user_name($message['user_id']) . "对您发布的借款列表 “<a href=\"" . $deal['url'] . "\">" . $deal['name'] . "</a>”进行了以下留言:</p>"; $content .= "<p>“" . $message['content'] . "”</p>"; send_user_msg("", $content, 0, $deal['user_id'], TIME_UTC, 0, true, 13, $message['rel_id']); } //邮件 if ($msg_conf['mail_asked'] == 1 && app_conf('MAIL_ON') == 1) { $user_info = $GLOBALS['db']->getRow("select * from " . DB_PREFIX . "user where id = " . $deal['user_id']); $tmpl = $GLOBALS['db']->getRowCached("select * from " . DB_PREFIX . "msg_template where name = 'TPL_MAIL_DEAL_MSG'"); $tmpl_content = $tmpl['content']; $notice['user_name'] = $user_info['user_name']; $notice['msg_user_name'] = get_user_name($message['user_id'], false); $notice['deal_name'] = $deal['name']; $notice['deal_url'] = SITE_DOMAIN . url("index", "deal", array("id" => $deal['id'])); $notice['message'] = $message['content']; $notice['site_name'] = app_conf("SHOP_TITLE"); $notice['site_url'] = SITE_DOMAIN . APP_ROOT; $notice['help_url'] = SITE_DOMAIN . url("index", "helpcenter"); $GLOBALS['tmpl']->assign("notice", $notice); $msg = $GLOBALS['tmpl']->fetch("str:" . $tmpl_content); $msg_data['dest'] = $user_info['email']; $msg_data['send_type'] = 1; $msg_data['title'] = get_user_name($message['user_id'], false) . "给您的标留言!"; $msg_data['content'] = addslashes($msg); $msg_data['send_time'] = 0; $msg_data['is_send'] = 0; $msg_data['create_time'] = TIME_UTC; $msg_data['user_id'] = $user_info['id']; $msg_data['is_html'] = $tmpl['is_html']; $GLOBALS['db']->autoExecute(DB_PREFIX . "deal_msg_list", $msg_data); //插入 } } } showSuccess($GLOBALS['lang']['MESSAGE_POST_SUCCESS'], $ajax); }
public function index() { require_once APP_ROOT_PATH . "system/libs/user.php"; $root = array(); $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['return'] = 0; $root['info'] = "请先登录"; output($root); } if (isset($_FILES['image_1'])) { //开始上传 //上传处理 //创建comment目录 if (!is_dir(APP_ROOT_PATH . "public/comment")) { @mkdir(APP_ROOT_PATH . "public/comment"); @chmod(APP_ROOT_PATH . "public/comment", 0777); } $dir = to_date(get_gmtime(), "Ym"); if (!is_dir(APP_ROOT_PATH . "public/comment/" . $dir)) { @mkdir(APP_ROOT_PATH . "public/comment/" . $dir); @chmod(APP_ROOT_PATH . "public/comment/" . $dir, 0777); } $dir = $dir . "/" . to_date(get_gmtime(), "d"); if (!is_dir(APP_ROOT_PATH . "public/comment/" . $dir)) { @mkdir(APP_ROOT_PATH . "public/comment/" . $dir); @chmod(APP_ROOT_PATH . "public/comment/" . $dir, 0777); } $dir = $dir . "/" . to_date(get_gmtime(), "H"); if (!is_dir(APP_ROOT_PATH . "public/comment/" . $dir)) { @mkdir(APP_ROOT_PATH . "public/comment/" . $dir); @chmod(APP_ROOT_PATH . "public/comment/" . $dir, 0777); } if (app_conf("IS_WATER_MARK") == 1) { $img_result = save_image_upload($_FILES, "image_1", "comment/" . $dir, $whs = array('thumb' => array(100, 100, 1, 0)), 1, 1); } else { $img_result = save_image_upload($_FILES, "image_1", "comment/" . $dir, $whs = array('thumb' => array(100, 100, 1, 0)), 0, 1); } if (app_conf("PUBLIC_DOMAIN_ROOT") != '') { $paths = pathinfo($img_result['topic_image']['url']); $path = str_replace("./", "", $paths['dirname']); $filename = $paths['basename']; $pathwithoupublic = str_replace("public/", "", $path); $syn_url = app_conf("PUBLIC_DOMAIN_ROOT") . "/es_file.php?username="******"IMAGE_USERNAME") . "&password="******"IMAGE_PASSWORD") . "&file=" . get_domain() . APP_ROOT . "/" . $path . "/" . $filename . "&path=" . $pathwithoupublic . "/&name=" . $filename . "&act=0"; @file_get_contents($syn_url); } require_once APP_ROOT_PATH . "system/utils/es_imagecls.php"; $image = new es_imagecls(); $info = $image->getImageInfo($img_result['image_1']['path']); $image_data['width'] = intval($info[0]); $image_data['height'] = intval($info[1]); $image_data['name'] = valid_str($_FILES['image_1']['name']); $image_data['filesize'] = filesize($img_result['image_1']['path']); $image_data['create_time'] = get_gmtime(); $image_data['user_id'] = intval($GLOBALS['user_info']['id']); $image_data['user_name'] = addslashes($GLOBALS['user_info']['user_name']); $image_data['path'] = $img_result['image_1']['thumb']['thumb']['url']; $image_data['o_path'] = $img_result['image_1']['url']; $GLOBALS['db']->autoExecute(DB_PREFIX . "topic_image", $image_data); $image_id = intval($GLOBALS['db']->insert_id()); //end 上传 } if ($image_id > 0) { $attach_list = array(array("id" => $image_id, "type" => "image")); } else { $attach_list = array(); } $id = insert_topic(valid_str($content), $title = "", $type = "", $group = "", $relay_id = 0, $fav_id = 0, $group_data = array(), $attach_list); if ($id) { increase_user_active($user_data['id'], "发表了一则分享"); $GLOBALS['db']->query("update " . DB_PREFIX . "topic set source_name = '" . $source . "' where id = " . intval($id)); } $syn_data['content'] = $content; //$syn_data['img'] = get_abs_img_root($GLOBALS['db']->getOne("select o_path from ".DB_PREFIX."topic_image where id = ".intval($image_id))); $syn_data['img'] = $GLOBALS['db']->getOne("select o_path from " . DB_PREFIX . "topic_image where id = " . intval($image_id)); if ($syn_data['img']) { $syn_data['img'] = APP_ROOT_PATH . $syn_data['img']; } //开始同步 if (intval($GLOBALS['request']['is_syn_sina'])) { //$GLOBALS['db']->query("update ".DB_PREFIX."user set is_syn_sina = 1 where id = ".intval($user_data['id'])); //$func_name = strim($GLOBALS['request']['type'])."_Sina"; //$result_sina = $func_name($syn_data); $result_sina = Sina($syn_data); $ext_info = ""; if (!$result_sina['status']) { if (intval($result_sina['code']) == 21316 || intval($result_sina['code']) == 21317) { $ext_info .= " 请先绑定新浪微博"; } if (intval($result_sina['code']) == 21314 || intval($result_sina['code']) == 21315) { $ext_info .= " 新浪微博授权过期"; } } } if (intval($GLOBALS['request']['is_syn_tencent'])) { //$GLOBALS['db']->query("update ".DB_PREFIX."user set is_syn_tencent = 1 where id = ".intval($user_data['id'])); // $func_name = strim($GLOBALS['request']['type'])."_Tencent"; // $result_tencent = $func_name($syn_data); $result_tencent = Tencent($syn_data); if (!$result_tencent['status']) { if (intval($result_tencent['code']) == 0) { $ext_info .= " 请先绑定腾讯微博"; } if (intval($result_tencent['code']) == 14) { $ext_info .= " 腾讯微博未实名认证"; } if (intval($result_tencent['code']) == 10017 || intval($result_tencent['code']) == 10018 || intval($result_tencent['code']) == 10019 || intval($result_tencent['code']) == 36 || intval($result_tencent['code']) == 37 || intval($result_tencent['code']) == 38) { $ext_info .= " 腾讯微博授权过期"; } } } $root['return'] = 1; $root['status'] = 1; $root['info'] = "发布成功" . $ext_info; output($root); }
function savedeal() { $is_ajax = intval($_REQUEST['is_ajax']); if (!$GLOBALS['user_info']) { showErr($GLOBALS['lang']['PLEASE_LOGIN_FIRST'], $is_ajax); } $t = trim($_REQUEST['t']); if (!in_array($t, array("save", "publish"))) { showErr($GLOBALS['lang']['ERROR_TITLE'], $is_ajax); } if ($t == "save") { $data['is_delete'] = 2; } else { $data['is_delete'] = 0; } $data['name'] = strim($_REQUEST['borrowtitle']); if (empty($data['name'])) { showErr("请输入借款标题", $is_ajax); } $data['publish_wait'] = 1; $icon_type = strim($_REQUEST['imgtype']); if ($icon_type == "") { showErr("请选择借款图片类型", $is_ajax); } $icon_type_arr = array('upload' => 1, 'userImg' => 2, 'systemImg' => 3); $data['icon_type'] = $icon_type_arr[$icon_type]; if (intval($data['icon_type']) == 0) { showErr("请选择借款图片类型", $is_ajax); } switch ($data['icon_type']) { case 1: if (strim($_REQUEST['icon']) == '') { showErr("请上传图片", $is_ajax); } else { $data['icon'] = replace_public(strim($_REQUEST['icon'])); } break; case 2: $data['icon'] = replace_public(get_user_avatar($GLOBALS['user_info']['id'], 'big')); break; case 3: if (intval($_REQUEST['systemimgpath']) == 0) { showErr("请选择系统图片", $is_ajax); } else { $data['icon'] = $GLOBALS['db']->getOne("SELECT icon FROM " . DB_PREFIX . "deal_loan_type WHERE id=" . intval($_REQUEST['systemimgpath'])); } break; } $data['type_id'] = intval($_REQUEST['borrowtype']); if ($data['type_id'] == 0) { showErr("请选择借款用途", $is_ajax); } $data['borrow_amount'] = floatval($_REQUEST['borrowamount']); if ($data['borrow_amount'] < (int) trim(app_conf('MIN_BORROW_QUOTA')) || $data['borrow_amount'] > (int) trim(app_conf('MAX_BORROW_QUOTA')) || $data['borrow_amount'] % 50 != 0) { showErr("请正确输入借款金额", $is_ajax); } //判断是否需要额度 if ($GLOBALS['db']->getOne("SELECT is_quota FROM " . DB_PREFIX . "deal_loan_type WHERE id=" . $data['type_id']) == 1) { if (intval($GLOBALS['user_info']['quota']) != 0) { $can_use_quota = get_can_use_quota($GLOBALS['user_info']['id']); if ($data['borrow_amount'] > intval($can_use_quota)) { showErr("输入借款的借款金额超过您的可用额度<br>您当前可用额度为:" . $can_use_quota, $is_ajax); } } } $data['repay_time'] = intval($_REQUEST['repaytime']); if ($data['repay_time'] == 0) { showErr("借款期限", $is_ajax); } $data['rate'] = floatval($_REQUEST['apr']); $data['repay_time_type'] = intval($_REQUEST['repaytime_type']); $level_list = load_auto_cache("level"); $min_rate = 0; $max_rate = 0; $is_rate_lock = false; foreach ($level_list['repaytime_list'][$GLOBALS['user_info']['level_id']] as $kkk => $vvv) { if ($data['repay_time_type'] == 1) { if ($data['repay_time'] == intval($vvv[0]) && $vvv[1] == $data['repay_time_type']) { $min_rate = $vvv[2]; $max_rate = $vvv[3]; } } else { if ($data['repay_time'] <= intval($vvv[0]) && intval($vvv[1]) == $data['repay_time_type'] && $is_rate_lock == false) { $min_rate = $vvv[2]; $max_rate = $vvv[3]; $is_rate_lock = true; } elseif ($data['repay_time'] > intval($vvv[0]) && intval($vvv[1]) == $data['repay_time_type']) { $min_rate = $vvv[2]; $max_rate = $vvv[3]; } } } if (floatval($data['rate']) <= 0 || floatval($data['rate']) > $max_rate || floatval($data['rate']) < $min_rate) { showErr("请正确输入借款利率", $is_ajax); } $data['enddate'] = intval($_REQUEST['enddate']); $data['description'] = replace_public(btrim($_REQUEST['borrowdesc'])); $data['description'] = valid_tag($data['description']); if (trim($data['description']) == '') { showErr("请输入项目描述", $is_ajax); } $user_view_info = $GLOBALS['user_info']['view_info']; $user_view_info = unserialize($user_view_info); $new_view_info_arr = array(); for ($i = 1; $i <= intval($_REQUEST['file_upload_count']); $i++) { $img_info = array(); $img = replace_public(strim($_REQUEST['file_' . $i])); if ($img != "") { $img_info['name'] = strim($_REQUEST['file_name_' . $i]); $img_info['img'] = $img; $img_info['is_user'] = 1; $user_view_info[] = $img_info; $ss = $user_view_info; end($ss); $key = key($ss); $new_view_info_arr[$key] = $img_info; } } $datas['view_info'] = serialize($user_view_info); $GLOBALS['db']->autoExecute(DB_PREFIX . "user", $datas, "UPDATE", "id=" . $GLOBALS['user_info']['id']); $data['view_info'] = array(); foreach ($_REQUEST['file_key'] as $k => $v) { if (isset($user_view_info[$v])) { $data['view_info'][$v] = $user_view_info[$v]; } } foreach ($new_view_info_arr as $k => $v) { $data['view_info'][$k] = $v; } $data['view_info'] = serialize($data['view_info']); //资金运转 $data['remark_1'] = strim(replace_public($_REQUEST['remark_1'])); $data['remark_1'] = valid_tag($data['remark_1']); //风险控制措施 $data['remark_2'] = strim(replace_public($_REQUEST['remark_2'])); $data['remark_2'] = valid_tag($data['remark_2']); //政策及市场分析 $data['remark_3'] = strim(replace_public($_REQUEST['remark_3'])); $data['remark_3'] = valid_tag($data['remark_3']); //企业背景 $data['remark_4'] = strim(replace_public($_REQUEST['remark_4'])); $data['remark_4'] = valid_tag($data['remark_4']); //企业信息 $data['remark_5'] = strim(replace_public($_REQUEST['remark_5'])); $data['remark_5'] = valid_tag($data['remark_5']); //项目相关资料 $data['remark_6'] = strim(replace_public($_REQUEST['remark_6'])); $data['remark_6'] = valid_tag($data['remark_6']); //$data['voffice'] = intval($_REQUEST['voffice']); //$data['vposition'] = intval($_REQUEST['vposition']); $data['voffice'] = 1; $data['vposition'] = 1; $data['is_effect'] = 1; $data['deal_status'] = 0; $data['agency_id'] = intval($_REQUEST['agency_id']); $data['agency_status'] = 1; $data['warrant'] = intval($_REQUEST['warrant']); $data['guarantor_margin_amt'] = floatval($_REQUEST['guarantor_margin_amt']); $data['guarantor_pro_fit_amt'] = floatval($_REQUEST['guarantor_pro_fit_amt']); $data['user_id'] = intval($GLOBALS['user_info']['id']); $data['loantype'] = intval($_REQUEST['loantype']); if ($data['repay_time_type'] == 0) { $data['loantype'] = 2; } //当为天的时候 if ($data['repay_time_type'] == 0) { $true_repay_time = 1; } else { $true_repay_time = $data['repay_time']; } //本金担保 if ($data['warrant'] == 1) { $data['guarantor_amt'] = $data['borrow_amount']; } elseif ($data['warrant'] == 2) { //等额本息 if ($data['loantype'] == 0) { $data['guarantor_amt'] = pl_it_formula($data['borrow_amount'], $data['rate'] / 12 / 100, $true_repay_time) * $true_repay_time; } elseif ($data['loantype'] == 1) { $data['guarantor_amt'] = av_it_formula($data['borrow_amount'], $data['rate'] / 12 / 100) * $true_repay_time + $data['borrow_amount']; } elseif ($data['loantype'] == 2) { $data['guarantor_amt'] = $data['borrow_amount'] * $data['rate'] / 12 / 100 * $true_repay_time + $data['borrow_amount']; } } $data['create_time'] = TIME_UTC; $module = "INSERT"; $jumpurl = url("index", "borrow#steptwo"); $condition = ""; $deal_id = $GLOBALS['db']->getOne("SELECT id FROM " . DB_PREFIX . "deal WHERE ((is_delete=2 or is_delete=3) or (is_delete=0 and publish_wait=1)) AND user_id=" . $GLOBALS['user_info']['id']); if ($deal_id > 0) { $module = "UPDATE"; if ($t == "save") { $jumpurl = url("index", "borrow#stepone"); } $condition = "id = {$deal_id}"; } else { if ($t == "save") { $jumpurl = url("index", "borrow#stepone"); } } $GLOBALS['db']->autoExecute(DB_PREFIX . "deal", $data, $module, $condition); if ($module == "INSERT") { $deal_id = $GLOBALS['db']->insert_id(); } require_once APP_ROOT_PATH . 'app/Lib/deal.php'; $deal = get_deal($deal_id); //发送验证通知 if ($t != "save" && trim(app_conf('CUSTOM_SERVICE')) != '' && ($GLOBALS['user_info']['idcardpassed'] == 0 || $GLOBALS['user_info']['incomepassed'] == 0 || $GLOBALS['user_info']['creditpassed'] == 0 || $GLOBALS['user_info']['workpassed'] == 0)) { $ulist = explode(",", trim(app_conf('CUSTOM_SERVICE'))); $ulist = array_filter($ulist); if ($ulist) { $uuid = $ulist[array_rand($ulist)]; if ($uuid > 0) { $content = app_conf("SHOP_TITLE") . "用户您好,请尽快上传必要信用认证材料(包括身份证认证、工作认证、收入认证、信用报告认证)。另外,多上传一些可选信用认证,有助于您提高借款额度,也有利于出借人更多的了解您的情况,以便让您更快的筹集到所需的资金。请您点击'我要贷款',之后点击相应的审核项目,进入后,可先阅读该项信用认证所需材料及要求,然后按要求上传资料即可。 如果您有任何问题请您拨打客服电话 " . app_conf('SHOP_TEL') . " 或给客服邮箱发邮件 " . app_conf("REPLY_ADDRESS") . " 我们会及时给您回复。"; require_once APP_ROOT_PATH . 'app/Lib/message.php'; //添加留言 $message['title'] = $content; $message['content'] = htmlspecialchars(addslashes(valid_str($content))); $message['title'] = valid_str($message['title']); $message['create_time'] = TIME_UTC; $message['rel_table'] = "deal"; $message['rel_id'] = $deal_id; $message['user_id'] = $uuid; $message['is_effect'] = 1; $GLOBALS['db']->autoExecute(DB_PREFIX . "message", $message); //添加到动态 insert_topic("message", $message['rel_id'], $message['user_id'], get_user_name($message['user_id'], false), $GLOBALS['user_info']['id']); //自己给自己留言不执行操作 if ($deal['user_id'] != $message['user_id']) { $msg_conf = get_user_msg_conf($deal['user_id']); //站内信 if ($msg_conf['sms_asked'] == 1) { $notices['shop_title'] = app_conf("SHOP_TITLE"); $notices['shop_tel'] = app_conf('SHOP_TEL'); $notices['shop_address'] = app_conf("REPLY_ADDRESS"); /*{$notice.shop_title}用户您好,请尽快上传必要信用认证材料(包括身份证认证、工作认证、收入认证、信用报告认证)。另外,多上传一些可选信用认证,有助于您提高借款额度,也有利于出借人更多的了解您的情况,以便让您更快的筹集到所需的资金。请您点击'我要贷款',之后点击相应的审核项目,进入后,可先阅读该项信用认证所需材料及要求,然后按要求上传资料即可。 如果您有任何问题请您拨打客服电话{$notice.shop_tel}或给客服邮箱发邮件{$notice.shop_address}我们会及时给您回复。*/ $notices['url'] = "“<a href=\"" . $deal_info['url'] . "\">" . $deal_info['name'] . "</a>”"; $notices['user_name'] = get_user_name($message['user_id']); $notices['money'] = $user_load_data['true_repay_money'] + $user_load_data['impose_money']; $tmpl_content = $GLOBALS['db']->getRow("select * from " . DB_PREFIX . "msg_template where name = 'TPL_WORDS_MSG'", false); $GLOBALS['tmpl']->assign("notice", $notices); $contents = $GLOBALS['tmpl']->fetch("str:" . $tmpl_content['content']); send_user_msg("", $contents, 0, $deal['user_id'], TIME_UTC, 0, true, 13, $message['rel_id']); } //邮件 if ($msg_conf['mail_asked'] == 1 && app_conf('MAIL_ON') == 1) { $tmpl = $GLOBALS['db']->getRow("select * from " . DB_PREFIX . "msg_template where name = 'TPL_MAIL_DEAL_MSG'"); $tmpl_content = $tmpl['content']; $notice['user_name'] = $GLOBALS['user_info']['user_name']; $notice['msg_user_name'] = get_user_name($message['user_id'], false); $notice['deal_name'] = $deal['name']; $notice['deal_url'] = SITE_DOMAIN . url("index", "deal", array("id" => $deal['id'])); $notice['message'] = $message['content']; $notice['site_name'] = app_conf("SHOP_TITLE"); $notice['site_url'] = SITE_DOMAIN . APP_ROOT; $notice['help_url'] = SITE_DOMAIN . url("index", "helpcenter"); $GLOBALS['tmpl']->assign("notice", $notice); $msg = $GLOBALS['tmpl']->fetch("str:" . $tmpl_content); $msg_data['dest'] = $GLOBALS['user_info']['email']; $msg_data['send_type'] = 1; $msg_data['title'] = get_user_name($message['user_id'], false) . "给您的标留言!"; $msg_data['content'] = addslashes($msg); $msg_data['send_time'] = 0; $msg_data['is_send'] = 0; $msg_data['create_time'] = TIME_UTC; $msg_data['user_id'] = $GLOBALS['user_info']['id']; $msg_data['is_html'] = $tmpl['is_html']; $GLOBALS['db']->autoExecute(DB_PREFIX . "deal_msg_list", $msg_data); //插入 } } } } } if ($is_ajax == 1) { showSuccess($GLOBALS['lang']['SUCCESS_TITLE'], $is_ajax, $jumpurl); } else { app_redirect($jumpurl); } }
public function index() { require_once APP_ROOT_PATH . "system/libs/user.php"; if (strim($GLOBALS['request']['act_2']) == 'bm') { $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'); //报名 if ($GLOBALS['user_info']) { $event_id = intval($GLOBALS['request']['event_id']); $user_id = intval($GLOBALS['user_info']['id']); $event = $GLOBALS['db']->getRow("select * from " . DB_PREFIX . "event where id = " . $event_id . " and is_effect = 1"); if ($event) { if ($event['xpoint'] == '') { $event['xpoint'] = 0; } if ($event['ypoint'] == '') { $event['ypoint'] = 0; } if ($event['submit_begin_time'] > get_gmtime()) { $root['return'] = 0; $root['info'] = "活动未开始"; } elseif ($event['submit_end_time'] < get_gmtime() && $event['submit_end_time'] != 0) { $root['return'] = 0; $root['info'] = "活动报名已结束"; } else { //开始提交报名 $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) { $root['return'] = 0; $root['info'] = "您已经报过名了"; } 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) { $bm = $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); //同步分享 $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)); } $root['return'] = 1; $root['info'] = "报名成功"; } else { $root['return'] = 0; $root['info'] = "报名失败"; } } } } else { $root['return'] = 0; $root['info'] = "没有该活动数据"; } } else { $root['return'] = 0; $root['info'] = "请先登录"; } output($root); //报名 } $page = intval($GLOBALS['request']['page']); if ($page == 0) { $page = 1; } $event_id = intval($GLOBALS['request']['event_id']); if ($page == 1) { $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'); $event = $GLOBALS['db']->getRow("select * from " . DB_PREFIX . "event where id = " . $event_id . " and is_effect = 1"); if ($event['xpoint'] == '') { $event['xpoint'] = 0; } if ($event['ypoint'] == '') { $event['ypoint'] = 0; } //验证是否报名 $is_submit = $GLOBALS['db']->getOne("select count(*) from " . DB_PREFIX . "event_submit where user_id = " . intval($GLOBALS['user_info']['id']) . " and event_id = " . $event['id']); $pattern = "/<img([^>]*)\\/>/i"; $replacement = "<img width=300 \$1 />"; $event['content'] = preg_replace($pattern, $replacement, get_abs_img_root($event['content'])); $event_fields = $GLOBALS['db']->getAll("select * from " . DB_PREFIX . "event_field where event_id = " . $event_id . " order by sort asc"); foreach ($event_fields as $k => $v) { $event_fields[$k]['value_scope'] = explode(" ", $v['value_scope']); } $event['field_list'] = $event_fields; $event['is_submit'] = $is_submit; } $res = m_get_event_reply($event_id, $page); $event['comments'] = $res['list']; $root['page'] = $res['page']; $root['return'] = 1; $root['item'] = $event; output($root); }