Esempio n. 1
0
 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 index()
 {
     $root = array();
     $ajax = intval($_REQUEST['ajax']);
     $root['ajax'] = $ajax;
     $email = strim($GLOBALS['request']['email']);
     //用户名或邮箱
     $pwd = strim($GLOBALS['request']['pwd']);
     //密码
     //检查用户,用户密码
     $user = user_check($email, $pwd);
     $user_id = intval($user['id']);
     if ($user_id > 0) {
         $id = intval($_REQUEST['id']);
         $deal_info = $GLOBALS['db']->getRow("select * from " . DB_PREFIX . "deal where id = " . $id . " and is_delete = 0 and is_effect = 1 and user_id = " . intval($GLOBALS['user_info']['id']));
         if (!$deal_info) {
             $root['info'] = "不能更新该项目的动态";
             output($root);
         } else {
             $data['log_info'] = strim($_REQUEST['log_info']);
             if ($data['log_info'] == "") {
                 $root['info'] = "请输入更新的内容";
                 output($root);
             }
             $data['image'] = strim($_REQUEST['image']) != "" ? replace_public($_REQUEST['image']) : "";
             $data['vedio'] = strim($_REQUEST['vedio']);
             if ($data['vedio'] != "") {
                 require_once APP_ROOT_PATH . "system/utils/vedio.php";
                 $vedio = fetch_vedio_url($_REQUEST['vedio']);
                 if ($vedio != "") {
                     $data['source_vedio'] = $vedio;
                 } else {
                     $root['info'] = "非法的视频地址";
                     output($root);
                 }
             }
             $data['user_id'] = intval($GLOBALS['user_info']['id']);
             $data['deal_id'] = $id;
             $data['create_time'] = NOW_TIME;
             $data['user_name'] = $GLOBALS['user_info']['user_name'];
             $GLOBALS['db']->autoExecute(DB_PREFIX . "deal_log", $data);
             $GLOBALS['db']->query("update " . DB_PREFIX . "deal set log_count = log_count + 1 where id = " . $deal_info['id']);
             showSuccess("", $ajax, url("deal#update", array("id" => $deal_info['id'])));
         }
     } else {
         $root['user_login_status'] = 0;
         output($root);
     }
 }
 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"));
 }
 public function update()
 {
     if (intval($_POST['id']) == 0) {
         showErr($GLOBALS['lang']['ERROR_TITLE'], 0, url("biz", "profile"));
         exit;
     }
     $id = intval($_POST['id']);
     $s_account_info = es_session::get("account_info");
     $location_ids = $s_account_info['location_ids'];
     $info = $GLOBALS['db']->getRow(" SELECT * FROM " . DB_PREFIX . "supplier_location WHERE id = " . intval($id) . " and id in (" . implode(",", $s_account_info['location_ids']) . ")");
     if (!$info) {
         showErr("门店不存在或者没有编辑该门店的权限");
     }
     $data['preview'] = str_replace(get_domain() . APP_ROOT, ".", addslashes(htmlspecialchars(trim($_POST['preview']))));
     $data['tags'] = addslashes(htmlspecialchars(trim($_POST['tags'])));
     $data['address'] = addslashes(htmlspecialchars(trim($_POST['address'])));
     $data['route'] = addslashes(htmlspecialchars(trim($_POST['route'])));
     $data['tel'] = addslashes(htmlspecialchars(trim($_POST['tel'])));
     $data['contact'] = addslashes(htmlspecialchars(trim($_POST['contact'])));
     $data['open_time'] = addslashes(htmlspecialchars(trim($_POST['open_time'])));
     $data['api_address'] = addslashes(htmlspecialchars(trim($_POST['api_address'])));
     $data['xpoint'] = $_POST['xpoint'];
     $data['ypoint'] = $_POST['ypoint'];
     $data['sms_content'] = addslashes(htmlspecialchars(trim($_POST['sms_content'])));
     $data['brief'] = addslashes(trim(replace_public($_POST['brief'])));
     $data['brief'] = valid_tag($data['brief']);
     $data['id'] = intval($_POST['id']);
     $data['seo_title'] = addslashes(htmlspecialchars(trim($_POST['seo_title'])));
     $data['seo_keyword'] = addslashes(htmlspecialchars(trim($_POST['seo_keyword'])));
     $data['seo_description'] = addslashes(htmlspecialchars(trim($_POST['seo_description'])));
     $rs = $GLOBALS['db']->autoExecute(DB_PREFIX . "supplier_location", $data, "UPDATE", " id = " . intval($_POST['id']));
     if ($rs) {
         //更新统计
         syn_supplier_locationcount($data);
         syn_supplier_location_match($data['id']);
         $cache_id = md5("store" . "view" . $data['id']);
         $GLOBALS['tmpl']->clear_cache('store_view.html', $cache_id);
         showSuccess($GLOBALS['lang']['SUPPLIER_MODIFY_SUCCESS'], 0, url("biz", "profile#modify", array("id" => intval($_POST['id']))));
     }
 }
Esempio n. 6
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);
 }
