Exemplo n.º 1
0
 public function index()
 {
     $content = strim($GLOBALS['request']['content']);
     //点评内容
     $point = intval($GLOBALS['request']['point']);
     //点评分数
     $deal_id = intval($GLOBALS['request']['id']);
     //团购或商品id //只有购买后,才能点评
     //检查用户,用户密码
     $user = $GLOBALS['user_info'];
     $user_id = intval($user['id']);
     $money = floatval($user['money']);
     $root = array();
     $root['return'] = 1;
     if ($user_id > 0) {
         $GLOBALS['user_info'] = $user;
         $root['user_login_status'] = 1;
         require_once APP_ROOT_PATH . "system/model/review.php";
         require_once APP_ROOT_PATH . "system/model/deal.php";
         $deal_info = get_deal($deal_id);
         if ($deal_info['is_shop'] == 1) {
             $cfg = load_dp_cfg(array("scate_id" => $deal_info['shop_cate_id']));
         } else {
             $cfg = load_dp_cfg(array("cate_id" => $deal_info['cate_id']));
         }
         $point_group = array();
         foreach ($cfg['point_group'] as $row) {
             $point_group[$row['id']] = $point;
         }
         $dp_img = array();
         if (count($_FILES['file']['name']) > 9) {
             $root['status'] = 0;
             $root['info'] = '上传图片不能超过9张';
         } else {
             //同步图片
             foreach ($_FILES['file']['name'] as $k => $v) {
                 $_files['file']['name'] = $v;
                 $_files['file']['type'] = $_FILES['file']['type'][$k];
                 $_files['file']['tmp_name'] = $_FILES['file']['tmp_name'][$k];
                 $_files['file']['error'] = $_FILES['file']['error'][$k];
                 $_files['file']['size'] = $_FILES['file']['size'][$k];
                 $res = upload_topic($_files);
                 if ($res['error'] == 0) {
                     $dp_img[] = $res['url'];
                 }
             }
             $result = save_review($user_id, array("deal_id" => $deal_id), $content, $point, $dp_img, array(), $point_group);
             //$result = add_deal_dp($user_id, $content, $point, $deal_id);
             $root['status'] = $result['status'];
             $root['info'] = $result['info'];
         }
     } else {
         $root['user_login_status'] = 0;
         $root['status'] = 0;
         $root['info'] = '请先登录';
     }
     output($root);
 }
Exemplo n.º 2
0
 public function index()
 {
     $content = strim($GLOBALS['request']['content']);
     //点评内容
     $point = intval($GLOBALS['request']['point']);
     //点评分数
     $city_name = strim($GLOBALS['request']['city_name']);
     //城市名称
     $type = strim($GLOBALS['request']['type']);
     $id = intval($GLOBALS['request']['id']);
     $deal_id = 0;
     $youhui_id = 0;
     $location_id = 0;
     $event_id = 0;
     $tech_id = 0;
     if ($type == "deal") {
         $deal_id = $id;
         require_once APP_ROOT_PATH . "system/model/deal.php";
         $relate_data = get_deal($deal_id);
     } elseif ($type == "supplier") {
         $location_id = $id;
         require_once APP_ROOT_PATH . "system/model/supplier.php";
         $relate_data = get_location($location_id);
     } elseif ($type == "youhui") {
         $youhui_id = $id;
         require_once APP_ROOT_PATH . "system/model/youhui.php";
         $relate_data = get_youhui($youhui_id);
     } elseif ($type == "event") {
         $event_id = $id;
         require_once APP_ROOT_PATH . "system/model/event.php";
         $relate_data = get_event($event_id);
     } elseif ($type == "tech") {
         $tech_id = $id;
         require_once APP_ROOT_PATH . "system/model/tech.php";
         $relate_data = get_tech($tech_id);
     }
     //检查用户,用户密码
     $user = $GLOBALS['user_info'];
     $user_id = intval($user['id']);
     $root = array();
     $root['return'] = 1;
     if ($user_id > 0) {
         $GLOBALS['user_info'] = $user;
         $root['user_login_status'] = 1;
         require_once APP_ROOT_PATH . "system/model/review.php";
         require_once APP_ROOT_PATH . "system/model/deal.php";
         if ($type == "deal") {
             if ($relate_data['is_shop'] == 1) {
                 $cfg = load_dp_cfg(array("scate_id" => $relate_data['shop_cate_id']));
             } else {
                 $cfg = load_dp_cfg(array("cate_id" => $relate_data['cate_id']));
             }
         } elseif ($type == "event") {
             $cfg = load_dp_cfg(array("ecate_id" => $relate_data['cate_id']));
         } elseif ($type == "supplier") {
             $cfg = load_dp_cfg(array("cate_id" => $relate_data['deal_cate_id']));
         } elseif ($type == "youhui") {
             $cfg = load_dp_cfg(array("cate_id" => $relate_data['deal_cate_id']));
         } elseif ($type == "tech") {
         }
         $point_group = array();
         foreach ($cfg['point_group'] as $row) {
             $point_group[$row['id']] = $point;
         }
         $dp_img = array();
         if (count($_FILES['file']['name']) > 9) {
             $root['status'] = 0;
             $root['info'] = '上传图片不能超过9张';
         } else {
             //同步图片
             foreach ($_FILES['file']['name'] as $k => $v) {
                 $_files['file']['name'] = $v;
                 $_files['file']['type'] = $_FILES['file']['type'][$k];
                 $_files['file']['tmp_name'] = $_FILES['file']['tmp_name'][$k];
                 $_files['file']['error'] = $_FILES['file']['error'][$k];
                 $_files['file']['size'] = $_FILES['file']['size'][$k];
                 $res = upload_topic($_files);
                 if ($res['error'] == 0) {
                     $dp_img[] = $res['url'];
                 }
             }
             if ($content != '') {
                 $result = save_review($user_id, array("deal_id" => $deal_id, "youhui_id" => $youhui_id, "event_id" => $event_id, "location_id" => $location_id, "tech_id" => $tech_id), $content, $point, $dp_img, array(), $point_group);
             }
             //$result = add_deal_dp($user_id, $content, $point, $deal_id);
             $root['status'] = $result['status'];
             $root['info'] = $result['info'];
         }
     } else {
         $root['user_login_status'] = 0;
         $root['status'] = 0;
         $root['info'] = '请先登录';
     }
     $root['page_title'] = "发表点评";
     $root['city_name'] = $city_name;
     output($root);
 }
