public function save()
 {
     $data = $_POST;
     foreach ($data as $k => $v) {
         if ($k == "description") {
             $data[$k] = replace_public(btrim($v));
         } else {
             $data[$k] = strim($v);
         }
     }
     $data['user_id'] = intval($GLOBALS['user_info']['id']);
     $mode = "INSERT";
     $where = "";
     if ($GLOBALS['db']->getOne("SELECT count(*) FROM " . DB_PREFIX . "user_company WHERE user_id=" . intval($GLOBALS['user_info']['id'])) > 0) {
         $mode = "UPDATE";
         $where = "user_id=" . intval($GLOBALS['user_info']['id']);
     }
     $GLOBALS['db']->autoExecute(DB_PREFIX . "user_company", $data, $mode, $where);
     if ($GLOBALS['db']->affected_rows() > 0) {
         $user_info_re = array();
         $user_info_re['enterpriseName'] = $data['enterpriseName'];
         $user_info_re['bankLicense'] = $data['bankLicense'];
         $user_info_re['orgNo'] = $data['orgNo'];
         $user_info_re['businessLicense'] = $data['businessLicense'];
         $user_info_re['taxNo'] = $data['enterpriseName'];
         $GLOBALS['db']->autoExecute(DB_PREFIX . "user", $user_info_re, "UPDATE", "id=" . intval($GLOBALS['user_info']['id']));
     }
     app_redirect(url("index", "uc_company#index"));
 }
 public function do_add_quota()
 {
     $data['user_id'] = $GLOBALS['user_info']['id'];
     $data['name'] = strim($_REQUEST['name']);
     $data['borrow_amount'] = floatval($_REQUEST['borrow_amount']);
     $data['description'] = replace_public(btrim($_REQUEST['description']));
     $data['description'] = valid_tag($data['description']);
     $data['is_effect'] = 1;
     $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['create_time'] = TIME_UTC;
     //申请时间
     $GLOBALS['db']->autoExecute(DB_PREFIX . "deal_quota_submit", $data);
     if ($GLOBALS['db']->insert_id()) {
         showSuccess('提交成功,等待管理员审核', 0, url("index", "uc_deal_quota"));
     } else {
         showErr('提交失败', 0, url("index", "uc_deal_quota"));
     }
 }
 public function save()
 {
     $data = $_POST;
     foreach ($data as $k => $v) {
         if ($k == "description") {
             $data[$k] = replace_public(btrim($v));
         } else {
             $data[$k] = strim($v);
         }
     }
     $data['user_id'] = intval($GLOBALS['user_info']['id']);
     $mode = "INSERT";
     $where = "";
     if ($GLOBALS['db']->getOne("SELECT count(*) FROM " . DB_PREFIX . "user_company WHERE user_id=" . intval($GLOBALS['user_info']['id'])) > 0) {
         $mode = "UPDATE";
         $where = "user_id=" . intval($GLOBALS['user_info']['id']);
     }
     $GLOBALS['db']->autoExecute(DB_PREFIX . "user_company", $data, $mode, $where);
     app_redirect(url("index", "uc_company#index"));
 }
Example #4
0
 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 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);
 }
Example #6
0
<?php