Esempio n. 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) {
         //判断是否有存在修改
         $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 credit_save()
 {
     $authorized_info = es_session::get("authorized_info");
     $type = strim($_REQUEST['type']);
     $credit_type = load_auto_cache("credit_type");
     if (!isset($credit_type['list'][$type])) {
         showErr('认证类型不存在', $this->is_ajax);
     }
     $field_array = array("credit_identificationscanning" => "idcardpassed", "credit_contact" => "workpassed", "credit_credit" => "creditpassed", "credit_incomeduty" => "incomepassed", "credit_house" => "housepassed", "credit_car" => "carpassed", "credit_marriage" => "marrypassed", "credit_titles" => "skillpassed", "credit_videoauth" => "videopassed", "credit_mobilereceipt" => "mobiletruepassed", "credit_residence" => "residencepassed", "credit_seal" => "sealpassed");
     $u_c_data[$field_array[$type]] = 0;
     //身份认证
     if ($type == "credit_identificationscanning") {
         $u_c_data['real_name'] = strim($_REQUEST['real_name']);
         $u_c_data['idno'] = strim($_REQUEST['idno']);
         if (getIDCardInfo($u_c_data['idno']) == 0) {
             showErr("提交失败,身份证号码错误!", $this->is_ajax);
         }
         if ($GLOBALS['db']->getOne("select count(*) from " . DB_PREFIX . "user where idno = '" . $u_c_data['idno'] . "' and id <> " . intval($authorized_info['id'])) > 0) {
             showErr("提交失败,身份证号码已使用!", $this->is_ajax);
         }
         $u_c_data['sex'] = intval($_REQUEST['sex']);
         $u_c_data['byear'] = intval($_REQUEST['byear']);
         $u_c_data['bmonth'] = intval($_REQUEST['bmonth']);
         $u_c_data['bday'] = intval($_REQUEST['bday']);
         $u_c_data['bday'] = intval($_REQUEST['bday']);
     }
     //汽车认证
     if ($type == "credit_car") {
         $u_c_data['car_brand'] = strim($_REQUEST['carbrand']);
         $u_c_data['car_year'] = intval($_REQUEST['caryear']);
         $u_c_data['car_number'] = strim($_REQUEST['carnumber']);
         $u_c_data['carloan'] = intval($_REQUEST['carloan']);
     }
     //房产认证
     if ($type == "credit_house") {
         $u_c_data['houseloan'] = intval($_REQUEST['houseloan']);
     }
     //结婚认证
     if ($type == "credit_marriage") {
         $u_c_data['haschild'] = intval($_REQUEST['haschild']);
     }
     //学历认证
     if ($type == "credit_graducation") {
         $u_c_data['edu_validcode'] = strim($_REQUEST['validcode']);
         $u_c_data['graduation'] = strim($_REQUEST['graduation']);
         $u_c_data['university'] = strim($_REQUEST['university']);
         $u_c_data['graduatedyear'] = intval($_REQUEST['graduatedyear']);
     }
     //视频认证
     if ($type == "credit_videoauth") {
         $u_c_data['has_send_video'] = intval($_REQUEST['usemail']);
     }
     //居住地证明
     if ($type == "credit_residence") {
         $u_w_data['province_id'] = intval($_REQUEST['province_id']);
         $u_w_data['city_id'] = intval($_REQUEST['city_id']);
         if ($GLOBALS['db']->getOne("SELECT count(*) FROM " . DB_PREFIX . "user_work where user_id=" . $authorized_info['id']) > 0) {
             $u_w_data['user_id'] = $authorized_info['id'];
             $GLOBALS['db']->autoExecute(DB_PREFIX . "user_work", $u_w_data, "INSERT");
         } else {
             $GLOBALS['db']->autoExecute(DB_PREFIX . "user_work", $u_w_data, "UPDATE", "user_id=" . $authorized_info['id']);
         }
         $u_c_data['address'] = htmlspecialchars($_REQUEST['address']);
         $u_c_data['phone'] = htmlspecialchars($_REQUEST['phone']);
         $u_c_data['postcode'] = htmlspecialchars($_REQUEST['postcode']);
     }
     $GLOBALS['db']->autoExecute(DB_PREFIX . "user", $u_c_data, "UPDATE", "id=" . $authorized_info['id']);
     $file = array();
     if ($credit_type['list'][$type]['file_count'] > 0) {
         for ($i = 1; $i <= $credit_type['list'][$type]['file_count']; $i++) {
             if (trim($_REQUEST['file' . $i]) != "") {
                 $file[] = replace_public(strim($_REQUEST['file' . $i]));
             }
         }
         if (count($file) == 0) {
             exit;
         }
     }
     $mode = "INSERT";
     $condition = "";
     $temp_info = $GLOBALS['db']->getRow("SELECT user_id,`type`,`file` FROM " . DB_PREFIX . "user_credit_file WHERE user_id=" . $authorized_info['id'] . " AND type='" . $type . "'");
     if ($temp_info) {
         $file_list = unserialize($temp_info['file']);
         //认证是否过期
         $time = TIME_UTC;
         $expire_time = $credit_type['list'][$type]['expire'] * 30 * 24 * 3600;
         switch ($type) {
             case "credit_contact":
                 if ($authorized_info['workpassed'] == 1) {
                     if ($time - $authorized_info['workpassed_time'] > $expire_time) {
                         $authorized_info['workpassed'] = 0;
                         $GLOBALS['db']->query("update " . DB_PREFIX . "user set workpassed=0 WHERE id=" . $authorized_info['id']);
                         es_session::set('user_info', $authorized_info);
                     }
                 }
                 break;
             case "credit_credit":
                 if ($authorized_info['creditpassed'] == 1) {
                     if ($time - $authorized_info['creditpassed_time'] > $expire_time) {
                         $authorized_info['creditpassed'] = 0;
                         $GLOBALS['db']->query("update " . DB_PREFIX . "user set creditpassed=0 WHERE id=" . $authorized_info['id']);
                         es_session::set('user_info', $authorized_info);
                     }
                 }
                 break;
             case "credit_incomeduty":
                 if ($authorized_info['incomepassed'] == 1) {
                     if ($time - $authorized_info['incomepassed_time'] > $expire_time) {
                         $authorized_info['incomepassed'] = 0;
                         $GLOBALS['db']->query("update " . DB_PREFIX . "user set incomepassed=0 WHERE id=" . $authorized_info['id']);
                         es_session::set('user_info', $authorized_info);
                     }
                 }
                 break;
             case "credit_residence":
                 if ($authorized_info['residencepassed'] == 1) {
                     if ($time - $authorized_info['residencepassed_time'] > $expire_time) {
                         $authorized_info['residencepassed'] = 0;
                         $GLOBALS['db']->query("update " . DB_PREFIX . "user set residencepassed=0 WHERE id=" . $authorized_info['id']);
                         es_session::set('user_info', $authorized_info);
                     }
                 }
                 break;
             case "credit_seal":
                 foreach ($file_list as $k => $v) {
                     @unlink(APP_ROOT_PATH . $v);
                 }
                 $file_list = array();
                 $authorized_info['sealpassed'] = 0;
                 $GLOBALS['db']->query("update " . DB_PREFIX . "user set sealpassed=0 WHERE id=" . $authorized_info['id']);
                 es_session::set('user_info', $authorized_info);
                 break;
         }
         $mode = "UPDATE";
         $condition = "user_id=" . $authorized_info['id'] . " AND type='" . $type . "'";
     }
     if ($file) {
         foreach ($file as $v) {
             $file_list[] = $v;
         }
     }
     $data['user_id'] = $authorized_info['id'];
     $data['type'] = $type;
     $data['status'] = 0;
     $data['file'] = serialize($file);
     $data['create_time'] = TIME_UTC;
     $data['passed'] = 0;
     $GLOBALS['db']->autoExecute(DB_PREFIX . "user_credit_file", $data, $mode, $condition);
     if ($this->is_ajax == 1) {
         showSuccess("提交成功,请等待管理员审核!", $this->is_ajax);
     } else {
         $GLOBALS['tmpl']->display("inc/credit/upload_result_tip.html");
     }
 }
Esempio n. 9
0
 public function investor_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_name = strim($_POST['identify_name']);
     $identify_number = strim($_POST['identify_number']);
     $image1['url'] = replace_public(strim($_POST['idcard_zheng_u']));
     $image2['url'] = replace_public(strim($_POST['idcard_fang_u']));
     $data = investor_save($id, $ajax = '', $identify_name, $identify_number, $image1['url'], $image2['url']);
     ajax_return($data);
     return false;
 }
