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); }
xassert($user_pdruschel->can_view_review($paper2, $review2a, false)); xassert(!$user_mgbaker->can_view_review($paper2, $review2a, false)); AssignmentSet::run($user_chair, "paper,action,email\n2,secondary,mgbaker@cs.stanford.edu\n"); $review2d = fetch_review(2, $user_mgbaker); xassert(!$review2d->reviewSubmitted); xassert($review2d->reviewNeedsSubmit == 1); xassert(!$user_mgbaker->can_view_review($paper2, $review2a, false)); $user_external = Contact::create(["email" => "external@_.com", "name" => "External Reviewer"]); $user_mgbaker->assign_review(2, $user_external->contactId, REVIEW_EXTERNAL); $review2d = fetch_review(2, $user_mgbaker); xassert(!$review2d->reviewSubmitted); xassert($review2d->reviewNeedsSubmit == -1); xassert(!$user_mgbaker->can_view_review($paper2, $review2a, false)); $review2e = fetch_review(2, $user_external); xassert(!$user_mgbaker->can_view_review($paper2, $review2e, false)); $review2e = save_review(2, $user_external, $revreq); $review2d = fetch_review(2, $user_mgbaker); xassert(!$review2d->reviewSubmitted); xassert($review2d->reviewNeedsSubmit == 0); xassert($user_mgbaker->can_view_review($paper2, $review2a, false)); xassert($user_mgbaker->can_view_review($paper2, $review2e, false)); // complex assignments assert_search_papers($user_chair, "2 AND re:4", "2"); assert_search_papers($user_chair, "re:mgbaker", "1 2 13 17"); assert_search_papers($user_chair, "re:sec:mgbaker", "2"); assert_search_papers($user_chair, "sec:mgbaker", "2"); assert_search_papers($user_chair, "re:pri:mgbaker", "1 13 17"); $assignset = new AssignmentSet($user_chair, null); $assignset->parse("action,paper,email,reviewtype\nreview,all,mgbaker@cs.stanford.edu,secondary:primary\n"); xassert_eqq(join("\n", $assignset->errors_text()), ""); xassert($assignset->execute());
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); }
public function save() { global_run(); if (empty($GLOBALS['user_info'])) { $data['status'] = -1; $data['info'] = ""; ajax_return($data); } require_once APP_ROOT_PATH . "system/model/review.php"; $deal_id = intval($_REQUEST['deal_id']); $youhui_id = intval($_REQUEST['youhui_id']); $event_id = intval($_REQUEST['event_id']); $location_id = intval($_REQUEST['location_id']); $order_item_id = intval($_REQUEST['order_item_id']); $youhui_log_id = intval($_REQUEST['youhui_log_id']); $event_submit_id = intval($_REQUEST['event_submit_id']); $param = array("deal_id" => $deal_id, "youhui_id" => $youhui_id, "event_id" => $event_id, "location_id" => $location_id, "order_item_id" => $order_item_id, "youhui_log_id" => $youhui_log_id, "event_submit_id" => $event_submit_id); $checker = check_dp_status($GLOBALS['user_info']['id'], $param); if (!$checker['status']) { showErr($checker['info'], 1); } $content = strim(valid_str($_REQUEST['content'])); //点评内容 $dp_point = intval($_REQUEST['dp_point']); //总评分 if ($dp_point <= 0) { $data['status'] = 0; $data['info'] = "请为总评打分"; ajax_return($data); } $dp_image = array(); //点评图片 foreach ($_REQUEST['dp_image'] as $k => $v) { if (strim($v) != "") { $dp_image[] = strim($v); } } $tag_group = array(); //标签分组 foreach ($_REQUEST['dp_tags'] as $k => $tags_arr) { foreach ($tags_arr as $v) { if (strim($v) != "") { $v_array = preg_split("/[ ,]/", $v); foreach ($v_array as $kk => $vv) { if (strim($vv) != "") { $tag_group[$k][] = strim(valid_str($vv)); } } } } } $point_group = array(); //评分分组 foreach ($_REQUEST['dp_point_group'] as $k => $v) { if (intval($v) > 0) { $point_group[$k] = intval($v); } else { $name = $GLOBALS['db']->getOne("select name from " . DB_PREFIX . "point_group where id = " . intval($k)); $info = "请打分"; if ($name) { $info = "请为" . $name . "打分"; } $data['status'] = 0; $data['info'] = $info; ajax_return($data); } } $result = save_review($GLOBALS['user_info']['id'], $param, $content, $dp_point, $dp_image, $tag_group, $point_group); if ($result['status']) { //分享 $attach_list = array(); if ($result['deal_id'] > 0) { require_once APP_ROOT_PATH . "system/model/deal.php"; $deal_info = get_deal($result['deal_id']); if ($deal_info['uname'] != "") { $url_key = $deal_info['uname']; } else { $url_key = $deal_info['id']; } $type = "dealcomment"; $url_route = array('rel_app_index' => 'index', 'rel_route' => 'deal#' . $url_key, 'rel_param' => ''); //同步图片 if ($deal_info['icon']) { require_once APP_ROOT_PATH . "system/utils/es_imagecls.php"; $imagecls = new es_imagecls(); $info = $imagecls->getImageInfo(APP_ROOT_PATH . $deal_info['icon']); $image_data['width'] = intval($info[0]); $image_data['height'] = intval($info[1]); $image_data['name'] = $deal_info['sub_name']; $image_data['filesize'] = filesize(APP_ROOT_PATH . $deal_info['icon']); $image_data['create_time'] = NOW_TIME; $image_data['user_id'] = intval($GLOBALS['user_info']['id']); $image_data['user_name'] = strim($GLOBALS['user_info']['user_name']); $image_data['path'] = $deal_info['icon']; $image_data['o_path'] = $deal_info['icon']; $GLOBALS['db']->autoExecute(DB_PREFIX . "topic_image", $image_data); $img_id = intval($GLOBALS['db']->insert_id()); $attach_list[] = array("type" => "image", "id" => intval($img_id)); } } elseif ($result['youhui_id'] > 0) { require_once APP_ROOT_PATH . "system/model/youhui.php"; $youhui_info = get_youhui($result['youhui_id']); $type = "youhuicomment"; $url_route = array('rel_app_index' => 'index', 'rel_route' => 'youhui#' . $result['youhui_id'], 'rel_param' => ''); //同步图片 if ($youhui_info['icon']) { require_once APP_ROOT_PATH . "system/utils/es_imagecls.php"; $imagecls = new es_imagecls(); $info = $imagecls->getImageInfo(APP_ROOT_PATH . $youhui_info['icon']); $image_data['width'] = intval($info[0]); $image_data['height'] = intval($info[1]); $image_data['name'] = $youhui_info['name']; $image_data['filesize'] = filesize(APP_ROOT_PATH . $youhui_info['icon']); $image_data['create_time'] = NOW_TIME; $image_data['user_id'] = intval($GLOBALS['user_info']['id']); $image_data['user_name'] = strim($GLOBALS['user_info']['user_name']); $image_data['path'] = $youhui_info['icon']; $image_data['o_path'] = $youhui_info['icon']; $GLOBALS['db']->autoExecute(DB_PREFIX . "topic_image", $image_data); $img_id = intval($GLOBALS['db']->insert_id()); $attach_list[] = array("type" => "image", "id" => intval($img_id)); } } elseif ($result['event_id'] > 0) { require_once APP_ROOT_PATH . "system/model/event.php"; $event_info = get_event($result['youhui_id']); $type = "eventcomment"; $url_route = array('rel_app_index' => 'index', 'rel_route' => 'event#' . $result['event_id'], 'rel_param' => ''); //同步图片 if ($event_info['icon']) { require_once APP_ROOT_PATH . "system/utils/es_imagecls.php"; $imagecls = new es_imagecls(); $info = $imagecls->getImageInfo(APP_ROOT_PATH . $event_info['icon']); $image_data['width'] = intval($info[0]); $image_data['height'] = intval($info[1]); $image_data['name'] = $event_info['name']; $image_data['filesize'] = filesize(APP_ROOT_PATH . $event_info['icon']); $image_data['create_time'] = NOW_TIME; $image_data['user_id'] = intval($GLOBALS['user_info']['id']); $image_data['user_name'] = strim($GLOBALS['user_info']['user_name']); $image_data['path'] = $event_info['icon']; $image_data['o_path'] = $event_info['icon']; $GLOBALS['db']->autoExecute(DB_PREFIX . "topic_image", $image_data); $img_id = intval($GLOBALS['db']->insert_id()); $attach_list[] = array("type" => "image", "id" => intval($img_id)); } } else { require_once APP_ROOT_PATH . "system/model/supplier.php"; $location_info = get_location($result['location_id']); $type = "slocationcomment"; $url_route = array('rel_app_index' => 'index', 'rel_route' => 'store#' . $result['location_id'], 'rel_param' => ''); //同步图片 if ($location_info['preview']) { require_once APP_ROOT_PATH . "system/utils/es_imagecls.php"; $imagecls = new es_imagecls(); $info = $imagecls->getImageInfo(APP_ROOT_PATH . $location_info['preview']); $image_data['width'] = intval($info[0]); $image_data['height'] = intval($info[1]); $image_data['name'] = $location_info['name']; $image_data['filesize'] = filesize(APP_ROOT_PATH . $location_info['preview']); $image_data['create_time'] = NOW_TIME; $image_data['user_id'] = intval($GLOBALS['user_info']['id']); $image_data['user_name'] = strim($GLOBALS['user_info']['user_name']); $image_data['path'] = $location_info['preview']; $image_data['o_path'] = $location_info['preview']; $GLOBALS['db']->autoExecute(DB_PREFIX . "topic_image", $image_data); $img_id = intval($GLOBALS['db']->insert_id()); $attach_list[] = array("type" => "image", "id" => intval($img_id)); } } foreach ($_REQUEST['topic_image_id'] as $att_id) { if (intval($att_id) > 0) { $attach_list[] = array("type" => "image", "id" => intval($att_id)); } } require_once APP_ROOT_PATH . "system/model/topic.php"; $tid = insert_topic($content, "", $type, $group = "", $relay_id = 0, $fav_id = 0, $group_data = "", $attach_list, $url_route); if ($tid) { $GLOBALS['db']->query("update " . DB_PREFIX . "topic set source_name = '网站' where id = " . intval($tid)); } $result['jump'] = url($url_route['rel_app_index'], $url_route['rel_route'], $url_route['rel_param']); ajax_return($result); } else { ajax_return($result); } }