// +----------------------------------------------------------------------
// | Fanwe 方维o2o商业系统
// +----------------------------------------------------------------------
// | Copyright (c) 2011 http://bbs.52jscn.com All rights reserved.
// +----------------------------------------------------------------------
// | Author: 锦尚中国(bbs.52jscn.com)
// +----------------------------------------------------------------------
//用于处理 api同步登录的回调
require './system/common.php';
require './app/Lib/app_init.php';
$api_class = btrim($_REQUEST['c']);
if (file_exists(APP_ROOT_PATH . 'system/api_login/' . $api_class . '_api.php')) {
    $api = $GLOBALS['db']->getRow("select * from " . DB_PREFIX . "api_login where class_name='" . $api_class . "'");
    require_once APP_ROOT_PATH . 'system/api_login/' . $api_class . '_api.php';
    $api_class = $api['class_name'] . "_api";
    $api_obj = new $api_class($api);
    $api_obj->callback();
}
Example #7
0
 /**
  * 保存商品产品数据
  */
 public function do_save_publish()
 {
     $account_info = $GLOBALS['account_info'];
     $supplier_id = $account_info['supplier_id'];
     $account_id = $account_info['id'];
     $edit_type = intval($_REQUEST['edit_type']);
     $id = intval($_REQUEST['id']);
     if ($edit_type == 1 && $id > 0) {
         //判断是否有存在修改
         $deal_submit_info = $GLOBALS['db']->getRow("select * from " . DB_PREFIX . "deal_submit where deal_id = " . $id . " and supplier_id = " . $supplier_id);
         if ($deal_submit_info && $deal_submit_info['admin_check_status'] == 0) {
             $result['status'] = 0;
             $result['info'] = "已经存在申请操作,请先删除避免重复申请";
             ajax_return($result);
             exit;
         } else {
             $deal_info = $GLOBALS['db']->getRow("select d.* from " . DB_PREFIX . "deal d \n                        left join " . DB_PREFIX . "deal_location_link dll on dll.deal_id = d.id  \n                            where d.is_effect = 1 and d.is_delete = 0 and id=" . $id . " and supplier_id = " . $supplier_id . "\n                            and dll.location_id in(" . implode(",", $account_info['location_ids']) . ")");
             if (empty($deal_info)) {
                 $result['status'] = 0;
                 $result['info'] = "数据不存在或没有权限操作该数据";
                 ajax_return($result);
                 exit;
             }
             $new_data = $deal_info;
             $new_data['deal_id'] = $deal_info['id'];
             unset($new_data['id']);
             $new_data['supplier_id'] = $supplier_id;
             $new_data['account_id'] = $account_id;
             //如果数据已经有存在,通过审核的数据,先清除掉在进行插入更新操作
             if ($deal_submit_info && $deal_submit_info['admin_check_status'] != 0) {
                 $GLOBALS['db']->query("delete from " . DB_PREFIX . "deal_submit where id=" . $deal_submit_info['id']);
             }
             //先建立数据
             $GLOBALS['db']->autoExecute(DB_PREFIX . "deal_submit", $new_data);
             $deal_submit_id = $GLOBALS['db']->insert_id();
         }
     }
     // 白名单过滤
     require_once APP_ROOT_PATH . 'system/model/no_xss.php';
     $this->check_goods_publish_data($_REQUEST);
     $data['supplier_id'] = $supplier_id;
     // 所属商户
     $data['account_id'] = $account_id;
     $data['name'] = strim($_REQUEST['name']);
     // 商品名称
     $data['sub_name'] = strim($_REQUEST['sub_name']);
     // 简短名称
     $data['brief'] = strim($_REQUEST['brief']);
     // 简介
     $data['buy_type'] = 0;
     // 默认为普通商品
     $data['brand_id'] = intval($_REQUEST['brand_id']);
     // 品牌
     $data['shop_cate_id'] = intval($_REQUEST['shop_cate_id']);
     //商品分类
     $data['description'] = btrim(no_xss($_REQUEST['description']));
     //描述
     $data['begin_time'] = strim($_REQUEST['begin_time']) == '' ? 0 : to_timespan($_REQUEST['begin_time'], "Y-m-d H:i");
     $data['end_time'] = strim($_REQUEST['end_time']) == '' ? 0 : to_timespan($_REQUEST['end_time'], "Y-m-d H:i");
     $data['max_bought'] = intval($_REQUEST['max_bought']);
     // 库存
     $data['user_min_bought'] = intval($_REQUEST['user_min_bought']);
     // 用户最小购买
     $data['user_max_bought'] = intval($_REQUEST['user_max_bought']);
     // 用户最大购买
     $data['origin_price'] = intval($_REQUEST['origin_price']);
     // 原价
     $data['balance_price'] = intval($_REQUEST['balance_price']);
     // 商户结算价
     $data['current_price'] = intval($_REQUEST['current_price']);
     // 商品价
     $data['is_refund'] = intval($_REQUEST['is_refund']);
     //是否支持退款
     $data['is_delivery'] = intval($_REQUEST['is_delivery']);
     //是否支持退款
     //开始创建筛选项
     $filter = $_REQUEST['filter'];
     foreach ($filter as $filter_group_id => $filter_value) {
         $filter_data = array();
         $filter_data['filter'] = $filter_value;
         $filter_data['filter_group_id'] = $filter_group_id;
         $filter_data['deal_id'] = $list;
         $filter_data_cache[] = $filter_data;
     }
     $data['cache_deal_filter'] = serialize($filter_data_cache);
     $data['deal_goods_type'] = intval($_REQUEST['deal_goods_type']);
     //商品类型
     $data['create_time'] = NOW_TIME;
     $data['update_time'] = NOW_TIME;
     $data['is_shop'] = 1;
     $data['is_effect'] = 1;
     $data['is_delete '] = 0;
     if ($_REQUEST['deal_attr'] && count($_REQUEST['deal_attr']) > 0) {
         //多套餐
         $data['multi_attr'] = 1;
     } else {
         $data['multi_attr'] = 0;
     }
     $deal_tags = $_REQUEST['deal_tag'];
     // 标签
     $deal_tag = 0;
     foreach ($deal_tags as $t) {
         $t2 = pow(2, $t);
         // 根据tag计算免预约
         if ($t == 1) {
             $data['auto_order'] = 1;
         }
         $deal_tag = $deal_tag | $t2;
     }
     $data['deal_tag'] = $deal_tag;
     foreach ($deal_tags as $t) {
         if ($t == 0) {
             $data['is_lottery'] = 1;
         }
         // 根据tag计算免预约
         if ($t == 1) {
             $data['auto_order'] = 1;
         }
         // 随时退
         if ($t == 6) {
             $data['any_refund'] = 1;
         }
         // 过期退
         if ($t == 5) {
             $data['expire_refund'] = 1;
         }
     }
     if ($data['any_refund'] == 1 || $data['expire_refund'] == 1) {
         $data['is_refund'] = 1;
     }
     $icon = strim($_REQUEST['img_icon']);
     // 缩略图
     $focus_imgs = $_REQUEST['focus_imgs'];
     // 图集
     if ($id > 0) {
         //更新操作需要替换图片地址
         $icon = replace_public($icon);
         foreach ($focus_imgs as $k => $v) {
             $v = replace_public($v);
             $focus_imgs[$k] = $v;
         }
     }
     $data['icon'] = $icon;
     // 主图
     foreach ($focus_imgs as $k => $v) {
         if ($v != '') {
             $data['img'] = $v;
             break;
         }
     }
     $location_id = $_REQUEST['location_id'];
     // 支持门店
     $data['cache_location_id'] = serialize($location_id);
     //支持门店缓存
     $data['cache_focus_imgs'] = serialize($focus_imgs);
     //图集缓存
     // 开始处理属性
     $deal_attr = $_REQUEST['deal_attr'];
     $deal_attr_price = $_REQUEST['deal_attr_price'];
     $deal_add_balance_price = $_REQUEST['deal_add_balance_price'];
     $deal_attr_stock_hd = $_REQUEST['deal_attr_stock_hd'];
     foreach ($deal_attr as $goods_type_attr_id => $arr) {
         foreach ($arr as $k => $v) {
             if ($v != '') {
                 $deal_attr_item['goods_type_attr_id'] = $goods_type_attr_id;
                 $deal_attr_item['name'] = $v;
                 $deal_attr_item['price'] = $deal_attr_price[$goods_type_attr_id][$k];
                 $deal_attr_item['add_balance_price'] = $deal_add_balance_price[$goods_type_attr_id][$k];
                 $deal_attr_item['is_checked'] = intval($deal_attr_stock_hd[$goods_type_attr_id][$k]);
                 $deal_attr_data[] = $deal_attr_item;
             }
         }
     }
     $data['cache_deal_attr'] = serialize($deal_attr_data);
     // 开始创建属性库存
     $stock_cfg = $_REQUEST['stock_cfg_num'];
     $attr_cfg = $_REQUEST['stock_attr'];
     $attr_str = $_REQUEST['stock_cfg'];
     foreach ($stock_cfg as $row => $v) {
         $stock_data = array();
         $stock_data['stock_cfg'] = $v;
         $stock_data['attr_str'] = $attr_str[$row];
         $attr_cfg_data = array();
         foreach ($attr_cfg as $attr_id => $cfg) {
             $attr_cfg_data[$attr_id] = $cfg[$row];
         }
         $stock_data['attr_cfg'] = serialize($attr_cfg_data);
         $attr_stock[] = $stock_data;
     }
     $data['cache_attr_stock'] = serialize($attr_stock);
     // 管理员状态
     $data['admin_check_status'] = 0;
     // 待审核
     if ($id > 0) {
         if ($edit_type == 1) {
             $id = $deal_submit_id;
             //上面生成的记录IDs
             $data['biz_apply_status'] = 2;
             // 修改申请
         }
         $GLOBALS['db']->autoExecute(DB_PREFIX . "deal_submit", $data, "UPDATE", " id=" . $id . " and account_id=" . $account_id);
         $result['status'] = 1;
         $result['info'] = "修改成功,等待管理员审核";
         $result['jump'] = url("biz", "goods#no_online_index");
     } else {
         $data['biz_apply_status'] = 1;
         // 新增申请
         $list = $GLOBALS['db']->autoExecute(DB_PREFIX . "deal_submit", $data);
         if ($list) {
             $result['status'] = 1;
             $result['info'] = "提交成功,等待管理员审核";
             $result['jump'] = url("biz", "goods#no_online_index");
         }
     }
     ajax_return($result);
 }