Esempio n. 10
0
 public function save_deal_item()
 {
     $ajax = intval($_REQUEST['ajax']);
     if (!$GLOBALS['user_info']) {
         showErr("", $ajax, url("user#login"));
     }
     $id = intval($_REQUEST['id']);
     $data['price'] = doubleval($_REQUEST['price']);
     if ($data['price'] <= 0) {
         showErr("请输入正确的价格", $ajax);
     }
     $data['description'] = strim($_REQUEST['description']);
     $data['is_delivery'] = intval($_REQUEST['is_delivery']);
     $data['delivery_fee'] = doubleval($_REQUEST['delivery_fee']);
     $data['is_limit_user'] = intval($_REQUEST['is_limit_user']);
     $data['limit_user'] = intval($_REQUEST['limit_user']);
     $data['repaid_day'] = intval($_REQUEST['repaid_day']);
     $data['deal_id'] = intval($_REQUEST['deal_id']);
     if (count($_REQUEST['image']) > 4) {
         showErr("图片不能超过四张", $ajax);
     }
     if ($id == 0) {
         $GLOBALS['db']->autoExecute(DB_PREFIX . "deal_item", $data, "INSERT", "", "SILENT");
         $result_id = intval($GLOBALS['db']->insert_id());
         if ($result_id > 0) {
             if (count($_REQUEST['image']) >= 0) {
                 foreach ($_REQUEST['image'] as $k => $v) {
                     $image_data['deal_id'] = $data['deal_id'];
                     $image_data['deal_item_id'] = $result_id;
                     $image_data['image'] = replace_public($v);
                     $GLOBALS['db']->autoExecute(DB_PREFIX . "deal_item_image", $image_data);
                 }
             }
             showSuccess("保存成功", $ajax, get_gopreview());
         } else {
             showErr("保存失败", $ajax);
         }
     } else {
         $GLOBALS['db']->autoExecute(DB_PREFIX . "deal_item", $data, "UPDATE", "id=" . $id, "SILENT");
         if (count($_REQUEST['image']) >= 0) {
             $GLOBALS['db']->query("delete from " . DB_PREFIX . "deal_item_image where deal_item_id = " . $id);
             foreach ($_REQUEST['image'] as $k => $v) {
                 $image_data['deal_id'] = $data['deal_id'];
                 $image_data['deal_item_id'] = $id;
                 $image_data['image'] = replace_public(strim($v));
                 $GLOBALS['db']->autoExecute(DB_PREFIX . "deal_item_image", $image_data);
             }
         }
         showSuccess("保存成功", $ajax, get_gopreview());
     }
 }
 public function index()
 {
     $root = array();
     $email = strim($GLOBALS['request']['email']);
     //用户名或邮箱
     $pwd = strim($GLOBALS['request']['pwd']);
     //密码
     //检查用户,用户密码
     $user = user_check($email, $pwd);
     $user_id = intval($user['id']);
     if ($user_id > 0) {
         $root['user_login_status'] = 1;
         $id = intval($_REQUEST['id']);
         $is_edit = $GLOBALS['db']->getOne("select is_edit from " . DB_PREFIX . "deal where id = " . $id);
         $is_effect = $GLOBALS['db']->getOne("select is_effect from " . DB_PREFIX . "deal where id = " . $id);
         if ($id > 0 && $is_effect == 1) {
             $root['info'] = "项目已提交,不能更改";
         }
         $data['name'] = strim($_REQUEST['name']);
         if ($data['name'] == "") {
             $root['info'] = "请填写项目名称";
         }
         if (msubstr($data['name'], 0, 25) != $data['name']) {
             $root['info'] = "项目名称不超过25个字";
         }
         $data['cate_id'] = intval($_REQUEST['cate_id']);
         if ($data['cate_id'] == 0) {
             $root['info'] = "请选择项目分类";
         }
         $data['province'] = strim($_REQUEST['province']);
         if ($data['province'] == '') {
             $root['info'] = "请选择省份";
         }
         $data['city'] = strim($_REQUEST['city']);
         if ($data['city'] == '') {
             $root['info'] = "请选择城市";
         }
         $data['brief'] = strim($_REQUEST['brief']);
         $data['image'] = replace_public(addslashes(trim($_REQUEST['image'])));
         if ($data['image'] == "") {
             $root['info'] = "上传封面图片";
         }
         require_once APP_ROOT_PATH . "system/libs/words.php";
         $data['tags'] = implode(" ", words::segment($data['name']));
         $data['description'] = replace_public(addslashes(trim(valid_tag($_REQUEST['description']))));
         //
         $data['vedio'] = strim($_REQUEST['vedio']);
         if ($data['vedio'] != "") {
             require_once APP_ROOT_PATH . "system/utils/vedio.php";
             $vedio = fetch_vedio_url($data['vedio']);
             if ($vedio != "") {
                 $data['source_vedio'] = $vedio;
             } else {
                 $root['info'] = "非法的视频地址";
             }
         }
         $data['limit_price'] = doubleval($_REQUEST['limit_price']);
         if ($data['limit_price'] <= 0) {
             $root['info'] = "请输入正确的目标金";
         }
         $data['deal_days'] = doubleval($_REQUEST['deal_days']);
         if ($data['deal_days'] <= 0) {
             $root['info'] = "请输入正确的上线天数";
         }
         $data['is_edit'] = 1;
         if ($id > 0) {
             $savenext = intval($_REQUEST['savenext']);
             $GLOBALS['db']->autoExecute(DB_PREFIX . "deal", $data, "UPDATE", "id=" . $id, "SILENT");
             //追加faq
             $GLOBALS['db']->query("delete from " . DB_PREFIX . "deal_faq where deal_id = " . $id);
             $sort = 1;
             foreach ($_REQUEST['question'] as $kk => $question_item) {
                 if (strim($_REQUEST['question'][$kk]) != "" && strim($_REQUEST['answer'][$kk]) != "" && strim($_REQUEST['question'][$kk]) != "请输入问题" && strim($_REQUEST['answer'][$kk]) != "请输入答案") {
                     $faq_item['deal_id'] = $id;
                     $faq_item['question'] = strim($_REQUEST['question'][$kk]);
                     $faq_item['answer'] = strim($_REQUEST['answer'][$kk]);
                     $faq_item['sort'] = $sort;
                     $GLOBALS['db']->autoExecute(DB_PREFIX . "deal_faq", $faq_item);
                     $sort++;
                 }
             }
             $GLOBALS['db']->query("update " . DB_PREFIX . "deal set deal_extra_cache = '' where id = " . $id);
             if ($savenext == 0) {
                 showSuccess($id, $ajax, "");
             } else {
                 showSuccess("", $ajax, url("project#add_item", array("id" => $id)));
             }
         } else {
             $data['user_id'] = intval($GLOBALS['user_info']['id']);
             $data['user_name'] = $GLOBALS['user_info']['user_name'];
             $data['create_time'] = NOW_TIME;
             $savenext = intval($_REQUEST['savenext']);
             $GLOBALS['db']->autoExecute(DB_PREFIX . "deal", $data, "INSERT", "", "SILENT");
             $data_id = intval($GLOBALS['db']->insert_id());
             if ($data_id == 0) {
                 $root['info'] = "保存失败,请联系管理员";
             } else {
                 es_session::delete("deal_image");
                 //追加faq
                 $sort = 1;
                 foreach ($_REQUEST['question'] as $kk => $question_item) {
                     if (strim($_REQUEST['question'][$kk]) != "" && strim($_REQUEST['answer'][$kk]) != "" && strim($_REQUEST['question'][$kk]) != "请输入问题" && strim($_REQUEST['answer'][$kk]) != "请输入答案") {
                         $faq_item['deal_id'] = $data_id;
                         $faq_item['question'] = strim($_REQUEST['question'][$kk]);
                         $faq_item['answer'] = strim($_REQUEST['answer'][$kk]);
                         $faq_item['sort'] = $sort;
                         $GLOBALS['db']->autoExecute(DB_PREFIX . "deal_faq", $faq_item);
                         $sort++;
                     }
                 }
                 if ($savenext == 0) {
                     showSuccess($data_id, $ajax, "");
                 } else {
                     showSuccess("", $ajax, url("project#add_item", array("id" => $data_id)));
                 }
             }
         }
     } else {
         $root['response_code'] = 0;
         $root['show_err'] = "未登录";
         $root['user_login_status'] = 0;
     }
     output($root);
 }
Esempio n. 12
0
 public function investor_two_save()
 {
     $ajax = intval($_REQUEST['ajax']);
     if (!$GLOBALS['user_info']) {
         showErr("", $ajax, url_wap("user#login"));
     }
     $id = intval($_REQUEST['id']);
     $is_effect = $GLOBALS['db']->getOne("select is_effect from " . DB_PREFIX . "deal where id = " . $id);
     if ($id > 0 && $is_effect == 1) {
         showErr("项目已提交,不能更改", $ajax, "");
     }
     $data['description_2'] = replace_public(addslashes(trim($_REQUEST['description_2'])));
     $data['description_3'] = replace_public(addslashes(trim($_REQUEST['description_3'])));
     $data['description_4'] = replace_public(addslashes(trim($_REQUEST['description_4'])));
     $data['description_5'] = replace_public(addslashes(trim($_REQUEST['description_5'])));
     $data['description_6'] = replace_public(addslashes(trim($_REQUEST['description_6'])));
     $data['description_7'] = replace_public(addslashes(trim($_REQUEST['description_7'])));
     if ($id == 0) {
         $GLOBALS['db']->autoExecute(DB_PREFIX . "deal", $data, "INSERT", "", "SILENT");
         $result_id = intval($GLOBALS['db']->insert_id());
         if ($result_id > 0) {
             $GLOBALS['db']->query("update " . DB_PREFIX . "deal set deal_extra_cache = '' where id = " . $result_id);
             showSuccess("保存成功", $ajax, url_wap("project#investor_three", array("id" => $result_id)));
         } else {
             showErr("保存失败", $ajax);
         }
     } else {
         $GLOBALS['db']->autoExecute(DB_PREFIX . "deal", $data, "UPDATE", "id=" . $id, "SILENT");
         $GLOBALS['db']->query("update " . DB_PREFIX . "deal set deal_extra_cache = '' where id = " . $id);
         $investor_edit = $GLOBALS['db']->getOne("select investor_edit from " . DB_PREFIX . "deal where id = " . $id . " and is_delete = 0 and user_id = " . intval($GLOBALS['user_info']['id']));
         if ($investor_edit == 1) {
             showSuccess("保存成功", $ajax, url_wap("project#investor_edit", array("id" => $id)));
         } else {
             showSuccess("保存成功", $ajax, url_wap("project#investor_three", array("id" => $id)));
         }
     }
 }
Esempio n. 13
0
 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 update()
 {
     if (intval($_POST['pid']) == 0) {
         showErr($GLOBALS['lang']['ERROR_TITLE'], 0, url("biz", "publish"));
         exit;
     }
     $pid = intval($_POST['pid']);
     $id = intval($_POST['id']);
     $s_account_info = es_session::get("account_info");
     $location_ids = $s_account_info['location_ids'];
     $info = $GLOBALS['db']->getRow(" SELECT * FROM " . DB_PREFIX . "supplier_location_images WHERE id = " . intval($pid) . " and supplier_location_id in (" . implode(",", $s_account_info['location_ids']) . ")");
     if (!$info) {
         showErr("门店不存在或者没有编辑该门店的权限");
     }
     $data['brief'] = addslashes(htmlspecialchars(trim($_POST['brief'])));
     $data['image'] = replace_public($_POST['image']);
     $data['images_group_id'] = intval($_POST['images_group_id']);
     $data['sort'] = intval($_POST['sort']);
     $data['create_time'] = get_gmtime();
     $rs = $GLOBALS['db']->autoExecute(DB_PREFIX . "supplier_location_images", $data, "UPDATE", " id = " . intval($_POST['pid']));
     if ($rs) {
         //更新统计
         $supplier_info['id'] = $_POST['id'];
         syn_supplier_locationcount($supplier_info);
         $cache_id = md5("store" . "view" . $_POST['id']);
         $GLOBALS['tmpl']->clear_cache('store_view.html', $cache_id);
         showSuccess($GLOBALS['lang']['MODIFY_SUCCESS'], 0, url("biz", "publish#modify", array("id" => intval($_POST['id']), "pid" => intval($_POST['pid']))));
     }
 }
