public function save_info() { $data = array(); $ajax = intval($_REQUEST['ajax']); $data['user_name'] = strim($_REQUEST['user_name']); if (empty($data['user_name'])) { showErr("请填写您的姓名", $ajax); } $data['tel'] = strim($_REQUEST['tel']); if (empty($data['tel'])) { showErr("请填写您的联系方式", $ajax); } $data['content'] = strim($_REQUEST['content']); if (empty($data['content'])) { showErr("请填写您的留言内容", $ajax); } $data['cate_id'] = intval($_REQUEST['cate_id']); $data['create_time'] = NOW_TIME; $data['user_id'] = intval($_REQUEST['user_id']); $GLOBALS['db']->autoExecute(DB_PREFIX . "message", $data, "INSERT", "", "SILENT"); $message_id = $GLOBALS['db']->insert_id(); if ($message_id > 0) { showSuccess("申请成功!", $ajax, url_wap("index")); } else { showErr("发送失败,请重新申请!", $ajax); } }
function save() { $url = $_GET['referer']; es_session::set("gopreview", $url); if (!$GLOBALS['user_info']) { app_redirect(url_wap("user#login")); } $info_data = array(); $info_data['user_id'] = $GLOBALS['user_info']['id']; $info_data['name'] = $GLOBALS['user_info']['user_name']; $info_data['mobile'] = $GLOBALS['user_info']['mobile']; $info_data['ip'] = get_client_ip(); $info_data['type'] = $_GET['f']; $info_data['creat_time'] = time(); $tmp_zhuanti_user_info = $GLOBALS['db']->getAll("select * from " . DB_PREFIX . "zhuanti_user where (mobile='" . $info_data['mobile'] . "' or user_id=" . $info_data['user_id'] . ") and type=2"); if ($tmp_zhuanti_user_info) { app_redirect("http://www.51zhishang.com/course/54.html"); } $GLOBALS['db']->autoExecute(DB_PREFIX . "zhuanti_user", $info_data, "INSERT"); $msgInfo = array(); $msgInfo['title'] = '专题报名'; $msgInfo['content'] = '专题报名'; send_zhuanti_sms($info_data['mobile'], $msgInfo, 3812); $data['status'] = 1; $data['info'] = "报名成功!"; app_redirect("http://www.51zhishang.com/course/54.html"); }
public function index() { $root = array(); $root['response_code'] = 1; $id = intval($_REQUEST['id']); $email = strim($GLOBALS['request']['email']); // 用户名或邮箱 $pwd = strim($GLOBALS['request']['pwd']); // 密码 // 检查用户,用户密码 $user = user_check($email, $pwd); $user_id = intval($user['id']); $deal_info = $GLOBALS['db']->getRow("select * from " . DB_PREFIX . "deal where id = " . $id . " and is_delete = 0 and (is_effect = 1 or (is_effect = 0 and user_id = " . intval($GLOBALS['user_info']['id']) . "))"); if (!$deal_info) { app_redirect(url("index")); } $deal_info = cache_deal_extra($deal_info); init_deal_page($deal_info); $page_size = $GLOBALS['m_config']['page_size']; $page = intval($_REQUEST['p']); if ($page == 0) { $page = 1; } $limit = ($page - 1) * $page_size . "," . $page_size; $log_list = $GLOBALS['db']->getAll("select * from " . DB_PREFIX . "deal_log where deal_id = " . $deal_info['id'] . " order by create_time desc limit " . $limit); $log_count = $GLOBALS['db']->getOne("select count(*) from " . DB_PREFIX . "deal_log where deal_id = " . $deal_info['id']); $url = url_wap("deal#show", array("id" => $id)); $root['url'] = $url; $last_time_key = ""; foreach ($log_list as $k => $v) { $log_list[$k]['image'] = get_user_avatar_root($v["user_id"], "middle"); //用户头像 //$log_list[$k]['image'] = get_abs_img_root(get_spec_image($v['image'],640,240,1)); $log_list[$k]['pass_time'] = pass_date($v['create_time']); $online_time = online_date($v['create_time'], $deal_info['begin_time']); $log_list[$k]['online_time'] = $online_time['info']; $log_list[$k]['comment_data_cache'] = null; $log_list[$k]['deal_info_cache'] = null; if ($online_time['key'] != $last_time_key) { $last_time_key = $log_list[$k]['online_time_key'] = $online_time['key']; } $log_list[$k] = cache_log_comment($log_list[$k]); } $root['log_list'] = $log_list; // require APP_ROOT_PATH.'app/Lib/page.php'; // $page = new Page($log_count,$page_size); //初始化分页对象 // $p = $page->show(); // $root['pages'] = $p; $root['page'] = array("page" => $page, "page_total" => ceil($log_count / $page_size), "page_size" => intval($page_size), 'total' => intval($log_count)); output($root); }
public function send() { $ajax = intval($_REQUEST['ajax']); if (!$GLOBALS['user_info']) { showErr("", $ajax, url_wap("user#login")); } $receive_user_id = intval($_REQUEST['id']); $send_user_id = intval($GLOBALS['user_info']['id']); if ($receive_user_id == $send_user_id) { showErr("不能向自己发私信", $ajax); } else { $receive_user_info = $GLOBALS['db']->getRow("select user_name from " . DB_PREFIX . "user where is_effect = 1 and id = " . $receive_user_id); if (!$receive_user_info) { showErr("收信人不存在", $ajax); } //发私信:生成发件与收件 //1.生成发件 $data = array(); $data['create_time'] = NOW_TIME; $data['message'] = strim($_REQUEST['message']); $data['user_id'] = $send_user_id; $data['dest_user_id'] = $receive_user_id; $data['send_user_id'] = $send_user_id; $data['receive_user_id'] = $receive_user_id; $data['user_name'] = $GLOBALS['user_info']['user_name']; $data['dest_user_name'] = $receive_user_info['user_name']; $data['send_user_name'] = $GLOBALS['user_info']['user_name']; $data['receive_user_name'] = $receive_user_info['user_name']; $data['message_type'] = "outbox"; $data['is_read'] = 1; $GLOBALS['db']->autoExecute(DB_PREFIX . "user_message", $data); //2.生成收件 $data = array(); $data['create_time'] = NOW_TIME; $data['message'] = strim($_REQUEST['message']); $data['user_id'] = $receive_user_id; $data['dest_user_id'] = $send_user_id; $data['send_user_id'] = $send_user_id; $data['receive_user_id'] = $receive_user_id; $data['user_name'] = $receive_user_info['user_name']; $data['dest_user_name'] = $GLOBALS['user_info']['user_name']; $data['send_user_name'] = $GLOBALS['user_info']['user_name']; $data['receive_user_name'] = $receive_user_info['user_name']; $data['message_type'] = "inbox"; $GLOBALS['db']->autoExecute(DB_PREFIX . "user_message", $data); showSuccess("发送成功", $ajax); } }
public function index() { //输出文章 $id = intval($_REQUEST['id']); $article = $GLOBALS['db']->getRow("select a.*,ac.type_id from " . DB_PREFIX . "article as a left join " . DB_PREFIX . "article_cate as ac on ac.id=a.cate_id where a.id={$id}"); $wx = array(); $wx['img_url'] = $article['icon']; $wx['title'] = $article['title']; $wx['desc'] = $article['brief']; $GLOBALS['tmpl']->assign('wx', $wx); $cate_id = $article['cate_id']; $article_cates = $GLOBALS['db']->getAllCached("select ac.*,fa.num from " . DB_PREFIX . "article_cate as ac left join (SELECT count(*) as num,cate_id from " . DB_PREFIX . "article where is_effect=1 and is_delete=0 GROUP BY cate_id) as fa on fa.cate_id=ac.id where ac.is_effect=1 and ac.is_delete=0 order by ac.sort asc"); foreach ($article_cates as $k => $v) { $article_cates[$k]['num'] = intval($v['num']); $article_cates[$k]['url'] = url_wap('article', array('id' => $v['id'])); } $artilce_cate_new = array(); foreach ($artilce_cate as $k => $v) { if ($v['type_id'] == $article['type_id'] && $v['id'] != $cate_id && $v['num'] > 0) { $artilce_cate_new[$k]['cate_id'] = $v['id']; $artilce_cate_new[$k]['titles'] = $v['title']; $artilce_cate_new[$k]['url'] = url_wap('article_cate', array('id' => $v['id'])); } } $GLOBALS['tmpl']->assign("other_cate", $artilce_cate_new); //文章详细页面最新更新(控制最新的10条) $temp_article_list = $GLOBALS['db']->getAllCached("SELECT a.*,c.type_id from " . DB_PREFIX . "article a LEFT JOIN " . DB_PREFIX . "article_cate c on a.cate_id=c.id where 1=1 and a.is_delete=0 and a.is_effect=1 and c.type_id=" . $article['type_id'] . " and a.cate_id={$cate_id} and a.id!={$id} order by update_time desc limit 0,5"); $article_list = array(); foreach ($temp_article_list as $k => $v) { //最新更新 $article_list[$k]['cate_title'] = $v['title']; if ($v['rel_url'] == "") { $article_list[$k]['url'] = url_wap('article', array('id' => $v['id'])); } else { $article_list[$k]['url'] = $v['rel_url']; } } unset($temp_article_list); $GLOBALS['tmpl']->assign("article", $article); $GLOBALS['tmpl']->assign("article_list", $article_list); $GLOBALS['tmpl']->display("article_index.html"); }
public function index() { $id = intval($GLOBALS['request']['id']); $email = strim($GLOBALS['request']['email']); $pwd = strim($GLOBALS['request']['pwd']); if (!dealIdIsExist($id, 1)) { $result = responseErrorInfo("deal_id参数错误"); output($result); } $user = user_check($email, $pwd); $user_id = intval($user['id']); get_mortgate(); // 不知道为什么要冻结 $deal_info = $this->getDealInfo($id, $user_id); $leader_info = getLeaderInfo($id); $deal_new_info = $this->getNewDeal_info($deal_info); // $stock_info = $this->getStockAndUnStock ( $deal_info ); // $history_info = $this->getHistoryInfo ( $deal_info ); // $plan_info = $this->getPlanInfo ( $deal_info ); $result = responseSuccessInfo("项目详情"); $result["deal_info"] = $deal_new_info; $result['leader_info'] = $leader_info; // $result ['stock_info'] = $stock_info; // $result ['history_info'] = $history_info; // $result ['plan_info'] = $plan_info; if ($user_id > 0) { $is_focus = $GLOBALS['db']->getOne("select count(*) from " . DB_PREFIX . "deal_focus_log where deal_id = " . $id . " and user_id = " . $user_id); $result['is_focus'] = $is_focus; } $result['business_url'] = get_domain() . url_mapi_html("deal#business", array("id" => $id, "user_id" => $user_id)); $result['teams_url'] = get_domain() . url_mapi_html("deal#teams", array("id" => $id, "user_id" => $user_id)); $result['history_url'] = get_domain() . url_mapi_html("deal#history", array("id" => $id, "user_id" => $user_id)); $result['plans_url'] = get_domain() . url_mapi_html("deal#plans", array("id" => $id, "user_id" => $user_id)); $url = replace_mapi(url_wap("deal#show", array("id" => $id))); $result['share_url'] = $url; if ($GLOBALS['m_config']['wx_appid'] != '' && $GLOBALS['m_config']['wx_secrit'] != '') { $weixin_1 = new weixin($GLOBALS['m_config']['wx_appid'], $GLOBALS['m_config']['wx_secrit'], $url); $wx_url = $weixin_1->scope_get_code(); $result['wx_share_url'] = $wx_url; } output($result); }
public function edit_applicate_leader($from = 'wap') { if (!$GLOBALS['user_info']) { if ($from == 'web') { app_redirect(url("user#login")); } elseif ($from == 'wap') { app_redirect(url_wap("user#login")); } } $data = $GLOBALS['db']->getRow("select i.* from " . DB_PREFIX . "investment_list i WHERE i.user_id=" . $GLOBALS['user_info']['id'] . " and i.status=0"); $data['cate_name_lists']['name'] = explode(",", $data['cates_name']); $data['cate_name_lists']['id'] = explode(",", $data['cates_id']); $GLOBALS['tmpl']->assign("data", $data); $GLOBALS['tmpl']->display("user_edit_applicate_leader.html"); }
/** * 用户提现 * @param int $user_id * @param int $user_type 0:普通用户fanwe_user.id;1:担保用户fanwe_deal_agency.id * @param float $pTrdAmt 充值金额 */ public function DoDwTrade() { //判断是否是黑名单会员 if ($GLOBALS['user_info']['is_black'] == 1) { showErr("您当前无权限提现,具体联系网站客服", 0, url_wap("index", "uc_center")); } $user_id = intval(strim($_REQUEST['user_id'])); $user_type = intval(strim($_REQUEST['user_type'])); $pTrdAmt = floatval(strim($_REQUEST['pTrdAmt'])); $data = array(); if ($user_type == 0) { $data = $GLOBALS['db']->getRow("select * from " . DB_PREFIX . "user where id = " . $user_id); } else { $data = $GLOBALS['db']->getRow("select * from " . DB_PREFIX . "user where id = " . $user_id); } if (empty($data)) { showErr('用户不存在', 0); } else { if (!empty($data['ips_acct_no'])) { $class_name = getCollName(); require_once APP_ROOT_PATH . "system/collocation/" . $class_name . "_collocation.php"; $collocation_class = $class_name . "_collocation"; $collocation_object = new $collocation_class(); $collocation_object->set_mobile_sys(); $collocation_code = $collocation_object->DoDwTrade($user_id, $user_type, $pTrdAmt); print_r($collocation_code); } else { showErr('该用户还未申请过资金托管帐户', 0); } } }
function init_deal_page_wap($deal_info) { $GLOBALS['tmpl']->assign("page_title", $deal_info['name']); if ($deal_info['seo_title'] != "") { $GLOBALS['tmpl']->assign("seo_title", $deal_info['seo_title']); } if ($deal_info['seo_keyword'] != "") { $GLOBALS['tmpl']->assign("seo_keyword", $deal_info['seo_keyword']); } if ($deal_info['seo_description'] != "") { $GLOBALS['tmpl']->assign("seo_description", $deal_info['seo_description']); } //开启限购后剩余几位 $deal_info['deal_item_count'] = 0; foreach ($deal_info['deal_item_list'] as $k => $v) { // 统计所有真实+虚拟(钱) $deal_info['total_virtual_person'] += $v['virtual_person']; $deal_info['total_virtual_price'] += $v['price'] * $v['virtual_person'] + $v['support_amount']; //统计每个子项目真实+虚拟(钱) $deal_info['deal_item_list'][$k]['person'] = $v['virtual_person'] + $v['support_count']; $deal_info['deal_item_list'][$k]['money'] = $v['price'] * $v['virtual_person'] + $v['support_amount']; $deal_info['deal_item_list'][$k]['cart_url'] = url_wap("cart#index", array("id" => $v['id'])); if ($v['limit_user']) { $deal_info['deal_item_list'][$k]['remain_person'] = $v['limit_user'] - $v['virtual_person'] - $v['support_count']; } $deal_info['deal_item_count']++; } // $deal_info['deal_type']=$GLOBALS['db']->getOne("select name from ".DB_PREFIX."deal_cate where id=".$deal_info['cate_id']); $deal_info['tags_arr'] = preg_split("/[ ,]/", $deal_info['tags']); $deal_info['support_amount_format'] = number_price_format($deal_info['support_amount']); $deal_info['limit_price_format'] = number_price_format($deal_info['limit_price']); $deal_info['total_virtual_price_format'] = number_price_format(intval($deal_info['total_virtual_price'])); $deal_info['remain_days'] = floor(($deal_info['end_time'] - NOW_TIME) / (24 * 3600)); $deal_info['percent'] = round($deal_info['support_amount'] / $deal_info['limit_price'] * 100); //$deal_info['deal_level']=$GLOBALS['db']->getOne("select level from ".DB_PREFIX."deal_level where id=".intval($deal_info['user_level'])); $deal_info['person'] = $deal_info['total_virtual_person'] + $deal_info['support_count']; $deal_info['percent'] = round($deal_info['total_virtual_price'] / $deal_info['limit_price'] * 100); $deal_info['update_url'] = url_wap("deal#update", array("id" => $deal_info['id'])); $deal_info['comment_url'] = url_wap("deal#comment", array("id" => $deal_info['id'])); $deal_info['info_url'] = url_wap("deal#info", array("id" => $deal_info['id'])); if ($deal_info['begin_time'] > NOW_TIME) { $deal_info['status'] = '0'; $deal_info['left_days'] = floor(($deal_info['begin_time'] - NOW_TIME) / (24 * 3600)); } elseif ($deal_info['end_time'] < NOW_TIME && $deal_info['end_time'] > 0) { if ($deal_info['percent'] >= 100) { $deal_info['status'] = '1'; } else { $deal_info['status'] = '2'; } } else { if ($deal_info['end_time'] > 0) { $deal_info['status'] = '3'; } else { $deal_info['status'] = '4'; } } if ($GLOBALS['user_info']) { $is_focus = $GLOBALS['db']->getOne("select count(*) from " . DB_PREFIX . "deal_focus_log where deal_id = " . $deal_info['id'] . " and user_id = " . intval($GLOBALS['user_info']['id'])); $GLOBALS['tmpl']->assign("is_focus", $is_focus); } if ($deal_info['user_id'] > 0) { $deal_user_info = $GLOBALS['db']->getRow("select id,user_name,province,city,intro,login_time from " . DB_PREFIX . "user where id = " . $deal_info['user_id'] . " and is_effect = 1"); if ($deal_user_info) { $deal_user_info['weibo_list'] = $GLOBALS['db']->getAll("select * from " . DB_PREFIX . "user_weibo where user_id = " . $deal_user_info['id']); $deal_user_info['image'] = get_user_avatar($deal_user_info['id'], 'middle'); $deal_info['user_info'] = $deal_user_info; } } if (!empty($deal_info['vedio']) && !preg_match("/http://player.youku.com/embed/i", $deal_info['source_video'])) { $deal_info['source_vedio'] = preg_replace("/id_(.*)\\.html(.*)/i", "http://player.youku.com/embed/\${1}", baseName($deal_info['vedio'])); $GLOBALS['db']->query("update " . DB_PREFIX . "deal set source_vedio='" . $deal_info['source_vedio'] . "' where id=" . $deal_info['id']); } $GLOBALS['tmpl']->assign("deal_info", $deal_info); }
public function submit_investor() { $id = intval($_REQUEST['id']); $ajax = 1; if (!$GLOBALS['user_info']) { showErr("", $ajax, url_wap("user#login")); } $GLOBALS['db']->query("update " . DB_PREFIX . "deal set is_edit = 0 where id = " . $id); $GLOBALS['db']->query("update " . DB_PREFIX . "deal set is_effect = 0 where id = " . $id); $GLOBALS['db']->query("update " . DB_PREFIX . "deal set type = 1 where id = " . $id); showSuccess("提交成功,等待管理员审核!", $ajax); }
public function investor_agency_save_data($from = 'web') { if (!$GLOBALS['user_info']) { if ($from == 'web') { app_redirect(url("user#login")); } elseif ($from == 'wap') { app_redirect(url_wap("user#login")); } } if (!check_ipop_limit(get_client_ip(), "user_investor_result", 5)) { showErr("提交太快", 1); } $id = intval($_REQUEST['id']); $ajax = intval($_POST['ajax']); $identify_business_name = strim($_POST['identify_business_name']); $identify_business_licence = es_session::get("identify_business_licence"); $identify_business_code = es_session::get("identify_business_code"); $identify_business_tax = es_session::get("identify_business_tax"); $image1['url'] = replace_public(strim($_POST['identify_business_licence_u'])); $image2['url'] = replace_public(strim($_POST['identify_business_code_u'])); $image3['url'] = replace_public(strim($_POST['identify_business_tax_u'])); $data = investor_agency_save($id, $ajax = '', $identify_business_name, $identify_business_licence, $identify_business_code, $identify_business_tax, $image1['url'], $image2['url'], $image3['url']); ajax_return($data); return false; }
public function save_mobile_password() { //$ajax = intval($_REQUEST['ajax']); if (!$GLOBALS['user_info']) { app_redirect(url_wap("user#login")); } $data = array(); if (!check_ipop_limit(get_client_ip(), "setting_save_mobile_password", 5)) { $data['info'] = "提交太频繁"; ajax_return($data); return false; } //showErr("提交太频繁",$ajax,""); $user_pwd = strim($_REQUEST['user_pwd']); $confirm_user_pwd = strim($_REQUEST['confirm_user_pwd']); $user_info = $GLOBALS['db']->getRow("select * from " . DB_PREFIX . "user where id = " . intval($GLOBALS['user_info']['id'])); $mobile = strim($user_info['mobile']); $user_info['verify_coder'] = strim($_REQUEST['verify_coder']); if ($mobile) { $has_code = $GLOBALS['db']->getOne("select count(*) from " . DB_PREFIX . "mobile_verify_code where mobile='" . $mobile . "' and verify_code='" . strim($_REQUEST['verify_coder']) . "' "); if (!$has_code) { //showErr("验证码错误",$ajax,""); $data['info'] = "验证码错误"; ajax_return($data); return false; } } else { //showErr("请绑定手机号",$ajax,""); $data['info'] = "请绑定手机号"; ajax_return($data); return false; } if (strlen($user_pwd) < 4) { //showErr("密码不能低于四位",$ajax,""); $data['info'] = "密码不能低于四位"; ajax_return($data); return false; } if ($user_pwd != $confirm_user_pwd) { //showErr("密码确认失败",$ajax,""); $data['info'] = "密码确认失败"; ajax_return($data); return false; } require_once APP_ROOT_PATH . "system/libs/user.php"; $user_info['user_pwd'] = $user_pwd; save_user($user_info, "UPDATE"); if ($GLOBALS['db']->query("update " . DB_PREFIX . "user set password_verify = '' where id = " . intval($GLOBALS['user_info']['id']))) { $data['status'] = 1; } else { $data['status'] = 0; } ajax_return($data); //showSuccess("保存成功",$ajax,url_wap("settings#index")); }
function get_deal_list($limit = "", $conditions = "", $orderby = " sort desc ") { if ($limit != "") { $limit = " LIMIT " . $limit; } if ($orderby != "") { $orderby = " ORDER BY " . $orderby; } if (app_conf("INVEST_STATUS") == 0) { $condition = " 1=1 AND d.is_delete = 0 AND d.is_effect = 1 "; } elseif (app_conf("INVEST_STATUS") == 1) { $condition = " 1=1 AND d.is_delete = 0 AND d.is_effect = 1 and d.type=0 "; } elseif (app_conf("INVEST_STATUS") == 2) { $condition = " 1=1 AND d.is_delete = 0 AND d.is_effect = 1 and d.type=1 "; } if ($conditions != "") { $condition .= " AND " . $conditions; } //权限浏览控制 if ($GLOBALS['user_info']['user_level'] != 0) { $level = $GLOBALS['db']->getOne("SELECT level from " . DB_PREFIX . "user_level where id=" . $GLOBALS['user_info']['user_level']); $condition .= " AND (d.user_level ='' or d.user_level=0 or d.user_level <={$level}) "; } else { $condition .= " AND (d.user_level =0 or d.user_level =1 or d.user_level ='') "; } $deal_count = $GLOBALS['db']->getOne("select count(*) from " . DB_PREFIX . "deal as d where " . $condition); /*(所需项目)准备虚拟数据 start*/ $deal_list = array(); $level_list = $GLOBALS['db']->getAll("select * from " . DB_PREFIX . "deal_level "); $level_list_array = array(); foreach ($level_list_array as $k => $v) { if ($v['id']) { $level_list_array[$v['id']] = $v['level']; } } if ($deal_count > 0) { $now_time = NOW_TIME; $deal_list = $GLOBALS['db']->getAll("select d.* from " . DB_PREFIX . "deal as d where " . $condition . $orderby . $limit); $deal_ids = array(); foreach ($deal_list as $k => $v) { $deal_list[$k]['remain_days'] = ceil(($v['end_time'] - $now_time) / (24 * 3600)); if ($v['begin_time'] > $now_time) { $deal_list[$k]['left_days'] = intval(($now_time - $v['create_time']) / 24 / 3600); } $deal_list[$k]['num_days'] = ceil(($v['end_time'] - $v['begin_time']) / (24 * 3600)); $deal_ids[] = $v['id']; //查询出对应项目id的user_level $deal_list[$k]['deal_level'] = $level_list_array[intval($deal_list[$k]['user_level'])]; if ($v['begin_time'] > $now_time) { $deal_list[$k]['left_begin_days'] = intval(($v['begin_time'] - $now_time) / 24 / 3600); } if ($v['begin_time'] > $now_time) { $deal_list[$k]['status'] = '0'; } elseif ($v['end_time'] < $now_time && $v['end_time'] > 0) { if ($deal_list[$k]['percent'] >= 100) { $deal_list[$k]['status'] = '1'; } else { $deal_list[$k]['status'] = '2'; } } else { if ($v['end_time'] > 0) { $deal_list[$k]['status'] = '3'; } else { $deal_list[$k]['status'] = '4'; } } } //获取当前项目列表下的所有子项目 //$temp_virtual_person_list = $GLOBALS['db']->getAll("select deal_id,virtual_person,price,support_count from ".DB_PREFIX."deal_item where deal_id in(".implode(",",$deal_ids).") "); //$virtual_person_list = array(); //重新组装一个以项目ID为KEY的 统计所有的虚拟人数和虚拟价格 // foreach($temp_virtual_person_list as $k=>$v){ // $virtual_person_list[$v['deal_id']]['total_virtual_person'] += $v['virtual_person']; // $virtual_person_list[$v['deal_id']]['total_support_person'] += $v['support_count']; // $virtual_person_list[$v['deal_id']]['total_virtual_price'] += $v['price'] * $v['virtual_person']; // $virtual_person_list[$v['deal_id']]['total_support_price'] += $v['price'] * $v['support_count']; // } //unset($temp_virtual_person_list); //将获取到的虚拟人数和虚拟价格拿到项目列表里面进行统计 foreach ($deal_list as $k => $v) { $deal_list[$k]['url'] = url_wap("deal#show", array("id" => $v['id'])); if ($v['type'] == 1) { $deal_list[$k]['virtual_person'] = $deal_list[$k]['invote_num']; $deal_list[$k]['support_count'] = $deal_list[$k]['invote_num']; $deal_list[$k]['support_amount'] = $deal_list[$k]['invote_money']; $deal_list[$k]['percent'] = round($deal_list[$k]['support_amount'] / $v['limit_price'] * 100); $deal_list[$k]['limit_price_w'] = round($deal_list[$k]['limit_price'] / 10000); $deal_list[$k]['invote_mini_money_w'] = round($deal_list[$k]['invote_mini_money'] / 10000); } else { $deal_list[$k]['virtual_person'] = $deal_list[$k]['virtual_num']; $deal_list[$k]['support_count'] = $deal_list[$k]['virtual_num'] + $deal_list[$k]['support_count']; $deal_list[$k]['support_amount'] = $deal_list[$k]['virtual_price'] + $deal_list[$k]['support_amount']; $deal_list[$k]['percent'] = round($deal_list[$k]['support_amount'] / $v['limit_price'] * 100); } } } return array("rs_count" => $deal_count, "list" => $deal_list); }
public function aqj_do_login() { $aqj_id = trim($_POST['log_aqjid']); $user_mobile = trim($_POST['log_mobile']); $user_pwd = trim($_POST['log_pwd']); require_once APP_ROOT_PATH . "system/libs/user.php"; $result = do_login_user($user_mobile, $user_pwd); if ($result['status'] == "1") { //登录成功,跳转到积分商城, $xlc_user = $GLOBALS['db']->getRow("select id,mobile,user_pwd from " . DB_PREFIX . "user where mobile='" . $user_mobile . "'"); $aqj_user = $GLOBALS['db']->getRow("select * from " . DB_PREFIX . "ap_partner_user where user_id=" . $xlc_user['id']); if ($aqj_user) { //存在新乐筹用户,更新绑定 $user_ap_partner = array(); $user_ap_partner['partner_user_id'] = $aqj_id; $user_ap_partner['edit_time'] = time(); $GLOBALS['db']->autoExecute(DB_PREFIX . "ap_partner_user", $user_ap_partner, "UPDATE", "id=" . intval($aqj_user['id'])); } else { //插入新用户 $user_ap_partner = array(); $user_ap_partner['user_id'] = $result['user']['id']; $user_ap_partner['partner_id'] = 2; $user_ap_partner['partner_user_id'] = $aqj_id; $user_ap_partner['create_time'] = time(); $GLOBALS['db']->autoExecute(DB_PREFIX . "ap_partner_user", $user_ap_partner); } $result['msg'] = "登录中..."; $result['jump'] = url_wap("deals", array('aqjid' => $aqj_id, 'm' => $user_mobile, 'isap' => 1)); } else { //提示登录失败 switch ($result['data']) { case "1": $result['msg'] = '对不起,帐户不存在。'; break; case "2": $result['msg'] = '对不起,帐户密码错误。'; break; case "3": $result['msg'] = '对不起,帐户未激活。'; break; } } ajax_return($result); }
public function init_deal_page($deal_info) { $GLOBALS['tmpl']->assign("page_title", $deal_info['name']); if ($deal_info['seo_title'] != "") { $GLOBALS['tmpl']->assign("seo_title", $deal_info['seo_title']); } if ($deal_info['seo_keyword'] != "") { $GLOBALS['tmpl']->assign("seo_keyword", $deal_info['seo_keyword']); } if ($deal_info['seo_description'] != "") { $GLOBALS['tmpl']->assign("seo_description", $deal_info['seo_description']); } $deal_info['tags_arr'] = preg_split("/[ ,]/", $deal_info['tags']); $deal_info['support_amount_format'] = number_price_format($deal_info['support_amount']); $deal_info['limit_price_format'] = number_price_format($deal_info['limit_price'] / 10000); $deal_info['remain_days'] = ceil(($deal_info['end_time'] - NOW_TIME) / (24 * 3600)); $deal_info['person'] = 0; $type_2 = 0; $type_array = array(); //初始化与虚拟金额有所关联的几个比较特殊的数据 start foreach ($deal_info['deal_item_list'] as $k => $v) { //统计每个子项目真实+虚拟(人) $deal_info['deal_item_list'][$k]['virtual_person_list'] = intval($v['virtual_person'] + $v['support_count']); if ($v['type'] == 1) { $type_array[] = $v; unset($deal_info['deal_item_list'][$k]); } } if ($type_array) { $deal_info['deal_item_list'] = array_merge($deal_info['deal_item_list'], $type_array); } if ($deal_info['type'] == 1) { $deal_info['person'] = $deal_info['invote_num']; $deal_info['total_virtual_price'] = number_price_format($deal_info['invote_money'] / 10000); $deal_info['percent'] = round($deal_info['invote_money'] / $deal_info['limit_price'] * 100, 2); } else { $deal_info['person'] = $deal_info['support_count'] + $deal_info['virtual_num']; $deal_info['total_virtual_price'] = number_price_format($deal_info['support_amount'] + $deal_info['virtual_price']); $deal_info['percent'] = round(($deal_info['support_amount'] + $deal_info['virtual_price']) / $deal_info['limit_price'] * 100, 2); } //项目等级放到项目详细页面模块(对详细页面进行控制) $deal_info['deal_level'] = $GLOBALS['db']->getOne("select level from " . DB_PREFIX . "deal_level where id=" . intval($deal_info['user_level'])); $deal_info['virtual_person'] = $GLOBALS['db']->getOne("select sum(virtual_person) from " . DB_PREFIX . "deal_item where deal_id=" . $deal_info['id']); $deal_info['update_url'] = url_wap("deal#update", array("id" => $deal_info['id'])); $deal_info['comment_url'] = url_wap("deal#comment", array("id" => $deal_info['id'])); //初始化与虚拟金额有所关联的几个比较特殊的数据 end if (!empty($deal_info['vedio']) && !preg_match("/http://player.youku.com/embed/i", $deal_info['source_video'])) { $deal_info['source_vedio'] = preg_replace("/id_(.*)\\.html(.*)/i", "http://player.youku.com/embed/\${1}", baseName($deal_info['vedio'])); $GLOBALS['db']->query("update " . DB_PREFIX . "deal set source_vedio='" . $deal_info['source_vedio'] . "' where id=" . $deal_info['id']); } $GLOBALS['tmpl']->assign("deal_info", $deal_info); $deal_item_list = $deal_info['deal_item_list']; //开启限购后剩余几位 foreach ($deal_item_list as $k => $v) { if ($v['limit_user'] > 0) { $deal_item_list[$k]['remain_person'] = $v['limit_user'] - $v['virtual_person'] - $v['support_count']; } } $GLOBALS['tmpl']->assign("deal_item_list", $deal_item_list); if ($GLOBALS['user_info']) { $is_focus = $GLOBALS['db']->getOne("select count(*) from " . DB_PREFIX . "deal_focus_log where deal_id = " . $deal_info['id'] . " and user_id = " . intval($GLOBALS['user_info']['id'])); $GLOBALS['tmpl']->assign("is_focus", $is_focus); } }
<?php if ($GLOBALS['user_info']) { app_redirect(url_wap("index#index")); } //var_dump(es_session::get('user_wx_info')); $wx_info = es_session::get('user_wx_info'); $GLOBALS['tmpl']->assign('wx_info', $wx_info); $GLOBALS['tmpl']->display("user_wx_register.html"); ?>
public function wx_content_code($tmpl) { if ($this->wx_tmpl[$tmpl] && $this->user_info['wx_openid']) { $msg = $this->wx_tmpl[$tmpl]['msg']; $data = unserialize($msg); $time = get_gmtime(); $now_date = to_date($time); $wx_url = get_domain() . url_wap("account#index"); $this->log('function:wx_content_code 参数$tmpl:' . $tmpl); if ($tmpl == 'OPENTM201490080') { //调用OPENTM201490080 ,订单支付成功 $data['keyword1'] = array('value' => $this->user_info['notice_sn'], 'color' => '#173177'); $data['keyword2'] = array('value' => $this->user_info['deal_name'], 'color' => '#173177'); $data['keyword3'] = array('value' => format_price($this->user_info['paid_money']), 'color' => '#173177'); $wx_url = get_domain() . url_wap("account#view_order", array('id' => $this->user_info['notice_sn'])); } elseif ($tmpl == 'OPENTM206915380') { //调用OPENTM206915380 ,后台管理操作通知 $data['keyword1'] = array('value' => $this->user_info['control_type'], 'color' => '#173177'); $data['keyword2'] = array('value' => $now_date, 'color' => '#173177'); $data['keyword3'] = array('value' => $this->user_info['control_content'], 'color' => '#173177'); $data['keyword4'] = array('value' => '处理完成', 'color' => '#173177'); $wx_url = get_domain() . url_wap("index"); } elseif ($tmpl == 'OPENTM207029514') { $data['first'] = array('value' => $this->user_info['control_type'], 'color' => '#173177'); $data['keyword1'] = array('value' => $this->user_info['control_content'], 'color' => '#173177'); $data['keyword2'] = array('value' => $now_date, 'color' => '#173177'); if ($this->user_info['control_url']) { $wx_url = $this->user_info['control_url']; } } elseif ($tmpl == 'OPENTM203026900') { $data['keyword1'] = array('value' => $this->user_info['wx_code'], 'color' => '#173177'); $data['keyword2'] = array('value' => $this->user_info['expire_time'], 'color' => '#173177'); } elseif ($tmpl == 'OPENTM267386236') { $data['keyword1'] = array('value' => format_price($this->user_info['incharge_money']), 'color' => '#173177'); $data['keyword2'] = array('value' => $now_date, 'color' => '#173177'); } elseif ($tmpl == 'TM00004') { //退款通知 $data['keyword1'] = array('value' => $this->user_info['control_content'], 'color' => '#173177'); $data['keyword2'] = array('value' => format_price($this->user_info['refund_money']), 'color' => '#173177'); } elseif ($tmpl == 'TM00979') { //提现申请通知 $data['first'] = array('value' => $this->user_info['control_content'], 'color' => '#173177'); $data['money'] = array('value' => format_price($this->user_info['carray_money']), 'color' => '#173177'); $data['timet'] = array('value' => $now_date, 'color' => '#173177'); } elseif ($tmpl == 'OPENTM202425107') { //提现结果通知 $data['keyword1'] = array('value' => format_price($this->user_info['carray_money']), 'color' => '#173177'); $data['keyword2'] = array('value' => $this->user_info['carray_bank'], 'color' => '#173177'); $data['keyword3'] = array('value' => $this->user_info['carray_create_time'], 'color' => '#173177'); $data['keyword4'] = array('value' => $this->user_info['carray_end_time'], 'color' => '#173177'); $data['keyword5'] = array('value' => $this->user_info['result'], 'color' => '#173177'); } elseif ($tmpl == 'OPENTM202116678') { //众筹通知 $data['keyword1'] = array('value' => $this->user_info['control_title'], 'color' => '#173177'); $data['keyword2'] = array('value' => $this->user_info['control_content'], 'color' => '#173177'); } $info = array('touser' => $this->user_info['wx_openid'], 'template_id' => $this->wx_tmpl[$tmpl]['template_id'], 'url' => $wx_url, 'topcolor' => '#FF0000', 'data' => $data); $this->log('function:wx_content_code 输出:' . var_export($info, true)); $this->msg_content = serialize($info); } }
public function go_pay() { if (es_session::get("confirm") == $_REQUEST['t']) { app_redirect(url_wap("index")); //支付过期时跳转回首页 // echo '网页过期'; exit; } if (!$GLOBALS['user_info']) { app_redirect(url_wap("user#login")); } $isap = $_REQUEST['isap']; $id = intval($_REQUEST['id']); $is_address = intval($_REQUEST['is_address']); $consignee_id = intval($_REQUEST['consignee_id']); if ($is_address == 1) { if (empty($consignee_id)) { $consignee = strim($_REQUEST['consignee']); $province = strim($_REQUEST['province']); $city = strim($_REQUEST['city']); $address = strim($_REQUEST['address']); $zip = strim($_REQUEST['zip']); $mobile = strim($_REQUEST['mobile']); $data = array(); $data['consignee'] = $consignee; $data['province'] = $province; $data['city'] = $city; $data['address'] = $address; $data['zip'] = $zip; $data['mobile'] = $mobile; $data['user_id'] = intval($GLOBALS['user_info']['id']); $GLOBALS['db']->autoExecute(DB_PREFIX . "user_consignee", $data); $consignee_id = $GLOBALS['db']->insert_id(); } } $credit = doubleval($_REQUEST['credit']); $memo = strim($_REQUEST['memo']); $payment_id = intval($_REQUEST['payment_id']); $deal_item = $GLOBALS['db']->getRow("select * from " . DB_PREFIX . "deal_item where id = " . $id); if (!$deal_item) { app_redirect(url_wap("index")); } elseif ($deal_item['support_count'] >= $deal_item['limit_user'] && $deal_item['limit_user'] != 0) { app_redirect(url_wap("deal#show", array("id" => $deal_item['deal_id']))); } $deal_info = $GLOBALS['db']->getRow("select * from " . DB_PREFIX . "deal where is_delete = 0 and is_effect = 1 and id = " . $deal_item['deal_id']); if (!$deal_info) { app_redirect(url_wap("index")); } elseif ($deal_info['begin_time'] > NOW_TIME || $deal_info['end_time'] < NOW_TIME && $deal_info['end_time'] != 0) { app_redirect(url_wap("deal#show", array("id" => $deal_item['deal_id']))); } if (intval($consignee_id) == 0 && $deal_item['is_delivery'] == 1) { showErr("请选择配送方式", 0, get_gopreview_wap()); } $order_info['deal_id'] = $deal_info['id']; $order_info['deal_item_id'] = $deal_item['id']; $order_info['user_id'] = intval($GLOBALS['user_info']['id']); $order_info['user_name'] = $GLOBALS['user_info']['user_name']; $order_info['total_price'] = $deal_item['price'] + $deal_item['delivery_fee']; $order_info['delivery_fee'] = $deal_item['delivery_fee']; $order_info['deal_price'] = $deal_item['price']; $order_info['support_memo'] = $memo; $order_info['payment_id'] = $payment_id; $order_info['bank_id'] = strim($_REQUEST['bank_id']); //积分商城项目增加积分方和积分兑换率 if ($isap == "1") { $order_info['is_ap'] = $isap; $order_info['ap_partner_id'] = 2; $order_info['ap_ratio'] = $deal_item['ap_ratio']; } $max_credit = $order_info['total_price'] < $GLOBALS['user_info']['money'] ? $order_info['total_price'] : $GLOBALS['user_info']['money']; $credit = $credit > $max_credit ? $max_credit : $credit; $order_info['credit_pay'] = $credit; $order_info['online_pay'] = 0; $order_info['deal_name'] = $deal_info['name']; $order_info['order_status'] = 0; $order_info['create_time'] = NOW_TIME; if ($consignee_id > 0) { $consignee_info = $GLOBALS['db']->getRow("select * from " . DB_PREFIX . "user_consignee where id = " . $consignee_id . " and user_id = " . intval($GLOBALS['user_info']['id'])); if (!$consignee_info && $deal_item['is_delivery'] == 1) { showErr("请选择配送方式", 0, get_gopreview_wap()); } $order_info['consignee'] = $consignee_info['consignee']; $order_info['zip'] = $consignee_info['zip']; $order_info['address'] = $consignee_info['address']; $order_info['province'] = $consignee_info['province']; $order_info['city'] = $consignee_info['city']; $order_info['mobile'] = $consignee_info['mobile']; } $order_info['is_success'] = $deal_info['is_success']; $GLOBALS['db']->autoExecute(DB_PREFIX . "deal_order", $order_info); $order_id = $GLOBALS['db']->insert_id(); if ($order_id > 0) { if ($order_info['credit_pay'] > 0) { require_once APP_ROOT_PATH . "system/libs/user.php"; modify_account(array("money" => "-" . $order_info['credit_pay']), intval($GLOBALS['user_info']['id']), "支持" . $order_info['deal_name'] . "项目支付"); } $result = pay_order($order_id); if ($result['status'] == 0) { $money = $result['money']; $payment_notice['create_time'] = NOW_TIME; $payment_notice['user_id'] = intval($GLOBALS['user_info']['id']); $payment_notice['payment_id'] = $order_info['payment_id']; $payment_notice['money'] = $money; $payment_notice['order_id'] = $order_id; $payment_notice['memo'] = $order_info['memo']; $payment_notice['deal_id'] = $order_info['deal_id']; $payment_notice['deal_item_id'] = $order_info['deal_item_id']; $payment_notice['deal_name'] = $order_info['deal_name']; //积分商城项目增加积分方和积分兑换率 if ($isap == "1") { $payment_notice['partner_id'] = $order_info['ap_partner_id']; $payment_notice['ap_ratio'] = $order_info['ap_ratio']; } do { $payment_notice['notice_sn'] = to_date(NOW_TIME, "Ymd") . rand(100, 999); $GLOBALS['db']->autoExecute(DB_PREFIX . "payment_notice", $payment_notice, "INSERT", "", "SILENT"); $notice_id = $GLOBALS['db']->insert_id(); } while ($notice_id == 0); /*if($isap=="1"){ app_redirect(url("cart#ap_jump",array("notice_id"=>$notice_id,"order_id"=>$order_id))); }*/ if ($isap == "1") { //调用积分支付方法类 require_once APP_ROOT_PATH . "system/payment/Appay_payment.php"; $o = new Appay_payment(); $res = $o->user_pay($notice_id); $data = array(); $data['deal_id'] = $order_info['deal_id']; $data['deal_item_id'] = $order_info['deal_item_id']; $data['order_id'] = $order_id; // $_COOKIE["confirm"] = false; es_session::set("confirm", $_REQUEST['t']); switch ($res) { case 1: $GLOBALS['tmpl']->assign('data', $data); $GLOBALS['tmpl']->display('pay_sucess.html'); break; case -1: $data['pay_info'] = '积分不足.'; // $GLOBALS['tmpl']->assign('msg','积分不足'); $GLOBALS['tmpl']->assign('data', $data); $GLOBALS['tmpl']->display('pay_error.html'); break; case 0: $data['pay_info'] = '订单为空.'; $GLOBALS['tmpl']->assign('data', $data); // $GLOBALS['tmpl']->assign('msg','订单为空'); $GLOBALS['tmpl']->display('pay_error.html'); break; } exit; } // echo $payment_id; if ($_REQUEST['isqr'] !== '1') { app_redirect(url("cart#jump", array("id" => $notice_id))); } else { app_redirect(url("cart#jump_wxzf", array("id" => $notice_id))); } } elseif ($result['status'] == 1) { $data['pay_status'] = 0; $data['pay_info'] = '订单过期.'; $data['show_pay_btn'] = 0; $GLOBALS['tmpl']->assign('data', $data); $GLOBALS['tmpl']->display('pay_order_index.html'); } elseif ($result['status'] == 2) { $data['pay_status'] = 0; $data['pay_info'] = '订单无库存.'; $data['show_pay_btn'] = 0; $GLOBALS['tmpl']->assign('data', $data); $GLOBALS['tmpl']->display('pay_order_index.html'); } else { $data['pay_status'] = 1; $data['pay_info'] = '订单支付成功.'; $data['show_pay_btn'] = 0; $GLOBALS['tmpl']->assign('data', $data); $GLOBALS['tmpl']->display('pay_order_index.html'); } //app_redirect(url_wap("cart#pay_order",array("order_id"=>$order_id))); } else { showErr("下单失败", 0, get_gopreview_wap()); } }
public function add_bank() { $bank_list = get_bank_list(); $user_info = $GLOBALS['user_info']; if ($user_info['investor_status'] != 1) { showErr('您的身份认证未完成,请点击确定去实名认证!', 1, url_wap("settings#security", array("method" => "setting-id-box"))); } $GLOBALS['tmpl']->assign('user_info', $GLOBALS['user_info']); $GLOBALS['tmpl']->caching = true; $cache_id = md5(MODULE_NAME . ACTION_NAME); if (!$GLOBALS['tmpl']->is_cached('inc/account_money_carry_addbank.html', $cache_id)) { $region_lv2 = $GLOBALS['db']->getAll("select * from " . DB_PREFIX . "region_conf where region_level = 2 order by py asc"); //二级地址 $GLOBALS['tmpl']->assign("region_lv2", $region_lv2); } $GLOBALS['tmpl']->assign('bank_list', $bank_list); $data['html'] = $GLOBALS['tmpl']->fetch("inc/account_money_carry_addbank.html"); $data['status'] = 1; ajax_return($data); }
<?php // +---------------------------------------------------------------------- // | Fanwe 方维众筹商业系统 // +---------------------------------------------------------------------- // | Copyright (c) 2011 http://www.fanwe.com All rights reserved. // +---------------------------------------------------------------------- // | Author: 甘味人生(526130@qq.com) // +---------------------------------------------------------------------- require './system/system_init.php'; require './app/Lib/App.class.php'; if ($_REQUEST['is_pc'] == 1) { es_cookie::set("is_pc", "1", 24 * 3600 * 30); } if (isMobile() && !isset($_REQUEST['is_pc']) && es_cookie::get("is_pc") != 1 && is_dir(APP_ROOT_PATH . "wap") & $_REQUEST['ctl'] != 'collocation' && $_REQUEST['ctl'] != 'collocation') { $ctl = $_REQUEST['ctl'] ? $_REQUEST['ctl'] : 'index'; $act = $_REQUEST['act'] ? $_REQUEST['act'] : 'index'; $id = $_REQUEST['id']; if ($id) { app_redirect(url_wap($ctl . "#" . $act, array('id' => $id))); } else { app_redirect(url_wap($ctl . "#" . $act)); } } else { set_source_url(); //实例化一个网站应用实例 $AppWeb = new App(); } //实例化一个网站应用实例
public function get_payment_code($payment_notice_id) { $payment_notice = $GLOBALS['db']->getRow("select * from " . DB_PREFIX . "payment_notice where id = " . $payment_notice_id); $order_sn = $payment_notice['notice_sn']; $money = round($payment_notice['money'], 2); $payment_info = $GLOBALS['db']->getRow("select id,config,logo from " . DB_PREFIX . "payment where id=" . intval($payment_notice['payment_id'])); $payment_info['config'] = unserialize($payment_info['config']); $wx_config = $payment_info['config']; $sql = "select name " . "from " . DB_PREFIX . "deal " . "where id =" . intval($payment_notice['deal_id']); $title_name = $GLOBALS['db']->getOne($sql); if (!$payment_notice['order_id']) { $title_name = '充值'; } $subject = $order_sn; include APP_ROOT_PATH . "system/payment/Wxjspay/WxPayPubHelper.php"; // $data_notify_url = get_domain().APP_ROOT.'/wx_web/yjwap_response.php'; // $data_return_url = get_domain().APP_ROOT.'/wx_web/yjwap_notify.php'; // // $data_notify_url = str_replace("/sjmapi", "", $data_notify_url); // $data_notify_url = str_replace("/mapi", "", $data_notify_url); // $data_notify_url = str_replace("/wap", "", $data_notify_url); $data_return_url = str_replace("/sjmapi", "", $data_return_url); $data_return_url = str_replace("/mapi", "", $data_return_url); $data_return_url = str_replace("/wap", "", $data_return_url); $notify_url = get_domain() . REAL_APP_ROOT . "/wxpay_web/notify_url.php?order_id=" . intval($payment_notice['order_id']) . "&out_trade_no=" . $order_sn; //."&out_trade_no={$data.walipay.out_trade_no}"; $order_id = $order_sn; //网页支付的订单在订单有效期内可以进行多次支付请求,但是需要注意的是每次请求的业务参数都要一致,交易时间也要保持一致。否则会报错“订单与已存在的订单信息不符” $return['notify_url'] = url_wap("cart#wx_jspay", array("id" => $payment_notice_id)); $money_fen = intval($money * 100); if ($wx_config['type'] == 'V2') { require_once APP_ROOT_PATH . 'system/extend/ip.php'; $iplocation = new iplocate(); $user_ip = $iplocation->getIP(); $unifiedOrder = new UnifiedOrder_pub(); $unifiedOrder->update_config($wx_config['appid'], $wx_config['appsecret'], $wx_config['mchid'], $wx_config['partnerid'], $wx_config['partnerkey'], $wx_config['key'], $wx_config['sslcert'], $wx_config['sslkey']); $unifiedOrder->setParameter("input_charset", "GBK"); $unifiedOrder->setParameter("bank_type", "WX"); $unifiedOrder->setParameter("body", $title_name); $unifiedOrder->setParameter("partner", $wx_config['partnerid']); //$unifiedOrder->setParameter("out_trade_no", $unifiedOrder->create_noncestr()); $unifiedOrder->setParameter("out_trade_no", $order_sn); $unifiedOrder->setParameter("total_fee", "{$money_fen}"); $unifiedOrder->setParameter("fee_type", "0"); $unifiedOrder->setParameter("notify_url", $notify_url); $unifiedOrder->setParameter("spbill_create_ip", $user_ip); $unifiedOrder->setParameter("input_charset", "GBK"); $jsApiParameters = $unifiedOrder->create_biz_package(); } elseif ($wx_config['type'] == 'V3' || $wx_config['type'] == 'V4') { $jsApi = new JsApi_pub(); $jsApi->update_config($wx_config['appid'], $wx_config['appsecret'], $wx_config['mchid'], $wx_config['partnerid'], $wx_config['partnerkey'], $wx_config['key'], $wx_config['sslcert'], $wx_config['sslkey']); if (!isset($_GET['code'])) { //触发微信返回code码 $url = $jsApi->createOauthUrlForCode(urlencode(get_domain() . $return['notify_url'])); Header("Location: {$url}"); $return['notify_url'] = $url; return $return; } else { //获取code码,以获取openid $code = $_GET['code']; $jsApi->setCode($code); $openid = $jsApi->getOpenId(); } $unifiedOrder = new UnifiedOrder_pub(); $unifiedOrder->update_config($wx_config['appid'], $wx_config['appsecret'], $wx_config['mchid'], $wx_config['partnerid'], $wx_config['partnerkey'], $wx_config['key'], $wx_config['sslcert'], $wx_config['sslkey']); $unifiedOrder->setParameter("openid", "{$openid}"); //商品描述 $unifiedOrder->setParameter("body", iconv_substr($title_name, 0, 50, 'UTF-8')); //商品描述 $timeStamp = NOW_TIME; $unifiedOrder->setParameter("out_trade_no", "{$order_sn}"); //商户订单号 $unifiedOrder->setParameter("total_fee", $money_fen); //总金额 $unifiedOrder->setParameter("notify_url", $notify_url); //通知地址 $unifiedOrder->setParameter("trade_type", "JSAPI"); //交易类型 $prepay_id = $unifiedOrder->getPrepayId(); //=========步骤3:使用jsapi调起支付============ $jsApi->setPrepayId($prepay_id); $jsApiParameters = $jsApi->getParameters($wx_config['type']); if ($wx_config['type'] == 'V4') { $jsApiParameters = str_replace('deal_url', url_wap("deal#index", array('id' => $payment_notice['deal_id'])), $jsApiParameters); } } $return['parameters'] = $jsApiParameters; //echo $jsApiParameters; return $return; }
public function index() { $GLOBALS['tmpl']->assign("page_title", "最新动态"); $param = array(); //参数集合 //数据来源参数 $r = strim($_REQUEST['r']); //推荐类型 $param['r'] = $r ? $r : ''; $GLOBALS['tmpl']->assign("p_r", $r); $id = intval($_REQUEST['id']); //分类id $param['id'] = $id; $GLOBALS['tmpl']->assign("p_id", $id); $loc = strim($_REQUEST['loc']); //地区 $param['loc'] = $loc; $GLOBALS['tmpl']->assign("p_loc", $loc); $state = intval($_REQUEST['state']); //状态 $param['state'] = $state; $GLOBALS['tmpl']->assign("p_state", $state); $tag = strim($_REQUEST['tag']); //标签 $param['tag'] = $tag; $GLOBALS['tmpl']->assign("p_tag", $tag); $kw = strim($_REQUEST['k']); //关键词 $param['k'] = $kw; $GLOBALS['tmpl']->assign("p_k", $kw); $type = intval($_REQUEST['type']); //推荐类型 $param['type'] = $type; $GLOBALS['tmpl']->assign("p_type", $type); if (intval($_REQUEST['redirect']) == 1) { $param = array(); if ($r != "") { $param = array_merge($param, array("r" => $r)); } if ($id > 0) { $param = array_merge($param, array("id" => $id)); } if ($loc != "") { $param = array_merge($param, array("loc" => $loc)); } if ($state != "") { $param = array_merge($param, array("state" => $state)); } if ($tag != "") { $param = array_merge($param, array("tag" => $tag)); } if ($kw != "") { $param = array_merge($param, array("k" => $kw)); } if ($type != "") { $param = array_merge($param, array("type" => $type)); } app_redirect(url_wap("deals", $param)); } $image_list = load_dynamic_cache("INDEX_IMAGE_LIST"); if ($image_list === false) { $image_list = $GLOBALS['db']->getAll("select * from " . DB_PREFIX . "index_image order by sort asc"); set_dynamic_cache("INDEX_IMAGE_LIST", $image_list); } $GLOBALS['tmpl']->assign("image_list", $image_list); $cate_list = load_dynamic_cache("INDEX_CATE_LIST"); if (!$cate_list) { $cate_list = $GLOBALS['db']->getAll("select * from " . DB_PREFIX . "deal_cate order by sort asc"); set_dynamic_cache("INDEX_CATE_LIST", $cate_list); } $cate_result = array(); foreach ($cate_list as $k => $v) { if ($v['pid'] == 0) { $temp_param = $param; $cate_result[$v['id']]['id'] = $v['id']; $cate_result[$v['id']]['name'] = $v['name']; $temp_param['id'] = $v['id']; $cate_result[$v['id']]['url'] = url_wap("deals", $temp_param); } else { if ($v['pid'] > 0) { $temp_param['id'] = $v['id']; $cate_result[$v['pid']]['child'][] = array('id' => $v['id'], 'name' => $v['name'], 'url' => url_wap("deals", $temp_param)); } } if ($v['id'] == $id) { $GLOBALS['tmpl']->assign("cate_name", $v['name']); } } $GLOBALS['tmpl']->assign("cate_list", $cate_result); $pid = $id; //获取父类id if ($cate_list) { $pid = $this->get_child($cate_list, $pid); } /*子分类 start*/ $cate_ids = array(); $is_child = false; $temp_cate_ids = array(); if ($cate_list) { $child_cate_result = array(); foreach ($cate_list as $k => $v) { if ($v['pid'] == $pid) { if ($v['id'] > 0) { $temp_param = $param; $child_cate_result[$v['id']]['id'] = $v['id']; $child_cate_result[$v['id']]['name'] = $v['name']; $temp_param['id'] = $v['id']; $child_cate_result[$v['id']]['url'] = url_wap("deals", $temp_param); if ($id == $v['id']) { $is_child = true; } } } if ($v['pid'] == $pid || $pid == 0) { $temp_cate_ids[] = $v['id']; } } } //假如选择了子类 那么使用子类ID 否则使用 父类和其子类 if ($is_child) { $cate_ids[] = $id; } else { $cate_ids[] = $pid; $cate_ids = array_merge($cate_ids, $temp_cate_ids); } $cate_ids = array_filter($cate_ids); $GLOBALS['tmpl']->assign("child_cate_list", $child_cate_result); $GLOBALS['tmpl']->assign("pid", $pid); /*子分类 end*/ $city_list = load_dynamic_cache("INDEX_CITY_LIST"); if ($type == 1) { if (!$city_list) { $city_list = $GLOBALS['db']->getAll("select province from " . DB_PREFIX . "deal where type=1 and is_effect =1 group by province order by sort asc"); // set_dynamic_cache("INDEX_CITY_LIST",$city_list); } } if ($type == 0) { if (!$city_list) { $city_list = $GLOBALS['db']->getAll("select province from " . DB_PREFIX . "deal where type=0 and is_effect =1 group by province order by sort asc"); // set_dynamic_cache("INDEX_CITY_LIST",$city_list); } } foreach ($city_list as $k => $v) { $temp_param = $param; $temp_param['loc'] = $v['province']; $city_list[$k]['url'] = url_wap("deals", $temp_param); if ($v['id']) { $child = $GLOBALS['db']->getAll("select * from " . DB_PREFIX . "region_conf where pid=" . $v['id']); if ($child) { foreach ($child as $k1 => $v1) { $temp_param['loc'] = $v1['name']; $child[$k1]['url'] = url_wap("deals", $temp_param); } $city_list[$k]['child'] = $child; } } } $GLOBALS['tmpl']->assign("city_list", $city_list); //=================region_conf============== $state_list = array(1 => array("name" => "筹资成功"), 2 => array("name" => "筹资失败"), 3 => array("name" => "筹资中")); foreach ($state_list as $k => $v) { $temp_param = $param; $temp_param['state'] = $k; $state_list[$k]['url'] = url_wap("deals", $temp_param); } if ($state == 0) { $GLOBALS['tmpl']->assign("state_name", "所有项目"); } else { $GLOBALS['tmpl']->assign("state_name", $state_list[$state]['name']); } $GLOBALS['tmpl']->assign("state_list", $state_list); $page_size = PAGE_SIZE; $step_size = PAGE_SIZE; $step = intval($_REQUEST['step']); if ($step == 0) { $step = 1; } $page = intval($_REQUEST['p']); if ($page == 0) { $page = 1; } $limit = ($page - 1) * $page_size + ($step - 1) * $step_size . "," . $step_size; $GLOBALS['tmpl']->assign("current_page", $page); $condition = " d.is_delete = 0 and d.is_effect = 1 "; if ($r != "") { if ($r == "new") { $condition .= " and " . NOW_TIME . " - d.begin_time < " . 7 * 24 * 3600 . " and " . NOW_TIME . " - d.begin_time > 0 "; //上线不超过一天 $GLOBALS['tmpl']->assign("page_title", "最新上线"); } elseif ($r == "rec") { $condition .= " and d.is_recommend = 1 "; $GLOBALS['tmpl']->assign("page_title", "推荐项目"); } elseif ($r == "yure") { $condition .= " and " . NOW_TIME . " < d.begin_time "; $GLOBALS['tmpl']->assign("page_title", "正在预热"); } elseif ($r == "nend") { $condition .= " and d.end_time - " . NOW_TIME . " < " . 7 * 24 * 3600 . " and d.end_time - " . NOW_TIME . " > 0 "; //三天就要结束 $GLOBALS['tmpl']->assign("page_title", "即将结束"); } elseif ($r == "classic") { $condition .= " and d.is_classic = 1 "; $GLOBALS['tmpl']->assign("page_title", "经典项目"); $GLOBALS['tmpl']->assign("is_classic", true); } elseif ($r == "limit_price") { $condition .= " and max(d.limit_price) "; $GLOBALS['tmpl']->assign("page_title", "最高目标金额"); } } switch ($state) { //筹资成功 case 1: $condition .= " and d.is_success=1 and d.end_time < " . NOW_TIME; $GLOBALS['tmpl']->assign("page_title", "筹资成功"); break; //筹资失败 //筹资失败 case 2: $condition .= " and d.end_time < " . NOW_TIME . " and d.end_time!=0 and d.is_success=0 "; $GLOBALS['tmpl']->assign("page_title", "筹资失败"); break; //筹资中 //筹资中 case 3: $condition .= " and (d.end_time > " . NOW_TIME . " or d.end_time=0 ) and d.begin_time < " . NOW_TIME . " "; $GLOBALS['tmpl']->assign("page_title", "筹资中"); break; } if (count($cate_ids) > 0) { $condition .= " and d.cate_id in (" . implode(",", $cate_ids) . ")"; $GLOBALS['tmpl']->assign("page_title", $cate_result[$id]['name']); } if ($loc != "") { $condition .= " and (d.province = '" . $loc . "' or city = '" . $loc . "') "; $GLOBALS['tmpl']->assign("page_title", $loc); } if ($tag != "") { $unicode_tag = str_to_unicode_string($tag); $condition .= " and match(d.tags_match) against('" . $unicode_tag . "' IN BOOLEAN MODE) "; $GLOBALS['tmpl']->assign("page_title", $tag); } if ($type !== "") { $type = intval($type); $condition .= " and type={$type} "; } if ($kw != "") { $kws_div = div_str($kw); foreach ($kws_div as $k => $item) { $kws[$k] = str_to_unicode_string($item); } $ukeyword = implode(" ", $kws); $condition .= " and (match(d.name_match) against('" . $ukeyword . "' IN BOOLEAN MODE) or match(d.tags_match) against('" . $ukeyword . "' IN BOOLEAN MODE) or d.name like '%" . $kw . "%') "; $GLOBALS['tmpl']->assign("page_title", $kw); } $result = get_deal_list($limit, $condition); foreach ($result['list'] as $k => $v) { } $GLOBALS['tmpl']->assign("deal_list", $result['list']); $GLOBALS['tmpl']->assign("deal_count", intval($result['rs_count'])); $page = new Page($result['rs_count'], $page_size); //初始化分页对象 $p = $page->show(); $GLOBALS['tmpl']->assign('pages', $p); $GLOBALS['tmpl']->assign("usermessage_url", url_wap("ajax#usermessage", array("id" => intval($GLOBALS['user_info']['id'])))); $GLOBALS['tmpl']->display("deals_index.html"); }
public function invester_list($from = 'web') { $GLOBALS['tmpl']->assign("page_title", "天使投资人列表"); $param = array(); //参数集合 get_user_lever_icon(8); //数据来源参数 $r = strim($_REQUEST['r']); //投资人类型 $r = $r ? $r : 'all'; $param['r'] = $r; $GLOBALS['tmpl']->assign("p_r", $r); $loc = strim($_REQUEST['loc']); //地区 $param['loc'] = $loc; $GLOBALS['tmpl']->assign("p_loc", $loc); $city = strim($_REQUEST['city']); //地区 $param['city'] = $city; $GLOBALS['tmpl']->assign("p_city", $city); if (intval($_REQUEST['redirect']) == 1) { $param = array(); if ($r != "") { $param = array_merge($param, array("r" => $r)); } if ($loc != "") { $param = array_merge($param, array("loc" => $loc)); } if ($city != "") { $param = array_merge($param, array("city" => $city)); } } $city_list = load_dynamic_cache("INDEX_CITY_LIST"); if (!$city_list) { $city_list = $GLOBALS['db']->getAll("select province from " . DB_PREFIX . "user group by province order by create_time desc"); set_dynamic_cache("INDEX_CITY_LIST", $city_list); } foreach ($city_list as $k => $v) { $temp_param = $param; unset($temp_param['city']); $temp_param['loc'] = $v['province']; if ($from == 'web') { $city_list[$k]['url'] = url("investor#invester_list", $temp_param); } elseif ($from == 'wap') { $city_list[$k]['url'] = url_wap("investor#invester_list", $temp_param); } } $GLOBALS['tmpl']->assign("city_list", $city_list); $next_pid = 0; $region_lv2 = $GLOBALS['db']->getAll("select * from " . DB_PREFIX . "region_conf where region_level = 2 order by py asc"); //二级地址 foreach ($region_lv2 as $k => $v) { $temp_param = $param; unset($temp_param['city']); $temp_param['loc'] = $v['name']; if ($from == 'web') { $region_lv2[$k]['url'] = url("investor#invester_list", $temp_param); } elseif ($from == 'wap') { $region_lv2[$k]['url'] = url_wap("investor#invester_list", $temp_param); } if ($loc == $v['name']) { $next_pid = $v['id']; } } $GLOBALS['tmpl']->assign("region_lv2", $region_lv2); if ($next_pid > 0) { $region_lv3 = $GLOBALS['db']->getAll("select * from " . DB_PREFIX . "region_conf where region_level = 3 and `pid`='" . $next_pid . "' order by py asc"); //二级地址 foreach ($region_lv3 as $k => $v) { $temp_param = $param; $temp_param['city'] = $v['name']; if ($from == 'web') { $region_lv3[$k]['url'] = url("investor#invester_list", $temp_param); } elseif ($from == 'wap') { $region_lv3[$k]['url'] = url_wap("investor#invester_list", $temp_param); } } $GLOBALS['tmpl']->assign("region_lv3", $region_lv3); } // print_r($region_lv2);exit; $page_size = 8; $page = intval($_REQUEST['p']); if ($page == 0) { $page = 1; } $limit = ($page - 1) * $page_size . "," . $page_size; $GLOBALS['tmpl']->assign("current_page", $page); $condition = "is_effect = 1 "; if ($r != "") { if ($r == "all") { if (app_conf("AVERAGE_USER_STATUS") == 0 && INVEST_TYPE != 1) { if ($r == "all") { $condition .= " and (is_investor = 1 or is_investor = 2)"; } } $GLOBALS['tmpl']->assign("page_title", "全部"); } if ($r == "ordinary_user") { $condition .= " and is_investor = 0 "; $GLOBALS['tmpl']->assign("page_title", "普通用户"); } if ($r == "invester") { $condition .= " and is_investor = 1 "; $GLOBALS['tmpl']->assign("page_title", "投资人"); } if ($r == "institutions_invester") { $condition .= " and is_investor = 2 "; $GLOBALS['tmpl']->assign("page_title", "机构投资人"); } } if ($loc != "") { $condition .= " and (province = '" . $loc . "') "; $GLOBALS['tmpl']->assign("page_title", $loc); } if ($city != "") { $condition .= " and (province = '" . $loc . "' and city = '" . $city . "') "; $GLOBALS['tmpl']->assign("page_title", $city); } /*投资人列表*/ $invester_list = $GLOBALS['db']->getAll("select * from " . DB_PREFIX . "user where " . $condition . " order by create_time desc limit " . $limit); foreach ($invester_list as $k => $v) { $invester_list[$k]['image'] = get_user_avatar($v["id"], "middle"); //用户头像 $invester_list[$k]['user_icon'] = $GLOBALS['user_level'][$v['user_level']]['icon']; //用户等级图标 $invester_list[$k]['cate_name'] = unserialize($v["cate_name"]); //所在行业领域 } $invester_count = $GLOBALS['db']->getOne("select count(*) from " . DB_PREFIX . "user where " . $condition); $GLOBALS['tmpl']->assign("invester_count", $invester_count); require APP_ROOT_PATH . 'app/Lib/page.php'; $page = new Page($invester_count, $page_size); //初始化分页对象 $p = $page->para_show("investor#invester_list", $param); $GLOBALS['tmpl']->assign('pages', $p); $GLOBALS['tmpl']->assign("invester_list", $invester_list); /*融资成功的项目*/ $deal_success_result = $GLOBALS['db']->getAll("select * from " . DB_PREFIX . "deal where is_success = 1 and is_effect = 1 order by support_count desc "); $GLOBALS['tmpl']->assign("deal_success_list", $deal_success_result); /*星级投资人*/ $stars_invester_list = $GLOBALS['db']->getAll("select * from " . DB_PREFIX . "user where investor_status = 1 and is_effect = 1 and (is_investor = 1 or is_investor = 2) order by point desc "); foreach ($stars_invester_list as $k => $v) { $stars_invester_list[$k]['image'] = get_user_avatar($v["id"], "middle"); //用户头像 $stars_invester_list[$k]['user_icon'] = $GLOBALS['user_level'][$v['user_level']]['icon']; //用户等级图标 $stars_invester_list[$k]['cate_name'] = unserialize($v["cate_name"]); //所在行业领域 } $GLOBALS['tmpl']->assign("stars_invester_list", $stars_invester_list); /*最新投资人*/ $new_invester = $GLOBALS['db']->getAll("select * from " . DB_PREFIX . "user where investor_status = 1 and is_effect = 1 and (is_investor = 1 or is_investor = 2) order by update_time desc "); foreach ($new_invester as $kk => $vv) { $new_invester[$kk]['image'] = get_user_avatar($vv["id"], "middle"); //用户头像 $new_invester[$kk]['user_icon'] = $GLOBALS['user_level'][$vv['user_level']]['icon']; //用户等级图标 $new_invester[$kk]['cate_name'] = unserialize($vv["cate_name"]); //所在行业领域 } $GLOBALS['tmpl']->assign("new_invester", $new_invester); $GLOBALS['tmpl']->display("invester_list.html"); }
public function setting_id() { if (!$GLOBALS['user_info']) { app_redirect(url_wap("user#login")); } $method = strim($_REQUEST['method']); $method_array = array("setting-username-box", "setting-pwd-box", "setting-email-box", "setting-mobile-box", "setting-pass-box", "setting-id-box"); if (!in_array($method, $method_array)) { $method = ''; } $GLOBALS['tmpl']->assign("method", $method); $GLOBALS['tmpl']->assign("page_title", "实名认证"); $GLOBALS['tmpl']->display("inc/setting_id.html"); }
public function go_pay() { if (!$GLOBALS['user_info']) { app_redirect(url_wap("user#login")); } $id = intval($_REQUEST['id']); $paypassword = strim($_REQUEST['paypassword']); if ($paypassword == '') { showErr("请输入支付密码", 0); } if (md5($paypassword) != $GLOBALS['user_info']['paypassword']) { showErr("支付密码错误", 0); } $consignee_id = intval($_REQUEST['consignee_id']); $credit = floatval($_REQUEST['credit']); $pay_score = intval($_REQUEST['pay_score']); if ($pay_score > 0) { $score_array = score_to_money($pay_score); $pay_score_money = $score_array['score_money']; $pay_score = $score_array['score']; } else { $pay_score = 0; $pay_score_money = 0; } $is_tg = intval($_REQUEST['is_tg']); if ($is_tg) { if (!$GLOBALS['is_user_tg']) { $jump_url = get_domain() . APP_ROOT . "/wap/index.php?ctl=collocation&act=CreateNewAcct&user_type=0&user_id=" . $GLOBALS['user_info']['id']; //$jump_url = get_domain().url_wap("collocation#CreateNewAcct",array('user_type'=>0,'user_id'=>$GLOBALS['user_info']['id'])); showErr("您未绑定第三方接口无法支付,点击确定后跳转到绑定页面", 0, $jump_url); } } $memo = strim($_REQUEST['memo']); $payment_id = intval($_REQUEST['payment']); $deal_item = $GLOBALS['db']->getRow("select * from " . DB_PREFIX . "deal_item where id = " . $id); if (!$deal_item) { app_redirect(url_wap("index")); } elseif ($deal_item['support_count'] >= $deal_item['limit_user'] && $deal_item['limit_user'] != 0) { app_redirect(url_wap("deal#show", array("id" => $deal_item['deal_id']))); } $deal_info = $GLOBALS['db']->getRow("select * from " . DB_PREFIX . "deal where is_delete = 0 and is_effect = 1 and id = " . $deal_item['deal_id']); if (!$deal_info) { app_redirect(url_wap("index")); } elseif ($deal_info['begin_time'] > NOW_TIME || $deal_info['end_time'] < NOW_TIME && $deal_info['end_time'] != 0) { app_redirect(url_wap("deal#show", array("id" => $deal_item['deal_id']))); } if (intval($consignee_id) == 0 && $deal_item['is_delivery'] == 1) { showErr("请选择配送方式", 0, get_gopreview_wap()); } //无私奉献 if ($deal_item['type'] == 1) { $pay_money = floatval($_REQUEST['pay_money']); if ($pay_money <= 0) { showErr("您输入的金额错误", 0, url_wap("deal#show", array("id" => $deal_item['deal_id']))); } $deal_item['price'] = $pay_money; $order_info['type'] = 2; } else { $order_info['type'] = $deal_info['type']; } $order_info['deal_id'] = $deal_info['id']; $order_info['deal_item_id'] = $deal_item['id']; $order_info['user_id'] = intval($GLOBALS['user_info']['id']); $order_info['user_name'] = $GLOBALS['user_info']['user_name']; $order_info['total_price'] = $deal_item['price'] + $deal_item['delivery_fee']; $order_info['delivery_fee'] = $deal_item['delivery_fee']; $order_info['deal_price'] = $deal_item['price']; $order_info['support_memo'] = $memo; $order_info['payment_id'] = $payment_id; $order_info['bank_id'] = strim($_REQUEST['bank_id']); if ($deal_item['is_share'] == 1) { $order_info['share_fee'] = $deal_item['share_fee']; $order_info['share_status'] = 0; } else { $order_info['share_fee'] = 0; } /* $max_credit= $order_info['total_price']<$GLOBALS['user_info']['money']?$order_info['total_price']:$GLOBALS['user_info']['money']; $credit = $credit>$max_credit?$max_credit:$credit; */ if (!$is_tg) { $credit_score_money = $pay_score_money + $credit; if ($credit > $GLOBALS['user_info']['money']) { showErr("余额最多只能用" . format_price($GLOBALS['user_info']['money']), 0); } if ($pay_score > $GLOBALS['user_info']['score']) { showErr("积分最多只能用" . $GLOBALS['user_info']['score']); } if ($credit_score_money > $order_info['total_price']) { showErr("支付超出"); } if (intval(($order_info['total_price'] - $credit_score_money) * 100) > 0 && $payment_id == 0) { showErr("请选择支付方式"); } } if ($credit > 0 && $GLOBALS['user_info']['money'] >= $credit) { $order_info['credit_pay'] = $credit; } if ($pay_score > 0 && $GLOBALS['user_info']['score'] >= $pay_score) { $order_info['score'] = $pay_score; $order_info['score_money'] = $pay_score_money; } // $order_info['credit_pay'] = $credit; $order_info['online_pay'] = 0; $order_info['deal_name'] = $deal_info['name']; $order_info['order_status'] = 0; $order_info['create_time'] = NOW_TIME; if ($consignee_id > 0) { $consignee_info = $GLOBALS['db']->getRow("select * from " . DB_PREFIX . "user_consignee where id = " . $consignee_id . " and user_id = " . intval($GLOBALS['user_info']['id'])); if (!$consignee_info && $deal_item['is_delivery'] == 1) { showErr("请选择配送方式", 0, get_gopreview_wap()); } $order_info['consignee'] = $consignee_info['consignee']; $order_info['zip'] = $consignee_info['zip']; $order_info['address'] = $consignee_info['address']; $order_info['province'] = $consignee_info['province']; $order_info['city'] = $consignee_info['city']; $order_info['mobile'] = $consignee_info['mobile']; } $order_info['is_success'] = $deal_info['is_success']; $GLOBALS['db']->autoExecute(DB_PREFIX . "deal_order", $order_info); $order_id = $GLOBALS['db']->insert_id(); if ($order_id > 0) { // if($order_info['credit_pay']>0) // { // require_once APP_ROOT_PATH."system/libs/user.php"; // modify_account(array("money"=>"-".$order_info['credit_pay']),intval($GLOBALS['user_info']['id']),"支持".$order_info['deal_name']."项目支付"); // } $result = pay_order($order_id); if ($result['status'] == 0) { if ($is_tg) { $sign = md5(md5($paypassword) . $order_id); $url = get_domain() . APP_ROOT . "/wap/index.php?ctl=collocation&act=RegisterCreditor&order_id=" . $order_id . "&sign=" . $sign; //showSuccess("",0,$url); app_redirect($url); } else { $money = $result['money']; $payment_notice['create_time'] = NOW_TIME; $payment_notice['user_id'] = intval($GLOBALS['user_info']['id']); $payment_notice['payment_id'] = $order_info['payment_id']; $payment_notice['money'] = $money; $payment_notice['order_id'] = $order_id; $payment_notice['memo'] = $order_info['memo']; $payment_notice['deal_id'] = $order_info['deal_id']; $payment_notice['deal_item_id'] = $order_info['deal_item_id']; $payment_notice['deal_name'] = $order_info['deal_name']; do { $payment_notice['notice_sn'] = to_date(NOW_TIME, "Ymdhi") . rand(10000, 99999); $GLOBALS['db']->autoExecute(DB_PREFIX . "payment_notice", $payment_notice, "INSERT", "", "SILENT"); $notice_id = $GLOBALS['db']->insert_id(); } while ($notice_id == 0); app_redirect(url_wap("cart#jump", array("id" => $notice_id))); } } elseif ($result['status'] == 1) { $data['pay_status'] = 0; $data['pay_info'] = '订单过期.'; $data['show_pay_btn'] = 0; $GLOBALS['tmpl']->assign('data', $data); $GLOBALS['tmpl']->display('pay_order_index.html'); } elseif ($result['status'] == 2) { $data['pay_status'] = 0; $data['pay_info'] = '订单无库存.'; $data['show_pay_btn'] = 0; $GLOBALS['tmpl']->assign('data', $data); $GLOBALS['tmpl']->display('pay_order_index.html'); } else { $data['pay_status'] = 1; $data['pay_info'] = '订单支付成功.'; $data['show_pay_btn'] = 0; $GLOBALS['tmpl']->assign('data', $data); $GLOBALS['tmpl']->display('pay_order_index.html'); } //app_redirect(url_wap("cart#pay_order",array("order_id"=>$order_id))); } else { showErr("下单失败", 0, get_gopreview_wap()); } }
public function index() { $id = intval($_REQUEST['id']); $article_cates = $GLOBALS['db']->getAllCached("select ac.*,fa.num from " . DB_PREFIX . "article_cate as ac left join (SELECT count(*) as num,cate_id from " . DB_PREFIX . "article where is_effect=1 and is_delete=0 GROUP BY cate_id) as fa on fa.cate_id=ac.id where ac.is_effect=1 and ac.is_delete=0 order by ac.sort asc"); foreach ($article_cates as $k => $v) { $article_cates[$k]['num'] = intval($v['num']); $article_cates[$k]['url'] = url_wap('article', array('id' => $v['id'])); } $type_id = 0; $cate_name = ''; foreach ($artilce_cate as $k => $v) { $artilce_cate[$k]['cate_id'] = $v['id']; $artilce_cate[$k]['titles'] = $v['title']; if ($id > 0 && $v['id'] == $id) { $type_id = intval($v['type_id']); $cate_name = $v['title']; } } $GLOBALS['tmpl']->assign("cate_name", $cate_name); $GLOBALS['tmpl']->assign("artilce_cate", $artilce_cate); //分页 $page_size = $GLOBALS['m_config']['page_size']; $page = intval($_REQUEST['p']); if ($page == 0) { $page = 1; } $limit = ($page - 1) * $page_size . "," . $page_size; //条件判断 $where = '1=1 and a.is_delete=0 and a.is_effect=1 '; if ($id > 0) { $where .= ' and c.type_id=' . $type_id . ' and a.cate_id=' . $id; } else { $where .= ' and c.type_id=0 '; } //wap文章分类栏 $article_cates_list = $GLOBALS['db']->getAllCached("select ac.id,ac.title from " . DB_PREFIX . "article_cate ac where ac.is_effect=1 and ac.is_delete=0 and ac.type_id=0 order by ac.id asc"); $cates_list = array(); foreach ($article_cates_list as $k => $v) { $cates_list[$k]['title'] = $v['title']; $cates_list[$k]['id'] = $v['id']; $cates_list[$k]['url'] = url_wap("article_cate", array('id' => $v['id'])); if ($v['id'] == intval($_REQUEST['id'])) { $cates_list[$k]['status'] = $k + 1; } } $temp_artilce_list = $GLOBALS['db']->getAllCached("SELECT a.*,c.type_id,c.title as cate_name from " . DB_PREFIX . "article a LEFT JOIN " . DB_PREFIX . "article_cate c on a.cate_id=c.id where {$where} order by a.update_time desc limit {$limit}"); $comment_count = $GLOBALS['db']->getOne("SELECT count(*) from " . DB_PREFIX . "article a LEFT JOIN " . DB_PREFIX . "article_cate c on a.cate_id=c.id where {$where} order by a.update_time asc"); $artilce_item = array(); foreach ($temp_artilce_list as $k => $v) { //最新智能头条type_id==0普通文章, type_id==1帮助文章,is_hot==1热门,is_week==1本周必读 if ($v['id'] > 0) { $artilce_item[$k]['cate_title'] = $v['title']; $artilce_item[$k]['seo_keyword'] = $v['seo_keyword']; $artilce_item[$k]['title'] = $v['title']; $artilce_item[$k]['content'] = $v['content']; $artilce_item[$k]['update_time'] = $v['update_time']; $artilce_item[$k]['cate_name'] = $v['cate_name']; $artilce_item[$k]['cate_url'] = url_wap('article_cate', array('id' => $v['cate_id'])); if ($v['rel_url'] == "") { $artilce_item[$k]['url'] = url_wap('article', array('id' => $v['id'])); } else { $artilce_item[$k]['url'] = $v['rel_url']; } } } $page = new Page($comment_count, $page_size); //初始化分页对象 $p = $page->show(); $GLOBALS['tmpl']->assign('pages', $p); unset($temp_artilce_list); $GLOBALS['tmpl']->assign("cates_list", $cates_list); $GLOBALS['tmpl']->assign("artilce_list", $artilce_item); $GLOBALS['tmpl']->display("article_cate_index.html"); }
function get_gopreview_wap() { $gopreview = es_session::get("gopreview"); if ($gopreview == get_current_url()) { $gopreview = url_wap("index"); } if (!isset($gopreview) || $gopreview == "") { $gopreview = es_session::get('before_login') ? es_session::get('before_login') : url_wap("index"); } return $gopreview; }
public function add_leader_info() { if (!$GLOBALS['user_info']) { app_redirect(url_wap("user#login")); } $id = intval($_REQUEST['id']); $leader_info = $GLOBALS['db']->getRow("select invest.*,d.name as deal_name from " . DB_PREFIX . "investment_list as invest left join " . DB_PREFIX . "deal as d on d.id=invest.deal_id where invest.id=" . $id); if ($GLOBALS['user_info']['id'] != $leader_info['user_id']) { showErr("该页面不存在", 0, ""); return false; } $file = unserialize($leader_info['leader_moban']); $GLOBALS['tmpl']->assign('file', $file); $GLOBALS['tmpl']->assign('leader_info', $leader_info); $GLOBALS['tmpl']->assign('title', '上传领投信息'); $GLOBALS['tmpl']->display("account_add_leader_info.html"); }
function show_wap_avatar($u_id, $type = "middle") { $key = md5("AVATAR_" . $u_id . $type); if (isset($GLOBALS[$key])) { return $GLOBALS[$key]; } else { $avatar_key = md5("USER_AVATAR_" . $u_id); $avatar_data = $GLOBALS['dynamic_avatar_cache'][$avatar_key]; // 当前用户所有头像的动态缓存 if (!isset($avatar_data) || !isset($avatar_data[$key])) { $avatar_file = get_user_avatar($u_id, $type); $avatar_str = "<a href='" . url_wap("settings", array("id" => $u_id)) . "' style='text-align:center; display:inline-block;'>" . "<img src='" . $avatar_file . "' />" . "</a>"; $avatar_data[$key] = $avatar_str; if (count($GLOBALS['dynamic_avatar_cache']) < 500) { $GLOBALS['dynamic_avatar_cache'][$avatar_key] = $avatar_data; } } else { $avatar_str = $avatar_data[$key]; } $GLOBALS[$key] = $avatar_str; return $GLOBALS[$key]; } }
public function del_consignee() { if (!$GLOBALS['user_info']) { $data['html'] = $GLOBALS['tmpl']->display("inc/user_login_box.html", "", true); $data['status'] = 1; ajax_return($data); } else { $id = intval($_REQUEST['id']); $data = array('status' => 1, 'info' => '删除成功', 'jump' => url_wap("settings#consignee")); $re = $GLOBALS['db']->query("delete from " . DB_PREFIX . "user_consignee where id = " . $id . " and user_id = " . intval($GLOBALS['user_info']['id'])); if (!$re) { $data['status'] = 0; $data['info'] = "删除失败"; $data['jump'] = ""; } ajax_return($data); } }