Example #8
0
 public function send_pm()
 {
     if ($GLOBALS['user_info']) {
         $user_name = strim($_REQUEST['user_name']);
         $user_id = $GLOBALS['db']->getOne("select id from " . DB_PREFIX . "user where user_name = '" . $user_name . "'");
         if (intval($user_id) == 0) {
             $result['status'] = 0;
             $result['info'] = $GLOBALS['lang']['TO_USER_EMPTY'];
             ajax_return($result);
         }
         /*if($GLOBALS['db']->getOne("select count(*) from ".DB_PREFIX."user_focus where focused_user_name = '".$GLOBALS['user_info']['user_name']."' and focus_user_name = '".$user_name."'")==0)
         		{
         			//不是粉丝,验证是否有来信记录
         			$sql = "select count(*) from ".DB_PREFIX."msg_box 
         					where is_delete = 0 and 
         					(to_user_id = ".intval($GLOBALS['user_info']['id'])." and `type` = 0 and from_user_id = ".$user_id.")";
         			$inbox_count = $GLOBALS['db']->getOne($sql);
         			if($inbox_count==0)
         			{
         				$result['status'] = 0;
         				$result['info'] = $GLOBALS['lang']['FANS_ONLY'];
         				ajax_return($result);
         			}			
         		}*/
         $content = btrim($_REQUEST['content']);
         send_user_msg("", $content, intval($GLOBALS['user_info']['id']), $user_id, TIME_UTC);
         $result['status'] = 1;
         $key = array($user_id, intval($GLOBALS['user_info']['id']));
         sort($key);
         $group_key = implode("_", $key);
         $result['info'] = url("shop", "uc_msg#deal", array("id" => $group_key));
     } else {
         $result['status'] = 0;
         $result['info'] = $GLOBALS['lang']['PLEASE_LOGIN_FIRST'];
     }
     ajax_return($result);
 }