Esempio n. 15
0
 public function submit_modify()
 {
     $s_account_info = es_session::get("account_info");
     $account_id = intval($s_account_info['id']);
     $id = intval($_REQUEST['id']);
     $data = $GLOBALS['db']->getRow("select d.* from " . DB_PREFIX . "deal as d left join " . DB_PREFIX . "deal_location_link as l on l.deal_id = d.id where d.id = " . $id . " and publish_wait = 1 and l.location_id in (" . implode(",", $s_account_info['location_ids']) . ")");
     if (!$data) {
         showErr("产品不存在或者没有编辑该产品的权限");
     }
     $data['name'] = addslashes(htmlspecialchars(trim($_REQUEST['name'])));
     $data['sub_name'] = addslashes(htmlspecialchars(trim($_REQUEST['sub_name'])));
     $data['origin_price'] = doubleval($_REQUEST['origin_price']);
     $data['balance_price'] = doubleval($_REQUEST['balance_price']);
     $data['max_bought'] = intval($_REQUEST['max_bought']);
     $data['brief'] = addslashes(htmlspecialchars(trim($_REQUEST['brief'])));
     $data['is_shop'] = intval($_REQUEST['is_shop']);
     $data['any_refund'] = intval($_REQUEST['any_refund']);
     $data['expire_refund'] = intval($_REQUEST['expire_refund']);
     $data['auto_order'] = intval($_REQUEST['auto_order']);
     if ($data['is_shop'] == 1) {
         $data['is_coupon'] = 0;
         $data['shop_cate_id'] = intval($_REQUEST['shop_cate_id']);
         $data['cate_id'] = 0;
     } else {
         $data['is_coupon'] = 1;
         $data['shop_cate_id'] = 0;
         $data['cate_id'] = intval($_REQUEST['cate_id']);
     }
     $data['city_id'] = intval($_REQUEST['city_id']);
     $data['icon'] = addslashes(htmlspecialchars(trim(replace_public($_REQUEST['icon']))));
     $data['img'] = addslashes(htmlspecialchars(trim(replace_public($_REQUEST['img']))));
     $data['description'] = trim(replace_public($_REQUEST['descript']));
     $data['description'] = valid_tag($data['description']);
     $data['account_id'] = intval($account_id);
     $data['publish_wait'] = 1;
     $data['create_time'] = get_gmtime();
     $data['is_effect'] = 0;
     $data['supplier_id'] = intval($s_account_info['supplier_id']);
     $data['begin_time'] = trim($_REQUEST['begin_time']) == '' ? 0 : to_timespan($_REQUEST['begin_time']);
     $data['end_time'] = trim($_REQUEST['end_time']) == '' ? 0 : to_timespan($_REQUEST['end_time']);
     $GLOBALS['db']->autoExecute(DB_PREFIX . "deal", $data, "UPDATE", "id=" . $data['id']);
     $deal_id = $data['id'];
     if ($deal_id > 0) {
         $GLOBALS['db']->query("delete from " . DB_PREFIX . "deal_gallery where deal_id = " . $deal_id . " and sort < 6");
         if ($_REQUEST['img0'] != '') {
             $deal_gallery_0 = array("img" => addslashes(htmlspecialchars(trim(replace_public($_REQUEST['img0'])))), "deal_id" => $deal_id, "sort" => 0);
             $GLOBALS['db']->autoExecute(DB_PREFIX . "deal_gallery", $deal_gallery_0);
         }
         if ($_REQUEST['img1'] != '') {
             $deal_gallery_1 = array("img" => addslashes(htmlspecialchars(trim(replace_public($_REQUEST['img1'])))), "deal_id" => $deal_id, "sort" => 1);
             $GLOBALS['db']->autoExecute(DB_PREFIX . "deal_gallery", $deal_gallery_1);
         }
         if ($_REQUEST['img2'] != '') {
             $deal_gallery_2 = array("img" => addslashes(htmlspecialchars(trim(replace_public($_REQUEST['img2'])))), "deal_id" => $deal_id, "sort" => 2);
             $GLOBALS['db']->autoExecute(DB_PREFIX . "deal_gallery", $deal_gallery_2);
         }
         if ($_REQUEST['img3'] != '') {
             $deal_gallery_3 = array("img" => addslashes(htmlspecialchars(trim(replace_public($_REQUEST['img3'])))), "deal_id" => $deal_id, "sort" => 3);
             $GLOBALS['db']->autoExecute(DB_PREFIX . "deal_gallery", $deal_gallery_3);
         }
         if ($_REQUEST['img4'] != '') {
             $deal_gallery_4 = array("img" => addslashes(htmlspecialchars(trim(replace_public($_REQUEST['img4'])))), "deal_id" => $deal_id, "sort" => 4);
             $GLOBALS['db']->autoExecute(DB_PREFIX . "deal_gallery", $deal_gallery_4);
         }
         if ($_REQUEST['img5'] != '') {
             $deal_gallery_5 = array("img" => addslashes(htmlspecialchars(trim(replace_public($_REQUEST['img5'])))), "deal_id" => $deal_id, "sort" => 5);
             $GLOBALS['db']->autoExecute(DB_PREFIX . "deal_gallery", $deal_gallery_5);
         }
         $GLOBALS['db']->query("delete from " . DB_PREFIX . "deal_cate_type_deal_link where deal_id = " . $deal_id);
         foreach ($_REQUEST['deal_cate_type_id'] as $deal_cate_type_id) {
             if ($deal_cate_type_id > 0) {
                 $deal_cate_type_link = array("deal_id" => $deal_id, "deal_cate_type_id" => intval($deal_cate_type_id));
                 $GLOBALS['db']->autoExecute(DB_PREFIX . "deal_cate_type_deal_link", $deal_cate_type_link);
             }
         }
         showSuccess("提交成功,请等待管理员审核");
     } else {
         showErr("发布失败");
     }
 }
Esempio n. 16
0
 public function submit_modify()
 {
     $s_account_info = es_session::get("account_info");
     $account_id = intval($s_account_info['id']);
     $id = intval($_REQUEST['id']);
     $data = $GLOBALS['db']->getRow("select e.* from " . DB_PREFIX . "event as e left join " . DB_PREFIX . "event_location_link as l on l.event_id = e.id where e.id = " . $id . " and e.publish_wait = 1 and l.location_id in (" . implode(",", $s_account_info['location_ids']) . ")");
     if (!$data) {
         showErr("活动不存在或者没有编辑该活动的权限");
     }
     $event_id = $data['id'] = $id;
     $data['name'] = addslashes(htmlspecialchars(trim($_REQUEST['name'])));
     $data['icon'] = addslashes(htmlspecialchars(replace_public(trim($_REQUEST['icon']))));
     $data['event_begin_time'] = trim($_REQUEST['event_begin_time']) == '' ? 0 : to_timespan($_REQUEST['event_begin_time']);
     $data['event_end_time'] = trim($_REQUEST['event_end_time']) == '' ? 0 : to_timespan($_REQUEST['event_end_time']);
     $data['submit_begin_time'] = trim($_REQUEST['submit_begin_time']) == '' ? 0 : to_timespan($_REQUEST['submit_begin_time']);
     $data['submit_end_time'] = trim($_REQUEST['submit_end_time']) == '' ? 0 : to_timespan($_REQUEST['submit_end_time']);
     $data['city_id'] = intval($_REQUEST['city_id']);
     $data['cate_id'] = intval($_REQUEST['cate_id']);
     $data['address'] = addslashes(htmlspecialchars(trim($_REQUEST['address'])));
     $data['brief'] = addslashes(htmlspecialchars(trim($_REQUEST['brief'])));
     $data['content'] = addslashes(trim(replace_public($_REQUEST['content'])));
     $data['content'] = valid_tag($data['content']);
     $data['user_id'] = intval($account_id);
     $data['publish_wait'] = 1;
     $data['is_effect'] = 0;
     $data['supplier_id'] = intval($s_account_info['supplier_id']);
     $data['xpoint'] = doubleval($_REQUEST['xpoint']);
     $data['ypoint'] = doubleval($_REQUEST['ypoint']);
     $GLOBALS['db']->autoExecute(DB_PREFIX . "event", $data, "UPDATE", "id=" . $data['id']);
     if ($event_id > 0) {
         $GLOBALS['db']->query("delete from " . DB_PREFIX . "event_field where event_id = " . $event_id);
         foreach ($_REQUEST['field_id'] as $k => $field_id) {
             $event_field = array();
             $event_field['event_id'] = $event_id;
             $event_field['field_show_name'] = addslashes(htmlspecialchars($_REQUEST['field_show_name'][$k]));
             $event_field['field_type'] = addslashes(htmlspecialchars($_REQUEST['field_type'][$k]));
             $event_field['value_scope'] = addslashes(htmlspecialchars($_REQUEST['value_scope'][$k]));
             $event_field['sort'] = $k;
             $GLOBALS['db']->autoExecute(DB_PREFIX . "event_field", $event_field);
         }
         showSuccess("提交成功,请等待管理员审核");
     } else {
         showErr("发布失败");
     }
 }
