根据推广公司配置推广后台

master
elf@home 4 years ago
parent d7eb2b75a2
commit dd66846e68

@ -534,6 +534,12 @@ class PromoteCompanyController extends ThinkController
$deposit = M('president_deposit', 'tab_')->where(['company_id' => $data['id']])->find();
$siteConfig = $data['site_config'] == '' ? null : json_decode($data['site_config'], true);
if ($siteConfig) {
$siteConfig['logo'] = get_cover($siteConfig['logo'], 'path');
$siteConfig['icon'] = get_cover($siteConfig['icon'], 'path');
}
$this->assign('selfCompanies', $selfCompanies);
$this->assign('payWays', PresidentDepositService::$payWays);
$this->assign('payTypes', PresidentDepositService::$payTypes);
@ -542,7 +548,7 @@ class PromoteCompanyController extends ThinkController
$this->assign('deposit', $deposit);
}
$this->assign('relation', $relation);
$this->assign('siteConfig', $siteConfig);
$this->assign('data', $data);
$this->meta_title ='推广公司信息查看';
$this->display();
@ -589,6 +595,12 @@ class PromoteCompanyController extends ThinkController
$selfCompanies = M('company_info', 'tab_')->field('id,partner company_name,link_man,link_phone')->where(['status' => 1])->select();
$siteConfig = $data['site_config'] ?? null;
if ($siteConfig) {
$siteConfig['logo'] = get_cover($siteConfig['logo'], 'path');
$siteConfig['icon'] = get_cover($siteConfig['icon'], 'path');
}
$this->assign('selfCompanies', $selfCompanies);
$this->assign('payWays', PresidentDepositService::$payWays);
$this->assign('payTypes', PresidentDepositService::$payTypes);
@ -598,6 +610,7 @@ class PromoteCompanyController extends ThinkController
}
$this->assign('relation', $data['relation'] ?? null);
$this->assign('data', $data);
$this->assign('siteConfig', $siteConfig);
$this->assign('commonset', M('Kuaijieicon')->where(['url' => 'Partner/edit'])->find());
$this->meta_title ='审核信息查看';
$this->display("view");
@ -704,6 +717,10 @@ class PromoteCompanyController extends ThinkController
if($data['resources'] == ''){
$data['resources'] ="[]";
}
$siteConfig = null;
if ($data['site_config']) {
$siteConfig = json_decode($data['site_config'], true);
}
$data['turnover_ratio'] = $data['turnover_ratio'] ? json_decode($data['turnover_ratio'], true) : $data['turnover_ratio'];
// $data['game_ids'] = explode(',', $data['game_ids']);
@ -743,6 +760,7 @@ class PromoteCompanyController extends ThinkController
$this->assign('relation', $relation);
$this->assign('serviceAgreements', M('service_agreement', 'tab_')->select());
$this->assign('siteConfig', $siteConfig);
$this->assign('data', $data);
$this->display();
}
@ -1134,13 +1152,30 @@ class PromoteCompanyController extends ThinkController
}
}
if (isset($save['is_site_custom']) && $save['is_site_custom'] == 1) {
if ($save['site_domain_prefix'] == '') {
$this->error('请输入推广后台域名前缀');
}
if ($save['site_config']['icon'] == '') {
$this->error('请上传推广后台ICON');
}
if ($save['site_config']['logo'] == '') {
$this->error('请上传推广后台logo');
}
/**
* @todo 暂未检查待审核的推广公司是否含有重复域名前缀
*/
$domainExistMap = ['site_domain_prefix' => $save['site_domain_prefix']];
if (!empty($save['id'])) {
$domainExistMap['id'] = ['neq', $save['id']];
}
$domainCompany = M('promote_company', 'tab_')->field(['id'])->where($domainExistMap)->find();
if ($domainCompany) {
$this->error('推广后台域名前缀已存在');
}
}
// if(!empty(I("contact_phone")) && !checkPhone(I('contact_phone'))) {
// $this->error('联系电话格式不正确');
// }
// if(!empty(I('reg_phone')) && !checkPhone(I('reg_phone'))) {
// $this->error('注册电话格式不正确');
// }
if(!empty(I('taxation_rate')) && I('taxation_rate') > 0) {
if(!checkNumber(I('taxation_rate'))){
$this->error('税费费率格式错误');

@ -22,6 +22,7 @@
<script type="text/javascript" src="__STATIC__/datetimepicker/js/locales/bootstrap-datetimepicker.zh-CN.js"charset="UTF-8"></script>
<script src="__STATIC__/juicer-min.js" type="text/javascript"></script>
<script src="__STATIC__/czinputcheck.js?v=07151710" type="text/javascript"></script>
<script type="text/javascript" src="__JS__/uploader.js"></script>
<style>
.coin-detail{
display: block;
@ -358,6 +359,71 @@
</td>
</tr>
<tr>
<td class="l noticeinfo"><i class="mustmark" style="margin-left:-7px">*</i>是否定制推广后台:</td>
<td class="r table_radio">
<span class="form_radio table_btn">
<label>
<input type="radio" class="inp_radio" value="1" name="is_site_custom" >
</label>
<label>
<input type="radio" class="inp_radio" value="0" name="is_site_custom" checked>
</label>
</span>
<span class="notice-text"></span>
</td>
</tr>
<tr class="site-custom-item" style="display: none;">
<td class="l"><i class="mustmark" style="margin-left:-7px">*</i>推广后台域名前缀:</td>
<td class="r" >
<input type="text" class="txt" style="float: none;" name="site_domain_prefix" value="" placeholder="请输入推广后台域名前缀">
<span class="notice-text" style="float: none;">请确保唯一。完整地址: <span id="site-url-show" style="color: red; font-weight: bold;" data-domain="<?=C('DOMAIN', null, null)?>"></span></span>
</td>
</tr>
<tr class="picbox site-custom-item" style="display: none;">
<td class="l noticeinfo" ><i class="mustmark" style="margin-left:-7px">*</i>推广后台ICON</td>
<td class="r">
<span class="table_btn table_upload table_icon" style="float: none;">
<div class="upload-wrapper">
<input type="hidden" id="site-icon" name="site_config[icon]" value="" />
<div class="btns">
<div id="icon-uploader">
<div class="webuploader-pick" style="line-height:13px">上传图标</div>
</div>
</div>
<!--用来存放文件信息-->
<div class="uploader-list" style="display: flex;">
</div>
</div>
</span>
<span class="notice-text">尺寸不得小于512*512px圆角半径113px不强制要求可直接提供512*512方图</span>
</td>
</tr>
<tr class="picbox site-custom-item" style="display: none;">
<td class="l noticeinfo" ><i class="mustmark" style="margin-left:-7px">*</i>推广后台LOGO</td>
<td class="r">
<span class="table_btn table_upload table_icon" style="float: none;">
<div class="upload-wrapper">
<input type="hidden" id="site-logo" name="site_config[logo]" value="" />
<div class="btns">
<div id="logo-uploader">
<div class="webuploader-pick" style="line-height:13px">上传图标</div>
</div>
</div>
<!--用来存放文件信息-->
<div class="uploader-list" style="display: flex;">
</div>
</div>
</span>
<span class="notice-text">尺寸不得小于512*512px圆角半径113px不强制要求可直接提供512*512方图</span>
</td>
</tr>
<tr>
<td class="l noticeinfo">文档管理</td>
<td class="r table_radio">
@ -1202,5 +1268,50 @@
$('#deposit-pay-way').val('')
}
})
var uploadUrl = "{:U('File/uploadPicture', ['session_id'=>session_id(), 'flag'=>true])}"
var iconUploader = new WmUploader({
selector: '#icon-uploader',
url: uploadUrl,
afterSuccess: function(file, response) {
$('#site-icon').val(response.id)
},
afterDelete: function(file) {
$('#site-icon').val('')
}
})
var logoUploader = new WmUploader({
selector: '#logo-uploader',
url: uploadUrl,
afterSuccess: function(file, response) {
$('#site-logo').val(response.id)
},
afterDelete: function(file) {
$('#site-logo').val('')
}
})
$('input[name=is_site_custom]').on({
click: function() {
var isSiteCustom = $('input[name=is_site_custom]:checked').val()
if (isSiteCustom == 1) {
$('.site-custom-item').show()
} else {
$('.site-custom-item').hide()
}
}
})
$('input[name=site_domain_prefix]').on({
blur: function() {
var domain = $('#site-url-show').attr('data-domain');
var prefix = $.trim($(this).val());
if (domain != '' && prefix != '') {
$('#site-url-show').html('https://tg-' + prefix + domain)
} else {
$('#site-url-show').html('无')
}
}
})
</script>
</block>

