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 reply() { $ajax = 1; global_run(); if (!$GLOBALS['user_info']) { $result['status'] = -1000; $result['info'] = "未登录"; ajax_return($result); } if ($_REQUEST['content'] == '') { showErr($GLOBALS['lang']['MESSAGE_CONTENT_EMPTY'], $ajax); } /*验证每天只允许评论5次*/ $day_send_count = $GLOBALS['db']->getOne("select count(*) from " . DB_PREFIX . "topic_reply where create_time>" . to_timespan(to_date(NOW_TIME, "Y-m-d"), "Y-m-d") . " and create_time<" . NOW_TIME); if ($day_send_count >= 8) { showErr('今天你已经发很多了哦~', $ajax); } if (!check_ipop_limit(get_client_ip(), "message", intval(app_conf("SUBMIT_DELAY")), 0)) { showErr($GLOBALS['lang']['MESSAGE_SUBMIT_FAST'], $ajax); } $topic_info = $GLOBALS['db']->getRow("select * from " . DB_PREFIX . "topic where id = " . intval($_REQUEST['topic_id'])); if (!$topic_info) { showErr("主题不存在", $ajax); } $reply_data = array(); $reply_data['topic_id'] = intval($_REQUEST['topic_id']); $reply_data['user_id'] = intval($GLOBALS['user_info']['id']); $reply_data['user_name'] = $GLOBALS['user_info']['user_name']; $reply_data['reply_id'] = intval($_REQUEST['reply_id']); $reply_data['create_time'] = NOW_TIME; $reply_data['is_effect'] = 1; $reply_data['is_delete'] = 0; $reply_data['content'] = strim(valid_str(addslashes($_REQUEST['content']))); require_once APP_ROOT_PATH . 'system/model/topic.php'; $reply_id = insert_topic_reply($reply_data); //返回页面的数据 $reply_data['reply_id'] = $reply_id; $reply_data['create_time'] = to_date(NOW_TIME, "Y-m-d H:i"); $reply_data['avatar'] = show_avatar($reply_data['user_id'], "small"); $reply_data['user_url'] = url("index", "uc_home#index", array("id" => $reply_data['user_id'])); $reply_data['status'] = 1; ajax_return($reply_data); }
} if (intval($img_result['error']) != 0) { ajax_return($img_result); } else { 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=" . SITE_DOMAIN . APP_ROOT . "/" . $path . "/" . $filename . "&path=" . $pathwithoupublic . "/&name=" . $filename . "&act=0"; @file_get_contents($syn_url); } } $data['error'] = 0; $data['message'] = $img_result['topic_image']['thumb']['thumb']['url']; $data['name'] = valid_str($_FILES['topic_image']['name']); require_once APP_ROOT_PATH . "system/utils/es_imagecls.php"; $image = new es_imagecls(); $info = $image->getImageInfo($img_result['topic_image']['path']); $image_data['width'] = intval($info[0]); $image_data['height'] = intval($info[1]); $image_data['name'] = valid_str($_FILES['topic_image']['name']); $image_data['filesize'] = filesize($img_result['topic_image']['path']); $image_data['create_time'] = TIME_UTC; $image_data['user_id'] = intval($GLOBALS['user_info']['id']); $image_data['user_name'] = addslashes($GLOBALS['user_info']['user_name']); $image_data['path'] = $img_result['topic_image']['thumb']['thumb']['url']; $image_data['o_path'] = $img_result['topic_image']['url']; $GLOBALS['db']->autoExecute(DB_PREFIX . "topic_image", $image_data); $data['id'] = intval($GLOBALS['db']->insert_id()); ajax_return($data);
public function do_relay_topic() { if (intval($GLOBALS['user_info']['id']) == 0) { $result['status'] = 0; $result['info'] = $GLOBALS['lang']['PLEASE_LOGIN_FIRST']; } else { $result['status'] = 1; $content = addslashes(htmlspecialchars(trim(valid_str($_REQUEST['content'])))); $id = intval($_REQUEST['id']); $tid = insert_topic($content, $title = "", $type = "", $group = "", $id, $fav_id = 0); if ($tid) { increase_user_active(intval($GLOBALS['user_info']['id']), "转发了一则分享"); $GLOBALS['db']->query("update " . DB_PREFIX . "topic set source_name = '网站' where id = " . intval($tid)); } $result['info'] = $GLOBALS['lang']['RELAY_SUCCESS']; } 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); } } 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); }
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 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); }
function preview() { $deal['id'] = 'XXX'; $deal_loan_type_list = load_auto_cache("deal_loan_type_list"); if (intval($_REQUEST['quota']) == 1) { $deal = $GLOBALS['db']->getRow("SELECT * FROM " . DB_PREFIX . "deal_quota_submit WHERE status=1 and user_id = " . $GLOBALS['user_info']['id'] . " ORDER BY id DESC"); $type_id = intval($deal['type_id']); $deal['rate_foramt'] = number_format($deal['rate'], 2); $data['view_info'] = unserialize($deal['view_info']); if ($deal['cate_id'] > 0) { $deal['cate_info'] = $GLOBALS['db']->getRowCached("select id,name,brief,uname,icon from " . DB_PREFIX . "deal_cate where id = " . $deal['cate_id'] . " and is_effect = 1 and is_delete = 0"); } $deal['repay_time'] = strim($_REQUEST['repay_time']); $deal['repay_time_type'] = 1; } else { $deal['name'] = strim($_REQUEST['borrowtitle']); $type_id = intval($_REQUEST['borrowtype']); $deal['repay_time_type'] = intval($_REQUEST['repaytime_type']); $deal['rate_foramt'] = number_format(strim($_REQUEST['apr']), 2); $deal['repay_time'] = strim($_REQUEST['repaytime']); $icon_type = strim($_REQUEST['imgtype']); $icon_type_arr = array('upload' => 1, 'userImg' => 2, 'systemImg' => 3); $data['icon_type'] = $icon_type_arr[$icon_type]; switch ($data['icon_type']) { case 1: $deal['icon'] = replace_public(strim($_REQUEST['icon'])); break; case 2: $deal['icon'] = replace_public(get_user_avatar($GLOBALS['user_info']['id'], 'big')); break; case 3: $deal['icon'] = $GLOBALS['db']->getOneCached("SELECT icon FROM " . DB_PREFIX . "deal_loan_type WHERE id=" . intval($_REQUEST['systemimgpath'])); } $deal['description'] = replace_public(valid_str(bstrim($_REQUEST['borrowdesc']))); $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; } } $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; } if ($deal['cate_id'] > 0) { $deal['cate_info']['name'] = "借款预览标"; } } $deal['borrow_amount'] = strim($_REQUEST['borrowamount']); $deal['borrow_amount_format'] = format_price($deal['borrow_amount'] / 10000) . "万"; $GLOBALS['tmpl']->assign('view_info_list', $data['view_info']); unset($data['view_info']); foreach ($deal_loan_type_list as $k => $v) { if ($v['id'] == $type_id) { $deal['type_info'] = $v; } } $deal['min_loan_money'] = 50; $deal['need_money'] = $deal['borrow_amount_format']; //本息还款金额 $deal['month_repay_money'] = format_price(pl_it_formula($deal['borrow_amount'], strim($deal['rate']) / 12 / 100, $deal['repay_time'])); if ($deal['agency_id'] > 0) { $deal['agency_info'] = $GLOBALS['db']->getRowCached("select * from " . DB_PREFIX . "deal_agency where id = " . $deal['agency_id'] . " and is_effect = 1"); } $deal['progress_point'] = 0; $deal['buy_count'] = 0; $deal['voffice'] = 1; $deal['vjobtype'] = 1; $deal['is_delete'] = 2; $u_info = get_user("*", $GLOBALS['user_info']['id']); $GLOBALS['tmpl']->assign("u_info", $u_info); $can_use_quota = get_can_use_quota($GLOBALS['user_info']['id']); $GLOBALS['tmpl']->assign('can_use_quota', $can_use_quota); $credit_file = get_user_credit_file($GLOBALS['user_info']['id'], $u_info); $GLOBALS['tmpl']->assign("credit_file", $credit_file); $user_statics = sys_user_status($GLOBALS['user_info']['id'], true); $GLOBALS['tmpl']->assign("user_statics", $user_statics); $seo_title = $deal['seo_title'] != '' ? $deal['seo_title'] : $deal['type_match_row'] . " - " . $deal['name']; $GLOBALS['tmpl']->assign("page_title", $seo_title); $seo_keyword = $deal['seo_keyword'] != '' ? $deal['seo_keyword'] : $deal['type_match_row'] . "," . $deal['name']; $GLOBALS['tmpl']->assign("page_keyword", $seo_keyword . ","); $seo_description = $deal['seo_description'] != '' ? $deal['seo_description'] : $deal['name']; $GLOBALS['tmpl']->assign("seo_description", $seo_description . ","); $GLOBALS['tmpl']->assign("deal", $deal); $GLOBALS['tmpl']->display("page/deal.html"); }
public function reply() { $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; } } $content = htmlspecialchars(addslashes(valid_str($_REQUEST['content']))); $uid = intval($GLOBALS["user_info"]['id']); $pid = intval($_REQUEST['pid']); $dp_id = intval($_REQUEST['dp_id']); $page = intval($_REQUEST['page']); if (!check_ipop_limit(get_client_ip(), "dpsign", 10, $dp_id)) { $return['message'] = '请勿频繁回应'; ajax_return($return); exit; } es_session::delete("verify"); $dp_info = $GLOBALS['db']->getRow("select * from " . DB_PREFIX . "supplier_location_dp where id = " . $dp_id); $merchant_info = $GLOBALS['db']->getRow("select name,id from " . DB_PREFIX . "supplier_location where id = " . $dp_info['supplier_location_id']); $reply_data = array(); $reply_data['dp_id'] = $dp_id; $reply_data['content'] = $content; $reply_data['user_id'] = $uid; $reply_data['parent_id'] = $pid; $reply_data['create_time'] = get_gmtime(); $GLOBALS['db']->autoExecute(DB_PREFIX . "supplier_location_dp_reply", $reply_data, "INSERT"); $rid = $GLOBALS['db']->insert_id(); if ($rid > 0) { $syn_reply = intval($_REQUEST['syn_reply']); if ($syn_reply == 1) { $s_account_info = es_session::get("account_info"); if (in_array($dp_info['supplier_location_id'], $s_account_info['location_ids']) && $dp_info['from_data'] != "") { //验证通过 $message_info = $GLOBALS['db']->getRow("select * from " . DB_PREFIX . "message where id = " . intval($dp_info['message_id'])); if ($message_info) { $message_info['admin_reply'] = $content; $message_info['update_time'] = get_gmtime(); $GLOBALS['db']->autoExecute(DB_PREFIX . "message", $message_info, "UPDATE", "id=" . $message_info['id']); send_user_msg("商户回复了你的点评", "商户回复了你的点评 [<a href='" . url("youhui", "review#detail", array("id" => $dp_info['id'])) . "' target='_blank'>" . $dp_info['title'] . "</a>]", 0, $dp_info['user_id'], get_gmtime(), 0, 1, 1); } } } increase_user_active(intval($GLOBALS['user_info']['id']), "回应了一则商户点评"); $GLOBALS['db']->query("update " . DB_PREFIX . "supplier_location_dp set reply_count = reply_count + 1 where id = " . $dp_id); } //输出回应列表 $sql_count = "select count(*) from " . DB_PREFIX . "supplier_location_dp_reply where dp_id = " . $dp_id; $count = $GLOBALS['db']->getOne($sql_count); $page_size = app_conf("PAGE_SIZE"); if ($page == 0) { $page = 1; } $limit = ($page - 1) * app_conf("PAGE_SIZE") . "," . app_conf("PAGE_SIZE"); $sql = "select * from " . DB_PREFIX . "supplier_location_dp_reply where dp_id = " . $dp_id . " order by create_time desc limit " . $limit; $reply_list = $GLOBALS['db']->getAll($sql); foreach ($reply_list as $k => $v) { $reply_list[$k]['user_name'] = $GLOBALS['db']->getOne("select user_name from " . DB_PREFIX . "user where id = " . $v['user_id']); $reply_list[$k]['create_time_format'] = pass_date($v['create_time']); } $GLOBALS['current_url'] = $_SERVER['REQUEST_URI'] = url("youhui", "review#detail", array("id" => $dp_id)); $page = new Page($count, $page_size); //初始化分页对象 $p = $page->show(); $GLOBALS['tmpl']->assign('pages', $p); $GLOBALS['tmpl']->assign("reply_list", $reply_list); $GLOBALS['tmpl']->assign('user_auth', get_user_auth()); $html = decode_topic($GLOBALS['tmpl']->fetch("inc/review/reply_list.html")); $return = array("status" => 1, "message" => $html); 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() { $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 = 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($_REQUEST['title'])) : htmlspecialchars(addslashes($_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; $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'] = $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'] = 0; $message['contact'] = $_REQUEST['contact'] ? htmlspecialchars(addslashes($_REQUEST['contact'])) : ''; $message['contact_name'] = $_REQUEST['contact_name'] ? htmlspecialchars(addslashes($_REQUEST['contact_name'])) : ''; $GLOBALS['db']->autoExecute(DB_PREFIX . "message", $message); if ($message_group == '退款' && $rel_table == 'deal_order') { $GLOBALS['db']->query("update " . DB_PREFIX . "deal_order set refund_status = 1 where id = " . intval($message['rel_id'])); $GLOBALS['db']->query("update " . DB_PREFIX . "deal_coupon set refund_status = 1 where order_id = " . intval($message['rel_id']) . " and confirm_time = 0 and is_valid = 1 and balance_time = 0 and (any_refund = 1 or (expire_refund = 1 and end_time > 0 and end_time < " . get_gmtime() . "))"); } if ($message_group == '退货' && $rel_table == 'deal_order') { $GLOBALS['db']->query("update " . DB_PREFIX . "deal_order set retake_status = 1 where id = " . intval($message['rel_id'])); } showSuccess($GLOBALS['lang']['MESSAGE_POST_SUCCESS'], $ajax); }
public function reply() { $no_verify = intval($_REQUEST['no_verify']); $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 && $no_verify == 0) { $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); } $topic_info = $GLOBALS['db']->getRow("select * from " . DB_PREFIX . "topic where id = " . intval($_REQUEST['topic_id'])); if (!$topic_info) { showErr("主题不存在", $ajax); } $reply_data = array(); $reply_data['topic_id'] = intval($_REQUEST['topic_id']); $reply_data['user_id'] = intval($GLOBALS['user_info']['id']); $reply_data['user_name'] = $GLOBALS['user_info']['user_name']; $reply_data['reply_id'] = intval($_REQUEST['reply_id']); if ($reply_data['reply_id'] > 0) { $reply_reply_data = $GLOBALS['db']->getRow("select id,user_id,user_name from " . DB_PREFIX . "topic_reply where id = " . $reply_data['reply_id']); $reply_data['reply_user_id'] = $reply_reply_data['user_id']; $reply_data['reply_user_name'] = $reply_reply_data['user_name']; } $reply_data['create_time'] = get_gmtime(); $reply_data['is_effect'] = 1; $reply_data['is_delete'] = 0; $reply_data['content'] = htmlspecialchars(valid_str(addslashes($_REQUEST['content']))); $GLOBALS['db']->autoExecute(DB_PREFIX . "topic_reply", $reply_data); $id = $GLOBALS['db']->insert_id(); if ($id > 0) { increase_user_active(intval($GLOBALS['user_info']['id']), "回应了一则分享"); $attach_list = get_topic_attach_list(); foreach ($attach_list as $attach) { if ($attach['type'] == 'image') { //插入图片 $GLOBALS['db']->query("update " . DB_PREFIX . "topic_image set topic_id = " . $id . ",topic_table='topic_reply' where id = " . $attach['id']); } } } //删除所有创建超过一小时,且未被使用过的图片 $del_list = $GLOBALS['db']->getAll("select id,path from " . DB_PREFIX . "topic_image where topic_id = 0 and " . get_gmtime() . " - create_time > 3600"); $GLOBALS['db']->query("delete from " . DB_PREFIX . "topic_image where topic_id = 0 and " . get_gmtime() . " - create_time > 3600"); foreach ($del_list as $k => $v) { @unlink(APP_ROOT_PATH . $v['path']); @unlink(APP_ROOT_PATH . $v['o_path']); } $GLOBALS['db']->query("update " . DB_PREFIX . "topic set reply_count = reply_count + 1,last_time = " . get_gmtime() . ",last_user_id = " . intval($GLOBALS['user_info']['id']) . " where id = " . $reply_data['topic_id']); showSuccess($GLOBALS['lang']['MESSAGE_POST_SUCCESS'], $ajax); }
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); }
/** * 分享点评的上传,上传到comment目录,按日期划分 * 错误返回 error!=0,message错误消息, error=1000表示未登录 * 正确时返回 error=0, url: ./public格式的文件相对路径 path:物理路径 name:文件名 * thumb->preview 100x100的小图 url,path */ public function upload_topic() { global_run(); if (empty($GLOBALS['user_info'])) { $data['error'] = 1000; //未登录 $data['msg'] = $GLOBALS['lang']['PLEASE_LOGIN_FIRST']; ajax_return($data); } //上传处理 //创建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(NOW_TIME, "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(NOW_TIME, "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(NOW_TIME, "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, "file", "comment/" . $dir, $whs = array('preview' => array(50, 50, 1, 0)), 1, 1); } else { $img_result = save_image_upload($_FILES, "file", "comment/" . $dir, $whs = array('preview' => array(50, 50, 1, 0)), 0, 1); } if (intval($img_result['error']) != 0) { ajax_return($img_result); } else { if ($GLOBALS['distribution_cfg']['OSS_TYPE'] && $GLOBALS['distribution_cfg']['OSS_TYPE'] != "NONE") { syn_to_remote_image_server($img_result['file']['url']); syn_to_remote_image_server($img_result['file']['thumb']['preview']['url']); } } $data_result['error'] = 0; $data_result['url'] = $img_result['file']['url']; $data_result['path'] = $img_result['file']['path']; $data_result['name'] = $img_result['file']['name']; $data_result['thumb'] = $img_result['file']['thumb']; require_once APP_ROOT_PATH . "system/utils/es_imagecls.php"; $image = new es_imagecls(); $info = $image->getImageInfo($img_result['file']['path']); $image_data['width'] = intval($info[0]); $image_data['height'] = intval($info[1]); $image_data['name'] = valid_str($_FILES['file']['name']); $image_data['filesize'] = filesize($img_result['file']['path']); $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'] = $img_result['file']['thumb']['preview']['url']; $image_data['o_path'] = $img_result['file']['url']; $GLOBALS['db']->autoExecute(DB_PREFIX . "topic_image", $image_data); $data_result['id'] = intval($GLOBALS['db']->insert_id()); ajax_return($data_result); }
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"; $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); }
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); }
/** * * @param $dp_title 点评的标题 * @param $dp_content 内容 * @param $location_id 点评的门店 * @param $point 评分 1-5 * @param $is_buy 是否购买点评 * @param $from 来源 (event/tuan/youhui/daijin) * @param $url_route 网址参数 * @param $message_id 其他部份留言的ID,用于同步 */ function insert_dp($dp_title, $dp_content, $location_id, $point = 0, $is_buy = 0, $from = "", $url_route = array(), $message_id = 0) { $dp_data = array(); $dp_data['title'] = valid_str($dp_title); $dp_data['content'] = valid_str($dp_content); $dp_data['create_time'] = get_gmtime(); $dp_data['point'] = $point; $dp_data['user_id'] = intval($GLOBALS['user_info']['id']); $dp_data['supplier_location_id'] = $location_id; $dp_data['status'] = 1; $dp_data['from_data'] = $from; $dp_data['is_buy'] = $is_buy; $dp_data['message_id'] = $message_id; foreach ($url_route as $k => $v) { $dp_data[$k] = $v; } $GLOBALS['db']->autoExecute(DB_PREFIX . "supplier_location_dp", $dp_data, "INSERT"); $dp_id = $GLOBALS['db']->insert_id(); if ($dp_id > 0) { $GLOBALS['db']->query("update " . DB_PREFIX . "user set dp_count = dp_count + 1 where id = " . intval($GLOBALS['user_info']['id'])); $supplier_info = $GLOBALS['db']->getRow("select * from " . DB_PREFIX . "supplier_location where id = " . $dp_data['supplier_location_id']); //更新统计 syn_supplier_locationcount($supplier_info); $cache_id = md5("store" . "view" . $supplier_info['id']); $GLOBALS['tmpl']->clear_cache('store_view.html', $cache_id); } return $dp_id; }
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 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); } }