Esempio n. 17
0
 public function submit_modify()
 {
     $s_account_info = es_session::get("account_info");
     $account_id = intval($s_account_info['id']);
     $id = intval($_REQUEST['id']);
     $data = $GLOBALS['db']->getRow("select y.* from " . DB_PREFIX . "youhui as y left join " . DB_PREFIX . "youhui_location_link as l on l.youhui_id = y.id where y.id = " . $id . " and y.publish_wait = 1 and l.location_id in (" . implode(",", $s_account_info['location_ids']) . ")");
     if (!$data) {
         showErr("优惠不存在或者没有编辑该优惠的权限");
     }
     $data['id'] = intval($_REQUEST['id']);
     $data['name'] = addslashes(htmlspecialchars(trim($_REQUEST['name'])));
     $data['total_num'] = addslashes(htmlspecialchars(trim($_REQUEST['total_num'])));
     $data['send_type'] = intval($_REQUEST['send_type']);
     if ($data['send_type'] > 0) {
         $data['is_print'] = 0;
     } else {
         $data['is_print'] = 1;
     }
     $data['is_sms'] = 1;
     $data['sms_content'] = addslashes(htmlspecialchars(trim($_REQUEST['sms_content'])));
     $data['begin_time'] = trim($_REQUEST['begin_time']) == '' ? 0 : to_timespan($_REQUEST['begin_time']);
     $data['end_time'] = trim($_REQUEST['end_time']) == '' ? 0 : to_timespan($_REQUEST['end_time']);
     $data['deal_cate_id'] = intval($_REQUEST['cate_id']);
     $data['city_id'] = intval($_REQUEST['city_id']);
     $data['icon'] = addslashes(htmlspecialchars(trim(replace_public($_REQUEST['icon']))));
     $data['image'] = addslashes(htmlspecialchars(trim(replace_public($_REQUEST['image']))));
     $data['brief'] = addslashes(htmlspecialchars(trim($_REQUEST['brief'])));
     $data['description'] = addslashes(trim(replace_public($_REQUEST['descript'])));
     $data['description'] = valid_tag($data['description']);
     $data['user_id'] = intval($account_id);
     $data['publish_wait'] = 1;
     $data['create_time'] = get_gmtime();
     $data['is_effect'] = 0;
     $data['supplier_id'] = intval($s_account_info['supplier_id']);
     foreach ($s_account_info['location_ids'] as $id) {
         $location_info = $GLOBALS['db']->getRow("select * from " . DB_PREFIX . "supplier_location where id = " . $id);
         if ($location_info) {
             $data['xpoint'] = $location_info['xpoint'];
             $data['ypoint'] = $location_info['ypoint'];
             break;
         }
     }
     $GLOBALS['db']->autoExecute(DB_PREFIX . "youhui", $data, "UPDATE", "id=" . $data['id']);
     $youhui_id = $data['id'];
     if ($youhui_id > 0) {
         $GLOBALS['db']->query("delete from " . DB_PREFIX . "deal_cate_type_youhui_link where youhui_id = " . $youhui_id);
         foreach ($_REQUEST['deal_cate_type_id'] as $deal_cate_type_id) {
             if ($deal_cate_type_id > 0) {
                 $deal_cate_type_link = array("youhui_id" => $youhui_id, "deal_cate_type_id" => intval($deal_cate_type_id));
                 $GLOBALS['db']->autoExecute(DB_PREFIX . "deal_cate_type_youhui_link", $deal_cate_type_link);
             }
         }
         showSuccess("提交成功,请等待管理员审核");
     } else {
         showErr("发布失败");
     }
 }
Esempio n. 18
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);
 }
