示例#1
0
    <?php 
        if (!empty($v['geval_image'])) {
            ?>
    <div class="image">
    	<?php 
            $image_array = explode(',', $v['geval_image']);
            ?>
        <?php 
            foreach ($image_array as $value) {
                ?>
        <a target="_blank" href="<?php 
                echo snsThumb($value, 1024);
                ?>
">
            <img src="<?php 
                echo snsThumb($value);
                ?>
">
        </a>
        <?php 
            }
            ?>
    </div>
    <?php 
        }
        ?>
	<div style="clear:both;"></div>
</div>
<?php 
    }
} else {
示例#2
0
 public function add_image_saveOp()
 {
     $geval_id = intval($_POST['geval_id']);
     $geval_image = '';
     foreach ($_POST['evaluate_image'] as $value) {
         if (!empty($value)) {
             $geval_image .= $value . ',';
         }
     }
     $geval_image = rtrim($geval_image, ',');
     $model_evaluate_goods = Model('evaluate_goods');
     $geval_info = $model_evaluate_goods->getEvaluateGoodsInfoByID($geval_id);
     if (empty($geval_info)) {
         showDialog(L('param_error'));
     }
     $update = array();
     $update['geval_image'] = $geval_image;
     $condition = array();
     $condition['geval_id'] = $geval_id;
     $result = $model_evaluate_goods->editEvaluateGoods($update, $condition);
     list($sns_image) = explode(',', $geval_image);
     $goods_url = urlShop('goods', 'index', array('goods_id' => $geval_info['geval_goodsid']));
     //同步到sns
     $content = "\r\n            <div class='fd-media'>\r\n            <div class='goodsimg'><a target=\"_blank\" href=\"{$goods_url}\"><img src=\"" . snsThumb($sns_image, 240) . "\" title=\"{$geval_info['geval_goodsname']}\" alt=\"{$geval_info['geval_goodsname']}\"></a></div>\r\n            <div class='goodsinfo'>\r\n            <dl>\r\n            <dt><a target=\"_blank\" href=\"{$goods_url}\">{$geval_info['geval_goodsname']}</a></dt>\r\n            <dd>价格" . Language::get('nc_colon') . Language::get('currency') . $geval_info['geval_goodsprice'] . "</dd>\r\n            <dd><a target=\"_blank\" href=\"{$goods_url}\">去看看</a></dd>\r\n            </dl>\r\n            </div>\r\n            </div>\r\n            ";
     $tracelog_model = Model('sns_tracelog');
     $insert_arr = array();
     $insert_arr['trace_originalid'] = '0';
     $insert_arr['trace_originalmemberid'] = '0';
     $insert_arr['trace_memberid'] = $_SESSION['member_id'];
     $insert_arr['trace_membername'] = $_SESSION['member_name'];
     $insert_arr['trace_memberavatar'] = $_SESSION['member_avatar'];
     $insert_arr['trace_title'] = '发表了商品晒单';
     $insert_arr['trace_content'] = $content;
     $insert_arr['trace_addtime'] = TIMESTAMP;
     $insert_arr['trace_state'] = '0';
     $insert_arr['trace_privacy'] = 0;
     $insert_arr['trace_commentcount'] = 0;
     $insert_arr['trace_copycount'] = 0;
     $insert_arr['trace_from'] = '1';
     $result = $tracelog_model->tracelogAdd($insert_arr);
     if ($result) {
         showDialog(L('nc_common_save_succ'), urlShop('member_evaluate', 'list'), 'succ');
     } else {
         showDialog(L('nc_common_save_succ'), urlShop('member_evaluate', 'list'));
     }
 }
示例#3
0
 /**
  * 上传图片
  *
  * @param
  * @return
  */
 public function swfuploadOp()
 {
     /**
      * 读取语言包
      */
     Language::read('sns_home');
     $lang = Language::getLangContent();
     $member_id = $_SESSION['member_id'];
     $class_id = intval($_POST['category_id']);
     if ($member_id <= 0 && $class_id <= 0) {
         echo json_encode(array('state' => 'false', 'message' => Language::get('sns_upload_pic_fail'), 'origin_file_name' => $_FILES["file"]["name"]));
         exit;
     }
     $model = Model();
     // 验证图片数量
     $count = $model->table('sns_albumpic')->where(array('member_id' => $member_id))->count();
     if (C('malbum_max_sum') != 0 && $count >= C('malbum_max_sum')) {
         echo json_encode(array('state' => 'false', 'message' => Language::get('sns_upload_img_max_num_error'), 'origin_file_name' => $_FILES["file"]["name"]));
         exit;
     }
     /**
      * 上传图片
      */
     $upload = new UploadFile();
     $upload_dir = ATTACH_MALBUM . DS . $member_id . DS;
     $upload->set('default_dir', $upload_dir . $upload->getSysSetPath());
     $thumb_width = '240,1024';
     $thumb_height = '2048,1024';
     $upload->set('max_size', C('image_max_filesize'));
     $upload->set('thumb_width', $thumb_width);
     $upload->set('thumb_height', $thumb_height);
     $upload->set('fprefix', $member_id);
     $upload->set('thumb_ext', '_240,_1024');
     $result = $upload->upfile('file');
     if (!$result) {
         echo json_encode(array('state' => 'false', 'message' => Language::get('sns_upload_pic_fail'), 'origin_file_name' => $_FILES["file"]["name"]));
         exit;
     }
     $img_path = $upload->getSysSetPath() . $upload->file_name;
     list($width, $height, $type, $attr) = getimagesize(BASE_UPLOAD_PATH . DS . ATTACH_MALBUM . DS . $member_id . DS . $img_path);
     $image = explode('.', $_FILES["file"]["name"]);
     if (strtoupper(CHARSET) == 'GBK') {
         $image['0'] = Language::getGBK($image['0']);
     }
     $insert = array();
     $insert['ap_name'] = $image['0'];
     $insert['ac_id'] = $class_id;
     $insert['ap_cover'] = $img_path;
     $insert['ap_size'] = intval($_FILES['file']['size']);
     $insert['ap_spec'] = $width . 'x' . $height;
     $insert['upload_time'] = time();
     $insert['member_id'] = $member_id;
     $result = $model->table('sns_albumpic')->insert($insert);
     $data = array();
     $data['file_id'] = $result;
     $data['file_name'] = $img_path;
     $data['origin_file_name'] = $_FILES["file"]["name"];
     $data['file_path'] = $img_path;
     $data['file_url'] = snsThumb($img_path, 240);
     $data['state'] = 'true';
     /**
      * 整理为json格式
      */
     $output = json_encode($data);
     echo $output;
 }
示例#4
0
 /**
  * 商品评论
  */
 public function get_commentsOp()
 {
     $size = 10;
     $goods_id = intval($_GET['goods_id']);
     $condition = array();
     $condition['geval_goodsid'] = $goods_id;
     $page = intval($_GET['page']);
     $page = $page <= 0 ? 1 : $page;
     $type = intval($_GET['type']);
     switch ($type) {
         case '1':
             $condition['geval_scores'] = array('in', '5,4');
             break;
         case '2':
             $condition['geval_scores'] = array('in', '3,2');
             break;
         case '3':
             $condition['geval_scores'] = array('in', '1');
             break;
     }
     $goodsevallist = Model('evaluate_goods')->field('geval_scores,geval_frommembername,geval_content,geval_image')->where($condition)->order('geval_id desc')->limit(($page - 1) * $size . ',' . $size)->select();
     if ($goodsevallist) {
         foreach ($goodsevallist as $k => $v) {
             if ($v['geval_image']) {
                 $geval_image = explode(",", $v['geval_image']);
                 foreach ($geval_image as $vv) {
                     $goodsevallist[$k]['geval_image_arr'][] = snsThumb($vv);
                 }
             }
         }
     }
     output_data(array('goodsevallist' => $goodsevallist));
 }