Example #9
0
 public function do_save_publish()
 {
     $account_info = $GLOBALS['account_info'];
     $supplier_id = $account_info['supplier_id'];
     $account_id = $account_info['id'];
     $edit_type = intval($_REQUEST['edit_type']);
     $id = intval($_REQUEST['id']);
     if ($edit_type == 1 && $id > 0) {
         //判断是否有存在修改
         $event_submit_info = $GLOBALS['db']->getRow("select * from " . DB_PREFIX . "event_biz_submit where event_id = " . $id . " and supplier_id = " . $supplier_id);
         if ($event_submit_info && $event_submit_info['admin_check_status'] == 0) {
             //存在未审核数据
             $result['status'] = 0;
             $result['info'] = "已经存在申请操作,请先删除避免重复申请";
             ajax_return($result);
             exit;
         } else {
             $event_info = $GLOBALS['db']->getRow("select e.* from " . DB_PREFIX . "event e\n\t                        left join " . DB_PREFIX . "event_location_link ell on ell.event_id = e.id \n                            where is_effect = 1 and id=" . $id . " and supplier_id = " . $supplier_id . "\n                            and ell.location_id in(" . implode(",", $account_info['location_ids']) . ")");
             if (empty($event_info)) {
                 $result['status'] = 0;
                 $result['info'] = "数据不存在或没有权限操作该数据";
                 ajax_return($result);
                 exit;
             }
             $new_data = $event_info;
             $new_data['event_id'] = $event_info['id'];
             unset($new_data['id']);
             $new_data['supplier_id'] = $supplier_id;
             $new_data['account_id'] = $account_id;
             //如果数据已经有存在,通过审核的数据,先清除掉在进行插入更新操作
             if ($event_submit_info && $event_submit_info['admin_check_status'] != 0) {
                 //删除已审核 或 拒绝的数据
                 $GLOBALS['db']->query("delete from " . DB_PREFIX . "event_biz_submit where id=" . $event_submit_info['id']);
             }
             //先建立数据
             $GLOBALS['db']->autoExecute(DB_PREFIX . "event_biz_submit", $new_data);
             $event_submit_id = $GLOBALS['db']->insert_id();
         }
     }
     // 白名单过滤
     require_once APP_ROOT_PATH . 'system/model/no_xss.php';
     //数据验证
     $this->check_event_publish_data($_REQUEST);
     $data['supplier_id'] = $supplier_id;
     // 所属商户
     $data['account_id'] = $account_id;
     $data['name'] = strim($_REQUEST['name']);
     // 名称
     //供应商标志图片
     $icon = strim($_REQUEST['icon']);
     // 活动图片
     if ($id > 0) {
         //更新操作需要替换图片地址
         $icon = replace_public($icon);
     }
     $data['icon'] = $icon;
     $data['event_begin_time'] = strim($_REQUEST['event_begin_time']) == '' ? 0 : to_timespan($_REQUEST['event_begin_time'], "Y-m-d H:i");
     $data['event_end_time'] = strim($_REQUEST['event_end_time']) == '' ? 0 : to_timespan($_REQUEST['event_end_time'], "Y-m-d H:i");
     $data['submit_begin_time'] = strim($_REQUEST['submit_begin_time']) == '' ? 0 : to_timespan($_REQUEST['submit_begin_time'], "Y-m-d H:i");
     // 报名开始时间:
     $data['submit_end_time'] = strim($_REQUEST['submit_end_time']) == '' ? 0 : to_timespan($_REQUEST['submit_end_time'], "Y-m-d H:i");
     // 报名结束时间
     $data['total_count'] = intval($_REQUEST['total_count']);
     //名额
     $data['score_limit'] = intval($_REQUEST['score_limit']);
     //消耗积分
     $data['point_limit'] = intval($_REQUEST['point_limit']);
     //经验限制
     $data['city_id'] = intval($_REQUEST['city_id']);
     // 城市
     $area_id = $_REQUEST['area_id'];
     // 地区列表
     $data['cache_event_area_link'] = serialize($area_id);
     $data['cate_id'] = intval($_REQUEST['cate_id']);
     // 分类
     $location_id = $_REQUEST['location_id'];
     // 支持门店
     $data['cache_event_location_link'] = serialize($location_id);
     $data['address'] = strim($_REQUEST['address']);
     // 地址
     $data['api_address'] = strim($_REQUEST['api_address']);
     // 地图定位的地址
     $data['xpoint'] = strim($_REQUEST['xpoint']);
     // 经度
     $data['ypoint'] = strim($_REQUEST['ypoint']);
     // 纬度
     $data['brief'] = strim($_REQUEST['brief']);
     // 部门简介
     $data['content'] = btrim(no_xss($_REQUEST['content']));
     //内容
     //字段配置
     foreach ($_REQUEST['field_id'] as $k => $field_id) {
         $event_field = array();
         $event_field['event_id'] = 0;
         $event_field['field_show_name'] = $_REQUEST['field_show_name'][$k];
         $event_field['field_type'] = $_REQUEST['field_type'][$k];
         $event_field['value_scope'] = $_REQUEST['value_scope'][$k];
         $event_field['sort'] = $k;
         $cache_event_field[] = $event_field;
     }
     $data['cache_event_field'] = serialize($cache_event_field);
     /*默认参数*/
     $data['is_effect'] = 1;
     // 管理员状态
     $data['admin_check_status'] = 0;
     // 待审核
     if ($id > 0) {
         if ($edit_type == 1) {
             $id = $event_submit_id;
             //上面生成的记录IDs
             $data['biz_apply_status'] = 2;
             // 修改申请
         }
         $GLOBALS['db']->autoExecute(DB_PREFIX . "event_biz_submit", $data, "UPDATE", " id=" . $id . " and account_id=" . $account_id);
         $result['status'] = 1;
         $result['info'] = "修改成功,等待管理员审核";
         $result['jump'] = url("biz", "event#no_online_index");
     } else {
         $data['biz_apply_status'] = 1;
         // 新增申请
         $list = $GLOBALS['db']->autoExecute(DB_PREFIX . "event_biz_submit", $data);
         if ($list) {
             $result['status'] = 1;
             $result['info'] = "提交成功,等待管理员审核";
             $result['jump'] = url("biz", "event#no_online_index");
         }
     }
     ajax_return($result);
 }
 /**
  * 保存账户资料
  */
 function accountsave()
 {
     $manageagency_info = $this->checkLogin();
     $data['brief'] = strim($_REQUEST["brief"]);
     $data['address'] = strim($_REQUEST["address"]);
     $data['header'] = replace_public(btrim($_REQUEST["header"]));
     $data['company_brief'] = strim($_REQUEST["company_brief"]);
     $data['history'] = replace_public(btrim($_REQUEST["history"]));
     $data['content'] = replace_public(btrim($_REQUEST["content"]));
     $GLOBALS['db']->autoExecute(DB_PREFIX . "deal_agency", $data, "UPDATE", "id=" . $manageagency_info['id']);
     $agency_info = $GLOBALS['db']->getRow("SELECT * FROM " . DB_PREFIX . "deal_agency  where id=" . $manageagency_info['id']);
     es_session::set("manageagency_info", $agency_info);
     showSuccess("操作成功", url("index", "manageagency#account"));
 }
