Beispiel #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);
 }
Beispiel #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);
 }
Beispiel #3
0
 public function index()
 {
     require_once APP_ROOT_PATH . "system/model/user.php";
     require_once APP_ROOT_PATH . "system/model/topic.php";
     $root = array();
     $content = strim($GLOBALS['request']['content']);
     $source = strim($GLOBALS['request']['source']);
     $source = str_replace("来自", "", $source);
     $user_data = $GLOBALS['user_info'];
     $user_data['id'] = intval($user_data['id']);
     if (intval($user_data['id']) == 0) {
         $root['return'] = 0;
         $root['info'] = "请先登录";
         output($root);
     }
     if (isset($_FILES['image_1'])) {
         // 			//开始上传
         // 			//上传处理
         // 			//创建comment目录
         // 			if (!is_dir(APP_ROOT_PATH."public/comment")) {
         // 		             @mkdir(APP_ROOT_PATH."public/comment");
         // 		             @chmod(APP_ROOT_PATH."public/comment", 0777);
         // 		        }
         // 		    $dir = to_date(get_gmtime(),"Ym");
         // 		    if (!is_dir(APP_ROOT_PATH."public/comment/".$dir)) {
         // 		             @mkdir(APP_ROOT_PATH."public/comment/".$dir);
         // 		             @chmod(APP_ROOT_PATH."public/comment/".$dir, 0777);
         // 		        }
         // 		    $dir = $dir."/".to_date(get_gmtime(),"d");
         // 		    if (!is_dir(APP_ROOT_PATH."public/comment/".$dir)) {
         // 		             @mkdir(APP_ROOT_PATH."public/comment/".$dir);
         // 		             @chmod(APP_ROOT_PATH."public/comment/".$dir, 0777);
         // 		        }
         // 		    $dir = $dir."/".to_date(get_gmtime(),"H");
         // 		    if (!is_dir(APP_ROOT_PATH."public/comment/".$dir)) {
         // 		             @mkdir(APP_ROOT_PATH."public/comment/".$dir);
         // 		             @chmod(APP_ROOT_PATH."public/comment/".$dir, 0777);
         // 		        }
         // 	   		if(app_conf("IS_WATER_MARK")==1)
         // 	   		$img_result = save_image_upload($_FILES,"image_1","comment/".$dir,$whs=array('thumb'=>array(100,100,1,0)),1,1);
         // 			else
         // 	   		$img_result = save_image_upload($_FILES,"image_1","comment/".$dir,$whs=array('thumb'=>array(100,100,1,0)),0,1);
         // 			if(app_conf("PUBLIC_DOMAIN_ROOT")!='')
         //         	{
         //         		$paths = pathinfo($img_result['topic_image']['url']);
         //         		$path = str_replace("./","",$paths['dirname']);
         //         		$filename = $paths['basename'];
         //         		$pathwithoupublic = str_replace("public/","",$path);
         // 	        	$syn_url = app_conf("PUBLIC_DOMAIN_ROOT")."/es_file.php?username="******"IMAGE_USERNAME")."&password="******"IMAGE_PASSWORD")."&file=".get_domain().APP_ROOT."/".$path."/".$filename."&path=".$pathwithoupublic."/&name=".$filename."&act=0";
         // 	        	@file_get_contents($syn_url);
         //         	}
         // 			require_once APP_ROOT_PATH."system/utils/es_imagecls.php";
         // 			$image = new es_imagecls();
         // 			$info = $image->getImageInfo($img_result['image_1']['path']);
         // 			$image_data['width'] = intval($info[0]);
         // 			$image_data['height'] = intval($info[1]);
         // 			$image_data['name'] = valid_str($_FILES['image_1']['name']);
         // 			$image_data['filesize'] = filesize($img_result['image_1']['path']);
         // 			$image_data['create_time'] = get_gmtime();
         // 			$image_data['user_id'] = intval($GLOBALS['user_info']['id']);
         // 			$image_data['user_name'] = addslashes($GLOBALS['user_info']['user_name']);
         // 			$image_data['path'] = $img_result['image_1']['thumb']['thumb']['url'];
         // 			$image_data['o_path'] = $img_result['image_1']['url'];
         // 			$GLOBALS['db']->autoExecute(DB_PREFIX."topic_image",$image_data);
         // 			$image_id = intval($GLOBALS['db']->insert_id());
         //end 上传
         $_files['file'] = $_FILES['image_1'];
         $rs = upload_topic($_files);
         $image_id = $rs['id'];
     }
     if ($image_id > 0) {
         $attach_list = array(array("id" => $image_id, "type" => "image"));
     } else {
         $attach_list = array();
     }
     $id = insert_topic(valid_str($content), $title = "", $type = "", $group = "", $relay_id = 0, $fav_id = 0, $group_data = array(), $attach_list);
     if ($id) {
         increase_user_active($user_data['id'], "发表了一则分享");
         $GLOBALS['db']->query("update " . DB_PREFIX . "topic set source_name = '" . $source . "' where id = " . intval($id));
     }
     $syn_data['content'] = $content;
     //$syn_data['img'] = get_abs_img_root($GLOBALS['db']->getOne("select o_path from ".DB_PREFIX."topic_image where id = ".intval($image_id)));
     $syn_data['img'] = $GLOBALS['db']->getOne("select o_path from " . DB_PREFIX . "topic_image where id = " . intval($image_id));
     if ($syn_data['img']) {
         $syn_data['img'] = APP_ROOT_PATH . $syn_data['img'];
     }
     //开始同步
     if (intval($GLOBALS['request']['is_syn_sina'])) {
         //$GLOBALS['db']->query("update ".DB_PREFIX."user set is_syn_sina = 1 where id = ".intval($user_data['id']));
         //$func_name = strim($GLOBALS['request']['type'])."_Sina";
         //$result_sina = $func_name($syn_data);
         $result_sina = Sina($syn_data);
         $ext_info = "";
         if (!$result_sina['status']) {
             if (intval($result_sina['code']) == 21316 || intval($result_sina['code']) == 21317) {
                 $ext_info .= " 请先绑定新浪微博";
             }
             if (intval($result_sina['code']) == 21314 || intval($result_sina['code']) == 21315) {
                 $ext_info .= " 新浪微博授权过期";
             }
         }
     }
     if (intval($GLOBALS['request']['is_syn_tencent'])) {
         //$GLOBALS['db']->query("update ".DB_PREFIX."user set is_syn_tencent = 1 where id = ".intval($user_data['id']));
         //			$func_name = strim($GLOBALS['request']['type'])."_Tencent";
         //			$result_tencent = $func_name($syn_data);
         $result_tencent = Tencent($syn_data);
         if (!$result_tencent['status']) {
             if (intval($result_tencent['code']) == 0) {
                 $ext_info .= " 请先绑定腾讯微博";
             }
             if (intval($result_tencent['code']) == 14) {
                 $ext_info .= " 腾讯微博未实名认证";
             }
             if (intval($result_tencent['code']) == 10017 || intval($result_tencent['code']) == 10018 || intval($result_tencent['code']) == 10019 || intval($result_tencent['code']) == 36 || intval($result_tencent['code']) == 37 || intval($result_tencent['code']) == 38) {
                 $ext_info .= " 腾讯微博授权过期";
             }
         }
     }
     $root['return'] = 1;
     $root['status'] = 1;
     $root['info'] = "发布成功" . $ext_info;
     output($root);
 }