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
... ...
... ... @@ -279,7 +279,7 @@ class Lib_Images
$context = stream_context_create(array(
'http' => array('timeout' => 3,),
));
$temp = file_get_contents($imageUrl, false, $context);
$temp = @file_get_contents($imageUrl, false, $context);
if ($temp)
{
... ...
<?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
... ...
... ... @@ -31,6 +31,7 @@
<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>
... ...
... ... @@ -42,11 +42,11 @@
</td>
</tr>
<tr>
<td>内容 <span class="text-error"> * </span</td>
<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>图片(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>
... ...
... ... @@ -50,11 +50,11 @@
</td>
</tr>
<tr>
<td>开始时间<span class="text-error"> * </span</td>
<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>结束时间<span class="text-error"> * </span></td>
<td>
<input value="" type="text" class="Wdate" name="end_time" id="end_time" title="点击选择时间">
</td>
... ...
... ... @@ -73,8 +73,6 @@
));?>
<div>
<?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
... ...