/** * 验证用户权限 */ protected function check_auth() { $ajax = intval($_REQUEST['ajax']); $s_account_info = $GLOBALS['account_info']; if (intval($s_account_info['id']) == 0) { showBizErr("没有登录商户账户,请先登录!", $ajax, url("biz", "user#login")); } else { //获取权限进行判断 if (!check_module_auth(MODULE_NAME)) { showBizErr("没有操作模块的权限,请更换有权限的账户登录!", $ajax); } } }
public function edit() { /* 基本参数初始化 */ init_app_page(); $account_info = $GLOBALS['account_info']; $supplier_id = $account_info['supplier_id']; $account_id = $account_info['id']; $id = intval($_REQUEST['id']); $edit_type = intval($_REQUEST['edit_type']); 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) { showBizErr("已经存在申请操作,请先删除避免重复申请", 0, url("biz", "goods#index")); exit; } } /* 业务逻辑 */ if ($edit_type == 1) { //管理员发布 /********************************* * 取真正的商品数据表数据 ********************************/ $deal_info = $GLOBALS['db']->getRow("select d.* from " . DB_PREFIX . "deal d left join " . DB_PREFIX . "deal_location_link dll on dll.deal_id = d.id where d.is_effect = 1 and d.is_delete = 0 and is_shop=1 and id=" . $id . " and supplier_id = " . $supplier_id . "\n and dll.location_id in(" . implode(",", $account_info['location_ids']) . ")"); if (empty($deal_info)) { showBizErr("数据不存在或没有操作权限!", 0, url("biz", "goods#index")); exit; } //支持门店 , 门店选中状态 $location_infos = $GLOBALS['db']->getAll("select id,name from " . DB_PREFIX . "supplier_location where id in(" . implode(",", $GLOBALS['account_info']['location_ids']) . ")"); $curr_location_list = $GLOBALS['db']->getAll("select * from " . DB_PREFIX . "deal_location_link where deal_id = " . $id); foreach ($curr_location_list as $k => $v) { $curr_locations[] = $v['location_id']; } foreach ($location_infos as $k => $v) { if (in_array($v['id'], $curr_locations)) { $location_infos[$k]['checked'] = 1; } } // 图集 $img_list = $GLOBALS['db']->getAll("select * from " . DB_PREFIX . "deal_gallery where deal_id=" . $id . " order by sort asc"); $imgs = array(); foreach ($img_list as $k => $v) { $focus_imgs[$v['sort']] = $v['img']; } // 输出规格库存的配置 $attr_stock = $GLOBALS['db']->getAll("select * from " . DB_PREFIX . "attr_stock where deal_id=" . $id . " order by id asc"); $go_list_url = url("biz", "goods#index"); } elseif ($edit_type == 2) { //商户提交 /********************************** * 取商户提交数据表 *********************************/ $deal_info = $GLOBALS['db']->getRow("select * from " . DB_PREFIX . "deal_submit where is_shop = 1 and id=" . $id . " and supplier_id = " . $supplier_id); if (empty($deal_info)) { showBizErr("数据不存在或没有操作权限!", 0, url("biz", "goods#no_online_index")); exit; } // 支持门店 , 门店选中状态 $cache_location_id = unserialize($deal_info['cache_location_id']); $location_infos = $GLOBALS['db']->getAll("select id,name from " . DB_PREFIX . "supplier_location where id in(" . implode(",", $GLOBALS['account_info']['location_ids']) . ")"); foreach ($location_infos as $k => $v) { if (in_array($v['id'], $cache_location_id)) { $location_infos[$k]['checked'] = 1; } } // 图集 $focus_imgs = unserialize($deal_info['cache_focus_imgs']); //筛选关键词 $filter = unserialize($deal_info['cache_deal_filter']); // 输出规格库存的配置 $attr_stock = unserialize($deal_info['cache_attr_stock']); $go_list_url = url("biz", "goods#no_online_index"); } // 商品分类 $shop_cate_tree = $GLOBALS['db']->getAll("select * from " . DB_PREFIX . "shop_cate where is_delete = 0"); $shop_cate_tree = toFormatTree($shop_cate_tree, "name"); //品牌名称 $brand_list = $GLOBALS['db']->getAll("select * from " . DB_PREFIX . "Brand"); //转换头部SCRIPT 用的 库存 JSON $attr_cfg_json = "{"; $attr_stock_json = "{"; foreach ($attr_stock as $k => $v) { $attr_cfg_json .= $k . ":" . "{"; $attr_stock_json .= $k . ":" . "{"; foreach ($v as $key => $vvv) { if ($key != 'attr_cfg') { $attr_stock_json .= "\"" . $key . "\":" . "\"" . $vvv . "\","; } } $attr_stock_json = substr($attr_stock_json, 0, -1); $attr_stock_json .= "},"; $attr_cfg_data = unserialize($v['attr_cfg']); foreach ($attr_cfg_data as $attr_id => $vv) { $attr_cfg_json .= $attr_id . ":" . "\"" . $vv . "\","; } $attr_cfg_json = substr($attr_cfg_json, 0, -1); $attr_cfg_json .= "},"; } if ($attr_stock) { $attr_cfg_json = substr($attr_cfg_json, 0, -1); $attr_stock_json = substr($attr_stock_json, 0, -1); } $attr_cfg_json .= "}"; $attr_stock_json .= "}"; /******************************************* * 通用数据部分 ********************************************/ // 商品类型 $goods_type_list = $GLOBALS['db']->getAll("select id,name from " . DB_PREFIX . "goods_type"); foreach ($goods_type_list as $k => $v) { if ($v['id'] == $deal_info['deal_goods_type']) { $goods_type_list[$k]['selected'] = 1; break; } } // 标签数据 for ($i = 0; $i < 10; $i++) { if ($i != 1 && $i != 3 && $i != 4 && $i != 5) { if (($deal_info['deal_tag'] & pow(2, $i)) == pow(2, $i)) { $tags_html .= '<label class="ui-checkbox" rel="common_cbo"><input type="checkbox" name="deal_tag[]" value="' . $i . '" checked="checked"/>' . lang("DEAL_TAG_" . $i) . '</label>'; } else { $tags_html .= '<label class="ui-checkbox" rel="common_cbo"><input type="checkbox" name="deal_tag[]" value="' . $i . '" />' . lang("DEAL_TAG_" . $i) . '</label>'; } } } // 时间格式化 $deal_info['begin_time'] = to_date($deal_info['begin_time'], "Y-m-d H:i"); $deal_info['end_time'] = to_date($deal_info['end_time'], "Y-m-d H:i"); $deal_info['coupon_begin_time'] = to_date($deal_info['coupon_begin_time'], "Y-m-d H:i"); $deal_info['coupon_end_time'] = to_date($deal_info['coupon_end_time'], "Y-m-d H:i"); /* 数据 */ $GLOBALS['tmpl']->assign("shop_cate_tree", $shop_cate_tree); // 商品分类 $GLOBALS['tmpl']->assign("brand_list", $brand_list); // 品牌 $GLOBALS['tmpl']->assign("goods_type_list", $goods_type_list); // 属性类型 $GLOBALS['tmpl']->assign("attr_cfg_json", $attr_cfg_json); // 属性配置 $GLOBALS['tmpl']->assign("attr_stock_json", $attr_stock_json); // 属性配置 $GLOBALS['tmpl']->assign("location_infos", $location_infos); // 支持门店 $GLOBALS['tmpl']->assign("tags_html", $tags_html); // 标签数据 $GLOBALS['tmpl']->assign("filter", $filter); // 筛选关键词 $GLOBALS['tmpl']->assign("focus_imgs", $focus_imgs); // 图集数组 $GLOBALS['tmpl']->assign("deal_info", $deal_info); // 商品所有数据 $GLOBALS['tmpl']->assign("edit_type", $edit_type); // 请求数据类型 $GLOBALS['tmpl']->assign("go_list_url", $go_list_url); // 返回列表连接 /* 系统默认 */ $GLOBALS['tmpl']->assign("ajax_url", url("biz", "goods")); $GLOBALS['tmpl']->assign("page_title", "商品项目编辑"); $GLOBALS['tmpl']->display("pages/project/goods_edit.html"); }
public function edit() { /* 基本参数初始化 */ init_app_page(); $account_info = $GLOBALS['account_info']; $supplier_id = $account_info['supplier_id']; $account_id = $account_info['id']; $id = intval($_REQUEST['id']); $edit_type = intval($_REQUEST['edit_type']); 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) { showBizErr("已经存在申请操作,请先删除避免重复申请", 0, url("biz", "event#index")); exit; } } /* 业务逻辑 */ if ($edit_type == 1) { //管理员发布 /********************************* * 取真正的活动数据表数据 ********************************/ $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)) { showBizErr("数据不存在或没有操作权限!", 0, url("biz", "event#index")); exit; } //支持活动 , 活动选中状态 $location_infos = $GLOBALS['db']->getAll("select id,name,xpoint,ypoint from " . DB_PREFIX . "supplier_location where id in(" . implode(",", $GLOBALS['account_info']['location_ids']) . ")"); $curr_location_list = $GLOBALS['db']->getAll("select * from " . DB_PREFIX . "event_location_link where event_id = " . $id); foreach ($curr_location_list as $k => $v) { $curr_locations[] = $v['location_id']; } foreach ($location_infos as $k => $v) { if (in_array($v['id'], $curr_locations)) { $location_infos[$k]['checked'] = 1; } } $event_field = $GLOBALS['db']->getAll("select * from " . DB_PREFIX . "event_field where event_id = " . $id); $go_list_url = url("biz", "event#index"); } elseif ($edit_type == 2) { //商户提交 /********************************** * 取商户提交数据表 *********************************/ $event_info = $GLOBALS['db']->getRow("select * from " . DB_PREFIX . "event_biz_submit where id=" . $id . " and supplier_id = " . $supplier_id . " and account_id = " . $account_id); if (empty($event_info)) { showBizErr("数据不存在或没有操作权限!", 0, url("biz", "event#no_online_index")); exit; } // 支持活动 , 活动选中状态 $cache_location_id = unserialize($event_info['cache_event_location_link']); $location_infos = $GLOBALS['db']->getAll("select id,name from " . DB_PREFIX . "supplier_location where id in(" . implode(",", $GLOBALS['account_info']['location_ids']) . ")"); foreach ($location_infos as $k => $v) { if (in_array($v['id'], $cache_location_id)) { $location_infos[$k]['checked'] = 1; } } $event_field = unserialize($event_info['cache_event_field']); $go_list_url = url("biz", "event#no_online_index"); } // 时间格式化 $event_info['event_begin_time'] = $event_info['event_begin_time'] > 0 ? to_date($event_info['event_begin_time'], "Y-m-d H:i") : ''; $event_info['event_end_time'] = $event_info['event_end_time'] > 0 ? to_date($event_info['event_end_time'], "Y-m-d H:i") : ''; $event_info['submit_begin_time'] = $event_info['submit_begin_time'] > 0 ? to_date($event_info['submit_begin_time'], "Y-m-d H:i") : ''; $event_info['submit_end_time'] = $event_info['submit_end_time'] > 0 ? to_date($event_info['submit_end_time'], "Y-m-d H:i") : ''; $event_info['total_count'] = $event_info['total_count'] > 0 ? $event_info['total_count'] : ''; $event_info['score_limit'] = $event_info['score_limit'] > 0 ? $event_info['score_limit'] : ''; $event_info['point_limit'] = $event_info['total_count'] > 0 ? $event_info['point_limit'] : ''; // 活动类型 $event_type_list = $GLOBALS['db']->getAll("select id,name from " . DB_PREFIX . "event_cate where is_effect = 1"); /* 数据 */ $GLOBALS['tmpl']->assign("event_field", $event_field); //配置字段 $GLOBALS['tmpl']->assign("location_infos", $location_infos); // 支持活动 $GLOBALS['tmpl']->assign("event_type_list", $event_type_list); // 活动类型 $GLOBALS['tmpl']->assign("vo", $event_info); // 活动所有数据 $GLOBALS['tmpl']->assign("edit_type", $edit_type); // 请求数据类型 $GLOBALS['tmpl']->assign("go_list_url", $go_list_url); // 返回列表连接 /* 系统默认 */ $GLOBALS['tmpl']->assign("ajax_url", url("biz", "event")); $GLOBALS['tmpl']->assign("page_title", "活动项目编辑"); $GLOBALS['tmpl']->display("pages/project/event_edit.html"); }
function do_login() { $account_name = strim($_POST['account_name']); $account_password = strim($_POST['account_password']); $data = array(); //验证 if ($account_name == '') { $data['status'] = false; $data['info'] = "请输入用户名"; $data['field'] = "account_user"; ajax_return($data); } if ($account_password == '') { $data['status'] = false; $data['info'] = "请输入密码"; $data['field'] = "account_password"; ajax_return($data); } $account_info = $GLOBALS['db']->getRow("SELECT * FROM " . DB_PREFIX . "supplier_account WHERE account_name='" . $account_name . "' AND is_delete=0"); require_once APP_ROOT_PATH . "system/libs/biz_user.php"; if (check_ipop_limit(CLIENT_IP, "biz_dologin", intval(app_conf("SUBMIT_DELAY")))) { $result = do_login_biz($account_name, $account_password); } else { showErr("提交太快了", 1); } if ($result['status']) { // $s_account_info = es_session::get("account_info"); // if(intval($_POST['auto_login'])==1) // { // //自动登录,保存cookie // $account_info = $s_account_info; // es_cookie::set("account_name",$account_info['account_name'],3600*24*30); // es_cookie::set("account_pwd",md5($account_info['account_password']."_EASE_COOKIE"),3600*24*30); // } // if(strim($_REQUEST['form_prefix'])=="ajax") // { // $GLOBALS['account_info'] = $s_account_info; // if($GLOBALS['account_info']) // { // $GLOBALS['tmpl']->assign("account_info",$s_account_info); // } // $tip = $GLOBALS['tmpl']->fetch("inc/insert/load_biz_user_tip.html"); // } //获取权限 $biz_account_auth = get_biz_account_auth(); if (empty($biz_account_auth)) { showBizErr("请更换帐号登录,此账户还没有分配权限", 1); } else { $jump_url = url("biz", $biz_account_auth[0]); } $return['status'] = true; $return['info'] = "登录成功"; $return['data'] = $result['msg']; $return['jump'] = $jump_url; $return['tip'] = $tip; ajax_return($return); } else { if ($result['data'] == ACCOUNT_NO_EXIST_ERROR) { $field = "account_name"; $err = $GLOBALS['lang']['USER_NOT_EXIST']; } if ($result['data'] == ACCOUNT_PASSWORD_ERROR) { $field = "account_password"; $err = $GLOBALS['lang']['PASSWORD_ERROR']; } if ($result['data'] == ACCOUNT_NO_VERIFY_ERROR) { $field = "account_name"; $err = $GLOBALS['lang']['USER_NOT_VERIFY']; } $data['status'] = false; $data['info'] = $err; $data['field'] = $field; ajax_return($data); } }
public function edit() { /* 基本参数初始化 */ init_app_page(); $account_info = $GLOBALS['account_info']; $supplier_id = $account_info['supplier_id']; $account_id = $account_info['id']; $id = intval($_REQUEST['id']); $edit_type = intval($_REQUEST['edit_type']); if ($edit_type == 1 && $id > 0) { //判断是否有存在修改 $deal_submit_info = $GLOBALS['db']->getRow("select * from " . DB_PREFIX . "youhui_biz_submit where youhui_id = " . $id . " and supplier_id = " . $supplier_id); if ($deal_submit_info && $deal_submit_info['admin_check_status'] == 0) { showBizErr("已经存在申请操作,请先删除避免重复申请", 0, url("biz", "youhui#index")); exit; } } /* 业务逻辑 */ if ($edit_type == 1) { //管理员发布 /********************************* * 取真正的商品、团购数据表数据 ********************************/ $youhui_info = $GLOBALS['db']->getRow("select y.* from " . DB_PREFIX . "youhui as y left join " . DB_PREFIX . "youhui_location_link as yl on yl.youhui_id = y.id where y.is_effect = 1 and id=" . $id . " and supplier_id = " . $supplier_id . " and yl.location_id in(" . implode(",", $account_info['location_ids']) . ")"); if (empty($youhui_info)) { showBizErr("数据不存在或没有操作权限!", 0, url("biz", "youhui#index")); exit; } //支持门店 , 门店选中状态 $location_infos = $GLOBALS['db']->getAll("select id,name,xpoint,ypoint from " . DB_PREFIX . "supplier_location where id in(" . implode(",", $GLOBALS['account_info']['location_ids']) . ")"); //该账户权限门店 $curr_location_list = $GLOBALS['db']->getAll("select * from " . DB_PREFIX . "youhui_location_link where youhui_id = " . $id); //该优惠券门店 foreach ($curr_location_list as $k => $v) { $curr_locations[] = $v['location_id']; } foreach ($location_infos as $k => $v) { if (in_array($v['id'], $curr_locations)) { $location_infos[$k]['checked'] = 1; } } // 选中子分类 $select_sub_cate = $GLOBALS['db']->getOne("select group_concat(Convert(deal_cate_type_id , char)) from " . DB_PREFIX . "deal_cate_type_youhui_link where youhui_id = " . $id); $go_list_url = url("biz", "youhui#index"); } elseif ($edit_type == 2) { //商户提交 /********************************** * 取商户提交数据表 *********************************/ $youhui_info = $GLOBALS['db']->getRow("select * from " . DB_PREFIX . "youhui_biz_submit where id=" . $id . " and supplier_id = " . $supplier_id); if (empty($youhui_info)) { showBizErr("数据不存在或没有操作权限!", 0, url("biz", "youhui#no_online_index")); exit; } // 支持门店 , 门店选中状态 $cache_location_id = unserialize($youhui_info['cache_youhui_location_link']); $location_infos = $GLOBALS['db']->getAll("select id,name,xpoint,ypoint from " . DB_PREFIX . "supplier_location where id in(" . implode(",", $GLOBALS['account_info']['location_ids']) . ")"); foreach ($location_infos as $k => $v) { if (in_array($v['id'], $cache_location_id)) { $location_infos[$k]['checked'] = 1; } } // 选中子分类 $select_sub_cate = implode(",", unserialize($youhui_info['cache_deal_cate_type_youhui_link'])); $go_list_url = url("biz", "youhui#no_online_index"); } // 时间格式化 $youhui_info['begin_time'] = to_date($youhui_info['begin_time'], "Y-m-d H:i"); $youhui_info['end_time'] = to_date($youhui_info['end_time'], "Y-m-d H:i"); $GLOBALS['tmpl']->assign("location_infos", $location_infos); // 支持门店 $GLOBALS['tmpl']->assign("select_sub_cate", $select_sub_cate); // 选中的子分类数据 $GLOBALS['tmpl']->assign("youhui_info", $youhui_info); // 商品所有数据 $GLOBALS['tmpl']->assign("edit_type", $edit_type); // 请求数据类型 $GLOBALS['tmpl']->assign("go_list_url", $go_list_url); // 返回列表连接 /* 系统默认 */ $GLOBALS['tmpl']->assign("ajax_url", url("biz", "youhui")); $GLOBALS['tmpl']->assign("page_title", "优惠券项目编辑"); $GLOBALS['tmpl']->display("pages/project/youhui_edit.html"); }
public function edit() { /* 基本参数初始化 */ init_app_page(); $account_info = $GLOBALS['account_info']; $supplier_id = $account_info['supplier_id']; $account_id = $account_info['id']; $id = intval($_REQUEST['id']); $edit_type = intval($_REQUEST['edit_type']); 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) { showBizErr("已经存在申请操作,请先删除避免重复申请", 0, url("biz", "location#index")); exit; } } /* 业务逻辑 */ if ($edit_type == 1) { //管理员发布 /********************************* * 取真正的门店数据表数据 ********************************/ $location_info = $GLOBALS['db']->getRow("select * from " . DB_PREFIX . "supplier_location 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)) { showBizErr("数据不存在或没有操作权限!", 0, url("biz", "location#index")); exit; } $location_images_data = $GLOBALS['db']->getAll("select * from " . DB_PREFIX . "supplier_location_images where supplier_location_id = " . $id); foreach ($location_images_data as $k => $v) { $location_images[] = $v['image']; } $go_list_url = url("biz", "location#index"); } elseif ($edit_type == 2) { //商户提交 /********************************** * 取商户提交数据表 *********************************/ $location_info = $GLOBALS['db']->getRow("select * from " . DB_PREFIX . "supplier_location_biz_submit where id=" . $id . " and supplier_id = " . $supplier_id . " and account_id = " . $account_id); if (empty($location_info)) { showBizErr("数据不存在或没有操作权限!", 0, url("biz", "location#no_online_index")); exit; } $location_images = unserialize($location_info['cache_supplier_location_images']); $go_list_url = url("biz", "location#no_online_index"); } /* 数据 */ $GLOBALS['tmpl']->assign("vo", $location_info); // 门店所有数据 $GLOBALS['tmpl']->assign("location_images", $location_images); // 图库 $GLOBALS['tmpl']->assign("edit_type", $edit_type); // 请求数据类型 $GLOBALS['tmpl']->assign("go_list_url", $go_list_url); // 返回列表连接 /* 系统默认 */ $GLOBALS['tmpl']->assign("ajax_url", url("biz", "location")); $GLOBALS['tmpl']->assign("page_title", "门店项目编辑"); $GLOBALS['tmpl']->display("pages/location/edit.html"); }