Esempio n. 19
0
 public function incharge_done()
 {
     /*
     	$payment_id = intval($_REQUEST['payment']);
     	$money = floatval($_REQUEST['money']);
     	$bank_id = addslashes(htmlspecialchars(trim($_REQUEST['bank_id'])));
     	$memo = addslashes(htmlspecialchars(trim($_REQUEST['memo'])));
     	
     	
     	if($money<=0)
     	{
     		showErr($GLOBALS['lang']['PLEASE_INPUT_CORRECT_INCHARGE']);
     	}
     	
     	$payment_info = $GLOBALS['db']->getRow("select * from ".DB_PREFIX."payment where id = ".$payment_id);
     	if(!$payment_info)
     	{
     		showErr($GLOBALS['lang']['PLEASE_SELECT_PAYMENT']);
     	}
     	//开始生成订单
     	$now = TIME_UTC;
     	$order['type'] = 1; //充值单
     	$order['user_id'] = $GLOBALS['user_info']['id'];
     	$order['create_time'] = $now;
     	if($payment_info['fee_type'] == 0)
     		$order['total_price'] = $money + $payment_info['fee_amount'];
     	else
     		$order['total_price'] = $money + $payment_info['fee_amount']*$money;
     		
     	$order['deal_total_price'] = $money;
     	$order['pay_amount'] = 0;  
     	$order['pay_status'] = 0;  
     	$order['delivery_status'] = 5;  
     	$order['order_status'] = 0; 
     	$order['payment_id'] = $payment_id;
     	if($payment_info['fee_type'] == 0)
     		$order['payment_fee'] = $payment_info['fee_amount'];
     	else
     		$order['payment_fee'] = $payment_info['fee_amount']*$money;
     		
     	$order['bank_id'] = $bank_id;
     	$order['memo'] = $bank_id;
     	if($payment_info['class_name']=='Otherpay' && $order['memo']!=""){
     		
     		$payment_info['config'] = unserialize($payment_info['config']);
     		$order['memo'] = "银行流水单号:".$order['memo'];
     		$order['memo'] .= "<br>开户行:".$payment_info['config']['pay_bank'][$order['bank_id']];
     		$order['memo'] .= "<br>充值银行:".$payment_info['config']['pay_name'][$order['bank_id']];
     		$order['memo'] .= "<br>帐号:".$payment_info['config']['pay_account'][$order['bank_id']];
     		$order['memo'] .= "<br>用户:".$payment_info['config']['pay_account_name'][$order['bank_id']];
     	}
     	do
     	{
     		$order['order_sn'] = to_date(TIME_UTC,"Ymdhis").rand(100,999);
     		$GLOBALS['db']->autoExecute(DB_PREFIX."deal_order",$order,'INSERT','','SILENT'); 
     		$order_id = intval($GLOBALS['db']->insert_id());
     	}while($order_id==0);
     	
     	require_once APP_ROOT_PATH."system/libs/cart.php";
     	$payment_notice_id = make_payment_notice($order['total_price'],$order_id,$payment_info['id'],$order['memo']);
     	//创建支付接口的付款单
     */
     $payment_id = intval($_REQUEST['payment']);
     $money = floatval($_REQUEST['money']);
     $bank_id = addslashes(htmlspecialchars(trim($_REQUEST['bank_id'])));
     $memo = addslashes(htmlspecialchars(trim($_REQUEST['memo'])));
     $pingzheng = replace_public(trim($_REQUEST['pingzheng']));
     $status = getInchargeDone($payment_id, $money, $bank_id, $memo, $pingzheng);
     if ($status['status'] == 0) {
         showErr($status['show_err']);
     } else {
         if ($status['pay_status']) {
             app_redirect(url("index", "payment#incharge_done", array("id" => $status['order_id'])));
             //充值支付成功
         } else {
             app_redirect(url("index", "payment#pay", array("id" => $status['payment_notice_id'])));
         }
     }
 }
 function preview()
 {
     $deal['id'] = 'XXX';
     $deal_loan_type_list = load_auto_cache("deal_loan_type_list");
     if (intval($_REQUEST['quota']) == 1) {
         $deal = $GLOBALS['db']->getRow("SELECT * FROM " . DB_PREFIX . "deal_quota_submit WHERE status=1 and user_id = " . $GLOBALS['user_info']['id'] . " ORDER BY id DESC");
         $type_id = intval($deal['type_id']);
         $deal['rate_foramt'] = number_format($deal['rate'], 2);
         $data['view_info'] = unserialize($deal['view_info']);
         if ($deal['cate_id'] > 0) {
             $deal['cate_info'] = $GLOBALS['db']->getRowCached("select id,name,brief,uname,icon from " . DB_PREFIX . "deal_cate where id = " . $deal['cate_id'] . " and is_effect = 1 and is_delete = 0");
         }
         $deal['repay_time'] = strim($_REQUEST['repay_time']);
         $deal['repay_time_type'] = 1;
     } else {
         $deal['name'] = strim($_REQUEST['borrowtitle']);
         $type_id = intval($_REQUEST['borrowtype']);
         $deal['repay_time_type'] = intval($_REQUEST['repaytime_type']);
         $deal['rate_foramt'] = number_format(strim($_REQUEST['apr']), 2);
         $deal['repay_time'] = strim($_REQUEST['repaytime']);
         $icon_type = strim($_REQUEST['imgtype']);
         $icon_type_arr = array('upload' => 1, 'userImg' => 2, 'systemImg' => 3);
         $data['icon_type'] = $icon_type_arr[$icon_type];
         switch ($data['icon_type']) {
             case 1:
                 $deal['icon'] = replace_public(strim($_REQUEST['icon']));
                 break;
             case 2:
                 $deal['icon'] = replace_public(get_user_avatar($GLOBALS['user_info']['id'], 'big'));
                 break;
             case 3:
                 $deal['icon'] = $GLOBALS['db']->getOneCached("SELECT icon FROM " . DB_PREFIX . "deal_loan_type WHERE id=" . intval($_REQUEST['systemimgpath']));
         }
         $deal['description'] = replace_public(valid_str(bstrim($_REQUEST['borrowdesc'])));
         $user_view_info = $GLOBALS['user_info']['view_info'];
         $user_view_info = unserialize($user_view_info);
         $new_view_info_arr = array();
         for ($i = 1; $i <= intval($_REQUEST['file_upload_count']); $i++) {
             $img_info = array();
             $img = replace_public(strim($_REQUEST['file_' . $i]));
             if ($img != "") {
                 $img_info['name'] = strim($_REQUEST['file_name_' . $i]);
                 $img_info['img'] = $img;
                 $img_info['is_user'] = 1;
                 $user_view_info[] = $img_info;
                 $ss = $user_view_info;
                 end($ss);
                 $key = key($ss);
                 $new_view_info_arr[$key] = $img_info;
             }
         }
         $data['view_info'] = array();
         foreach ($_REQUEST['file_key'] as $k => $v) {
             if (isset($user_view_info[$v])) {
                 $data['view_info'][$v] = $user_view_info[$v];
             }
         }
         foreach ($new_view_info_arr as $k => $v) {
             $data['view_info'][$k] = $v;
         }
         if ($deal['cate_id'] > 0) {
             $deal['cate_info']['name'] = "借款预览标";
         }
     }
     $deal['borrow_amount'] = strim($_REQUEST['borrowamount']);
     $deal['borrow_amount_format'] = format_price($deal['borrow_amount'] / 10000) . "万";
     $GLOBALS['tmpl']->assign('view_info_list', $data['view_info']);
     unset($data['view_info']);
     foreach ($deal_loan_type_list as $k => $v) {
         if ($v['id'] == $type_id) {
             $deal['type_info'] = $v;
         }
     }
     $deal['min_loan_money'] = 50;
     $deal['need_money'] = $deal['borrow_amount_format'];
     //本息还款金额
     $deal['month_repay_money'] = format_price(pl_it_formula($deal['borrow_amount'], strim($deal['rate']) / 12 / 100, $deal['repay_time']));
     if ($deal['agency_id'] > 0) {
         $deal['agency_info'] = $GLOBALS['db']->getRowCached("select * from " . DB_PREFIX . "deal_agency where id = " . $deal['agency_id'] . " and is_effect = 1");
     }
     $deal['progress_point'] = 0;
     $deal['buy_count'] = 0;
     $deal['voffice'] = 1;
     $deal['vjobtype'] = 1;
     $deal['is_delete'] = 2;
     $u_info = get_user("*", $GLOBALS['user_info']['id']);
     $GLOBALS['tmpl']->assign("u_info", $u_info);
     $can_use_quota = get_can_use_quota($GLOBALS['user_info']['id']);
     $GLOBALS['tmpl']->assign('can_use_quota', $can_use_quota);
     $credit_file = get_user_credit_file($GLOBALS['user_info']['id'], $u_info);
     $GLOBALS['tmpl']->assign("credit_file", $credit_file);
     $user_statics = sys_user_status($GLOBALS['user_info']['id'], true);
     $GLOBALS['tmpl']->assign("user_statics", $user_statics);
     $seo_title = $deal['seo_title'] != '' ? $deal['seo_title'] : $deal['type_match_row'] . " - " . $deal['name'];
     $GLOBALS['tmpl']->assign("page_title", $seo_title);
     $seo_keyword = $deal['seo_keyword'] != '' ? $deal['seo_keyword'] : $deal['type_match_row'] . "," . $deal['name'];
     $GLOBALS['tmpl']->assign("page_keyword", $seo_keyword . ",");
     $seo_description = $deal['seo_description'] != '' ? $deal['seo_description'] : $deal['name'];
     $GLOBALS['tmpl']->assign("seo_description", $seo_description . ",");
     $GLOBALS['tmpl']->assign("deal", $deal);
     $GLOBALS['tmpl']->display("page/deal.html");
 }
Esempio n. 21
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);
 }
 /**
  * 保存账户资料
  */
 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"));
 }