Exemplo n.º 3
0
 public function index()
 {
     global_run();
     init_app_page();
     $GLOBALS['tmpl']->assign("no_nav", true);
     //无分类下拉
     if (empty($GLOBALS['user_info'])) {
         app_redirect(url("index", "user#login"));
     }
     require_once APP_ROOT_PATH . "system/model/review.php";
     $order_item_id = intval($_REQUEST['order_item_id']);
     //订单商品ID
     $youhui_log_id = intval($_REQUEST['youhui_log_id']);
     //优惠券领取日志ID
     $event_submit_id = intval($_REQUEST['event_submit_id']);
     //活动报名日志ID
     if ($order_item_id > 0) {
         $deal_id = intval($GLOBALS['db']->getOne("select deal_id from " . DB_PREFIX . "deal_order_item where id = " . $order_item_id));
     } else {
         $deal_id = intval($_REQUEST['deal_id']);
     }
     if ($youhui_log_id > 0) {
         $youhui_id = intval($GLOBALS['db']->getOne("select youhui_id from " . DB_PREFIX . "youhui_log where id = " . $youhui_log_id));
     } else {
         $youhui_id = intval($_REQUEST['youhui_id']);
     }
     if ($event_submit_id > 0) {
         $event_id = intval($GLOBALS['db']->getOne("select event_id from " . DB_PREFIX . "event_submit where id = " . $event_submit_id));
     } else {
         $event_id = intval($_REQUEST['event_id']);
     }
     $location_id = intval($_REQUEST['location_id']);
     if ($deal_id > 0) {
         require_once APP_ROOT_PATH . "system/model/deal.php";
         $deal_info = get_deal($deal_id);
         if ($deal_info) {
             //验证是否可以点评
             $checker = check_dp_status($GLOBALS['user_info']['id'], array("deal_id" => $deal_id, "order_item_id" => $order_item_id));
             if (!$checker['status']) {
                 showErr($checker['info'], 0, $deal_info['url']);
             }
             $dp_data = load_dp_info(array("deal_id" => $deal_id));
             if ($deal_info['is_shop'] == 1) {
                 $dp_cfg = load_dp_cfg(array("scate_id" => $deal_info['shop_cate_id']));
             } else {
                 $dp_cfg = load_dp_cfg(array("cate_id" => $deal_info['cate_id']));
             }
             $item_info['id'] = $deal_info['id'];
             $item_info['key'] = 'deal_id';
             $item_info['ex_key'] = 'order_item_id';
             $item_info['ex_id'] = $order_item_id;
             $item_info['name'] = $deal_info['sub_name'];
             $item_info['detail'] = $deal_info['name'];
             $item_info['url'] = $deal_info['url'];
             $item_info['image'] = $deal_info['icon'];
             $GLOBALS['tmpl']->assign("dp_data", $dp_data);
             $GLOBALS['tmpl']->assign("dp_cfg", $dp_cfg);
             $GLOBALS['tmpl']->assign("item_info", $item_info);
             //print_r($dp_cfg);
             //输出导航
             $site_nav[] = array('name' => $GLOBALS['lang']['HOME_PAGE'], 'url' => url("index"));
             $site_nav[] = array('name' => $deal_info['sub_name'], 'url' => url("index", "review", array("deal_id" => $deal_info['id'])));
             $GLOBALS['tmpl']->assign("site_nav", $site_nav);
             //输出seo
             $page_title = "";
             $page_keyword = "";
             $page_description = "";
             if ($deal_info['supplier_info']['name']) {
                 $page_title .= "[" . $deal_info['supplier_info']['name'] . "]";
                 $page_keyword .= $deal_info['supplier_info']['name'] . ",";
                 $page_description .= $deal_info['supplier_info']['name'] . ",";
             }
             $page_title .= $deal_info['sub_name'];
             $page_keyword .= $deal_info['sub_name'];
             $page_description .= $deal_info['sub_name'];
             $GLOBALS['tmpl']->assign("page_title", $page_title);
             $GLOBALS['tmpl']->assign("page_keyword", $page_keyword);
             $GLOBALS['tmpl']->assign("page_description", $page_description);
             //输出右侧的其他团购
             if ($deal_info['is_shop'] == 0) {
                 $side_deal_list = get_deal_list(5, array(DEAL_ONLINE, DEAL_NOTICE), array("cid" => $deal_info['cate_id'], "city_id" => $GLOBALS['city']['id']), "", "  d.buy_type <> 1 and d.is_shop = 0 and d.id<>" . $deal_info['id']);
             } elseif ($deal_info['is_shop'] == 1) {
                 if ($deal_info['buy_type'] == 1) {
                     $side_deal_list = get_goods_list(5, array(DEAL_ONLINE, DEAL_NOTICE), array("cid" => $deal_info['shop_cate_id'], "city_id" => $GLOBALS['city']['id']), "", "  d.buy_type = 1 and d.is_shop = 1 and d.id<>" . $deal_info['id']);
                 } else {
                     $side_deal_list = get_goods_list(5, array(DEAL_ONLINE, DEAL_NOTICE), array("cid" => $deal_info['shop_cate_id'], "city_id" => $GLOBALS['city']['id']), "", "  d.buy_type <> 1 and d.is_shop = 1 and d.id<>" . $deal_info['id']);
                 }
             }
             //$side_deal_list = get_deal_list(4,array(DEAL_ONLINE));
             $GLOBALS['tmpl']->assign("side_deal_list", $side_deal_list['list']);
         } else {
             showErr("你要点评的商品不存在");
         }
     } elseif ($youhui_id > 0) {
         require_once APP_ROOT_PATH . "system/model/youhui.php";
         $youhui_info = get_youhui($youhui_id);
         if ($youhui_info) {
             //验证是否可以点评
             $checker = check_dp_status($GLOBALS['user_info']['id'], array("youhui_id" => $youhui_id, "youhui_log_id" => $youhui_log_id));
             if (!$checker['status']) {
                 showErr($checker['info'], 0, $youhui_info['url']);
             }
             $dp_data = load_dp_info(array("youhui_id" => $youhui_id));
             $dp_cfg = load_dp_cfg(array("cate_id" => $youhui_info['deal_cate_id']));
             $item_info['id'] = $youhui_info['id'];
             $item_info['key'] = 'youhui_id';
             $item_info['ex_key'] = 'youhui_log_id';
             $item_info['ex_id'] = $youhui_log_id;
             $item_info['name'] = $youhui_info['name'];
             $item_info['url'] = $youhui_info['url'];
             $item_info['image'] = $youhui_info['icon'];
             $GLOBALS['tmpl']->assign("dp_data", $dp_data);
             $GLOBALS['tmpl']->assign("dp_cfg", $dp_cfg);
             $GLOBALS['tmpl']->assign("item_info", $item_info);
             //输出导航
             $site_nav[] = array('name' => $GLOBALS['lang']['HOME_PAGE'], 'url' => url("index"));
             $site_nav[] = array('name' => $youhui_info['name'], 'url' => url("index", "review", array("youhui_id" => $youhui_info['id'])));
             $GLOBALS['tmpl']->assign("site_nav", $site_nav);
             //输出seo
             $page_title = "";
             $page_keyword = "";
             $page_description = "";
             if ($youhui_info['supplier_info']['name']) {
                 $page_title .= "[" . $youhui_info['supplier_info']['name'] . "]";
                 $page_keyword .= $youhui_info['supplier_info']['name'] . ",";
                 $page_description .= $youhui_info['supplier_info']['name'] . ",";
             }
             $page_title .= $youhui_info['name'];
             $page_keyword .= $youhui_info['name'];
             $page_description .= $youhui_info['name'];
             $GLOBALS['tmpl']->assign("page_title", $page_title);
             $GLOBALS['tmpl']->assign("page_keyword", $page_keyword);
             $GLOBALS['tmpl']->assign("page_description", $page_description);
         } else {
             showErr("你要点评的优惠券不存在");
         }
     } elseif ($location_id > 0) {
         require_once APP_ROOT_PATH . "system/model/supplier.php";
         $location_info = get_location($location_id);
         if ($location_info) {
             //验证是否可以点评
             $checker = check_dp_status($GLOBALS['user_info']['id'], array("location_id" => $location_id));
             if (!$checker['status']) {
                 showErr($checker['info'], 0, $location_info['url']);
             }
             $dp_data = load_dp_info(array("location_id" => $location_id));
             $dp_cfg = load_dp_cfg(array("cate_id" => $location_info['deal_cate_id']));
             $item_info['id'] = $location_info['id'];
             $item_info['key'] = 'location_id';
             $item_info['name'] = $location_info['name'];
             $item_info['url'] = $location_info['url'];
             $item_info['image'] = $location_info['preview'];
             $GLOBALS['tmpl']->assign("dp_data", $dp_data);
             $GLOBALS['tmpl']->assign("dp_cfg", $dp_cfg);
             $GLOBALS['tmpl']->assign("item_info", $item_info);
             //输出导航
             $site_nav[] = array('name' => $GLOBALS['lang']['HOME_PAGE'], 'url' => url("index"));
             $site_nav[] = array('name' => $location_info['name'], 'url' => url("index", "review", array("location_id" => $location_info['id'])));
             $GLOBALS['tmpl']->assign("site_nav", $site_nav);
             //输出seo
             $page_title = "";
             $page_keyword = "";
             $page_description = "";
             if ($location_info['supplier_info']['name']) {
                 $page_title .= "[" . $location_info['supplier_info']['name'] . "]";
                 $page_keyword .= $location_info['supplier_info']['name'] . ",";
                 $page_description .= $location_info['supplier_info']['name'] . ",";
             }
             $page_title .= $location_info['name'];
             $page_keyword .= $location_info['name'];
             $page_description .= $location_info['name'];
             $GLOBALS['tmpl']->assign("page_title", $page_title);
             $GLOBALS['tmpl']->assign("page_keyword", $page_keyword);
             $GLOBALS['tmpl']->assign("page_description", $page_description);
         } else {
             showErr("你要点评的商家不存在");
         }
     } elseif ($event_id > 0) {
         require_once APP_ROOT_PATH . "system/model/event.php";
         $event_info = get_event($event_id);
         if ($event_info) {
             //验证是否可以点评
             $checker = check_dp_status($GLOBALS['user_info']['id'], array("event_id" => $event_id, "event_submit_id" => $event_submit_id));
             if (!$checker['status']) {
                 showErr($checker['info'], 0, $event_info['url']);
             }
             $dp_data = load_dp_info(array("event_id" => $event_id));
             $dp_cfg = load_dp_cfg(array("ecate_id" => $event_info['cate_id']));
             $item_info['id'] = $event_info['id'];
             $item_info['key'] = 'event_id';
             $item_info['ex_key'] = 'event_submit_id';
             $item_info['ex_id'] = $event_submit_id;
             $item_info['name'] = $event_info['name'];
             $item_info['url'] = $event_info['url'];
             $item_info['image'] = $event_info['icon'];
             $GLOBALS['tmpl']->assign("dp_data", $dp_data);
             $GLOBALS['tmpl']->assign("dp_cfg", $dp_cfg);
             $GLOBALS['tmpl']->assign("item_info", $item_info);
             //输出导航
             $site_nav[] = array('name' => $GLOBALS['lang']['HOME_PAGE'], 'url' => url("index"));
             $site_nav[] = array('name' => $event_info['name'], 'url' => url("index", "review", array("event_id" => $event_info['id'])));
             $GLOBALS['tmpl']->assign("site_nav", $site_nav);
             //输出seo
             $page_title = "";
             $page_keyword = "";
             $page_description = "";
             if ($event_info['supplier_info']['name']) {
                 $page_title .= "[" . $event_info['supplier_info']['name'] . "]";
                 $page_keyword .= $event_info['supplier_info']['name'] . ",";
                 $page_description .= $event_info['supplier_info']['name'] . ",";
             }
             $page_title .= $event_info['name'];
             $page_keyword .= $event_info['name'];
             $page_description .= $event_info['name'];
             $GLOBALS['tmpl']->assign("page_title", $page_title);
             $GLOBALS['tmpl']->assign("page_keyword", $page_keyword);
             $GLOBALS['tmpl']->assign("page_description", $page_description);
         } else {
             showErr("你要点评的活动不存在");
         }
     } else {
         app_redirect(url("index"));
     }
     $GLOBALS['tmpl']->display("review.html");
 }