@ -22,6 +22,7 @@
<script type="text/javascript" src="__STATIC__/datetimepicker/js/locales/bootstrap-datetimepicker.zh-CN.js"charset="UTF-8"></script>
<script src="__STATIC__/juicer-min.js" type="text/javascript"></script>
<script src="__STATIC__/czinputcheck.js?v=1.29" type="text/javascript"></script>
<script type="text/javascript" src="__JS__/uploader.js"></script>
<style>
.coin-detail{
display: block;
@ -359,6 +360,89 @@
<span class="notice-text"></span>
</td>
</tr>
<tr>
<td class="l noticeinfo"><i class="mustmark" style="margin-left:-7px">*</i>是否定制推广后台:</td>
<td class="r table_radio">
<span class="form_radio table_btn">
<label>
<input type="radio" class="inp_radio" value="1" name="is_site_custom" <if condition="$data['is_site_custom'] eq 1">checked</if>> 是
</label>
<label>
<input type="radio" class="inp_radio" value="0" name="is_site_custom" <if condition="$data['is_site_custom'] eq 0">checked</if>> 否
</label>
</span>
<span class="notice-text"></span>
</td>
</tr>
<tr class="site-custom-item" <?php if($data['is_site_custom'] == 0):?>style="display:none"<?php endif;?>>
<td class="l"><i class="mustmark" style="margin-left:-7px">*</i>推广后台域名前缀:</td>
<td class="r" >
<?php
$domain = C('DOMAIN', null, null);
$siteUrl = '无';
if ($domain && !empty($data['site_domain_prefix'])) {
$siteUrl = 'https://tg-' . $data['site_domain_prefix'] . $domain;
}
?>
<input type="text" class="txt" style="float: none;" name="site_domain_prefix" value="{$data.site_domain_prefix}" placeholder="请输入推广后台域名前缀">
<span class="notice-text" style="float: none;">请确保唯一。完整地址: <span id="site-url-show" style="color: red; font-weight: bold;" data-domain="<?=$domain?>"><?=$siteUrl?></span></span>
</td>
</tr>
<tr class="picbox site-custom-item" <?php if($data['is_site_custom'] == 0):?>style="display:none"<?php endif;?>>
<td class="l noticeinfo" ><i class="mustmark" style="margin-left:-7px">*</i>推广后台ICON</td>
<td class="r">
<span class="table_btn table_upload table_icon" style="float: none;">
<div class="upload-wrapper">
<input type="hidden" id="site-icon" name="site_config[icon]" value="<?=$siteConfig ? $siteConfig['icon'] : ''?>" />
<div class="btns">
<div id="icon-uploader">
<div class="webuploader-pick" style="line-height:13px">上传图标</div>
</div>
</div>
<!--用来存放文件信息-->
<div class="uploader-list" style="display: flex;">
<div id="<?=$siteConfig['icon']?>" class="item flooring_page_img_box" style="margin-right: 10px;">
<a href="javascript:;"><img src="<?=get_cover($siteConfig['icon'], 'path')?>" style="width: 100px;height: 100px;cursor: move;"></a>
<h4 class="info" style="text-align: center;">
<a href="javascript:;" class="file-delete table_click" style="float:none;display:inline-block;" data-ref-tag="#site-icon">删除</a>
</h4>
</div>
</div>
</div>
</span>
<span class="notice-text">尺寸不得小于512*512px圆角半径113px不强制要求可直接提供512*512方图</span>
</td>
</tr>
<tr class="picbox site-custom-item" <?php if($data['is_site_custom'] == 0):?>style="display:none"<?php endif;?>>
<td class="l noticeinfo" ><i class="mustmark" style="margin-left:-7px">*</i>推广后台LOGO</td>
<td class="r">
<span class="table_btn table_upload table_icon" style="float: none;">
<div class="upload-wrapper">
<input type="hidden" id="site-logo" name="site_config[logo]" value="<?=$siteConfig ? $siteConfig['logo'] : ''?>" />
<div class="btns">
<div id="logo-uploader">
<div class="webuploader-pick" style="line-height:13px">上传图标</div>
</div>
</div>
<!--用来存放文件信息-->
<div class="uploader-list" style="display: flex;">
<div id="<?=$siteConfig['logo']?>" class="item flooring_page_img_box" style="margin-right: 10px;">
<a href="javascript:;"><img src="<?=get_cover($siteConfig['logo'], 'path')?>" style="width: 100px;height: 100px;cursor: move;"></a>
<h4 class="info" style="text-align: center;">
<a href="javascript:;" class="file-delete table_click" style="float:none;display:inline-block;" data-ref-tag="#site-logo">删除</a>
</h4>
</div>
</div>
</div>
</span>
<span class="notice-text">尺寸不得小于512*512px圆角半径113px不强制要求可直接提供512*512方图</span>
</td>
</tr>
<tr>
<td class="l noticeinfo">文档管理</td>
<td class="r table_radio">
@ -1056,6 +1140,55 @@
if ($('#deposit-pay-type').val() == 3) {
$('.need-amount').hide();
}
// $('#deposit-pay-type').change()
var uploadUrl = "{:U('File/uploadPicture', ['session_id'=>session_id(), 'flag'=>true])}"
var iconUploader = new WmUploader({
selector: '#icon-uploader',
url: uploadUrl,
afterSuccess: function(file, response) {
$('#site-icon').val(response.id)
},
afterDelete: function(file) {
$('#site-icon').val('')
}
})
var logoUploader = new WmUploader({
selector: '#logo-uploader',
url: uploadUrl,
afterSuccess: function(file, response) {
$('#site-logo').val(response.id)
},
afterDelete: function(file) {
$('#site-logo').val('')
}
})
$('input[name=is_site_custom]').on({
click: function() {
var isSiteCustom = $('input[name=is_site_custom]:checked').val()
if (isSiteCustom == 1) {
$('.site-custom-item').show()
} else {
$('.site-custom-item').hide()
}
}
})
$('input[name=site_domain_prefix]').on({
blur: function() {
var domain = $('#site-url-show').attr('data-domain');
var prefix = $.trim($(this).val());
if (domain != '' && prefix != '') {
$('#site-url-show').html('https://tg-' + prefix + domain)
} else {
$('#site-url-show').html('无')
}
}
})
$('.uploader-list').children().children('h4').children('.file-delete').on('click', function() {
var tag = $(this).attr('data-ref-tag');
$(this).parent().parent().remove();
$(tag).val('')
});
</script>
</block>

@ -375,6 +375,66 @@
</td>
</tr>
<tr>
<td class="l noticeinfo"><i class="mustmark" style="margin-left:-7px">*</i>是否定制推广后台:</td>
<td class="r table_radio">
<span class="form_radio table_btn">
<label>
<input type="radio" disabled class="inp_radio" value="1" name="is_site_custom" <if condition="$data['is_site_custom'] eq 1">checked
</if>> 是
</label>
<label>
<input type="radio" disabled class="inp_radio" value="0" name="is_site_custom" <if condition="$data['is_site_custom'] eq 0">checked
</if>> 否
</label>
</span>
<span class="notice-text"></span>
</td>
</tr>
<?php if(isset($data['is_site_custom']) && $data['is_site_custom'] == 1):?>
<?php
$domain = C('DOMAIN', null, null);
$siteUrl = '无';
if ($domain && !empty($data['site_domain_prefix'])) {
$siteUrl = 'https://tg-' . $data['site_domain_prefix'] . $domain;
}
?>
<tr class="site-custom-item" >
<td class="l"><i class="mustmark" style="margin-left:-7px">*</i>推广后台域名前缀:</td>
<td class="r" >
<input type="text" disabled class="txt" style="float: none;" name="site_domain_prefix" value="{$data.site_domain_prefix}" placeholder="请输入推广后台域名前缀">
<span class="notice-text" style="float: none;">完整地址: <span id="site-url-show" style="color: red; font-weight: bold;" data-domain="<?=$domain?>"><?=$siteUrl?></span></span>
</td>
</tr>
<tr class="picbox site-custom-item">
<td class="l noticeinfo" ><i class="mustmark" style="margin-left:-7px">*</i>推广后台ICON</td>
<td class="r">
<span class="table_btn table_upload table_icon" style="float: none;">
<div class="upload-wrapper">
<div class="uploader-list" style="display: flex;">
<a href="javascript:;"><img src="{$siteConfig.icon}" style="width: 100px;height: 100px;cursor: move;"></a>
</div>
</div>
</span>
</td>
</tr>
<tr class="picbox site-custom-item">
<td class="l noticeinfo" ><i class="mustmark" style="margin-left:-7px">*</i>推广后台LOGO</td>
<td class="r">
<span class="table_btn table_upload table_icon" style="float: none;">
<div class="upload-wrapper">
<div class="uploader-list" style="display: flex;">
<a href="javascript:;"><img src="{$siteConfig.logo}" style="width: 100px;height: 100px;cursor: move;"></a>
</div>
</div>
</span>
</td>
</tr>
<?php endif;?>
<tr>
<td class="l noticeinfo">文档管理</td>
<td class="r table_radio">

@ -172,6 +172,8 @@ class PromoteCompanyService
unset($companyInfo['relation']);
unset($companyInfo['promotes']);
$companyInfo['site_config'] = json_encode($companyInfo['site_config']);
$isNewDeposit = false;
if($application['company_id'] == 0){
//新增

@ -1256,4 +1256,39 @@ class PromoteService {
}
return true;
}
public function getPromoteCompanyBySite($url)
{
$domain = C('DOMAIN', null, '');
if ($domain == '') {
return null;
}
if (strpos($url, $domain) === false) {
return null;
}
$url = str_replace('http://', '', $url);
$url = str_replace('https://', '', $url);
$url = str_replace($domain, '', $url);
$domainPrefix = str_replace('tg-', '', $url);
return M('promote_company', 'tab_')->where(['site_domain_prefix' => $domainPrefix])->find();
}
public function getSiteConfig($promoteCompany)
{
$siteConfig = $promoteCompany && $promoteCompany['is_site_custom'] == 1 ? json_decode($promoteCompany['site_config'], true) : null;
if (!$siteConfig) {
$siteConfig = [];
$siteConfig['logo'] = check_logo_is_exist(C('CH_LOGO_BACKSTAGE'), 'logo_default.png');
// $siteConfig['login_logo'] = check_logo_is_exist(C('CH_SET_LOGO'),'logo_default.png');
$siteConfig['icon'] = get_cover(C('CH_SET_ICO'), 'path');
$siteConfig['title'] = seo_replace(C('channel_index.seo_title'),'','channel') . '_' . C('CH_SET_TITLE');
} else {
$siteConfig['logo'] = get_cover($siteConfig['logo'], 'path');
$siteConfig['icon'] = get_cover($siteConfig['icon'], 'path');
$siteConfig['title'] = '推广平台_手机游戏推广联盟_手游推广员赚钱平台';
}
$siteConfig['description'] = '首页 登录 欢迎您回来!';
$siteConfig['keywords'] = C('channel_index.seo_keyword');
return $siteConfig;
}
}