Esempio n. 23
0
 function savedebit()
 {
     $view["type"] = intval($_REQUEST["type"]);
     $view["debit_money"] = strim($_REQUEST["debit_money"]);
     $view["repay_time"] = intval($_REQUEST["repaytime"]);
     $view["university"] = strim($_REQUEST["university"]);
     $view["address"] = strim($_REQUEST["address"]);
     $view["mobile"] = strim($_REQUEST["mobile"]);
     $is_ajax = intval($_REQUEST["is_ajax"]);
     if (strim($GLOBALS["user_info"]["u_alipay"]) == "") {
         showErr("请先绑定支付宝", $is_ajax);
     }
     if ($view["university"] == "") {
         showErr("请填写学校信息", $is_ajax);
     }
     if ($view["address"] == "") {
         showErr("请填写地址", $is_ajax);
     }
     if ($view["mobile"] == "") {
         showErr("请填写联系电话", $is_ajax);
     }
     if ($view["type"] == "" || $view["debit_money"] == "" || $view["repay_time"] == "") {
         showErr("请返回重新提交", $is_ajax);
     }
     $is_ajax = intval($_REQUEST['is_ajax']);
     if (!$GLOBALS['user_info']) {
         showErr($GLOBALS['lang']['PLEASE_LOGIN_FIRST'], $is_ajax);
     }
     $t = trim($_REQUEST['t']);
     if (!in_array($t, array("save", "publish"))) {
         showErr($GLOBALS['lang']['ERROR_TITLE'], $is_ajax);
     }
     /*读取白条配置*/
     $debit_conf = $GLOBALS["db"]->getRow("select * from " . DB_PREFIX . "debit_conf");
     /*读取标类别作为商品名*/
     $view["deal_loan_type"] = $GLOBALS["db"]->getOne("select name from " . DB_PREFIX . "deal_loan_type");
     if ($t == "save") {
         $data['is_delete'] = 2;
     } else {
         $data['is_delete'] = 0;
     }
     $data['name'] = $view["deal_loan_type"] . $view["debit_money"] . "元";
     if (empty($data['name'])) {
         showErr("请输入借款标题", $is_ajax);
     }
     $data['publish_wait'] = 1;
     $icon_type = "systemImg";
     if ($icon_type == "") {
         showErr("请选择借款图片类型", $is_ajax);
     }
     $icon_type_arr = array('upload' => 1, 'userImg' => 2, 'systemImg' => 3);
     $data['icon_type'] = $icon_type_arr[$icon_type];
     if (intval($data['icon_type']) == 0) {
         showErr("请选择借款图片类型", $is_ajax);
     }
     $_REQUEST['systemimgpath'] = $view["type"];
     switch ($data['icon_type']) {
         case 1:
             if (strim($_REQUEST['icon']) == '') {
                 showErr("请上传图片", $is_ajax);
             } else {
                 $data['icon'] = replace_public(strim($_REQUEST['icon']));
             }
             break;
         case 2:
             $data['icon'] = replace_public(get_user_avatar($GLOBALS['user_info']['id'], 'big'));
             break;
         case 3:
             if (intval($_REQUEST['systemimgpath']) == 0) {
                 showErr("请选择系统图片", $is_ajax);
             } else {
                 $data['icon'] = $GLOBALS['db']->getOne("SELECT icon FROM " . DB_PREFIX . "deal_loan_type WHERE id=" . intval($_REQUEST['systemimgpath']));
             }
             break;
     }
     //$data['cate_id'] = $data['type_id'] = intval($view["type"]);
     $data['type_id'] = intval($view["type"]);
     if ($data['type_id'] == 0) {
         showErr("请选择借款用途", $is_ajax);
     }
     $data['borrow_amount'] = floatval($view["debit_money"]);
     /*if($data['borrow_amount'] < (int)trim(app_conf('MIN_BORROW_QUOTA')) || $data['borrow_amount'] > (int)trim(app_conf('MAX_BORROW_QUOTA')) || $data['borrow_amount'] %50 != 0){
      		showErr("请正确选择借款金额",$is_ajax);
      	}*/
     //判断是否需要额度
     if ($GLOBALS['db']->getOne("SELECT is_quota FROM " . DB_PREFIX . "deal_loan_type WHERE id=" . $data['type_id']) == 1) {
         if (intval($GLOBALS['user_info']['quota']) != 0) {
             $can_use_quota = get_can_use_quota($GLOBALS['user_info']['id']);
             if ($data['borrow_amount'] > intval($can_use_quota)) {
                 showErr("输入借款的借款金额超过您的可用额度<br>您当前可用额度为:" . $can_use_quota, $is_ajax);
             }
         }
     }
     $data['repay_time'] = intval($_REQUEST['repaytime']);
     if ($data['repay_time'] == 0) {
         showErr("借款期限", $is_ajax);
     }
     $data['rate'] = floatval($view["rate"]);
     //
     $data['repay_time_type'] = 1;
     //按月
     $min_rate = 0;
     $max_rate = 0;
     $is_rate_lock = false;
     $level_list = load_auto_cache("level");
     $level_list_info = reset($level_list["repaytime_list"]);
     foreach ($level_list_info as $k => $v) {
         if ($v[1] != 0 && $v[0] == $view["repay_time"]) {
             $min_rate = $v[2];
             $max_rate = $v[3];
             break;
         }
     }
     if ($debit_conf["rate_cfg"] == 0) {
         $data["rate"] = $min_rate;
     } elseif ($debit_conf["rate_cfg"] == 1) {
         $data["rate"] = floatval(($min_rate + $max_rate) / 2);
     } elseif ($debit_conf["rate_cfg"] == 2) {
         $data["rate"] = $max_rate;
     }
     if (floatval($data['rate']) <= 0 || floatval($data['rate']) > $max_rate || floatval($data['rate']) < $min_rate) {
         showErr("请正确输入借款利率", $is_ajax);
     }
     $data['enddate'] = intval($debit_conf['enddate']);
     //筹标期限
     $data['description'] = $GLOBALS["user_info"]["user_name"] . "的白条:" . $view["deal_loan_type"] . $view["debit_money"] . "元";
     if (trim($data['description']) == '') {
         showErr("请输入项目描述", $is_ajax);
     }
     $datas["university"] = $view["university"];
     $datas["address"] = $view["address"];
     $datas["mobile"] = $view["mobile"];
     //$datas['view_info'] = serialize($user_view_info);
     $GLOBALS['db']->autoExecute(DB_PREFIX . "user", $datas, "UPDATE", "id=" . $GLOBALS['user_info']['id']);
     $data["services_fee"] = $debit_conf["services_fee"];
     $data["manage_fee"] = $debit_conf["manage_fee"];
     $data["manage_impose_fee_day1"] = $debit_conf["manage_impose_fee_day1"];
     $data["manage_impose_fee_day2"] = $debit_conf["manage_impose_fee_day2"];
     $data["impose_fee_day1"] = $debit_conf["impose_fee_day1"];
     $data["impose_fee_day2"] = $debit_conf["impose_fee_day2"];
     $data['voffice'] = 1;
     $data['vposition'] = 1;
     $data['is_effect'] = 1;
     $data['deal_status'] = 0;
     $data['agency_id'] = 0;
     //担保机构
     $data['agency_status'] = 1;
     $data['warrant'] = 0;
     //担保类型
     $data['guarantor_margin_amt'] = 0;
     //担保保证金
     $data['guarantor_pro_fit_amt'] = 0;
     //担保收益
     $data['user_id'] = intval($GLOBALS['user_info']['id']);
     $data['loantype'] = intval($view['loantype']);
     if ($data['repay_time_type'] == 0) {
         $data['loantype'] = 2;
     }
     //当为天的时候
     if ($data['repay_time_type'] == 0) {
         $true_repay_time = 1;
     } else {
         $true_repay_time = $data['repay_time'];
     }
     //本金担保
     if ($data['warrant'] == 1) {
         $data['guarantor_amt'] = $data['borrow_amount'];
     } elseif ($data['warrant'] == 2) {
         //等额本息
         if ($data['loantype'] == 0) {
             $data['guarantor_amt'] = pl_it_formula($data['borrow_amount'], $data['rate'] / 12 / 100, $true_repay_time) * $true_repay_time;
         }
     }
     $data['is_hidden'] = 1;
     $data['create_time'] = TIME_UTC;
     //推荐人
     $work_id = strim($_REQUEST["work_id"]);
     if ($work_id) {
         $data["admin_id"] = $GLOBALS['db']->getOne("select id from " . DB_PREFIX . "admin where work_id = '" . $work_id . "'");
     }
     $module = "INSERT";
     $jumpurl = url("debit", "debit_uc_center#order");
     $condition = "";
     $deal_id = $GLOBALS['db']->getOne("SELECT id FROM " . DB_PREFIX . "deal WHERE ((is_delete=2 or is_delete=3) or (is_delete=0 and publish_wait=1)) AND user_id=" . $GLOBALS['user_info']['id']);
     if ($deal_id > 0) {
         $module = "UPDATE";
         if ($t == "save") {
             $jumpurl = url("debit", "debit_uc_center#order");
         }
         $condition = "id = {$deal_id}";
     } else {
         if ($t == "save") {
             $jumpurl = url("debit", "debit_uc_center#order");
         }
     }
     $GLOBALS['db']->autoExecute(DB_PREFIX . "deal", $data, $module, $condition);
     if ($module == "INSERT") {
         $deal_id = $GLOBALS['db']->insert_id();
     }
     require_once APP_ROOT_PATH . 'app/Lib/deal.php';
     $deal = get_deal($deal_id);
     //发送验证通知
     if ($t != "save" && trim(app_conf('CUSTOM_SERVICE')) != '' && ($GLOBALS['user_info']['idcardpassed'] == 0 || $GLOBALS['user_info']['incomepassed'] == 0 || $GLOBALS['user_info']['creditpassed'] == 0 || $GLOBALS['user_info']['workpassed'] == 0)) {
         $ulist = explode(",", trim(app_conf('CUSTOM_SERVICE')));
         $ulist = array_filter($ulist);
         if ($ulist) {
             $uuid = $ulist[array_rand($ulist)];
             if ($uuid > 0) {
                 $content = app_conf("SHOP_TITLE") . "用户您好,请尽快上传必要信用认证材料(包括身份证认证、工作认证、收入认证、信用报告认证)。另外,多上传一些可选信用认证,有助于您提高借款额度,也有利于出借人更多的了解您的情况,以便让您更快的筹集到所需的资金。请您点击'我要贷款',之后点击相应的审核项目,进入后,可先阅读该项信用认证所需材料及要求,然后按要求上传资料即可。 如果您有任何问题请您拨打客服电话 " . app_conf('SHOP_TEL') . " 或给客服邮箱发邮件 " . app_conf("REPLY_ADDRESS") . " 我们会及时给您回复。";
                 require_once APP_ROOT_PATH . 'app/Lib/message.php';
                 //添加留言
                 $message['title'] = $content;
                 $message['content'] = htmlspecialchars(addslashes(valid_str($content)));
                 $message['title'] = valid_str($message['title']);
                 $message['create_time'] = TIME_UTC;
                 $message['rel_table'] = "deal";
                 $message['rel_id'] = $deal_id;
                 $message['user_id'] = $uuid;
                 $message['is_effect'] = 1;
                 $GLOBALS['db']->autoExecute(DB_PREFIX . "message", $message);
                 //添加到动态
                 insert_topic("message", $message['rel_id'], $message['user_id'], get_user_name($message['user_id'], false), $GLOBALS['user_info']['id']);
                 //自己给自己留言不执行操作
                 if ($deal['user_id'] != $message['user_id']) {
                     $msg_conf = get_user_msg_conf($deal['user_id']);
                     //站内信
                     if ($msg_conf['sms_asked'] == 1) {
                         $notices['shop_title'] = app_conf("SHOP_TITLE");
                         $notices['shop_tel'] = app_conf('SHOP_TEL');
                         $notices['shop_address'] = app_conf("REPLY_ADDRESS");
                         /*{$notice.shop_title}用户您好,请尽快上传必要信用认证材料(包括身份证认证、工作认证、收入认证、信用报告认证)。另外,多上传一些可选信用认证,有助于您提高借款额度,也有利于出借人更多的了解您的情况,以便让您更快的筹集到所需的资金。请您点击'我要贷款',之后点击相应的审核项目,进入后,可先阅读该项信用认证所需材料及要求,然后按要求上传资料即可。 如果您有任何问题请您拨打客服电话{$notice.shop_tel}或给客服邮箱发邮件{$notice.shop_address}我们会及时给您回复。*/
                         $notices['url'] = "“<a href=\"" . $deal_info['url'] . "\">" . $deal_info['name'] . "</a>”";
                         $notices['user_name'] = get_user_name($message['user_id']);
                         $notices['money'] = $user_load_data['true_repay_money'] + $user_load_data['impose_money'];
                         $tmpl_content = $GLOBALS['db']->getRow("select * from " . DB_PREFIX . "msg_template where name = 'TPL_WORDS_MSG'", false);
                         $GLOBALS['tmpl']->assign("notice", $notices);
                         $contents = $GLOBALS['tmpl']->fetch("str:" . $tmpl_content['content']);
                         send_user_msg("", $contents, 0, $deal['user_id'], TIME_UTC, 0, true, 13, $message['rel_id']);
                     }
                     //邮件
                     if ($msg_conf['mail_asked'] == 1 && app_conf('MAIL_ON') == 1) {
                         $tmpl = $GLOBALS['db']->getRow("select * from " . DB_PREFIX . "msg_template where name = 'TPL_MAIL_DEAL_MSG'");
                         $tmpl_content = $tmpl['content'];
                         $notice['user_name'] = $GLOBALS['user_info']['user_name'];
                         $notice['msg_user_name'] = get_user_name($message['user_id'], false);
                         $notice['deal_name'] = $deal['name'];
                         $notice['deal_url'] = SITE_DOMAIN . url("index", "deal", array("id" => $deal['id']));
                         $notice['message'] = $message['content'];
                         $notice['site_name'] = app_conf("SHOP_TITLE");
                         $notice['site_url'] = SITE_DOMAIN . APP_ROOT;
                         $notice['help_url'] = SITE_DOMAIN . url("index", "helpcenter");
                         $GLOBALS['tmpl']->assign("notice", $notice);
                         $msg = $GLOBALS['tmpl']->fetch("str:" . $tmpl_content);
                         $msg_data['dest'] = $GLOBALS['user_info']['email'];
                         $msg_data['send_type'] = 1;
                         $msg_data['title'] = get_user_name($message['user_id'], false) . "给您的标留言!";
                         $msg_data['content'] = addslashes($msg);
                         $msg_data['send_time'] = 0;
                         $msg_data['is_send'] = 0;
                         $msg_data['create_time'] = TIME_UTC;
                         $msg_data['user_id'] = $GLOBALS['user_info']['id'];
                         $msg_data['is_html'] = $tmpl['is_html'];
                         $GLOBALS['db']->autoExecute(DB_PREFIX . "deal_msg_list", $msg_data);
                         //插入
                     }
                 }
             }
         }
     }
     if ($is_ajax == 1) {
         showSuccess("提交成功,请等待管理员审核", $is_ajax, $jumpurl);
     } else {
         app_redirect($jumpurl);
     }
 }
