Authored by whb

在线登记

define('admin/onlinereg', function(require, exports){
var box = require('admin/box'); // 提示框
var $ = require("jquery");
var common = require("common");
var upload = require('admin/upload');
var form_html = $("#form_pan").html()+'';
$("#form_pan").remove();
exports.index = function()
{
//批量导出
$(".batch_export").bind("click",function()
{
var ids = '';
$("input[type=checkbox]").each(function()
{
if($(this).attr("checked"))
{
ids += $(this).attr("seller_id")+',';
}
});
if(ids != '')
{
window.location.href = '/admin/onlinereg/export?id='+ids;
}
else
{
alert("没有选中");
}
});
//查看数据
$(".look").bind("click",function()
{
var type = $(".nav-tabs").attr("type");
var sellerId = $(this).attr("seller_id");
var seller;
box.confirm(form_html,function()
{
var type = $(".nav-tabs").attr("type");
var params = {};
var sellerId = $("#box_confirm_ok").attr("seller_id");
var requires = [];
//参展商校验数据
var requireType0 = ['name','contact','telphone','relation','place'];
//赞助商校验数据
var requireType1 = ['name','product_type','contact','telphone'];
//媒体校验数据
var requireType2 = ['name','mobile'];
var val = '';
var keys = ['name','product_type','profession','sex','company','contact','telphone','mobile','brand_reg_type',
'country', 'zipcode','city','introduction','email','place','website'];
var selectKeys = ['is_enter_yohobuy','is_3c','relation'];
var i;
params.id = sellerId;
if(type == 0)
{
requires = requireType0;
}
else if(type == 1)
{
requires = requireType1;
}
else if(type == 2)
{
requires = requireType2;
}
for(i = 0;i< selectKeys.length; i++)
{
if($("select[name="+selectKeys[i]+"]").size()> 0)
{
params[""+selectKeys[i]+""] = $("select[name="+selectKeys[i]+"]").val();
}
}
for(i = 0; i< keys.length; i++)
{
if($("input[name="+keys[i]+"]").size() > 0)
{
val = $.trim($("input[name="+keys[i]+"]").val());
if($.inArray(keys[i], requires) !== -1 && val == '')
{
alert("带*内容不能为空");
return false;
}
params[""+keys[i]+""] = val;
}
}
$.ajax
({
type:"post",
url:"/admin/onlinereg/setseller",
data:params,
success:function(data)
{
if(data.code == 200)
{
window.location.reload();
}
else
{
alert("保存失败");
}
}
});
},{title: '查看详情', width: '750px', autoClose: false});
$.ajax
({
type:"post",
url:"/admin/onlinereg/getseller",
data:{id:sellerId},
success:function(data)
{
seller = data.data;
if(data.code == 200)
{
var files = [], html = '', filePath;
$("input[name=name]").val(seller.name);
$("select[name=is_enter_yohobuy]").val(seller.is_enter_yohobuy);
$("input[name=product_type]").val(seller.product_type);
$("input[name=profession]").val(seller.profession);
$("input[name=sex]").val(seller.sex);
$("input[name=company]").val(seller.company);
$("input[name=contact]").val(seller.contact);
$("input[name=telphone]").val(seller.telphone);
$("input[name=mobile]").val(seller.mobile);
$("select[name=relation]").val(seller.relation);
$("input[name=country]").val(seller.country);
$("input[name=zipcode]").val(seller.zipcode);
$("input[name=city]").val(seller.city);
$("input[name=introduction]").val(seller.introduction);
$("input[name=email]").val(seller.email);
$("input[name=place]").val(seller.place);
$("select[name=is_3c]").val(seller.is_3c);
$("select[name=brand_reg_type]").val(seller.brand_reg_type);
$("input[name=website]").val(seller.website);
if(seller.files != "")
{
files = seller.files.split("|");
for(var i = 0; i <files.length; i++)
{
if(files[i] !='')
{
filePath = common.getImages(files[i],'source', 'blogimg');
html+='<a href="' + filePath + '">'+files[i].split("/")[files[i].split("/").length - 1]+'</a><br/>';
}
}
}
$("#download_list").html(html);
$("#box_confirm_ok").attr("seller_id", sellerId);
}
}
});
});
};
function init_upload(id, callback, setting, post_params)
{
var defaultSetting = {
button_placeholder_id:id,
button_width : "58",
button_height : "30",
post_params: {'key':$('#'+id).attr('key'), 'format':'json'},
file_queue_limit:50,
custom_settings:
{
saveCallback:callback
}
};
if(setting)
{
$.extend(defaultSetting, setting);
}
if(post_params)
{
$.extend(defaultSetting.post_params, post_params);
}
//绑定上传背景按钮
upload.init(defaultSetting);
}
//设置下载信息
exports.download = function()
{
//设置下载信息
$(".modify, #create_download_info").bind("click", function()
{
var download_id = 0;
var type = $(".table").attr("type");
var title = type == 0 ? '设置参展商手册':'设置新闻稿';
//设置下载信息
box.confirm(form_html,function()
{
var id = parseInt($("#download_id").val());
var title = $("input[name=title]").val();
var type = $(".table").attr("type");
var file = $("#file").size() ? $("#file").attr("val") : '';
var cover = '';
var source = '';
var source_link = '';
if(title == '' || file == '')
{
alert("带*内容不能为空");
return false;
}
//封面
if(typeof($("#pic").attr("val")) !=="undefined")
{
cover = $("#pic").attr("val");
if(cover == '')
{
alert("带*内容不能为空");
return false;
}
}
//来源
if($("input[name=source]").size())
{
source = $("input[name=source]").val();
if(source == '')
{
alert("带*内容不能为空");
return false;
}
}
//来源链接
if($("input[name=source_link]").size())
{
source_link = $("input[name=source_link]").val();
if(source_link == '')
{
alert("带*内容不能为空");
return false;
}
}
$.ajax
({
type:"post",
url:"/admin/onlinereg/setdownload",
data:{title:title,cover:cover, file:file, id: id, type:type, source:source, source_link:source_link},
success:function(data)
{
if(data.code == 200)
{
window.location.reload();
}
else
{
alert("设置失败");
}
}
})
},{title: title, width: '750px', autoClose: false});
if($("#upload_pic").size())
{
//上传图片
init_upload('upload_pic', function(response, swf)
{
var thumbPath = common.getImages(response.data.file.relaPath, "0100x0100", "blogimg", "primary");
var realPath = response.data.file.relaPath;
$("#picdiv").html("<img id='pic' class='thumb_but' val='"+realPath+"' src='"+thumbPath+"' width='100' height='100' /> ");
}, {button_width:"100", button_height : "30"});
}
if($("#upload_file").size())
{
//上传文件
init_upload('upload_file', function(response, swf)
{
var filePath = response.data.file.absPath;
var realPath = response.data.file.relaPath;
var file = filePath.split("/")[filePath.split("/").length - 1];
//图片
$("#filediv").html('<a id="file" href="'+filePath+'" val="'+realPath+'">'+file+'</a>');
}, {button_width:"100", button_height : "30",file_types:"*.zip;*.xlsx;*.xls;*.docx;*.doc;*.pdf;*.ppt;*.pptx"}, {"fileType":"file"});
}
//下载ID
if(typeof($(this).attr("download_id")) !== 'undefined')
{
download_id = $(this).attr("download_id");
$("#download_id").val(download_id);
}
if(download_id > 0)
{
$.ajax
({
type:"get",
url:"/admin/onlinereg/getdownload",
data:{id:download_id},
success:function(data)
{
if(data.code == 200)
{
$("#title").val(data.data.title);
var thumbPath = common.getImages(data.data.cover, "0100x0100", "blogimg", "primary");
$("#picdiv").html("<img id='pic' class='thumb_but' val='"+data.data.cover+"' src='"+thumbPath+"' width='100' height='100' /> ");
var filePath = common.getImages(data.data.file,'source','blogimg');
var file = filePath.split("/")[filePath.split("/").length - 1];
$("#filediv").html('<a id="file" href="'+filePath+'" val="'+data.data.file+'">'+file+'</a>');
$("input[name=source]").val(data.data.source);
$("input[name=source_link]").val(data.data.source_link);
}
}
});
}
});
//删除下载
$(".del").bind("click",function()
{
if(window.confirm("你确定要删除吗?"))
{
var download_id = $(this).attr("download_id");
$.ajax
({
type:"post",
url:"/admin/onlinereg/deldownload",
data:{id:download_id},
success:function(data)
{
if(data.code == 200)
{
window.location.reload();
}
else
{
alert("删除失败");
}
}
});
}
});
};
});
\ No newline at end of file
... ...
<?php
class Controller_Admin_Onlinereg extends Controller_Admin_Base
{
/**
* 参展商登记
*/
public function indexAction()
{
$type = intval($this->_request->get('type', 0));
$types = array(
Facade_Onlinereg::TYPE_ONLINE_EXHIBITOR =>'参展商',
Facade_Onlinereg::TYPE_ONLINE_SPONSOR =>'赞助商',
Facade_Onlinereg::TYPE_ONLINE_MEDIA =>'媒体');
if(!in_array($type, array_keys($types))) {
$type = 0;
}
$limit = 15;
$total = Facade_Onlinereg::getSellerListByType($type);
$pagination = new Lib_Helper_Pagination($total, $limit);
$pagination->setParames(array('type' => $type));
$list = Facade_Onlinereg::getSellerListByType($type, $pagination->getOffset(), $limit);
$this->_view['list'] = $list;
$this->_view['pagination'] = $pagination->getPagination();
$this->_view['type'] = $type;
$this->_view['sellerTypes'] = $types;
}
/**
* 参展商手册
*/
public function downloadAction()
{
$limit = 15;
$type = intval($this->_request->get('type', 0));
if(!in_array($type, array(Facade_Onlinereg::TYPE_ONLINE_DOWNLOAD_EXHIBITOR,
Facade_Onlinereg::TYPE_ONLINE_DOWNLOAD_MEDIA)))
{
$type = 0;
}
$total = Facade_Onlinereg::getDownloadTotalByType($type);
$pagination = new Lib_Helper_Pagination($total, $limit);
$list = Facade_Onlinereg::getDownloadListByType($type, $pagination->getOffset(), $limit);
foreach ($list as &$download)
{
$download['cover'] = Lib_Images::getImageUrl($download['cover'], 'source','fragmentimg');
}
$this->_view['type'] = $type;
$this->_view['list'] = $list;
$this->_view['pagination'] = $pagination->getPagination();
$this->_view['key'] = Lib_Images::genKey('fragmentimg');
}
/**
* 获取商家数据
*
* @return array
*/
public function getsellerAction()
{
$sellerId = $this->_request->query('id');
$seller = array();
if(!empty($sellerId))
{
$seller = Facade_Onlinereg::getSellerById($sellerId);
}
if(!empty($seller))
{
return $this->returnJson(true, 200, $seller);
}
else
{
return $this->returnJson(false, 403);
}
}
/**
* 设置商家数据
*
* @return array
*/
public function setsellerAction()
{
$data = $_POST;
if(isset($data['id']))
{
unset($data['files']);
$data = array_map('addslashes', $data);
$status = Facade_Onlinereg::setSeller($data);
if($status)
{
return $this->returnJson(true, 200);
}
else
{
return $this->returnJson(false, 403);
}
}
else
{
return $this->returnJson(false, 403);
}
}
/**
* 获取下载相关
*/
public function getdownloadAction()
{
$id = intval($this->_request->query('id'));
$download = Facade_Onlinereg::getDownloadById($id);
return $this->returnJson(true, 200, $download);
}
/**
* 设置下载信息
*
* @return json
*/
public function setdownloadAction()
{
$status = false;
$type = $this->_request->query('type', 0);
$id = $this->_request->query('id', 0);
$title = trim($this->_request->query('title', ''));
$cover = $this->_request->query('cover', '');
$file = $this->_request->query('file', '');
$source = $this->_request->query('source', '');
$source_link = $this->_request->query('source_link', '');
if(!empty($title) && !empty($id))
{
//更新数据
$status = Facade_Onlinereg::setDownloadInfoById($id, $title, $cover, $file, $source, $source_link);
}
else if(!empty($title) && in_array($type, array(
Facade_Onlinereg::TYPE_ONLINE_DOWNLOAD_EXHIBITOR,
Facade_Onlinereg::TYPE_ONLINE_DOWNLOAD_MEDIA)))
{
$status = Facade_Onlinereg::setDownloadInfo($title, $cover, $file, $source, $source_link, $type);
}
if($status)
{
return $this->returnJson(true, 200);
}
else
{
return $this->returnJson(false, 403);
}
}
/**
* 删除下载数据
*
*/
public function deldownloadAction()
{
$id = $this->_request->query('id');
$status = Facade_Onlinereg::delDownload($id);
if($status)
{
return $this->returnJson(true, 200);
}
else
{
return $this->returnJson(false, 403);
}
}
/**
* 导出excel
*/
public function exportAction()
{
$typeAttrs = array(
Facade_Onlinereg::TYPE_ONLINE_EXHIBITOR => array('ID','品牌名称','是否入驻有货','品牌注册','公司名称','联系人',
'电话','邮箱','公司与品牌关系','商品所在地','是否3C','官网','时间'),
Facade_Onlinereg::TYPE_ONLINE_SPONSOR => array('ID','品牌名称','是否入驻有货','产品类型','所属国家','公司名称','公司地址',
'联系人','电话','邮箱','品牌官网','时间'),
Facade_Onlinereg::TYPE_ONLINE_MEDIA => array('ID','姓名','职位','性别','媒体名/公司名','介绍','官网地址',
'所在城市','邮箱','手机','座机','固定地址','邮编','时间'),
);
$typeDBKeys = array(
Facade_Onlinereg::TYPE_ONLINE_EXHIBITOR => array('id','name','is_enter_yohobuy',
'brand_reg_type','company','contact','telphone','email','relation','place','is_3c','website','create_time'),
Facade_Onlinereg::TYPE_ONLINE_SPONSOR => array('id','name','is_enter_yohobuy','product_type','country',
'company','place','contact','telphone','email','website','create_time'),
Facade_Onlinereg::TYPE_ONLINE_MEDIA => array('id','name','profession','sex','company','introduction','website',
'city','email','mobile','telphone','place','zipcode','create_time'),
);
$typeSaveNames = array(
Facade_Onlinereg::TYPE_ONLINE_EXHIBITOR => 'exhibitor',
Facade_Onlinereg::TYPE_ONLINE_SPONSOR => 'sponsor',
Facade_Onlinereg::TYPE_ONLINE_MEDIA => 'media',
);
$type = 0;
$id = $this->_request->query('id');
$sellerIds = array_filter(explode(',', $id),'is_numeric');
$sellerList = array();
foreach($sellerIds as $sellerId)
{
$sellerList[] = Facade_Onlinereg::getSellerById($sellerId);
}
if(!empty($sellerList))
{
$excel = new Util_Excel_Excel();
$excel->getProperties()->setCreator('yoho')
->setTitle('yohood')->setSubject('yohood')->setDescription('yohood')->setKeywords('yohood');
$excel->setActiveSheetIndex(0);
$type = $sellerList[0]['type'];
$attrs = $typeAttrs[$type];
$indexs = range('A','Z');
$brandRegTypes = array('未注册','已注册','已申请');
$relationAttrs = array('品牌商','代理商','经销商','其他');
$pos = 0;
$cellNum = 1;
foreach($attrs as $attr)//输出属性
{
$cell = $indexs[$pos++];
$excel->getActiveSheet()->getColumnDimension($cell)->setWidth(15);
$excel->getActiveSheet()->setCellValue($cell.$cellNum, $attr);
}
foreach($sellerList as $seller)
{
$cellNum ++;
$pos = 0;
for($i = 0; $i<count($attrs); $i++)
{
$key = $typeDBKeys[$type][$i];
$cell = $indexs[$pos++].$cellNum;
$attr = $seller[$key];
if($key == 'create_time') //时间属性
{
$value = date('Y-m-d H:i:s', $attr);
}
else if(in_array($key, array('is_enter_yohobuy','is_3c')))//是否
{
$value = empty($attr) ? '是':'否';
}
else if($key == 'brand_reg_type')//品牌注册类型
{
$value = $brandRegTypes[$attr];
}
else if($key == 'relation')//公司与品牌关系
{
$value = $relationAttrs[$attr];
}
else
{
$value = $attr;
}
$excel->getActiveSheet()->setCellValue($cell, $value);
}
}
header('Content-Type: application/vnd.ms-excel');
header('Content-Disposition: attachment;filename="'.$typeSaveNames[$type].'.xls"');
header('Cache-Control: max-age=0');
$excel->setActiveSheetIndex(0);
$objWriter = PHPExcel_IOFactory::createWriter($excel, 'Excel5');
$objWriter->save('php://output');
}
else
{
die('没有下载');
}
}
}
\ No newline at end of file
... ...
<?php
/**
* 资讯业务处理
*
*/
class Facade_Onlinereg
{
//参展商
const TYPE_ONLINE_EXHIBITOR = 0;
//赞助商
const TYPE_ONLINE_SPONSOR = 1;
//媒体
const TYPE_ONLINE_MEDIA = 2;
//手册参展商
const TYPE_ONLINE_DOWNLOAD_EXHIBITOR = 0;
//手册媒体
const TYPE_ONLINE_DOWNLOAD_MEDIA = 1;
/**
* 服务
*/
private static $service = null;
/**
*
* @return Service_Index
*/
private static function service ()
{
if (! isset(self::$service))
{
self::$service = new Service_Onlinereg();
}
return self::$service;
}
/**
* 设置商家信息
*
* @param string $name
* @param string $type
* @param int $brand_reg_type
* @param int $is_enter_yohobuy
* @param string $product_type
* @param string $country
* @param string $company
* @param string $contact
* @param string $telphone
* @param string $email
* @param string $relation
* @param string $website
* @param int $is_3c
* @param string $place
* @param array|string $files
* @return int
*/
public static function setSellerInfo($name, $type, $brand_reg_type, $is_enter_yohobuy, $product_type, $country,
$company, $contact, $telphone, $email, $relation, $website, $is_3c, $place, $files)
{
$file = '';
if(is_array($files))
{
$file = implode('|', $files);
} else {
$file = $files;
}
return self::service()->getSellerInfo($name, $type, $brand_reg_type, $is_enter_yohobuy, $product_type, $country,
$company, $contact, $telphone, $email, $relation, $website, $is_3c, $place, $file);
}
/**
* 获取商家列表
*
* @param int $type
* @param int $offset
* @param int $limit
* @return array
*/
public static function getSellerListByType($type, $offset = 1, $limit = 10)
{
return self::service()->getSellerListByType($type, $offset, $limit);
}
/**
* 根据type获取总数
*
* @param int $type
* @return array
*/
public static function getSellerTotalByType($type)
{
return self::service()->getSellerTotalByType($type);
}
/**
* 根据ID获取商家
*
* @param int $id
* @return array
*/
public static function getSellerById($id)
{
return self::service()->getSellerById($id);
}
/**
* 设置媒体信息
*
* @param string $name
* @param string $profession
* @param int $sex
* @param string $company
* @param string $introduction
* @param string $website
* @param string $city
* @param string $email
* @param string $mobile
* @param string $telphone
* @param string $address
* @param string $zipcode
* @return int
*/
public static function setMediaInfo($name, $profession, $sex, $company, $introduction, $website, $city,
$email, $mobile, $telphone, $address, $zipcode)
{
return self::service()->setMediaInfo($name, $profession, $sex, $company, $introduction, $website, $city,
$email, $mobile, $telphone, $address, $zipcode);
}
/**
* 获取下载列表
*
* @param int $type
* @param int $offset
* @param int $limit
* @return array
*/
public static function getDownloadListByType($type, $offset, $limit)
{
return self::service()->getDownloadListByType($type, $offset, $limit);
}
/**
* 获取下载总数
*
* @param int $type
* @return array
*/
public static function getDownloadTotalByType($type)
{
return self::service()->getDownloadTotalByType($type);
}
/**
* 根据ID设置下载信息
*
* @param int $id
* @param string $title
* @param string $cover
* @param string $file
* @param string $source
* @param string $source_link
* @return boolean
*/
public static function setDownloadInfoById($id, $title, $cover, $file, $source, $source_link)
{
return self::service()->setDownloadInfoById($id, $title, $cover, $file, $source, $source_link);
}
/**
* 设置下载信息
*
* @param string $title
* @param string $cover
* @param string $file
* @param string $source
* @param string $source_link
* @param string $type
* @return boolean
*/
public static function setDownloadInfo($title, $cover, $file, $source, $source_link, $type)
{
return self::service()->setDownloadInfo($title, $cover, $file, $source, $source_link, $type);
}
/**
* 获取下载信息
*
* @param int $id
* @return array
*/
public static function getDownloadById($id)
{
return self::service()->getDownloadById($id);
}
/**
* 删除下载信息
*
* @param int $id
* @return boolean
*/
public static function delDownload($id)
{
return self::service()->delDownload($id);
}
/**
* 设置商家信息
*
* @param array $data
* @return boolean
*/
public static function setSeller(array $data)
{
return self::service()->setSeller($data);
}
}
\ No newline at end of file
... ...
<?php
class Lib_Images
{
/**
* 获取七牛尺寸
*
* @param string $size
* @return string
*/
public static function getExistQiniuSize($size)
{
$qiniuKey = 'mem_qiniu_sizes';
$sizes = Lib_Utils_Cache_Data::get($qiniuKey);
if(empty($sizes))
{
$sizes = array(57600 =>'0240x0240', 102400 =>'0320x0320', 230400 =>'0480x0480',409600 => '0640x0640',
5999400=>'0600x9999',3600 =>'0060x0060', 85264=>'0292x0292',79920=>'0296x0270',42632=>'0292x0146',
21316=>'0146x0146', 30976 => '0176x0176',16936 =>'0146x0116',586240=>'0640x0916', 473600=>'0640x0740',10000 => '0100x0100',
22500 =>'0150x0150',14400 => '0120x0120',5399460=>'0540x9999',900=>'0030x0030');
asort($sizes);
Lib_Utils_Cache_Data::set($qiniuKey, $sizes);
}
$sizeKey = 'qiniu_sizes_'.$size;
$key = Lib_Utils_Cache_Data::get($sizeKey);
if(empty($key))
{
$key = array_search($size, $sizes);
if($key === false)
{
//获取接近的尺寸
$arr = explode('x', $size);
$pixel = intval($arr[0]) * intval($arr[1]);
foreach($sizes as $keyPixel => $size)
{
if($keyPixel > $pixel)
{
$key = $keyPixel;
break;
}
}
//都不存在,获取第一个
if($key === false)
{
$key = current($sizes);
}
}
Lib_Utils_Cache_Data::set($sizeKey, $key);
}
return $sizes[$key];
}
/**
* 保存图片
*
* @param mixed $file (文件或文件流)
* @param string $project (项目名称,默认为fragmentimg)
* @param boolean $preProcess (控制是否预先处理图片) @since 1.2.3
* @return string (返回相对图片路径)
*/
public static function saveImage($file, $project = 'fragmentimg', $preProcess = false)
{
if (!isset(Config_File_Upload::${$project}))
{
return '';
}
$_key_data = Config_File_Upload::${$project};
$projectConfig = self::genConfig($project);
if (is_array($file))
{
$up = new Util_Upload_File($file, $projectConfig['serverPath']);
$key = key($file);
}
elseif (@file_exists($file) && is_file($file))//文件
{
$up = new Util_Upload_FileStream(@file_get_contents($file), $projectConfig['serverPath']);
$key = 0;
}
// 2014/01/07 hf: 修改抓取外网图片抓不了的问题
elseif (is_string($file) && isset($file[0]))
{
$up = new Util_Upload_FileStream($file, $projectConfig['serverPath']);
$key = 0;
$file = null;
}
else
{
return '';
}
$up->setFormat($projectConfig['format']);
$up->setMaxFileSize($projectConfig['upload_max_size']);
$up->setPrefix($projectConfig['randNode']);
if (isset($_key_data['file_path']))
{
$up->setNewFileName($_key_data['file_path']);
}
$checkStatus = $up->check();
if ($checkStatus['code'] == 0)
{
$checkStatus = $up->write();
}
$imagePath = isset($checkStatus['result']['hit'][$key]['relaPath']) ? $checkStatus['result']['hit'][$key]['relaPath'] : '';
return $imagePath;
}
/**
* 获取图片地址
*
* @param string $url 图片的相对地址
* @param string $type 图片的类型
* @param string $project 图片模块分类名
* @param string $crop 切图方式
* @param string $platform 默认:web
* @return string
*/
public static function getImageUrl($url = '', $type = null, $project = null, $crop = 'customCrop', $platform = 'web')
{
$qiniuUploadState = defined('QINIU_UPLOAD_STATE') ? QINIU_UPLOAD_STATE : false;
// 判断图片地址的有效性
if ($url === null || $url === '' || $url === 'boy' || $url === 'girl' || ! is_string($url))
{
// 地址: 新社区用户默认头像
if ($project === 'headimg')
{
$finds = ($url === 'girl') ? Config_Static::$headImgGirl : Config_Static::$headImgBoy;
if (! array_key_exists($type, $finds))
{
$type = key($finds);
}
return SITE_IMG . $finds[$type];
}
return '';
}
// 地址: 站内站外的绝对地址
if (0 === strpos($url, 'http://') || 0 === strpos($url, 'https://'))
{
if (($host = parse_url($url)) && isset($host['host']))
{
return $url;
}
}
// 地址: 老社区的图片
if (0 === strpos($url, OLD_SITE_MAIN_I) || 0 === strpos($url, OLD_SITE_MAIN_P) || 0 === strpos($url, 'yohobuy.com'))
{
return $url;
}
// 地址: 老社区用户的头像或用户相册的照片
if (0 === stripos($url, '/user/') || 0 === stripos($url, '/photo/'))
{
return OLD_SITE_MAIN . $url;
}
// 判断项目是否存在
if (true !== property_exists('Config_File_Upload', $project))
{
return '';
}
// 获取服务器域名
$imageInfo = pathinfo($url);
$sysKey = self::getSysKey($imageInfo['basename']);
if (array_key_exists($sysKey, Config_File_Image::$imageServerUrl))
{
$sourceUrl = Config_File_Image::$imageServerUrl[$sysKey];
$targetUrl = Config_File_Image::$imageThumbUrl[$sysKey];
}
else
{
return '';
}
$imageConfig = Config_File_Upload::${$project};
// 判断是否访问源图片文件
if ($type == 'source')
{
$sourceUrl .= $imageConfig['path'] . $url;
if($qiniuUploadState && $platform != 'web')//七牛,移动版
{
$sourceUrl = sprintf("%s_.%s", $sourceUrl, $imageInfo['extension']);
}
// 返回图片源地址
return $sourceUrl;
}
// 格式化尺寸为"0000x0000"格式
if (is_string($type) && strpos($type, 'x') !== false)
{
$finds = explode('x', $type);
$type = str_pad($finds[0], 4, '0', STR_PAD_LEFT) . 'x' . str_pad($finds[1], 4, '0', STR_PAD_LEFT);
}
$finds = Config_Static::$cropTypes;
if (! array_key_exists($crop, $finds))
{
$crop = key($finds);
}
// 缩略剪切方式
if($qiniuUploadState)//七牛
{
if($platform != 'web')//移动版
{
$finds = Config_Static::$qiniuCropTypes;
$type = self::getExistQiniuSize($type);
//_-宽x高-切图方式.图片后缀
$rule = '_-' . $type . '-' . $finds[$crop] . '.' . $imageInfo['extension'];
}
else
{
//网页版使用参数规则
$rule = str_replace('{size}', $type, Config_Static::$qiniuCropRules[$crop]);
}
}
else //原始版
{
//-宽x高-切图方式.图片后缀
$rule = '-' . $type . '-' . $finds[$crop] . '.' . $imageInfo['extension'];
}
if($qiniuUploadState)
{
//域名/项目名/年/月/日/时/{01|02}md5(32).图片后缀[_-宽x高-切图方式.图片后缀|?imageMogr2/thumbnail/xx/xxx]
$targetUrl .= $imageConfig['path'] . $imageInfo['dirname'] . '/' . basename($url, '.' . $imageInfo['extension']) . '.' . $imageInfo['extension'].$rule;
}
else
{
// 生成路径的格式: "域名/项目名/年/月/日/时/{01|02}md5(32)-宽x高-切图方式.图片后缀"
$targetUrl .= $imageConfig['path'] . $imageInfo['dirname'] . '/' . basename($url, '.' . $imageInfo['extension']) . $rule;
}
// 返回缩略图地址
return $targetUrl;
}
/**
* 预处理图片
*
* @param string $imagePath (源图片相对路径)
* @param array $project (项目)
* @param array $projectConfig (项目配置)
* @param array $data (图片的信息)
* @return void
*/
public static function processImage($imagePath, $project, &$projectConfig, &$data)
{
return self::getImageInfo($imagePath, $project);
}
/**
* 获取图片的信息
*
* @param string $url (文件存放地址)
* @param string $project (文件项目名)
* @return false | array(
* width => 宽度,
* height => 高度,
* size => 大小,
* mine => 'MINE'
* )
*
* @example
* Lib_Images::getImageInfo('/2013/03/06/17/019182a667143d313a18b16e4525235b4d.jpg', 'blogimg');
* Lib_Images::getImageInfo('http://img03.res.yoho.cn/blogimg/2012/09/18/11/01167a11b8e7c0d913e789d75b2e52f433-0580x320-1.jpeg', 'blogimg');
*/
public static function getImageInfo($url, $project)
{
$data = array('width' => 200, 'height' => 300, 'size' => 200000, 'mine' => 'image/jpeg',);
if ($project != '' && $url != '' && is_string($url))
{
$source = self::getImageUrl($url, 'source', $project);
if(strpos($source,'_') !== false)
{
$imageUrl = strstr($source, '_', true) . '?imageInfo';
}
else
{
$imageUrl = $source . '?imageInfo';
}
// 设置一个超时时间,单位为秒
$context = stream_context_create(array(
'http' => array('timeout' => 3,),
));
$temp = file_get_contents($imageUrl, false, $context);
if ($temp)
{
$temp = json_decode($temp, true);
if (isset($temp['width']))
{
$data['width'] = $temp['width'];
$data['height'] = $temp['height'];
$data['mine'] = $temp['format'];
$data['size'] = $temp['width'] * $data['height'];
}
}
}
return $data;
}
/**
* 分隔文件路径地址 (以文件后缀名"."符号分隔)
*
* @param string $path (文件路径)
* @return array
*/
public static function partPath($path)
{
$pos = strrpos($path, '.');
return array(
'left' => substr($path, 0, $pos),
'right' => substr($path, $pos),
);
}
/**
* 创建文件夹
*
* @param string $path (文件路径)
* @return void
*/
public static function createFolder($path)
{
if (!file_exists($path))
{
$path = dirname($path);
self::createFolder($path);
@mkdir($path, 0755);
}
}
/**
* 发送指令处理图片 (通过服务器调度, 进行图片处理. 此方法已不再使用)
*
* @param string $source 源文件地址
* @param string $size 需要的尺寸
* @param string $crop 切图方式
* @param string $target 目标文件地址
* @return void
*/
public static function makeImage($source, $size, $crop, $target)
{
list($w, $h) = explode('x', $size);
$size = array('w' => $w, 'h' => $h );
$data = array(
'source' => $source,
'target' => $target,
'size' => $size,
'mode' => $crop
);
$c = Util_Gearman::client();
$c->d(IMAGE_GMAGICK_FUNC, json_encode($data));
$c->clones();
}
/**
* 获取文件存放的节点
*
* @return string ('01' | '02')
*/
public static function getRandNode()
{
$randNum = time() % 2;
$randNum = ($randNum) ? $randNum : 2;
return sprintf('%02d', $randNum);
}
/**
* 获取图片系统键名
*
* @param string $basename (文件名)
* @return string ('img01' | 'img02')
*/
public static function getSysKey($basename)
{
return 'img' . substr($basename, 0, 2);
}
/**
* 生成上传密钥
*
* @param string $porject (项目模块名称)
* @return string | false
*/
public static function genKey($porject)
{
$projectData = $porject . 'Data';
if (property_exists('Config_File_Upload', $projectData) === true)
{
$uploadConfig = Config_File_Upload::${$projectData};
return Util_Utils_Function::base64_str_encode(
Util_Utils_AuthCode::encode(
json_encode($uploadConfig), Config_File_Upload::$key
)
);
}
return false;
}
/**
* 获取上传的配置
*
* @param string $project (项目模块名称)
* @return array
*/
public static function genConfig($project)
{
if (property_exists('Config_File_Upload', $project) === true)
{
$config = (array) Config_File_Upload::${$project};
$config['randNode'] = Lib_Images::getRandNode();
$config['serverNode'] = 'img' . $config['randNode'];
$config['serverPath'] = Config_File_Image::$imageServer[$config['serverNode']] . $config['path'];
$config['thumbPath'] = Config_File_Image::$thumbPath[$config['serverNode']] . $config['path'];
$config['sourceUrl'] = Config_File_Image::$imageServerUrl[$config['serverNode']] . $config['path'];
$config['thumbUrl'] = Config_File_Image::$imageThumbUrl[$config['serverNode']] . $config['path'];
return $config;
}
return array();
}
}
<?php
class Lib_Images
{
/**
* 获取七牛尺寸
*
* @param string $size
* @return string
*/
public static function getExistQiniuSize($size)
{
$qiniuKey = 'mem_qiniu_sizes';
$sizes = Lib_Utils_Cache_Data::get($qiniuKey);
if(empty($sizes))
{
$sizes = array(57600 =>'0240x0240', 102400 =>'0320x0320', 230400 =>'0480x0480',409600 => '0640x0640',
5999400=>'0600x9999',3600 =>'0060x0060', 85264=>'0292x0292',79920=>'0296x0270',42632=>'0292x0146',
21316=>'0146x0146', 30976 => '0176x0176',16936 =>'0146x0116',586240=>'0640x0916', 473600=>'0640x0740',10000 => '0100x0100',
22500 =>'0150x0150',14400 => '0120x0120',5399460=>'0540x9999',900=>'0030x0030');
asort($sizes);
Lib_Utils_Cache_Data::set($qiniuKey, $sizes);
}
$sizeKey = 'qiniu_sizes_'.$size;
$key = Lib_Utils_Cache_Data::get($sizeKey);
if(empty($key))
{
$key = array_search($size, $sizes);
if($key === false)
{
//获取接近的尺寸
$arr = explode('x', $size);
$pixel = intval($arr[0]) * intval($arr[1]);
foreach($sizes as $keyPixel => $size)
{
if($keyPixel > $pixel)
{
$key = $keyPixel;
break;
}
}
//都不存在,获取第一个
if($key === false)
{
$key = current($sizes);
}
}
Lib_Utils_Cache_Data::set($sizeKey, $key);
}
return $sizes[$key];
}
/**
* 保存图片
*
* @param mixed $file (文件或文件流)
* @param string $project (项目名称,默认为fragmentimg)
* @param boolean $preProcess (控制是否预先处理图片) @since 1.2.3
* @return string (返回相对图片路径)
*/
public static function saveImage($file, $project = 'fragmentimg', $preProcess = false)
{
if (!isset(Config_File_Upload::${$project}))
{
return '';
}
$_key_data = Config_File_Upload::${$project};
$projectConfig = self::genConfig($project);
if (is_array($file))
{
$up = new Util_Upload_File($file, $projectConfig['serverPath']);
$key = key($file);
}
elseif (@file_exists($file) && is_file($file))//文件
{
$up = new Util_Upload_FileStream(@file_get_contents($file), $projectConfig['serverPath']);
$key = 0;
}
// 2014/01/07 hf: 修改抓取外网图片抓不了的问题
elseif (is_string($file) && isset($file[0]))
{
$up = new Util_Upload_FileStream($file, $projectConfig['serverPath']);
$key = 0;
$file = null;
}
else
{
return '';
}
$up->setFormat($projectConfig['format']);
$up->setMaxFileSize($projectConfig['upload_max_size']);
$up->setPrefix($projectConfig['randNode']);
if (isset($_key_data['file_path']))
{
$up->setNewFileName($_key_data['file_path']);
}
$checkStatus = $up->check();
if ($checkStatus['code'] == 0)
{
$checkStatus = $up->write();
}
$imagePath = isset($checkStatus['result']['hit'][$key]['relaPath']) ? $checkStatus['result']['hit'][$key]['relaPath'] : '';
return $imagePath;
}
/**
* 获取图片地址
*
* @param string $url 图片的相对地址
* @param string $type 图片的类型
* @param string $project 图片模块分类名
* @param string $crop 切图方式
* @param string $platform 默认:web
* @return string
*/
public static function getImageUrl($url = '', $type = null, $project = null, $crop = 'customCrop', $platform = 'web')
{
$qiniuUploadState = defined('QINIU_UPLOAD_STATE') ? QINIU_UPLOAD_STATE : false;
// 判断图片地址的有效性
if ($url === null || $url === '' || $url === 'boy' || $url === 'girl' || ! is_string($url))
{
// 地址: 新社区用户默认头像
if ($project === 'headimg')
{
$finds = ($url === 'girl') ? Config_Static::$headImgGirl : Config_Static::$headImgBoy;
if (! array_key_exists($type, $finds))
{
$type = key($finds);
}
return SITE_IMG . $finds[$type];
}
return '';
}
// 地址: 站内站外的绝对地址
if (0 === strpos($url, 'http://') || 0 === strpos($url, 'https://'))
{
if (($host = parse_url($url)) && isset($host['host']))
{
return $url;
}
}
// 地址: 老社区的图片
if (0 === strpos($url, OLD_SITE_MAIN_I) || 0 === strpos($url, OLD_SITE_MAIN_P) || 0 === strpos($url, 'yohobuy.com'))
{
return $url;
}
// 地址: 老社区用户的头像或用户相册的照片
if (0 === stripos($url, '/user/') || 0 === stripos($url, '/photo/'))
{
return OLD_SITE_MAIN . $url;
}
// 判断项目是否存在
if (true !== property_exists('Config_File_Upload', $project))
{
return '';
}
// 获取服务器域名
$imageInfo = pathinfo($url);
$sysKey = self::getSysKey($imageInfo['basename']);
if (array_key_exists($sysKey, Config_File_Image::$imageServerUrl))
{
$sourceUrl = Config_File_Image::$imageServerUrl[$sysKey];
$targetUrl = Config_File_Image::$imageThumbUrl[$sysKey];
}
else
{
return '';
}
$imageConfig = Config_File_Upload::${$project};
// 判断是否访问源图片文件
if ($type == 'source')
{
$sourceUrl .= $imageConfig['path'] . $url;
if($qiniuUploadState && $platform != 'web')//七牛,移动版
{
$sourceUrl = sprintf("%s_.%s", $sourceUrl, $imageInfo['extension']);
}
// 返回图片源地址
return $sourceUrl;
}
// 格式化尺寸为"0000x0000"格式
if (is_string($type) && strpos($type, 'x') !== false)
{
$finds = explode('x', $type);
$type = str_pad($finds[0], 4, '0', STR_PAD_LEFT) . 'x' . str_pad($finds[1], 4, '0', STR_PAD_LEFT);
}
$finds = Config_Static::$cropTypes;
if (! array_key_exists($crop, $finds))
{
$crop = key($finds);
}
// 缩略剪切方式
if($qiniuUploadState)//七牛
{
if($platform != 'web')//移动版
{
$finds = Config_Static::$qiniuCropTypes;
$type = self::getExistQiniuSize($type);
//_-宽x高-切图方式.图片后缀
$rule = '_-' . $type . '-' . $finds[$crop] . '.' . $imageInfo['extension'];
}
else
{
//网页版使用参数规则
$rule = str_replace('{size}', $type, Config_Static::$qiniuCropRules[$crop]);
}
}
else //原始版
{
//-宽x高-切图方式.图片后缀
$rule = '-' . $type . '-' . $finds[$crop] . '.' . $imageInfo['extension'];
}
if($qiniuUploadState)
{
//域名/项目名/年/月/日/时/{01|02}md5(32).图片后缀[_-宽x高-切图方式.图片后缀|?imageMogr2/thumbnail/xx/xxx]
$targetUrl .= $imageConfig['path'] . $imageInfo['dirname'] . '/' . basename($url, '.' . $imageInfo['extension']) . '.' . $imageInfo['extension'].$rule;
}
else
{
// 生成路径的格式: "域名/项目名/年/月/日/时/{01|02}md5(32)-宽x高-切图方式.图片后缀"
$targetUrl .= $imageConfig['path'] . $imageInfo['dirname'] . '/' . basename($url, '.' . $imageInfo['extension']) . $rule;
}
// 返回缩略图地址
return $targetUrl;
}
/**
* 预处理图片
*
* @param string $imagePath (源图片相对路径)
* @param array $project (项目)
* @param array $projectConfig (项目配置)
* @param array $data (图片的信息)
* @return void
*/
public static function processImage($imagePath, $project, &$projectConfig, &$data)
{
return self::getImageInfo($imagePath, $project);
}
/**
* 获取图片的信息
*
* @param string $url (文件存放地址)
* @param string $project (文件项目名)
* @return false | array(
* width => 宽度,
* height => 高度,
* size => 大小,
* mine => 'MINE'
* )
*
* @example
* Lib_Images::getImageInfo('/2013/03/06/17/019182a667143d313a18b16e4525235b4d.jpg', 'blogimg');
* Lib_Images::getImageInfo('http://img03.res.yoho.cn/blogimg/2012/09/18/11/01167a11b8e7c0d913e789d75b2e52f433-0580x320-1.jpeg', 'blogimg');
*/
public static function getImageInfo($url, $project)
{
$data = array('width' => 200, 'height' => 300, 'size' => 200000, 'mine' => 'image/jpeg',);
if ($project != '' && $url != '' && is_string($url))
{
$source = self::getImageUrl($url, 'source', $project);
if(strpos($source,'_') !== false)
{
$imageUrl = strstr($source, '_', true) . '?imageInfo';
}
else
{
$imageUrl = $source . '?imageInfo';
}
// 设置一个超时时间,单位为秒
$context = stream_context_create(array(
'http' => array('timeout' => 3,),
));
$temp = @file_get_contents($imageUrl, false, $context);
if ($temp)
{
$temp = json_decode($temp, true);
if (isset($temp['width']))
{
$data['width'] = $temp['width'];
$data['height'] = $temp['height'];
$data['mine'] = $temp['format'];
$data['size'] = $temp['width'] * $data['height'];
}
}
}
return $data;
}
/**
* 分隔文件路径地址 (以文件后缀名"."符号分隔)
*
* @param string $path (文件路径)
* @return array
*/
public static function partPath($path)
{
$pos = strrpos($path, '.');
return array(
'left' => substr($path, 0, $pos),
'right' => substr($path, $pos),
);
}
/**
* 创建文件夹
*
* @param string $path (文件路径)
* @return void
*/
public static function createFolder($path)
{
if (!file_exists($path))
{
$path = dirname($path);
self::createFolder($path);
@mkdir($path, 0755);
}
}
/**
* 发送指令处理图片 (通过服务器调度, 进行图片处理. 此方法已不再使用)
*
* @param string $source 源文件地址
* @param string $size 需要的尺寸
* @param string $crop 切图方式
* @param string $target 目标文件地址
* @return void
*/
public static function makeImage($source, $size, $crop, $target)
{
list($w, $h) = explode('x', $size);
$size = array('w' => $w, 'h' => $h );
$data = array(
'source' => $source,
'target' => $target,
'size' => $size,
'mode' => $crop
);
$c = Util_Gearman::client();
$c->d(IMAGE_GMAGICK_FUNC, json_encode($data));
$c->clones();
}
/**
* 获取文件存放的节点
*
* @return string ('01' | '02')
*/
public static function getRandNode()
{
$randNum = time() % 2;
$randNum = ($randNum) ? $randNum : 2;
return sprintf('%02d', $randNum);
}
/**
* 获取图片系统键名
*
* @param string $basename (文件名)
* @return string ('img01' | 'img02')
*/
public static function getSysKey($basename)
{
return 'img' . substr($basename, 0, 2);
}
/**
* 生成上传密钥
*
* @param string $porject (项目模块名称)
* @return string | false
*/
public static function genKey($porject)
{
$projectData = $porject . 'Data';
if (property_exists('Config_File_Upload', $projectData) === true)
{
$uploadConfig = Config_File_Upload::${$projectData};
return Util_Utils_Function::base64_str_encode(
Util_Utils_AuthCode::encode(
json_encode($uploadConfig), Config_File_Upload::$key
)
);
}
return false;
}
/**
* 获取上传的配置
*
* @param string $project (项目模块名称)
* @return array
*/
public static function genConfig($project)
{
if (property_exists('Config_File_Upload', $project) === true)
{
$config = (array) Config_File_Upload::${$project};
$config['randNode'] = Lib_Images::getRandNode();
$config['serverNode'] = 'img' . $config['randNode'];
$config['serverPath'] = Config_File_Image::$imageServer[$config['serverNode']] . $config['path'];
$config['thumbPath'] = Config_File_Image::$thumbPath[$config['serverNode']] . $config['path'];
$config['sourceUrl'] = Config_File_Image::$imageServerUrl[$config['serverNode']] . $config['path'];
$config['thumbUrl'] = Config_File_Image::$imageThumbUrl[$config['serverNode']] . $config['path'];
return $config;
}
return array();
}
}
... ...
<?php
class Service_Onlinereg extends Lib_Service
{
const ROUTER = 'onlinereg.yohood.onlinereg';
private static $_seller_tag = 'tag_yohood_seller_';
private static $_seller_key = 'key_yohood_seller_';
private static $_download_tag = 'tag_yohood_download_';
private static $_download_key = 'key_yohood_download_';
/**
* 设置商家信息
*
* @param string $name
* @param string $type
* @param int $brand_reg_type
* @param int $is_enter_yohobuy
* @param string $product_type
* @param string $country
* @param string $company
* @param string $contact
* @param string $telphone
* @param string $email
* @param string $relation
* @param string $website
* @param int $is_3c
* @param string $place
* @param string $files
* @return int
*/
public function setSellerInfo($name, $type, $brand_reg_type, $is_enter_yohobuy, $product_type, $country,
$company, $contact, $telphone, $email, $relation, $website, $is_3c, $place, $files)
{
$params = array(
'name' => $name, 'type' => $type,'brand_reg_type'=> intval($brand_reg_type), 'is_enter_yohobuy'=> intval($is_enter_yohobuy),
'product_type'=> $product_type,'company'=> $company,'contact'=> $contact,'telphone' => $telphone,'email'=>$email,
'relation'=> $relation,'website' => $website,'is_3c'=> intval($is_3c), 'place' => $place,'files'=> $files
);
return self::service(self::ROUTER)->cache(self::$_seller_tag)->insert('setSellerInfo', $params)->lastInsertId();
}
/**
* 根据type获取商家列表
*
* @param int $type
* @param int $offset
* @param int $limit
* @return array
*/
public function getSellerListByType($type, $offset, $limit)
{
$params = array('type' => intval($type),'offset' => intval($offset), 'limit' => intval($limit));
$key = sprintf("%s_%s_%s_%s", self::$_seller_key, $type, $offset, $limit);
return self::service(self::ROUTER)->tag(self::$_seller_tag)->key($key)->fetchAssoc('getSellerListByType', $params);
}
/**
* 根据type获取总数
*
* @param int $type
* @return array
*/
public function getSellerTotalByType($type)
{
$params = array('type' => intval($type));
return self::service(self::ROUTER)->cache(false)->fetchOne('getSellerTotalByType', $params);
}
/**
* 根据ID获取商家
*
* @param int $id
* @return array
*/
public function getSellerById($id)
{
$params = array('id'=> $id);
$key = self::$_seller_key . $id;
return self::service(self::ROUTER)->tag(self::$_seller_tag)->key($key)->fetchRow('getSellerById', $params);
}
/**
* 设置媒体信息
*
* @param string $name
* @param int $type
* @param string $profession
* @param int $sex
* @param string $company
* @param string $introduction
* @param string $website
* @param string $city
* @param string $email
* @param string $mobile
* @param string $telphone
* @param string $address
* @param string $zipcode
* @return int
*/
public function setMediaInfo($name, $type, $profession, $sex, $company, $introduction, $website, $city,
$email, $mobile, $telphone, $address, $zipcode)
{
$params = array(
'name' => addslashes($name),'type'=>$type, 'profession' => addslashes($profession),'sex'=> $sex, 'company'=> addslashes($company),
'introduction'=> addslashes($introduction),'website' => $website,'city'=> $city,
'email'=> addslashes($email),'mobile' =>addslashes($mobile), 'telphone'=> $telphone,'address' => addslashes($address),
'zipcode' => $zipcode);
return self::service(self::ROUTER)->tag(self::$_seller_tag)->insert('setMediaInfo', $params)->status();
}
/**
* 设置下载信息
*
* @param string $title
* @param string $cover
* @param string $file
* @param string $source
* @param string $source_link
* @param string $type
* @return boolean
*/
public function setDownloadInfo($title, $cover, $file, $source, $source_link, $type)
{
$params = array('title'=> addslashes($title), 'cover' => $cover, 'file'=> $file, 'source' => addslashes($source),
'source_link' => addslashes($source_link), 'type' => intval($type));
return self::service(self::ROUTER)->tag(self::$_download_tag)->insert('setDownloadInfo', $params)->status();
}
/**
* 根据ID设置下载信息
*
* @param int $id
* @param string $title
* @param string $cover
* @param string $file
* @param string $source
* @param string $source_link
* @return boolean
*/
public function setDownloadInfoById($id, $title, $cover, $file, $source, $source_link)
{
$params = array('title'=> addslashes($title), 'cover' => $cover, 'file'=> $file, 'source' => addslashes($source),
'source_link' => addslashes($source_link),'id'=> intval($id));
return self::service(self::ROUTER)->tag(self::$_download_tag)->update('setDownloadInfoById', $params)->status();
}
/**
* 获取下载列表
*
* @param int $type
* @param int $offset
* @param int $limit
* @return array
*/
public function getDownloadListByType($type, $offset, $limit)
{
$params = array('type' => intval($type),'offset' => intval($offset), 'limit' => intval($limit));
$key = sprintf("%s_%s_%s_%s", self::$_download_key, $type, $offset, $limit);
return self::service(self::ROUTER)->tag(self::$_download_tag)->fetchAssoc('getDownloadListByType', $params);
}
/**
* 获取下载总数
*
* @param int $type
* @return array
*/
public function getDownloadTotalByType($type)
{
$params = array('type' => intval($type));
return self::service(self::ROUTER)->tag(self::$_download_tag)->fetchOne('getDownloadTotalByType', $params);
}
/**
* 获取下载信息
*
* @param int $id
* @return array
*/
public function getDownloadById($id)
{
$params = array('id' => intval($id));
return self::service(self::ROUTER)->tag(self::$_download_tag)->fetchRow('getDownloadById', $params);
}
/**
* 删除下载信息
*
* @param int $id
* @return boolean
*/
public function delDownload($id)
{
$params = array('id' => intval($id));
return self::service(self::ROUTER)->tag(self::$_download_tag)->delete('delDownload', $params);
}
/**
* 设置商家信息
*
* @param array $data
* @return boolean
*/
public function setSeller(array $data)
{
$up = Util_Utils_SqlString::mergeSqlUpstring($data);
$replaces = array('up' => $up);
return self::service(self::ROUTER)->tag(self::$_seller_tag)->update('setSeller', $data, $replaces)->status();
}
}
?>
\ No newline at end of file
... ...
<?xml version="1.0" encoding="UTF-8"?>
<sqlMap namespace="onlinereg">
<insert id="setSellerInfo">
INSERT INTO tbl_online_seller(`name`, `type`, brand_reg_type, is_enter_yohobuy, product_type,country,company,
contact,telphone,email,relation,website,is_3c,place,files,create_time)
VALUES(:name,:type,:brand_reg_type, :is_enter_yohobuy, :product_type, :country,:company,
:contact,:telphone,:email,:relation,:website,:is_3c,:place,:files,UNIX_TIMESTAMP())
</insert>
<select id="getSellerListByType">
SELECT * FROM tbl_online_seller where `type`= :type ORDER BY create_time DESC LIMIT :offset, :limit
</select>
<select id="getSellerTotalByType">
SELECT COUNT(*) FROM tbl_online_seller where `type`= :type
</select>
<select id="getSellerById">
SELECT * FROM tbl_online_seller WHERE id = :id
</select>
<insert id="setMediaInfo">
INSERT INTO tbl_online_seller(`name`, `type`, profession, sex, company, introduction, website,
city, email, mobile, telphone,address, zipcode,create_time)
VALUES(:name,:type, :profession,:sex, :company, :introduction, :website, :city,
:email,:mobile,:telphone,:address,:zipcode,UNIX_TIMESTAMP())
</insert>
<insert id="setDownloadInfo">
INSERT INTO tbl_online_download(title, cover, file, source, source_link, `type`, create_time) VALUES(:title,:cover,:file,:source,
:source_link, :type, UNIX_TIMESTAMP())
</insert>
<update id="setDownloadInfoById">
UPDATE tbl_online_download SET title = :title, cover =:cover, file =:file, source = :source, source_link = :source_link, create_time = UNIX_TIMESTAMP() WHERE id = :id
</update>
<select id="getDownloadListByType">
SELECT * FROM tbl_online_download WHERE `type` = :type LIMIT :offset, :limit
</select>
<select id="getDownloadTotalByType">
SELECT COUNT(*) FROM tbl_online_download WHERE `type` = :type
</select>
<select id="getDownloadById">
SELECT * FROM tbl_online_download WHERE id = :id
</select>
<delete id="delDownload">
DELETE FROM tbl_online_download WHERE id = :id
</delete>
<update id="setSeller">
UPDATE tbl_online_seller SET #up# WHERE id = :id
</update>
</sqlMap>
\ No newline at end of file
... ...
<!DOCTYPE html>
<html>
<head>
<link rel="shortcut icon" href="favicon.ico" />
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>YOHO!- YOHOOD</title>
<meta name="Author" content="YOHO.CN" />
<?php $this->_block('css');?>
<?php $this->_css('admin.css', array(
SITE_CSS . '/common/bootstrap.min.css',
));?>
<?php $this->_endblock();?>
</head>
<?php $_ctx = Framework_YHttpRequest::instance();?>
<body style="padding-bottom: 40px;">
<div class="navbar navbar-inverse">
<div class="navbar-inner">
<div class="container-fluid">
<a class="brand" href="<?php echo SITE_MAIN;?>">
YO'HOOD
</a>
<div class="nav-collapse collapse">
<ul class="nav">
<li <?php if ($_ctx->controller_name == 'mobile'):?>class="active"<?php endif;?>><a href="<?php echo url('mobile/index')?>" >客户端模块</a></li>
<li <?php if ($_ctx->controller_name == 'index'):?>class="active"<?php endif;?>><a href="<?php echo url('index/index')?>" >首页</a></li>
<li <?php if ($_ctx->controller_name == 'activity' && in_array($_ctx->action_name, array('index','create')) ):?>class="active"<?php endif;?>><a href="<?php echo url('activity/index')?>" >活动介绍</a></li>
<li <?php if ($_ctx->controller_name == 'news'):?>class="active"<?php endif;?>><a href="<?php echo url('news/index')?>">资讯</a></li>
<li <?php if ($_ctx->controller_name == 'brand' && $_ctx->action_name != 'booth' || ($_ctx->controller_name == 'prod' && !isset($_REQUEST['status'])) ):?>class="active" <?php endif;?>><a href="<?php echo url('brand/index')?>" >品牌</a></li>
<li <?php if ($_ctx->controller_name == 'prod' && isset($_REQUEST['status']) ):?> <?php echo $_REQUEST['status'] == 1 ? 'class="active"':''; endif;?>><a href="<?php echo url('prod/index', array('status'=> 1))?>">限量商品</a></li>
<li <?php if ($_ctx->controller_name == 'activity' && in_array($_ctx->action_name, array('plantopic','plan'))):?>class="active"<?php endif;?>><a href="<?php echo url('activity/plantopic')?>">现场活动</a></li>
<li <?php if ($_ctx->controller_name == 'partner' && $_ctx->action_name == 'index'):?>class="active"<?php endif;?>><a href="/admin/partner/index">合作伙伴</a></li>
<li <?php if ($_ctx->controller_name == 'brand' && $_ctx->action_name == 'booth'):?>class="active"<?php endif;?>><a href="/admin/brand/booth">booth坐标</a></li>
<li <?php if ($_ctx->controller_name == 'invitation' && $_ctx->action_name == 'index'):?>class="active"<?php endif;?>><a href="/admin/invitation/index">邀请函</a></li>
</ul>
<span style="float: right;font-size: 16px;padding-top: 10px;">
<a href="<?php echo url('admin::default/logout')?>" style='color:white;'>退出</a>
</span>
</div>
</div>
</div>
</div>
<div class="container-fluid">
<div class="row-fluid">
<?php $this->_block('main');$this->_endblock();?>
</div>
</div>
<!-- 弹窗 -->
<!-- ALERT窗口 -->
<div class="modal hide fade" id='box_alert' style="width: 350px;">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
<h4>系统提示</h4>
</div>
<div class="modal-body">
<p id="alert_message"></p>
<p style="float:right;"><a href="javascript:void(0);" class="btn btn-primary" data-dismiss="modal" aria-hidden="true">确定</a></p>
</div>
</div>
<!-- CONFIRM窗口 -->
<div class="modal hide fade" id='box_confirm' style="width: 350px;">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
<h4>系统提示</h4>
</div>
<div class="modal-body">
<p id="confirm_message"></p>
</div>
<div class="modal-footer">
<button class="btn" data-dismiss="modal" aria-hidden="true">取消</button>
<button class="btn btn-primary" id='box_confirm_ok'>确定</button>
</div>
</div>
<?php $this->_block('js');?>
<?php $this->_js('seajs.js', array(
SITE_JS . '/lib/seajs.js'
));?>
<?php $this->_endblock();?>
</body>
<!DOCTYPE html>
<html>
<head>
<link rel="shortcut icon" href="favicon.ico" />
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>YOHO!- YOHOOD</title>
<meta name="Author" content="YOHO.CN" />
<?php $this->_block('css');?>
<?php $this->_css('admin.css', array(
SITE_CSS . '/common/bootstrap.min.css',
));?>
<?php $this->_endblock();?>
</head>
<?php $_ctx = Framework_YHttpRequest::instance();?>
<body style="padding-bottom: 40px;">
<div class="navbar navbar-inverse">
<div class="navbar-inner">
<div class="container-fluid">
<a class="brand" href="<?php echo SITE_MAIN;?>">
YO'HOOD
</a>
<div class="nav-collapse collapse">
<ul class="nav">
<li <?php if ($_ctx->controller_name == 'mobile'):?>class="active"<?php endif;?>><a href="<?php echo url('mobile/index')?>" >客户端模块</a></li>
<li <?php if ($_ctx->controller_name == 'index'):?>class="active"<?php endif;?>><a href="<?php echo url('index/index')?>" >首页</a></li>
<li <?php if ($_ctx->controller_name == 'activity' && in_array($_ctx->action_name, array('index','create')) ):?>class="active"<?php endif;?>><a href="<?php echo url('activity/index')?>" >活动介绍</a></li>
<li <?php if ($_ctx->controller_name == 'news'):?>class="active"<?php endif;?>><a href="<?php echo url('news/index')?>">资讯</a></li>
<li <?php if ($_ctx->controller_name == 'brand' && $_ctx->action_name != 'booth' || ($_ctx->controller_name == 'prod' && !isset($_REQUEST['status'])) ):?>class="active" <?php endif;?>><a href="<?php echo url('brand/index')?>" >品牌</a></li>
<li <?php if ($_ctx->controller_name == 'prod' && isset($_REQUEST['status']) ):?> <?php echo $_REQUEST['status'] == 1 ? 'class="active"':''; endif;?>><a href="<?php echo url('prod/index', array('status'=> 1))?>">限量商品</a></li>
<li <?php if ($_ctx->controller_name == 'activity' && in_array($_ctx->action_name, array('plantopic','plan'))):?>class="active"<?php endif;?>><a href="<?php echo url('activity/plantopic')?>">现场活动</a></li>
<li <?php if ($_ctx->controller_name == 'partner' && $_ctx->action_name == 'index'):?>class="active"<?php endif;?>><a href="/admin/partner/index">合作伙伴</a></li>
<li <?php if ($_ctx->controller_name == 'brand' && $_ctx->action_name == 'booth'):?>class="active"<?php endif;?>><a href="/admin/brand/booth">booth坐标</a></li>
<li <?php if ($_ctx->controller_name == 'invitation' && $_ctx->action_name == 'index'):?>class="active"<?php endif;?>><a href="/admin/invitation/index">邀请函</a></li>
<li <?php if ($_ctx->controller_name == 'onlinereg'):?>class="active"<?php endif;?>><a href="/admin/onlinereg/index">在线登记</a></li>
</ul>
<span style="float: right;font-size: 16px;padding-top: 10px;">
<a href="<?php echo url('admin::default/logout')?>" style='color:white;'>退出</a>
</span>
</div>
</div>
</div>
</div>
<div class="container-fluid">
<div class="row-fluid">
<?php $this->_block('main');$this->_endblock();?>
</div>
</div>
<!-- 弹窗 -->
<!-- ALERT窗口 -->
<div class="modal hide fade" id='box_alert' style="width: 350px;">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
<h4>系统提示</h4>
</div>
<div class="modal-body">
<p id="alert_message"></p>
<p style="float:right;"><a href="javascript:void(0);" class="btn btn-primary" data-dismiss="modal" aria-hidden="true">确定</a></p>
</div>
</div>
<!-- CONFIRM窗口 -->
<div class="modal hide fade" id='box_confirm' style="width: 350px;">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
<h4>系统提示</h4>
</div>
<div class="modal-body">
<p id="confirm_message"></p>
</div>
<div class="modal-footer">
<button class="btn" data-dismiss="modal" aria-hidden="true">取消</button>
<button class="btn btn-primary" id='box_confirm_ok'>确定</button>
</div>
</div>
<?php $this->_block('js');?>
<?php $this->_js('seajs.js', array(
SITE_JS . '/lib/seajs.js'
));?>
<?php $this->_endblock();?>
</body>
</html>
\ No newline at end of file
... ...
<?php $this->_extends('layout/admin_layout');?>
<?php $this->_block('main');?>
<h4><?php echo $this->view->topicInfo['title'];?>现场活动</h4>
<table class="table">
<caption style="text-align:left; padding-bottom:5px;">
<button class="btn" id="create_activity_plan" style="float:left;" parent_id="<?php echo $this->view->topicInfo['id'];?>"
start_time="<?php echo $this->view->topicInfo['start_time'];?>" end_time="<?php echo $this->view->topicInfo['end_time'];?>">
添加现场活动
</button>
</caption>
<thead>
<td>编号</td>
<td width="10%">活动时间</td>
<td>标题</td>
<td>图片</td>
<td width="15%">内容</td>
<td>操作</td>
</thead>
<?php foreach($this->view->plans as $plan):?>
<tr>
<td><?php echo $plan['id'];?></td>
<td><?php echo date('Y-m-d H:i:s', $plan['start_time']);?></td>
<td><?php echo $plan['title'];?></td>
<td><img src="<?php echo Lib_Images::getImageUrl($plan['pic'], '0200x0150','fragmentimg');?>" width="100" height="100" pic="<?php echo $plan['pic'];?>"/></td>
<td><?php echo $plan['content'];?></td>
<td>
<button class="btn edit_activity_plan">编辑</button>
<button class="btn btn-danger del_activity_plan" plan_id="<?php echo $plan['id'];?>">删除</button>
</td>
</tr>
<?php endforeach;?>
</table>
<div id="form_pan" admin="" style="display:none;">
<table class="table table-bordered">
<tbody>
<tr>
<td>标题 <span class="text-error"> * </span></td>
<td colspan="3">
<input type="text" id="title" name="title"/>
<input type="hidden" id="id" name="id" value=""/>
</td>
</tr>
<tr>
<td>内容 <span class="text-error"> * </span</td>
<td>
<textarea rows="3" style="margin-left: 0px; margin-right: 0px; width:300px;" id="content" name="content"></textarea>
</td>
<td>图片(640xN)<span class="text-error"> * </span</td>
<td>
<span id="upload_pic" key="<?php echo $this->view->key?>"></span>
<button class="btn btn-info" type="button">上传</button>
<input type="hidden" id="pic_val" name="pic_val" />
<img src="" id="img" width="100" height="100" />
</td>
</tr>
<tr>
<td>活动时间<span class="text-error"> * </span></td>
<td colspan="3">
<input value="" type="text" class="Wdate" name="start_time" id="start_time" title="点击选择时间">
<span class="text-error">
(<?php echo date('Y-m-d H:i:s', $this->view->topicInfo['start_time']).' -- '.date('Y-m-d H:i:s', $this->view->topicInfo['end_time']);?> )
</span>
</td>
</tr>
</tbody>
</table>
</div>
<?php $this->_endblock();?>
<?php $this->_block('js');?>
<?php $this->_js('feedback.js', array(
SITE_JS . '/lib/seajs.js',
SITE_JS . '/lib/ui/date/WdatePicker.js',
));?>
<script type="text/javascript">
seajs.use('admin/activity',function(activity){
activity.plan();
});
</script>
<?php $this->_extends('layout/admin_layout');?>
<?php $this->_block('main');?>
<h4><?php echo $this->view->topicInfo['title'];?>现场活动</h4>
<table class="table">
<caption style="text-align:left; padding-bottom:5px;">
<button class="btn" id="create_activity_plan" style="float:left;" parent_id="<?php echo $this->view->topicInfo['id'];?>"
start_time="<?php echo $this->view->topicInfo['start_time'];?>" end_time="<?php echo $this->view->topicInfo['end_time'];?>">
添加现场活动
</button>
</caption>
<thead>
<td>编号</td>
<td width="10%">活动时间</td>
<td>标题</td>
<td>图片</td>
<td width="15%">内容</td>
<td>操作</td>
</thead>
<?php foreach($this->view->plans as $plan):?>
<tr>
<td><?php echo $plan['id'];?></td>
<td><?php echo date('Y-m-d H:i:s', $plan['start_time']);?></td>
<td><?php echo $plan['title'];?></td>
<td><img src="<?php echo Lib_Images::getImageUrl($plan['pic'], '0200x0150','fragmentimg');?>" width="100" height="100" pic="<?php echo $plan['pic'];?>"/></td>
<td><?php echo $plan['content'];?></td>
<td>
<button class="btn edit_activity_plan">编辑</button>
<button class="btn btn-danger del_activity_plan" plan_id="<?php echo $plan['id'];?>">删除</button>
</td>
</tr>
<?php endforeach;?>
</table>
<div id="form_pan" admin="" style="display:none;">
<table class="table table-bordered">
<tbody>
<tr>
<td>标题 <span class="text-error"> * </span></td>
<td colspan="3">
<input type="text" id="title" name="title"/>
<input type="hidden" id="id" name="id" value=""/>
</td>
</tr>
<tr>
<td>内容 <span class="text-error"> * </span></td>
<td>
<textarea rows="3" style="margin-left: 0px; margin-right: 0px; width:300px;" id="content" name="content"></textarea>
</td>
<td>图片(640xN)<span class="text-error"> * </span></td>
<td>
<span id="upload_pic" key="<?php echo $this->view->key?>"></span>
<button class="btn btn-info" type="button">上传</button>
<input type="hidden" id="pic_val" name="pic_val" />
<img src="" id="img" width="100" height="100" />
</td>
</tr>
<tr>
<td>活动时间<span class="text-error"> * </span></td>
<td colspan="3">
<input value="" type="text" class="Wdate" name="start_time" id="start_time" title="点击选择时间">
<span class="text-error">
(<?php echo date('Y-m-d H:i:s', $this->view->topicInfo['start_time']).' -- '.date('Y-m-d H:i:s', $this->view->topicInfo['end_time']);?> )
</span>
</td>
</tr>
</tbody>
</table>
</div>
<?php $this->_endblock();?>
<?php $this->_block('js');?>
<?php $this->_js('feedback.js', array(
SITE_JS . '/lib/seajs.js',
SITE_JS . '/lib/ui/date/WdatePicker.js',
));?>
<script type="text/javascript">
seajs.use('admin/activity',function(activity){
activity.plan();
});
</script>
<?php $this->_endblock();?>
\ No newline at end of file
... ...
<?php $this->_extends('layout/admin_layout');?>
<?php $this->_block('main');?>
<h4>现场主题</h4>
<table class="table">
<caption style="text-align:left; padding-bottom:5px;">
<button class="btn" id="create_activity_topic" style="float:left;">
添加现场主题
</button>
</caption>
<thead>
<td>编号</td>
<td width="10%">开始时间</td>
<td width="10%">结束时间</td>
<td width="10%">区域</td>
<td>标题</td>
<td>操作</td>
</thead>
<?php foreach($this->view->topics as $topic):?>
<tr>
<td><?php echo $topic['id'];?></td>
<td><?php echo date('Y-m-d H:i:s', $topic['start_time']);?></td>
<td><?php echo date('Y-m-d H:i:s', $topic['end_time']);?></td>
<td><?php echo $topic['place'];?></td>
<td><?php echo $topic['title'];?></td>
<td>
<button class="btn edit_activity_topic">编辑</button>
<button class="btn join_activity_plan" topic_id="<?php echo $topic['id'];?>">添加现场活动</button>
<button class="btn btn-danger del_activity_topic" topic_id="<?php echo $topic['id'];?>">删除</button>
</td>
</tr>
<?php endforeach;?>
</table>
<?php $this->_component('Common_Pagination',array(
'pagination' => $this->view->pagination,'show_count' =>true,
));?>
<div id="form_pan" admin="" style="display:none;">
<table class="table table-bordered">
<tbody>
<tr>
<td>标题 <span class="text-error"> * </span></td>
<td>
<input type="text" id="title" name="title"/>
<input type="hidden" id="id" name="id" value=""/>
</td>
<td>区域<span class="text-error"> * </span></td>
<td>
<input type="text" id="place" name="place"/>
</td>
</tr>
<tr>
<td>开始时间<span class="text-error"> * </span</td>
<td>
<input value="" type="text" class="Wdate" name="start_time" id="start_time" title="点击选择时间">
</td>
<td>结束时间<span class="text-error"> * </span</td>
<td>
<input value="" type="text" class="Wdate" name="end_time" id="end_time" title="点击选择时间">
</td>
</tr>
</tbody>
</table>
</div>
<?php $this->_endblock();?>
<?php $this->_block('js');?>
<?php $this->_js('feedback.js', array(
SITE_JS . '/lib/seajs.js',
SITE_JS . '/lib/ui/date/WdatePicker.js',
));?>
<script type="text/javascript">
seajs.use('admin/activity',function(activity){
activity.topic();
});
</script>
<?php $this->_extends('layout/admin_layout');?>
<?php $this->_block('main');?>
<h4>现场主题</h4>
<table class="table">
<caption style="text-align:left; padding-bottom:5px;">
<button class="btn" id="create_activity_topic" style="float:left;">
添加现场主题
</button>
</caption>
<thead>
<td>编号</td>
<td width="10%">开始时间</td>
<td width="10%">结束时间</td>
<td width="10%">区域</td>
<td>标题</td>
<td>操作</td>
</thead>
<?php foreach($this->view->topics as $topic):?>
<tr>
<td><?php echo $topic['id'];?></td>
<td><?php echo date('Y-m-d H:i:s', $topic['start_time']);?></td>
<td><?php echo date('Y-m-d H:i:s', $topic['end_time']);?></td>
<td><?php echo $topic['place'];?></td>
<td><?php echo $topic['title'];?></td>
<td>
<button class="btn edit_activity_topic">编辑</button>
<button class="btn join_activity_plan" topic_id="<?php echo $topic['id'];?>">添加现场活动</button>
<button class="btn btn-danger del_activity_topic" topic_id="<?php echo $topic['id'];?>">删除</button>
</td>
</tr>
<?php endforeach;?>
</table>
<?php $this->_component('Common_Pagination',array(
'pagination' => $this->view->pagination,'show_count' =>true,
));?>
<div id="form_pan" admin="" style="display:none;">
<table class="table table-bordered">
<tbody>
<tr>
<td>标题 <span class="text-error"> * </span></td>
<td>
<input type="text" id="title" name="title"/>
<input type="hidden" id="id" name="id" value=""/>
</td>
<td>区域<span class="text-error"> * </span></td>
<td>
<input type="text" id="place" name="place"/>
</td>
</tr>
<tr>
<td>开始时间<span class="text-error"> * </span></td>
<td>
<input value="" type="text" class="Wdate" name="start_time" id="start_time" title="点击选择时间">
</td>
<td>结束时间<span class="text-error"> * </span></td>
<td>
<input value="" type="text" class="Wdate" name="end_time" id="end_time" title="点击选择时间">
</td>
</tr>
</tbody>
</table>
</div>
<?php $this->_endblock();?>
<?php $this->_block('js');?>
<?php $this->_js('feedback.js', array(
SITE_JS . '/lib/seajs.js',
SITE_JS . '/lib/ui/date/WdatePicker.js',
));?>
<script type="text/javascript">
seajs.use('admin/activity',function(activity){
activity.topic();
});
</script>
<?php $this->_endblock();?>
\ No newline at end of file
... ...
<?php $this->_extends('layout/admin_layout');?>
<?php $this->_block('main');?>
<div>
<h4 style="float: left;">资讯列表</h4>
<select name="tag" style="margin-left: 20px;margin-top:10px;width:150px;" id="choose_tag">
<option value="" <?php '' == $this->view->tag ? 'selected':''?>>全部资讯</option>
<?php
$tags = array('品牌资讯', '现场活动','独家合作','主理人','明星','限量产品','票务','视频','专题');//'手机视频'
foreach($tags as $tag)
{
echo sprintf('<option value="%s" %s>%s</option>', $tag, $tag == $this->view->tag ? 'selected':'', $tag);
}
?>
</div>
</select>
<table class="table">
<caption style="text-align:left; padding-bottom:5px;">
<button class="btn" style="float:left;" onclick="location.href='<?php echo url('news/create',array('type' => $this->view->currentType))?>'">
添加资讯
</button>
</caption>
<thead>
<td>资讯ID</td>
<td>标签</td>
<td>标题</td>
<td>内容</td>
<td>缩略图</td>
<td>客户端缩略图</td>
<td>浏览量</td>
<td>排序(值越大,排序越靠前)</td>
<td>创建时间</td>
<td>操作</td>
</thead>
<?php if (empty($this->view->list)) :?>
<tr><td colspan="10" style="text-align: center">无记录</td></tr>
<?php else :?>
<?php foreach ($this->view->list as $feedback) :?>
<tr>
<td><?php echo $feedback['id'];?></td>
<td><?php echo $feedback['tag']?></td>
<td title="<?php echo $feedback['title'];?>"><?php echo trim($feedback['title']);?></td>
<td title="<?php echo $feedback['content'];?>"><?php echo $feedback['content']?></td>
<td>
<?php if ($feedback['thumb']):?>
<img width="80" height="60" src="<?php echo $feedback['thumb']?>"/>
<?php else:?>
暂无缩略图
<?php endif ;?>
</td>
<td>
<?php if ($feedback['client_thumb']):?>
<img width="80" height="60" src="<?php echo $feedback['client_thumb']?>"/>
<?php else:?>
暂无缩略图
<?php endif ;?>
</td>
<td><?php echo $feedback['hits']?></td>
<td><?php echo $feedback['sort'];?></td>
<td><?php echo date('Y-m-d H:i:s', $feedback['create_time']);?></td>
<td>
<button class="btn look" onclick="location.href='<?php echo url('news/create',array('id' => $feedback['id']))?>'" >查看</button>
<button type="submit" class="btn btn-danger del" href="<?php echo url('news/del',array('id' => $feedback['id']))?>">删除</button>
</td>
</tr>
<?php endforeach;?>
<?php endif;?>
</table>
<?php $this->_component('Common_Pagination',array(
'pagination' => $this->view->pagination,'show_count' =>true,
));?>
<div>
<?php $this->_endblock();?>
<?php $this->_block('js');?>
<?php $this->_js('feedback.js', array(
SITE_JS . '/lib/seajs.js',
));?>
<script type="text/javascript" src="<?php echo SITE_JS?>/lib/ui/date/WdatePicker.js"></script>
<script type="text/javascript">
seajs.use('admin/news');
</script>
<?php $this->_endblock();?>
<?php $this->_extends('layout/admin_layout');?>
<?php $this->_block('main');?>
<div>
<h4 style="float: left;">资讯列表</h4>
<select name="tag" style="margin-left: 20px;margin-top:10px;width:150px;" id="choose_tag">
<option value="" <?php '' == $this->view->tag ? 'selected':''?>>全部资讯</option>
<?php
$tags = array('品牌资讯', '现场活动','独家合作','主理人','明星','限量产品','票务','视频','专题');//'手机视频'
foreach($tags as $tag)
{
echo sprintf('<option value="%s" %s>%s</option>', $tag, $tag == $this->view->tag ? 'selected':'', $tag);
}
?>
</div>
</select>
<table class="table">
<caption style="text-align:left; padding-bottom:5px;">
<button class="btn" style="float:left;" onclick="location.href='<?php echo url('news/create',array('type' => $this->view->currentType))?>'">
添加资讯
</button>
</caption>
<thead>
<td>资讯ID</td>
<td>标签</td>
<td>标题</td>
<td>内容</td>
<td>缩略图</td>
<td>客户端缩略图</td>
<td>浏览量</td>
<td>排序(值越大,排序越靠前)</td>
<td>创建时间</td>
<td>操作</td>
</thead>
<?php if (empty($this->view->list)) :?>
<tr><td colspan="10" style="text-align: center">无记录</td></tr>
<?php else :?>
<?php foreach ($this->view->list as $feedback) :?>
<tr>
<td><?php echo $feedback['id'];?></td>
<td><?php echo $feedback['tag']?></td>
<td title="<?php echo $feedback['title'];?>"><?php echo trim($feedback['title']);?></td>
<td title="<?php echo $feedback['content'];?>"><?php echo $feedback['content']?></td>
<td>
<?php if ($feedback['thumb']):?>
<img width="80" height="60" src="<?php echo $feedback['thumb']?>"/>
<?php else:?>
暂无缩略图
<?php endif ;?>
</td>
<td>
<?php if ($feedback['client_thumb']):?>
<img width="80" height="60" src="<?php echo $feedback['client_thumb']?>"/>
<?php else:?>
暂无缩略图
<?php endif ;?>
</td>
<td><?php echo $feedback['hits']?></td>
<td><?php echo $feedback['sort'];?></td>
<td><?php echo date('Y-m-d H:i:s', $feedback['create_time']);?></td>
<td>
<button class="btn look" onclick="location.href='<?php echo url('news/create',array('id' => $feedback['id']))?>'" >查看</button>
<button type="submit" class="btn btn-danger del" href="<?php echo url('news/del',array('id' => $feedback['id']))?>">删除</button>
</td>
</tr>
<?php endforeach;?>
<?php endif;?>
</table>
<?php $this->_component('Common_Pagination',array(
'pagination' => $this->view->pagination,'show_count' =>true,
));?>
<?php $this->_endblock();?>
<?php $this->_block('js');?>
<?php $this->_js('feedback.js', array(
SITE_JS . '/lib/seajs.js',
));?>
<script type="text/javascript" src="<?php echo SITE_JS?>/lib/ui/date/WdatePicker.js"></script>
<script type="text/javascript">
seajs.use('admin/news');
</script>
<?php $this->_endblock();?>
... ...
<?php $this->_extends('layout/admin_layout');?>
<?php $this->_block('main');?>
<?php if($this->view->type == 0):?>
<h4>参展商手册</h4>
<table class="table" type="<?php echo $this->view->type;?>">
<caption style="text-align:left; padding-bottom:5px;">
<button class="btn" id="create_download_info" style="float:left;">
添加参展商手册
</button>
</caption>
<thead>
<td width="10%">编号</td>
<td width="10%">参展商名称</td>
<td width="20%">图片</td>
<td width="20%">日期</td>
<td>操作</td>
</thead>
<?php foreach ($this->view->list as $download):?>
<tr>
<td><?php echo $download['id']?></td>
<td><?php echo $download['title']?></td>
<td><img alt="" src="<?php echo $download['cover']?>" width="200" height="200"></td>
<td><?php echo date('Y-m-d H:i:s', $download['create_time']);?></td>
<td>
<button class="btn btn-success modify" download_id="<?php echo $download['id']?>">修改</button>
<button class="btn btn-danger del" download_id="<?php echo $download['id']?>">删除</button>
</td>
</tr>
<?php endforeach;?>
</table>
<div id="form_pan" admin="" style="display:none;">
<table class="table table-bordered">
<tbody>
<tr>
<td>名称<span class="text-error"> * </span></td>
<td colspan="3">
<input type="text" id="title" name="title"/>
<input type="hidden" name="download_id" id="download_id" value="0"/>
</td>
</tr>
<tr>
<td>封面图(NxN)<span class="text-error"> * </span></td>
<td>
<span id="upload_pic" key="<?php echo $this->view->key?>"></span>
<button class="btn btn-info" type="button">上传</button>
<div id="picdiv"></div>
</td>
</tr>
<tr>
<td>文件上传<span class="text-error"> * </span></td>
<td>
<span id="upload_file" key="<?php echo $this->view->key?>"></span>
<button class="btn btn-info" type="button">上传</button>
<div id="filediv"></div>
</td>
</tr>
</tbody>
</table>
</div>
<?php else:?>
<table class="table" type="<?php echo $this->view->type;?>">
<caption style="text-align:left; padding-bottom:5px;">
<button class="btn" id="create_download_info" style="float:left;">
添加新闻稿
</button>
</caption>
<thead>
<td width="10%">编号</td>
<td width="10%">媒体稿</td>
<td width="20%">腾讯娱乐</td>
<td width="20%">日期</td>
<td>操作</td>
</thead>
<?php foreach ($this->view->list as $download):?>
<tr>
<td><?php echo $download['id']?></td>
<td><?php echo $download['title']?></td>
<td><?php echo $download['source']?></td>
<td><?php echo date('Y-m-d H:i:s', $download['create_time']);?></td>
<td>
<button class="btn btn-success modify" download_id="<?php echo $download['id']?>">修改</button>
<button class="btn btn-danger del" download_id="<?php echo $download['id']?>">删除</button>
</td>
</tr>
<?php endforeach;?>
</table>
<div id="form_pan" admin="" style="display:none;">
<table class="table table-bordered">
<tbody>
<tr>
<td>名称<span class="text-error"> * </span></td>
<td colspan="3">
<input type="text" id="title" name="title"/>
<input type="hidden" id="download_id" name="download_id" value="0"/>
</td>
</tr>
<tr>
<td>来源<span class="text-error"> * </span></td>
<td colspan="3">
<input type="text" id="source" name="source"/>
</td>
</tr>
<tr>
<td>来源链接:<span class="text-error"> * </span></td>
<td colspan="3">
<input type="text" id="source_link" name="source_link"/>
</td>
</tr>
<tr>
<td>文件上传<span class="text-error"> * </span></td>
<td>
<span id="upload_file" key="<?php echo $this->view->key?>"></span>
<button class="btn btn-info" type="button">上传</button>
<div id="filediv"></div>
</td>
</tr>
</tbody>
</table>
</div>
<?php endif;?>
<?php $this->_endblock();?>
<?php $this->_block('js');?>
<?php $this->_js('feedback.js', array(
SITE_JS . '/lib/seajs.js',
));?>
<script type="text/javascript">
seajs.use('admin/onlinereg',function(onlinereg){
onlinereg.download();
});
</script>
<?php $this->_endblock();?>
\ No newline at end of file
... ...
<?php $this->_extends('layout/admin_layout');?>
<?php $this->_block('main');?>
<ul class="nav nav-tabs" type="<?php echo $this->view->type;?>">
<li <?php echo $this->view->type == 0 ? 'class="active"' :''; ?> >
<a href="/admin/onlinereg/index">参展商登记</a>
</li>
<li <?php echo $this->view->type == 1 ? 'class="active"' :''; ?>>
<a href="/admin/onlinereg/index/type/1">赞助商登记</a>
</li>
<li <?php echo $this->view->type == 2 ? 'class="active"' :''; ?>>
<a href="/admin/onlinereg/index/type/2">媒体登记</a>
</li>
</ul>
<?php if($this->view->type == 0)://参展商登记?>
<table class="table">
<caption style="text-align:left; padding-bottom:5px;">
<button class="btn" style="float:left;" onclick="location.href='/admin/onlinereg/download/type/0';">查看参展商手册</button>
<button class="btn batch_export" style="margin-left:100px">批量导出</button>
</caption>
<thead>
<td width="5%">选择</td>
<td width="5%">ID</td>
<td width="5%">品牌名称</td>
<td width="5%">类型</td>
<td width="5%">联系人</td>
<td width="5%">电话</td>
<td width="5%">创建时间</td>
<td width="10%">操作</td>
</thead>
<?php foreach($this->view->list as $seller):?>
<tr>
<td><input type="checkbox" seller_id="<?php echo $seller['id']?>"></td>
<td><?php echo $seller['id']?></td>
<td><?php echo $seller['name']?></td>
<td><?php echo $this->view->sellerTypes[$this->view->type];?></td>
<td><?php echo $seller['contact']?></td>
<td><?php echo $seller['telphone']?></td>
<td><?php echo date('Y-m-d H:i:s', $seller['create_time']);?></td>
<td>
<button class="btn look" seller_id="<?php echo $seller['id']?>">查看</button>
<button class="btn btn-danger export" onclick="location.href='/admin/onlinereg/export?id=<?php echo $seller['id']?>';">导出</button>
</td>
</tr>
<?php endforeach;?>
</table>
<div id="form_pan" admin="" style="display:none;">
<table class="table table-bordered">
<tbody>
<tr>
<td>品牌名称<span class="text-error"> * </span></td>
<td><input type="text" name="name"/></td>
</tr>
<tr>
<td>是否品牌入驻有货<span class="text-error"> * </span></td>
<td>
<select id="is_enter_yohobuy" name="is_enter_yohobuy">
<option value="0"></option>
<option value="1"></option>
</select>
</td>
</tr>
<tr>
<td>品牌注册<span class="text-error"> * </span></td>
<td>
<select id="brand_reg_type" name="brand_reg_type">
<option value="0">未注册</option>
<option value="1">已注册</option>
<option value="2">已申请</option>
</select>
</td>
</tr>
<tr>
<td>公司名称</td>
<td><input type="text" name="company" /></td>
</tr>
<tr>
<td>联系人<span class="text-error"> * </span></td>
<td><input type="text" name="contact" /></td>
</tr>
<tr>
<td>电话<span class="text-error"> * </span></td>
<td><input type="text" name="telphone" /></td>
</tr>
<tr>
<td>邮箱</td>
<td><input type="text" name="email" /></td>
</tr>
<tr>
<td>公司与品牌关系<span class="text-error"> * </span></td>
<td>
<select id="relation" name="relation">
<option value="0">品牌商</option>
<option value="1">代理商</option>
<option value="2">经销商</option>
<option value="3">其他</option>
</select>
</td>
</tr>
<tr>
<td>商品所在地<span class="text-error"> * </span></td>
<td><input type="text" name="place" /></td>
</tr>
<tr>
<td>是否具有3C凭证<span class="text-error"> * </span></td>
<td>
<select id="is_3c" name="is_3c">
<option value="0"></option>
<option value="1"></option>
</select>
</td>
</tr>
<tr>
<td>品牌官网</td>
<td><input type="text" name="website" /></td>
</tr>
<tr>
<td>品牌资料</td>
<td>
<div id="download_list"></div>
</td>
</tr>
</tbody>
</table>
</div>
<?php elseif($this->view->type == 1)://赞助商登记?>
<table class="table">
<caption style="text-align:left; padding-bottom:5px;">
<button class="btn batch_export" style="float:left;">批量导出</button>
</caption>
<thead>
<td width="5%">选择</td>
<td width="5%">ID</td>
<td width="5%">品牌名称</td>
<td width="5%">产品类型</td>
<td width="5%">类型</td>
<td width="5%">联系人</td>
<td width="5%">电话</td>
<td width="5%">时间</td>
<td width="10%">操作</td>
</thead>
<?php foreach($this->view->list as $seller):?>
<tr>
<td><input type="checkbox" seller_id="<?php echo $seller['id']?>"></td>
<td><?php echo $seller['id']?></td>
<td><?php echo $seller['name']?></td>
<td width="15%"><?php echo $seller['product_type']?></td>
<td><?php echo $this->view->sellerTypes[$this->view->type];?></td>
<td><?php echo $seller['contact']?></td>
<td><?php echo $seller['telphone']?></td>
<td><?php echo date('Y-m-d H:i:s', $seller['create_time']);?></td>
<td>
<button class="btn look" seller_id="<?php echo $seller['id']?>">查看</button>
<button class="btn btn-danger export" onclick="location.href='/admin/onlinereg/export?id=<?php echo $seller['id']?>';">导出</button>
</td>
</tr>
<?php endforeach;?>
</table>
<div id="form_pan" admin="" style="display:none;">
<table class="table table-bordered">
<tbody>
<tr>
<td>品牌名称<span class="text-error"> * </span></td>
<td><input type="text" name="name"/></td>
</tr>
<tr>
<td>是否品牌入驻有货<span class="text-error"> * </span></td>
<td>
<select id="is_enter_yohobuy" name="is_enter_yohobuy">
<option value="0"></option>
<option value="1"></option>
</select>
</td>
</tr>
<tr>
<td>产品类型<span class="text-error"> * </span></td>
<td><input type="text" name="product_type" /></td>
</tr>
<tr>
<td>所属国家</td>
<td><input type="text" name="country" /></td>
</tr>
<tr>
<td>公司名称</td>
<td><input type="text" name="company" /></td>
</tr>
<tr>
<td>公司地址</td>
<td><input type="text" name="place" /></td>
</tr>
<tr>
<td>联系人<span class="text-error"> * </span></td>
<td><input type="text" name="contact" /></td>
</tr>
<tr>
<td>电话<span class="text-error"> * </span></td>
<td><input type="text" name="telphone" /></td>
</tr>
<tr>
<td>邮箱</td>
<td><input type="text" name="email" /></td>
</tr>
<tr>
<td>品牌官网</td>
<td><input type="text" name="website" /></td>
</tr>
<tr>
<td>品牌资料</td>
<td>
<div id="download_list"></div>
</td>
</tr>
</tbody>
</table>
</div>
<?php elseif($this->view->type == 2)://媒体登记?>
<table class="table">
<caption style="text-align:left; padding-bottom:5px;">
<button class="btn" style="float:left;" onclick="location.href='/admin/onlinereg/download/type/1';">查看新闻稿</button>
<button class="btn batch_export" style="margin-left:100px">批量导出</button>
</caption>
<thead>
<td width="5%">选择</td>
<td width="5%">ID</td>
<td width="5%">媒体名称</td>
<td width="5%">类型</td>
<td width="5%">联系人</td>
<td width="5%">电话</td>
<td width="5%">创建时间</td>
<td width="10%">操作</td>
</thead>
<?php foreach($this->view->list as $seller):?>
<tr>
<td><input type="checkbox" seller_id="<?php echo $seller['id']?>"></td>
<td><?php echo $seller['id']?></td>
<td><?php echo $seller['name']?></td>
<td><?php echo $this->view->sellerTypes[$this->view->type];?></td>
<td><?php echo $seller['contact']?></td>
<td><?php echo $seller['telphone']?></td>
<td><?php echo date('Y-m-d H:i:s', $seller['create_time']);?></td>
<td>
<button class="btn look" seller_id="<?php echo $seller['id']?>">查看</button>
<button class="btn btn-danger export" onclick="location.href='/admin/onlinereg/export?id=<?php echo $seller['id']?>';">导出</button>
</td>
</tr>
<?php endforeach;?>
</table>
<div id="form_pan" admin="" style="display:none;">
<table class="table table-bordered">
<tbody>
<tr>
<td>姓名<span class="text-error"> * </span></td>
<td><input type="text" name="name"/></td>
</tr>
<tr>
<td>职位</td>
<td><input type="text" name="profession" /></td>
</tr>
<tr>
<td>性别</td>
<td><input type="text" name="sex" /></td>
</tr>
<tr>
<td>媒体名/公司名</td>
<td><input type="text" name="country" /></td>
</tr>
<tr>
<td>介绍</td>
<td><input type="text" name="introduction" /></td>
</tr>
<tr>
<td>官网地址</td>
<td><input type="text" name="website" /></td>
</tr>
<tr>
<td>所在城市</td>
<td><input type="text" name="city" /></td>
</tr>
<tr>
<td>邮箱</td>
<td><input type="text" name="email" /></td>
</tr>
<tr>
<td>手机<span class="text-error"> * </span></td>
<td><input type="text" name="mobile" /></td>
</tr>
<tr>
<td>座机</td>
<td><input type="text" name="telphone" /></td>
</tr>
<tr>
<td>固定地址</td>
<td><input type="text" name="place" /></td>
</tr>
<tr>
<td>邮编</td>
<td><input type="text" name="zipcode" /></td>
</tr>
</tbody>
</table>
</div>
<?php endif;?>
<?php $this->_component('Common_Pagination',array(
'pagination' => $this->view->pagination,'show_count' =>true,
));?>
<?php $this->_endblock();?>
<?php $this->_block('js');?>
<?php $this->_js('feedback.js', array(
SITE_JS . '/lib/seajs.js',
));?>
<script type="text/javascript">
seajs.use('admin/onlinereg',function(onlinereg){
onlinereg.index();
});
</script>
<?php $this->_endblock();?>
\ No newline at end of file
... ...