@ -46,10 +46,8 @@ class BaseController extends HomeController
define('G_SETTLEMENT_GRADE', 'sub_status,third_status');
}
if ($loginer['company_id']) {
$company = M('promote_company', 'tab_')->where(['id'=>$loginer['company_id']])->find();
$company = $this->getLoginPromoteCompany();
$this->assign('company', $company);
}
$this->canViewUserRecharge = $this->promoteCan('view-user-recharge');
$this->checkUrlPermission();
@ -264,15 +262,6 @@ class BaseController extends HomeController
return $records;
}
public function getLoginPromote()
{
if ($this->loginPromote == null) {
$promoteId = session('promote_auth.pid');
$this->loginPromote = M('promote', 'tab_')->where(['id' => $promoteId])->find();
}
return $this->loginPromote;
}
//验证安全密码--视图
public function verifyPasswordView($modelList, $show = true)
{

@ -15,6 +15,9 @@ use Base\Tool\MobileDetect;
*/
class HomeController extends Controller
{
protected $loginPromote = null;
protected $loginPromoteCompany = null;
/* 空操作用于输出404页面 */
public function _empty()
{
@ -26,10 +29,38 @@ class HomeController extends Controller
/* 读取站点配置 */
$config = api('Config/lists');
C($config); //添加配置
//var_dump($config);
if (!C('WEB_SITE_CLOSE')) {
$this->error('站点已经关闭,请稍后访问~');
}
$promoteService = new PromoteService();
$siteConfig = null;
$promoteCompany = $this->getLoginPromoteCompany();
if (is_null($promoteCompany)) {
$url = Request::getHost();
$promoteCompany = $promoteService->getPromoteCompanyBySite($url);
}
$siteConfig = $promoteService->getSiteConfig($promoteCompany);
$this->assign('siteConfig', $siteConfig);
}
public function getLoginPromote()
{
if ($this->loginPromote == null) {
$promoteId = session('promote_auth.pid');
$this->loginPromote = M('promote', 'tab_')->where(['id' => $promoteId])->find();
}
return $this->loginPromote;
}
public function getLoginPromoteCompany()
{
$loginer = $this->getLoginPromote();
if ($this->loginPromoteCompany == null && $loginer) {
$this->loginPromoteCompany = M('promote_company', 'tab_')->where(['id'=>$loginer['company_id']])->find();
}
return $this->loginPromoteCompany;
}
public function rule()

@ -7,13 +7,13 @@
<meta name="renderer" content="webkit">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<if condition="ACTION_NAME eq index and CONTROLLER_NAME eq Index">
<title>{:seo_replace(C('channel_index.seo_title'),'','channel')}_{:C('CH_SET_TITLE')}</title>
<meta name="description" content="首页 登录 欢迎您回来!"/>
<title>{$siteConfig['title']}</title>
<meta name="description" content="{$siteConfig['description']}"/>
<meta name="robots" content="noarchive">
<meta property="og:description" content="首页 登录 欢迎您回来!"/>
<meta property="og:title" content="{:seo_replace(C('channel_index.seo_title'),'','channel')}_{:C('CH_SET_TITLE')}"/>
<meta property="og:image" content="{:get_cover(C('CH_SET_ICO'),'path')}"/>
<meta name="keywords" content="{:C('channel_index.seo_keyword')}">
<meta property="og:description" content="{$siteConfig['description']}"/>
<meta property="og:title" content="{$siteConfig['title']}"/>
<meta property="og:image" content="{$siteConfig['icon']}"/>
<meta name="keywords" content="{$siteConfig['keywords']}">
<elseif condition="ACTION_NAME eq game_list and CONTROLLER_NAME eq Article"/>
<title>{:seo_replace(C('channel_game_list.seo_title'),'','channel')}</title>
<meta name="keywords" content="{:C('channel_game_list.seo_keyword')}">
@ -31,7 +31,7 @@
<meta name="keywords" content="{:C('channel_news_detail.seo_keyword')}">
<meta name="description" content="{:C('channel_news_detail.seo_description')}">
</if>
<link href="{:get_cover(C('CH_SET_ICO'),'path')}" type="image/x-icon" rel="shortcut icon">
<link href="{$siteConfig['icon']}" type="image/x-icon" rel="shortcut icon">
<link href="__CSS__/20170913/common.css" rel="stylesheet">
<script src="__JS__/jquery-1.11.1.min.js"></script>
@ -54,7 +54,7 @@
<else/>
<a href="{:U('index/index')}">
<span class="placeholder-graphic placeholder-graphic_logo" style="background:transparent;">
<img src="{:check_logo_is_exist(C('CH_SET_LOGO'),'logo_default.png')}" alt="logo">
<img src="{$siteConfig['logo']}" alt="logo">
</span>
</a>
</if>

@ -8,7 +8,7 @@
<link href="__CSS__/20170831/select2.min.css" rel="stylesheet" type="text/css" />
<!--<link href="__CSS__/20170831/common.css" rel="stylesheet" type="text/css">-->
<link href="__CSS__/20180207/common.css" rel="stylesheet" type="text/css">
<link href="{:get_cover(C('CH_SET_ICO'),'path')}" type="image/x-icon" rel="shortcut icon">
<link href="{$siteConfig['icon']}" type="image/x-icon" rel="shortcut icon">
<script type="text/javascript" src="__JS__/jquery-1.11.1.min.js"></script>
<!--[if lt IE 9]>
@ -33,7 +33,7 @@
<!--左侧导航栏 开始-->
<div class="nav_new fl">
<div class="logo_picture">
<img src="{:check_logo_is_exist(C('CH_LOGO_BACKSTAGE'),'logo_default.png')}" style="height:40px;margin:0px;">
<img src="{$siteConfig['logo']}" style="height:40px;margin:0px;">
</div>
<div class="subNavBox">
<a href="{:U('Promote/index')}" class="subNav <if condition='CONTROLLER_NAME eq Promote and ACTION_NAME eq index '>active</if>"> 后台首页 </a>

@ -2714,3 +2714,10 @@ ALTER TABLE `tab_testing_user`
ADD COLUMN `verify_time` int(11) NOT NULL DEFAULT 0 COMMENT '审核时间' AFTER `verify_status`;
ALTER TABLE `tab_testing_resource_batch`
ADD COLUMN `auto_verify` tinyint(1) NOT NULL DEFAULT 0 COMMENT '是否需要审核' AFTER `verify_status`;
ALTER TABLE `tab_promote_company`
ADD COLUMN `is_site_custom` tinyint(1) NOT NULL DEFAULT 0 COMMENT '是否定制推广后台' AFTER `is_inside`;
ALTER TABLE `tab_promote_company`
ADD COLUMN `site_domain_prefix` varchar(20) NOT NULL DEFAULT '' COMMENT '推广后台域名前缀' AFTER `is_site_custom`;
ALTER TABLE `tab_promote_company`
ADD COLUMN `site_config` varchar(255) NOT NULL DEFAULT '' COMMENT '推广后台网站配置' AFTER `is_site_custom`;

@ -0,0 +1,127 @@
function WmUploader(options) {
this.randomNum = function(min, max){
var range = max - min;
var rand = Math.random();
var num = min + Math.round(rand * range);
return num;
}
// fileType: img file
this.fileType = options.fileType == undefined ? 'img' : options.fileType
this.uploadKey = options.uniqueCode == undefined ? this.randomNum(10000, 99999) : options.uniqueCode
this.uploadSelector = options.selector
this.uploadUrl = options.url
this.uploadWrapper = $(this.uploadSelector).parents('.upload-wrapper').eq(0);
this.uploadList = this.uploadWrapper.find('.uploader-list');
this.afterSuccess = options.afterSuccess
this.afterDelete = options.afterDelete
var that = this
this.getFileId = function(file) {
return file.id + '-' + that.uploadKey
}
this.getFileTag = function(file) {
return $('#' + that.getFileId(file))
}
this.uploader = WebUploader.create({
auto: true,
swf: '/Public/static/webuploader/Uploader.swf',
server: that.uploadUrl,
pick: {
id: that.uploadSelector,
multiple: false
},
accept: {
title: '图片',
extensions: 'png,gif,jpg,jpeg,bmp',
mimeTypes: '.png,.gif,.jpg,.jpeg,.bmp',
},
resize: false,
disableGlobalDnd: true,
fileNumLimit: 1,
threads: 5,
thumb: true,
compress: false,
prepareNextFile: true,
formData: function(){ return $.extend(true, {}, {}); },
chunked: false,
duplicate: true
});
this.uploader.on('fileQueued', function(file) {
if (that.fileType == 'img') {
var html = '';
html += '<div id="' + that.getFileId(file) + '" class="item" style="margin-right: 10px;">';
html += '<a href="javascript:;"><img src="" style="width: 100px;height: 100px;cursor: move;"></a>';
html += '<h4 class="info">' + file.name + '</h4>';
html += '<p class="state">等待上传...</p>';
html += '</div>';
that.uploadList.append(html);
that.uploadList.css('margin-top','10px');
var imgNode = that.uploadList.children(that.getFileTag(file)).find('img');
that.uploader.makeThumb(file, function (error, src) {
if (error) {
return;
}
imgNode.attr('src', src);
}, 300, 300);
} else {
that.uploadList.append(
'<div id="' + that.getFileId(file) + '" class="item">' +
'<h4 class="info">' + file.name + '</h4>' +
'<p class="state">等待上传...</p>' +
'</div>'
);
}
});
this.uploader.on('uploadProgress', function(file, percentage) {
var $li = that.getFileTag(file),
$percent = $li.find('.progress .progress-bar');
// 避免重复创建
if ( !$percent.length ) {
$percent = $('<div class="progress progress-striped active">' +
'<div class="progress-bar" role="progressbar" style="width: 0%">' +
'</div>' +
'</div>').appendTo( $li ).find('.progress-bar');
}
$li.find('p.state').text('上传中');
$percent.css('width', percentage * 100 + '%');
$percent.text((percentage * 100).toFixed(0) + '%');
});
this.uploader.on('uploadSuccess', function(file, response) {
var fileTag = that.getFileTag(file)
fileTag.find('p.state').text('已上传').fadeOut(800);
fileTag.find('h4.info').append('<a href="javascript:;" class="file-delete table_click" style="float:none;display:inline-block;margin-left:10px;">删除</a>');
fileTag.find('.file-delete').on('click', function() {
$('#file_url').val('');
that.uploader.removeFile(file.id);
fileTag.remove();
if (that.afterDelete != undefined) {
that.afterDelete(file)
}
return false;
});
if(!response.chunk) {
var url = response.path + '/' + response.name;
$('#file_url').val(url);
}
if (that.afterSuccess != undefined) {
that.afterSuccess(file, response)
}
});
this.uploader.on('uploadError', function(file) {
that.getFileTag(file).find('p.state').text('上传出错');
});
this.uploader.on('uploadComplete', function(file) {
that.getFileTag(file).find('.progress').fadeOut();
});
}
Loading…
Cancel
Save