Esempio n. 24
0
 public function ajax_recommend_save()
 {
     $result = array('status' => '', 'info' => '', 'url' => '', 'html' => '');
     $memo = strim($_POST['memo']);
     //推荐项目id
     $deal_id = intval($_POST['deal_id']);
     //推荐项目图片
     $deal_image = strim($_POST['deal_image']) != "" ? replace_public($_POST['deal_image']) : "";
     //推荐项目名字
     $deal_name = strim($_POST['deal_name']);
     //被推荐人id
     $user_id = intval($_POST['user_id']);
     //项目类型 0普通 1股权
     $deal_type = intval($_POST['deal_type']);
     //推荐人id
     $recommend_user_id = intval($_POST['recommend_user_id']);
     $create_time = NOW_TIME;
     if ($deal_id == null) {
         $result['status'] = 0;
         $result['info'] = "请选择推荐项目!";
         ajax_return($result);
         return false;
     }
     if ($memo == null) {
         $result['status'] = 0;
         $result['info'] = "推荐理由不能为空!";
         ajax_return($result);
         return false;
     }
     if ($GLOBALS['db']->autoExecute(DB_PREFIX . "recommend", array("memo" => $memo, "deal_id" => $deal_id, "user_id" => $user_id, "recommend_user_id" => $recommend_user_id, "create_time" => $create_time, "deal_type" => $deal_type, "deal_name" => $deal_name, "deal_image" => $deal_image), "INSERT") > 0) {
         $result['status'] = 1;
         $result['info'] = "项目推荐成功!";
         ajax_return($result);
         return false;
     } else {
         $result['status'] = 0;
         $result['info'] = "系统繁忙,请您稍后重试!";
         ajax_return($result);
         return false;
     }
 }
Esempio n. 25
0
 public function save_update()
 {
     $ajax = intval($_REQUEST['ajax']);
     if (!$GLOBALS['user_info']) {
         showErr("", $ajax, url("user#login"));
     }
     $id = intval($_REQUEST['id']);
     $deal_info = $GLOBALS['db']->getRow("select * from " . DB_PREFIX . "deal where id = " . $id . " and is_delete = 0 and is_effect = 1 and user_id = " . intval($GLOBALS['user_info']['id']));
     if (!$deal_info) {
         showErr("不能更新该项目的动态", $ajax);
     } else {
         $data['log_info'] = strim($_REQUEST['log_info']);
         if ($data['log_info'] == "") {
             showErr("请输入更新的内容", $ajax, "");
         }
         $data['image'] = strim($_REQUEST['image']) != "" ? replace_public($_REQUEST['image']) : "";
         $data['vedio'] = strim($_REQUEST['vedio']);
         if ($data['vedio'] != "") {
             require_once APP_ROOT_PATH . "system/utils/vedio.php";
             $vedio = fetch_vedio_url($_REQUEST['vedio']);
             if ($vedio != "") {
                 $data['source_vedio'] = $vedio;
             } else {
                 showErr("非法的视频地址", $ajax, "");
             }
         }
         $data['user_id'] = intval($GLOBALS['user_info']['id']);
         $data['deal_id'] = $id;
         $data['create_time'] = NOW_TIME;
         $data['user_name'] = $GLOBALS['user_info']['user_name'];
         $GLOBALS['db']->autoExecute(DB_PREFIX . "deal_log", $data);
         $GLOBALS['db']->query("update " . DB_PREFIX . "deal set log_count = log_count + 1 where id = " . $deal_info['id']);
         showSuccess("", $ajax, url("deal#update", array("id" => $deal_info['id'])));
     }
 }
Esempio n. 26
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);
     }
 }
Esempio n. 27
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"));
 }