Example #11
0
 public function insert()
 {
     B('FilterString');
     $data = M(MODULE_NAME)->create();
     //开始验证有效性
     $this->assign("jumpUrl", u(MODULE_NAME . "/add"));
     if (!check_empty($data['name'])) {
         $this->error(L("NAV_NAME_EMPTY_TIP"));
     }
     if (!check_empty($data['url']) && $_REQUEST['u_module'] == '') {
         $this->error(L("NAV_URL_EMPTY_TIP"));
     }
     if ($_REQUEST['u_module'] != '') {
         $data['app_index'] = $this->navs[$data['u_module']]['app_index'];
         $data['url'] = '';
     }
     if ($data['url'] != '') {
         $data['u_module'] = '';
         $data['u_action'] = '';
         $data['u_id'] = '';
         $data['u_param'] = '';
     }
     if (!isset($_REQUEST['u_action'])) {
         $data['u_action'] = '';
     }
     // 更新数据
     $data['u_param'] = btrim($data['u_param']);
     $list = M(MODULE_NAME)->add($data);
     $log_info = $data['name'];
     if (false !== $list) {
         //成功提示
         save_log($log_info . L("INSERT_SUCCESS"), 1);
         rm_auto_cache("cache_nav_list_shop");
         rm_auto_cache("cache_nav_list_tuan");
         rm_auto_cache("cache_nav_list_youhui");
         $this->success(L("INSERT_SUCCESS"));
     } else {
         //错误提示
         $dbErr = M()->getDbError();
         save_log($log_info . L("INSERT_FAILED") . $dbErr, 0);
         $this->error(L("INSERT_FAILED") . $dbErr);
     }
 }
Example #12
0
 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']);
         $data['view_info'] = unserialize($deal['view_info']);
         if ($deal['cate_id'] > 0) {
             $deal['cate_info'] = $GLOBALS['db']->getRow("select id,name,brief,uname,icon from " . DB_PREFIX . "deal_cate where id = " . $deal['cate_id'] . " and is_effect = 1 and is_delete = 0");
         }
     } else {
         $deal['name'] = strim($_REQUEST['borrowtitle']);
         $type_id = intval($_REQUEST['borrowtype']);
         $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']->getOne("SELECT icon FROM " . DB_PREFIX . "deal_loan_type WHERE id=" . intval($_REQUEST['systemimgpath']));
         }
         $deal['description'] = replace_public(valid_str(btrim($_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['rate_foramt'] = number_format(strim($_REQUEST['apr']), 2);
     $deal['repay_time'] = strim($_REQUEST['repaytime']);
     $deal['repay_time_type'] = intval($_REQUEST['repaytime_type']);
     $deal['loantype'] = intval($_REQUEST['loantype']);
     $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']->getRow("select * from " . DB_PREFIX . "user 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");
 }
Example #13
0
 /**
  * 保存团购产品数据
  */
 public function do_save_publish()
 {
     $account_info = $GLOBALS['account_info'];
     $supplier_id = $account_info['supplier_id'];
     $account_id = $account_info['id'];
     //print_r($_REQUEST);exit;
     $edit_type = intval($_REQUEST['edit_type']);
     $id = intval($_REQUEST['id']);
     if ($edit_type == 1 && $id > 0) {
         //判断是否有存在修改
         $youhui_submit_info = $GLOBALS['db']->getRow("select * from " . DB_PREFIX . "youhui_biz_submit where youhui_id = " . $id . " and supplier_id = " . $supplier_id);
         if ($youhui_submit_info && $youhui_submit_info['admin_check_status'] == 0) {
             $result['status'] = 0;
             $result['info'] = "已经存在申请操作,请先删除避免重复申请";
             ajax_return($result);
             exit;
         } else {
             $youhui_info = $GLOBALS['db']->getRow("select y.* from " . DB_PREFIX . "youhui as y \n                        left join " . DB_PREFIX . "youhui_location_link yl on yl.youhui_id = y.id  \n                            where y.is_effect = 1 and y.id=" . $id . " and y.supplier_id = " . $supplier_id . "\n                            and yl.location_id in(" . implode(",", $account_info['location_ids']) . ")");
             if (empty($youhui_info)) {
                 $result['status'] = 0;
                 $result['info'] = "数据不存在或没有权限操作该数据";
                 ajax_return($result);
                 exit;
             }
             $new_data = $youhui_info;
             $new_data['youhui_id'] = $youhui_info['id'];
             $new_data['is_effect'] = 1;
             unset($new_data['id']);
             $new_data['supplier_id'] = $supplier_id;
             $new_data['account_id'] = $account_id;
             //如果数据已经有存在,通过审核的数据,先清除掉在进行插入更新操作
             if ($youhui_submit_info && $youhui_submit_info['admin_check_status'] == 1) {
                 $GLOBALS['db']->query("delete from " . DB_PREFIX . "youhui_biz_submit where id=" . $youhui_submit_info['id']);
             }
             //先建立数据
             $GLOBALS['db']->autoExecute(DB_PREFIX . "youhui_biz_submit", $new_data);
             $youhui_submit_id = $GLOBALS['db']->insert_id();
         }
     }
     // 白名单过滤
     require_once APP_ROOT_PATH . 'system/model/no_xss.php';
     $this->check_publish_data($_REQUEST);
     $data['supplier_id'] = $supplier_id;
     // 所属商户
     $data['account_id'] = $account_id;
     $data['name'] = strim($_REQUEST['name1']);
     // 优惠券名称
     $data['icon'] = strim($_REQUEST['icon']);
     // 优惠券名称
     $data['image'] = strim($_REQUEST['image']);
     // 优惠券名称
     if ($id > 0) {
         //更新操作需要替换图片地址
         $data['icon'] = replace_public($data['icon']);
         $data['image'] = replace_public($data['image']);
     }
     $data['begin_time'] = strim($_REQUEST['begin_time']) == '' ? 0 : to_timespan($_REQUEST['begin_time'], "Y-m-d H:i");
     $data['end_time'] = strim($_REQUEST['end_time']) == '' ? 0 : to_timespan($_REQUEST['end_time'], "Y-m-d H:i");
     $data['expire_day'] = intval($_REQUEST['expire_day']);
     // 有效天数
     $data['total_num'] = intval($_REQUEST['total_num']);
     // 总条数
     $data['user_limit'] = intval($_REQUEST['user_limit']);
     // 下载限制
     $data['city_id'] = intval($_REQUEST['city_id']);
     // 城市
     $data['deal_cate_id'] = intval($_REQUEST['cate_id']);
     // 分类
     $data['youhui_type'] = intval($_REQUEST['youhui_type']);
     // 优惠券类型
     $data['xpoint'] = strim($_REQUEST['xpoint']);
     $data['ypoint'] = strim($_REQUEST['ypoint']);
     $data['is_effect'] = 1;
     // 简介
     $data['list_brief'] = strim($_REQUEST['list_brief']);
     // 简介
     $data['description'] = btrim(no_xss($_REQUEST['description']));
     $data['use_notice'] = btrim(no_xss($_REQUEST['use_notice']));
     $data['create_time'] = NOW_TIME;
     $deal_cate_type_id = $_REQUEST['deal_cate_type_id'];
     // 子分类
     foreach ($deal_cate_type_id as $k => $v) {
         $deal_cate_type_id[$k] = intval($v);
     }
     $location_id = $_REQUEST['location_id'];
     // 支持门店
     foreach ($location_id as $k => $v) {
         $location_id[$k] = intval($v);
     }
     $data['cache_deal_cate_type_youhui_link'] = serialize($deal_cate_type_id);
     $data['cache_youhui_location_link'] = serialize($location_id);
     // 管理员状态
     $data['admin_check_status'] = 0;
     // 待审核
     if ($id > 0) {
         if ($edit_type == 1) {
             $id = $youhui_submit_id;
             //上面生成的记录IDs
             $data['biz_apply_status'] = 2;
             // 修改申请
         }
         $GLOBALS['db']->autoExecute(DB_PREFIX . "youhui_biz_submit", $data, "UPDATE", " id=" . $id . " and account_id=" . $account_id);
         $result['status'] = 1;
         $result['info'] = "修改成功,等待管理员审核";
         $result['jump'] = url("biz", "youhui#no_online_index");
     } else {
         $data['biz_apply_status'] = 1;
         // 新增申请
         $list = $GLOBALS['db']->autoExecute(DB_PREFIX . "youhui_biz_submit", $data);
         if ($list) {
             $result['status'] = 1;
             $result['info'] = "提交成功,等待管理员审核";
             $result['jump'] = url("biz", "youhui#no_online_index");
         }
     }
     ajax_return($result);
 }
Example #14
0
 public function update()
 {
     B('FilterString');
     $data = M(MODULE_NAME)->create();
     //		if($_FILES['preview']['name']!='')
     //		{
     //			$result = $this->uploadImage();
     //			if($result['status']==0)
     //			{
     //				$this->error($result['info'],$ajax);
     //			}
     //			//删除图片
     //			@unlink(get_real_path().M("Article")->where("id=".$data['id'])->getField("preview"));
     //			$data['preview'] = $result['data'][0]['bigrecpath'].$result['data'][0]['savename'];
     //		}
     $log_info = M(MODULE_NAME)->where("id=" . intval($data['id']))->getField("title");
     //开始验证有效性
     $this->assign("jumpUrl", u(MODULE_NAME . "/edit", array("id" => $data['id'])));
     if (!check_empty($data['title'])) {
         $this->error(L("ARTICLE_TITLE_EMPTY_TIP"));
     }
     if ($data['cate_id'] == 0) {
         $this->error(L("ARTICLE_CATE_EMPTY_TIP"));
     }
     $data['u_module'] = strim($_REQUEST['u_module']);
     $data['u_action'] = strim($_REQUEST['u_action']);
     $data['url'] = strim($_REQUEST['url']);
     $data['u_param'] = btrim($_REQUEST['u_param']);
     if ($data['u_module'] != '') {
         $rel_url = 'u:';
         $navs = (require_once APP_ROOT_PATH . "system/web_cfg/" . APP_TYPE . "/webnav_cfg.php");
         $rel_url .= $navs[$data['u_module']]['app_index'] . '|' . $data['u_module'];
         if ($data['u_action'] != "") {
             $rel_url .= '#' . $data['u_action'];
         }
         if ($data['u_param'] != "") {
             $rel_url .= '|' . $data['u_param'];
         }
     } elseif ($data['url'] != '') {
         $rel_url = $data['url'];
     }
     if ($rel_url === null) {
         $rel_url = "";
     }
     $data['rel_url'] = $rel_url;
     if (!check_empty($data['content']) && $data['rel_url'] == '') {
         $this->error(L("ARTICLE_CONTENT_EMPTY_TIP"));
     }
     // 更新数据
     $data['update_time'] = NOW_TIME;
     $list = M(MODULE_NAME)->save($data);
     if (false !== $list) {
         //成功提示
         save_log($log_info . L("UPDATE_SUCCESS"), 1);
         $this->success(L("UPDATE_SUCCESS"));
     } else {
         //错误提示
         save_log($log_info . L("UPDATE_FAILED"), 0);
         $this->error(L("UPDATE_FAILED"), 0, $log_info . L("UPDATE_FAILED"));
     }
 }
Example #15
0
 public function do_save_publish()
 {
     $account_info = $GLOBALS['account_info'];
     $supplier_id = $account_info['supplier_id'];
     $account_id = $account_info['id'];
     $edit_type = intval($_REQUEST['edit_type']);
     $id = intval($_REQUEST['id']);
     if ($edit_type == 1 && $id > 0) {
         //判断是否有存在修改
         $location_submit_info = $GLOBALS['db']->getRow("select * from " . DB_PREFIX . "supplier_location_biz_submit where location_id = " . $id . " and supplier_id = " . $supplier_id);
         if ($location_submit_info && $location_submit_info['admin_check_status'] == 0) {
             //存在未审核数据
             $result['status'] = 0;
             $result['info'] = "已经存在申请操作,请先删除避免重复申请";
             ajax_return($result);
             exit;
         } else {
             $location_info = $GLOBALS['db']->getRow("select * from " . DB_PREFIX . "supplier_location\n                            where is_effect = 1 and id=" . $id . " and supplier_id = " . $supplier_id . "\n                            and id in(" . implode(",", $account_info['location_ids']) . ")");
             if (empty($location_info)) {
                 $result['status'] = 0;
                 $result['info'] = "数据不存在或没有权限操作该数据";
                 ajax_return($result);
                 exit;
             }
             $new_data = $location_info;
             $new_data['location_id'] = $location_info['id'];
             unset($new_data['id']);
             $new_data['supplier_id'] = $supplier_id;
             $new_data['account_id'] = $account_id;
             //如果数据已经有存在,通过审核的数据,先清除掉在进行插入更新操作
             if ($location_submit_info && $location_submit_info['admin_check_status'] != 0) {
                 //删除已审核 或 拒绝的数据
                 $GLOBALS['db']->query("delete from " . DB_PREFIX . "supplier_location_biz_submit where id=" . $location_submit_info['id']);
             }
             //先建立数据
             $GLOBALS['db']->autoExecute(DB_PREFIX . "supplier_location_biz_submit", $new_data);
             $location_submit_id = $GLOBALS['db']->insert_id();
         }
     }
     // 白名单过滤
     require_once APP_ROOT_PATH . 'system/model/no_xss.php';
     //数据验证
     $this->check_location_publish_data($_REQUEST);
     $data['supplier_id'] = $supplier_id;
     // 所属商户
     $data['account_id'] = $account_id;
     $data['name'] = strim($_REQUEST['name']);
     // 名称
     $data['tags'] = strim($_REQUEST['tags']);
     // 标签
     //供应商标志图片
     $preview_img = strim($_REQUEST['preview']);
     // 缩略图
     if ($id > 0) {
         //更新操作需要替换图片地址
         $preview_img = replace_public($preview_img);
     }
     $data['preview'] = $preview_img;
     //图库
     $location_images = $_REQUEST['location_images'];
     foreach ($location_images as $k => $v) {
         $cache_location_images[] = replace_public($v);
     }
     $data['cache_supplier_location_images'] = serialize($cache_location_images);
     $data['city_id'] = intval($_REQUEST['city_id']);
     // 城市
     $area_id = $_REQUEST['area_id'];
     // 地区列表
     $data['cache_supplier_location_area_link'] = serialize($area_id);
     $data['deal_cate_id'] = intval($_REQUEST['cate_id']);
     // 分类
     $deal_cate_type_id = $_REQUEST['deal_cate_type_id'];
     // 子分类
     $data['cache_deal_cate_type_location_link'] = serialize($deal_cate_type_id);
     $data['address'] = strim($_REQUEST['address']);
     // 地址
     $data['route'] = strim($_REQUEST['route']);
     // 交通路线
     $data['tel'] = strim($_REQUEST['tel']);
     // 地址
     $data['address'] = strim($_REQUEST['address']);
     // 联系电话
     $data['contact'] = strim($_REQUEST['contact']);
     // 联系人
     $data['open_time'] = strim($_REQUEST['open_time']);
     // 营业时间
     $data['api_address'] = strim($_REQUEST['api_address']);
     // 地图定位的地址
     $data['xpoint'] = strim($_REQUEST['xpoint']);
     // 经度
     $data['ypoint'] = strim($_REQUEST['ypoint']);
     // 纬度
     $data['brief'] = btrim(no_xss($_REQUEST['brief']));
     // 部门简介
     /*默认参数*/
     $data['is_main'] = 0;
     $data['is_effect'] = 1;
     // 管理员状态
     $data['admin_check_status'] = 0;
     // 待审核
     if ($id > 0) {
         if ($edit_type == 1) {
             $id = $location_submit_id;
             //上面生成的记录IDs
             $data['biz_apply_status'] = 2;
             // 修改申请
         }
         $GLOBALS['db']->autoExecute(DB_PREFIX . "supplier_location_biz_submit", $data, "UPDATE", " id=" . $id . " and account_id=" . $account_id);
         $result['status'] = 1;
         $result['info'] = "修改成功,等待管理员审核";
         $result['jump'] = url("biz", "location#no_online_index");
     } else {
         $data['biz_apply_status'] = 1;
         // 新增申请
         $list = $GLOBALS['db']->autoExecute(DB_PREFIX . "supplier_location_biz_submit", $data);
         if ($list) {
             $result['status'] = 1;
             $result['info'] = "提交成功,等待管理员审核";
             $result['jump'] = url("biz", "location#no_online_index");
         }
     }
     ajax_return($result);
 }
Example #16
0
 function save_create()
 {
     require_once APP_ROOT_PATH . 'app/Lib/uc.php';
     if (!$GLOBALS['user_info']) {
         app_redirect(url("user#login"));
     }
     $order = $GLOBALS["db"]->getRow("select * from " . DB_PREFIX . "licai where user_id =" . $GLOBALS["user_info"]["id"] . " and status =0 and verify = 0");
     if ($order) {
         showErr("您已经有申请的理财在审核,请耐心等待");
     }
     $data = array();
     $data["name"] = $_REQUEST["name"];
     $lc_sn = $GLOBALS["db"]->getOne("select max(id) from " . DB_PREFIX . "licai");
     $data['sort'] = $lc_sn + 1;
     $data["licai_sn"] = "LC" . to_date(TIME_UTC, "Y") . "" . str_pad($lc_sn + 1, 7, 0, STR_PAD_LEFT);
     $data["user_id"] = intval($GLOBALS['user_info']["id"]);
     $data['img'] = strim($_REQUEST['img']);
     $data['begin_buy_date'] = strim($_REQUEST['begin_buy_date']);
     $data['end_buy_date'] = strim($_REQUEST['end_buy_date']);
     $data['begin_interest_date'] = strim($_REQUEST['begin_interest_date']);
     $data['end_date'] = strim($_REQUEST['end_date']);
     $data['min_money'] = floatval($_REQUEST['min_money']);
     $data['max_money'] = floatval($_REQUEST['max_money']);
     $data['scope'] = strim($_REQUEST['scope']);
     $data['profit_way'] = strim($_REQUEST['profit_way']);
     $data['time_limit'] = intval($_REQUEST['time_limit']);
     $data['begin_interest_type'] = intval($_REQUEST['begin_interest_type']);
     $data['product_size'] = strim($_REQUEST['product_size']);
     $data['type'] = intval($_REQUEST['type']);
     $data['status'] = 0;
     $data['purchasing_time'] = strim($_REQUEST['purchasing_time']);
     $data['description'] = replace_public(btrim($_REQUEST['description']));
     $data['description'] = valid_tag($data['description']);
     $data['brief'] = replace_public(btrim($_REQUEST['brief']));
     $data['brief'] = valid_tag($data['brief']);
     $data['rule_info'] = replace_public(btrim($_REQUEST['rule_info']));
     $data['rule_info'] = valid_tag($data['rule_info']);
     $data['net_value'] = strim($_REQUEST['net_value']);
     $data['fund_key'] = strim($_REQUEST['fund_key']);
     $data['fund_type_id'] = intval($_REQUEST['fund_type_id']);
     $data['fund_brand_id'] = intval($_REQUEST['fund_brand_id']);
     //$data['risk_rank'] = intval($_REQUEST['risk_rank']); //风险等级
     $data['verify'] = 0;
     if ($data['name'] == "") {
         showErr("请输入名称");
     }
     if ($data['begin_buy_date'] == "" || $data['begin_buy_date'] == '00000000') {
         showErr("请选择理财开始购买时间");
     }
     if ($data['max_money'] == 0) {
         showErr("单笔最大购买限额");
     }
     //余额宝
     if ($data['type'] == 0) {
         if ($data['end_date'] == "" || $data['end_date'] == '00000000') {
             showErr("请选择理财结束时间");
         }
     } else {
         if ($data['begin_interest_date'] == "" || $data['begin_interest_date'] == '00000000') {
             showErr("请选择起息时间");
         }
         if ($data['time_limit'] && ($data['end_date'] == "" || $data['end_date'] == '00000000')) {
             showErr("项目结束时间和理财期限至少填写一个");
         }
     }
     $GLOBALS['db']->autoExecute(DB_PREFIX . "licai", $data, "INSERT");
     showSuccess("提交成功,等待管理员审核", 0, url("index", "licai#uc_published_lc"));
 }