【 ps:以下是最新V1.7.0版本更新方法】
大家好,由于目前程序默認(rèn)只有圖集和文章模型在會(huì)員中心發(fā)表,版友問(wèn),如何在會(huì)員中心投稿里面要發(fā)表下載或者產(chǎn)品甚至視頻/專輯模型的文章,該如何增加,我在閑暇時(shí)給大家簡(jiǎn)單的一個(gè)修改方案,此方案就可以自行掌握修改,大家可以試試效果哦,如果有什么問(wèn)題可以留言告知。
方法如下:
新增配置文件:
web3.htm(自己創(chuàng)建) 路徑:\application\admin\template\system
代碼內(nèi)如如下:
{include file="public/layout" /}
<link href="__PUBLIC__/plugins/colpick/css/colpick.css" rel="stylesheet" type="text/css"/>
<body class="bodystyle" style="overflow-y: scroll; cursor: default; -moz-user-select: inherit;">
<div id="append_parent"></div>
<div id="ajaxwaitid"></div>
<div class="page">
{include file="system/bar" /}
<div class="flexigrid">
<form method="post" id="handlepost" action="{:U('System/web3')}" enctype="multipart/form-data" name="form1" class="form-horizontal">
<div class="ncap-form-default">
<div class="hDiv htitx">
<div class="hDivBox">
<table cellspacing="0" cellpadding="0" style="width: 100%">
<thead>
<tr>
<th class="sign w10" axis="col0">
<div class="tc"></div>
</th>
{if condition="$php_servicemeal > 1"}
{eq name='$main_lang' value='$admin_lang'}
{eq name="$Think.const.CONTROLLER_NAME.'@web3'|is_check_access" value="1"} <dl class="row">
<dt class="tit">
<label>投稿模型控制</label>
</dt>
<dd class="opt" style="line-height: 26px;">
<label class="curpoin">
<a href='{:url("Member/users_config")}'><span>選擇欄目</span></a>
</label><p class="notic">控制前端允許發(fā)布的模型欄目</p>
</dd>
</dl>{/eq}{/eq}
<th abbr="ac_id" axis="col4">
<div class=""></div>
</th>
</tr>
</thead>
</table>
</div>
</div>
<dl class="row">
<dt class="tit">
<label for="web_usertougao">文章模型</label>
</dt>
<dd class="opt">
<div class="onoff">
<label for="web_usertougao1" class="cb-enable {if condition='isset($config.web_usertougao) AND $config.web_usertougao eq 1'}selected{/if}">開(kāi)啟</label>
<label for="web_usertougao0" class="cb-disable {if condition='!isset($config.web_usertougao) OR empty($config.web_usertougao)'}selected{/if}">關(guān)閉</label>
<input id="web_usertougao0" name="web_usertougao" value="0" type="radio" {if condition="!isset($config.web_usertougao) OR empty($config.web_usertougao)"} checked="checked"{/if}>
<input id="web_usertougao1" name="web_usertougao" value="1" type="radio" {if condition="isset($config.web_usertougao) AND $config.web_usertougao eq 1"} checked="checked"{/if}>
<input type="hidden" id="old_web_usertougao" value="{$config.web_usertougao|default='0'}">
</div>
<p class="notic">設(shè)置文章模型欄目開(kāi)關(guān)</p>
<br/>
<p class="notic2"> </p>
</dd>
</dl>
<dl class="row">
<dt class="tit">
<label for="web_usertougaob">圖集模型</label>
</dt>
<dd class="opt">
<div class="onoff">
<label for="web_usertougaob3" class="cb-enable {if condition='isset($config.web_usertougaob) AND $config.web_usertougaob eq 3'}selected{/if}">開(kāi)啟</label>
<label for="web_usertougaob0" class="cb-disable {if condition='!isset($config.web_usertougaob) OR empty($config.web_usertougaob)'}selected{/if}">關(guān)閉</label>
<input id="web_usertougaob0" name="web_usertougaob" value="0" type="radio" {if condition="!isset($config.web_usertougaob) OR empty($config.web_usertougaob)"} checked="checked"{/if}>
<input id="web_usertougaob3" name="web_usertougaob" value="3" type="radio" {if condition="isset($config.web_usertougaob) AND $config.web_usertougaob eq 3"} checked="checked"{/if}>
<input type="hidden" id="old_web_usertougaob" value="{$config.web_usertougaob|default='0'}">
</div>
<p class="notic">設(shè)置圖集模型欄目開(kāi)關(guān)</p>
<br/>
<p class="notic2"> </p>
</dd>
</dl>
<dl class="row">
<dt class="tit">
<label for="web_usertougaoc">產(chǎn)品模型</label>
</dt>
<dd class="opt">
<div class="onoff">
<label for="web_usertougaoc2" class="cb-enable {if condition='isset($config.web_usertougaoc) AND $config.web_usertougaoc eq 2'}selected{/if}">開(kāi)啟</label>
<label for="web_usertougaoc0" class="cb-disable {if condition='!isset($config.web_usertougaoc) OR empty($config.web_usertougaoc)'}selected{/if}">關(guān)閉</label>
<input id="web_usertougaoc0" name="web_usertougaoc" value="0" type="radio" {if condition="!isset($config.web_usertougaoc) OR empty($config.web_usertougaoc)"} checked="checked"{/if}>
<input id="web_usertougaoc2" name="web_usertougaoc" value="2" type="radio" {if condition="isset($config.web_usertougaoc) AND $config.web_usertougaoc eq 2"} checked="checked"{/if}>
<input type="hidden" id="old_web_usertougaoc" value="{$config.web_usertougaoc|default='0'}">
</div>
<p class="notic">設(shè)置產(chǎn)品模型欄目開(kāi)關(guān)</p>
<br/>
<p class="notic2"> </p>
</dd>
</dl>
<dl class="row">
<dt class="tit">
<label for="web_usertougaod">下載模型</label>
</dt>
<dd class="opt">
<div class="onoff">
<label for="web_usertougaod4" class="cb-enable {if condition='isset($config.web_usertougaod) AND $config.web_usertougaod eq 4'}selected{/if}">開(kāi)啟</label>
<label for="web_usertougaod0" class="cb-disable {if condition='!isset($config.web_usertougaod) OR empty($config.web_usertougaod)'}selected{/if}">關(guān)閉</label>
<input id="web_usertougaod0" name="web_usertougaod" value="0" type="radio" {if condition="!isset($config.web_usertougaod) OR empty($config.web_usertougaod)"} checked="checked"{/if}>
<input id="web_usertougaod4" name="web_usertougaod" value="4" type="radio" {if condition="isset($config.web_usertougaod) AND $config.web_usertougaod eq 4"} checked="checked"{/if}>
<input type="hidden" id="old_web_usertougaod" value="{$config.web_usertougaod|default='0'}">
</div>
<p class="notic">設(shè)置下載模型欄目開(kāi)關(guān)</p>
<br/>
<p class="notic2"> </p>
</dd>
</dl>
<dl class="row">
<dt class="tit">
<label for="web_usertougaof">視頻模型</label>
</dt>
<dd class="opt">
<div class="onoff">
<label for="web_usertougaof5" class="cb-enable {if condition='isset($config.web_usertougaof) AND $config.web_usertougaof eq 5'}selected{/if}">開(kāi)啟</label>
<label for="web_usertougaof0" class="cb-disable {if condition='!isset($config.web_usertougaof) OR empty($config.web_usertougaof)'}selected{/if}">關(guān)閉</label>
<input id="web_usertougaof0" name="web_usertougaof" value="0" type="radio" {if condition="!isset($config.web_usertougaof) OR empty($config.web_usertougaof)"} checked="checked"{/if}>
<input id="web_usertougaof5" name="web_usertougaof" value="5" type="radio" {if condition="isset($config.web_usertougaof) AND $config.web_usertougaof eq 5"} checked="checked"{/if}>
<input type="hidden" id="old_web_usertougaof" value="{$config.web_usertougaof|default='0'}">
</div>
<p class="notic">設(shè)置視頻模型欄目開(kāi)關(guān)</p>
<br/>
<p class="notic2"> </p>
</dd>
</dl>
{/if}
<div class="bot">
<a href="JavaScript:void(0);" class="ncap-btn-big ncap-btn-green" on-click="adsubmit();">確認(rèn)提交</a>
</div>
</div>
</form>
<input type="hidden" id="show_web_adminlogo" value="{$config.web_adminlogo|default=''}">
<input type="hidden" id="show_uiset" value="{$show_uiset|default=''}">
<script type="text/javascript">
function adsubmit(){
// 留言外鏈與默認(rèn)切換
var web_goods_mode_obj = $('input[name=web_goods_mode]');
if ($('input[name=web_goods_mode]:checked').val() == 1) {
if (web_goods_mode_obj.val() == "{$subDomain|default='www'}") {
showErrorMsg('外鏈地址必須全部輸入');
web_goods_mode_obj.focus();
return false;
}
}
// 會(huì)員外鏈與默認(rèn)切換
var web_usertz_mode_obj = $('input[name=web_usertz_mode]');
if ($('input[name=web_usertz_mode]:checked').val() == 1) {
if (web_usertz_mode_obj.val() == "{$subDomain|default='www'}") {
showErrorMsg('外鏈地址必須全部輸入');
web_usertz_mode_obj.focus();
return false;
}
}
// 后臺(tái)登錄超時(shí)
var web_login_expiretime_obj = $('input[name=web_login_expiretime]');
if (web_login_expiretime_obj.val() < 60) {
showErrorMsg('后臺(tái)登錄超時(shí)不能少于60秒!');
web_login_expiretime_obj.focus();
return false;
}
var adminbasefileObj = $('textarea[name=web_goods]');
var adminbasefile_oldObj = $('textarea[name=web_goods]');
if(adminbasefile_oldObj.val() != adminbasefileObj.val()){
var flag = false;
var site_url = adminbasefileObj.data('site_url');
layer.confirm('后臺(tái)路徑:<font color="red">'+site_url+'__ROOT_DIR__/'+adminbasefileObj.val()+'.php</font>,確認(rèn)更改?', {
title: false,
btn: ['繼續(xù)更改','取消'] //按鈕
}, function(){
layer_loading('正在處理');
$('#handlepost').submit();
}, function(index){
flag = false;
}
);
return flag;
}
layer_loading('正在處理');
$('#handlepost').submit();
}
</script>
{include file="public/footer" /}
打開(kāi):\application\admin\template\system目錄
找到bar.htm
在</ul>前面增加以下代碼:
{if condition="$php_servicemeal > 1"}
{eq name='$main_lang' value='$admin_lang'}
{eq name="$Think.const.CONTROLLER_NAME.'@web3'|is_check_access" value="1"}
<li><a href="{:url('System/web3')}" {if condition="'we3'==$Think.const.ACTION_NAME"}class="current"{/if}><span>其他設(shè)置</span></a></li>
{/eq}
{/eq} {/if}
打開(kāi):\application\admin\controller目錄
打開(kāi)System.php文件:
在最底下的最后一個(gè) } 符號(hào)前面新增以下代碼:
public function web3()
{
$this->language_access(); // 多語(yǔ)言功能操作權(quán)限
$inc_type = 'web';
if (IS_POST) {
$param = input('post.');
/*多語(yǔ)言*/
if (is_language()) {
$langRow = \think\Db::name('language')->order('id asc')
->cache(true, EYOUCMS_CACHE_TIME, 'language')
->select();
foreach ($langRow as $key => $val) {
tpCache($inc_type,$param,$val['mark']);
write_global_params($val['mark']); // 寫入全局內(nèi)置參數(shù)
}
} else {
tpCache($inc_type,$param);
write_global_params($this->admin_lang); // 寫入全局內(nèi)置參數(shù)
}
/*--end*/
/*更改session會(huì)員設(shè)置 - session有效期(后臺(tái)登錄超時(shí))*/
$session_conf = [];
$session_file = APP_PATH.'admin/conf/session_conf.php';
if (file_exists($session_file)) {
require_once($session_file);
$session_conf_tmp = EY_SESSION_CONF;
if (!empty($session_conf_tmp)) {
$session_conf_tmp = json_decode($session_conf_tmp, true);
if (!empty($session_conf_tmp) && is_array($session_conf_tmp)) {
$session_conf = $session_conf_tmp;
}
}
}
$session_conf['expire'] = $param['web_login_expiretime'];
$str_session_conf = '<?php'.PHP_EOL.'$session_1600593464 = json_encode('.var_export($session_conf,true).');'.PHP_EOL.'define(\'EY_SESSION_CONF\', $session_1600593464);';
@file_put_contents(APP_PATH . 'admin/conf/session_conf.php', $str_session_conf);
/*--end*/
$refresh = false;
$gourl = request()->domain().$this->root_dir.'/'.$adminbasefile; // 支持子目錄
/*--end*/
$this->success('操作成功', url('System/web3'));
}
$config = tpCache($inc_type);
$show_uiset = '';
$web_tpl_theme = !empty($config['web_tpl_theme']) ? $config['web_tpl_theme'].DS : '';
if (file_exists(ROOT_PATH.'template'.DS.$web_tpl_theme.'pc'.DS.'uiset.txt') && file_exists(ROOT_PATH.'template'.DS.$web_tpl_theme.'mobile'.DS.'uiset.txt')) {
$show_uiset = 'pc+mobile';
} else if (file_exists(ROOT_PATH.'template'.DS.$web_tpl_theme.'pc'.DS.'uiset.txt')) {
$show_uiset = 'pc';
} else if (file_exists(ROOT_PATH.'template'.DS.$web_tpl_theme.'mobile'.DS.'uiset.txt')) {
$show_uiset = 'mobile';
}
$this->assign('show_uiset', $show_uiset);
/*end*/
$this->assign('config',$config);//當(dāng)前配置項(xiàng)
$assign_data['weapp_plugin_open'] = tpCache('php.php_weapp_plugin_open');
$assign_data['php_weapp_plugin_open'] = $php_weapp_plugin_open;
$this->assign($assign_data);
return $this->fetch();
}
再次打開(kāi):\application\admin\template\member目錄
打開(kāi):users_config.htm文件
找到:(247行左右)
<dl class="row">
<dt class="tit">
<label>投稿次數(shù)限制</label>
</dt>
<dd class="opt">
<label class="curpoin">
<input name="users[is_open_posts_count]" value="1" type="radio" {if condition="isset($usersConfig.is_open_posts_count) && $usersConfig.is_open_posts_count == 1"} checked="checked"{/if}>開(kāi)啟
</label>
<label class="curpoin">
<input name="users[is_open_posts_count]" value="0" type="radio" {if condition="!isset($usersConfig.is_open_posts_count) || empty($usersConfig.is_open_posts_count)"} checked="checked" {/if}>關(guān)閉
</label>
<a {if condition='!isset($usersConfig.is_open_posts_count) || empty($usersConfig.is_open_posts_count)'}style="display: none;"{/if} id='UpUsersLevelBout' href="javascript:void(0);" on-click="UpUsersLevelBout();" class="ml10 ncap-btn ncap-btn-green">設(shè)置次數(shù)</a>
<p class="notic">開(kāi)啟后可設(shè)置會(huì)員每日的投搞數(shù)量</p>
</dd>
</dl>
在下面新增以下代碼:
{eq name='$main_lang' value='$admin_lang'}
{eq name="$Think.const.CONTROLLER_NAME.'@web3'|is_check_access" value="1"} <dl class="row">
<dt class="tit">
<label>投稿模型開(kāi)關(guān)</label>
</dt>
<dd class="opt" style="line-height: 26px;">
<label class="curpoin">
<a href="{:url('System/web3')}"><span>配置</span></a>
</label><p class="notic">控制前端允許發(fā)布的模型欄目</p>
</dd>
</dl>{/eq}
{/eq}
保存!
打開(kāi)目錄:/application/admin/controller目錄
Member.php文件
找到:大概在980行左右
找到:
// 左側(cè)菜單
$this->assign('usersTplVersion', getUsersTplVersion());
在下面添加:
$web_usertougao = tpCache('web.web_usertougao');
$web_usertougaob = tpCache('web.web_usertougaob');
$web_usertougaoc = tpCache('web.web_usertougaoc');
$web_usertougaod = tpCache('web.web_usertougaod');
$web_usertougaof = tpCache('web.web_usertougaof');
然后繼續(xù)
在下一行
找到
/*允許發(fā)布文檔列表的欄目*/
$current_channel = [1,3,4,5]; // 允許投稿的模型
修改為:
/*允許發(fā)布文檔列表的欄目*/
$current_channel = [$web_usertougao,$web_usertougaod,$web_usertougaob,$web_usertougaoc, $web.web_usertougaof]; // 允許投稿的模型
修改后保存。
最后打開(kāi):\application\user\controller
UsersRelease.php 文件:
大概在172行左右
找到:
public function release_select()
{
下面增加:
$web_usertougao = tpCache('web.web_usertougao');
$web_usertougaob = tpCache('web.web_usertougaob');
$web_usertougaoc = tpCache('web.web_usertougaoc');
$web_usertougaod = tpCache('web.web_usertougaod');
$web_usertougaof = tpCache('web.web_usertougaof');
下面2行找到:
$ids = [1,3,4,5];
修改為:
$ids = [$web_usertougao,$web_usertougaod,$web_usertougaob,$web_usertougaoc,web_usertougaof];
最后保存
完畢
說(shuō)明,修改或者增加模型以上數(shù)字需都要修改,必須統(tǒng)一,模型 ID請(qǐng)到高級(jí)設(shè)置-頻道管理-模型列表查看
最后打開(kāi)/data/runtime目錄(緩存文件)
里面的所有目錄 全部刪除干凈。
再打開(kāi):/data/目錄里面的 類似/session_12Xi28Zr 全部刪除(不用擔(dān)心這個(gè)目錄刪了 還會(huì)自動(dòng)生成,只是后臺(tái)緩存文件)
后臺(tái)緩存如果無(wú)效請(qǐng)手動(dòng)刪除上面的步驟,然后搞定。
修改或者新增模型后請(qǐng)重新到后臺(tái)
投稿配置里 重新設(shè)置欄目允許前臺(tái)投稿使用。
最后說(shuō)明,有可能新的模型在會(huì)員中心有新的屬性或者自定義標(biāo)簽,需要CSS的 則自己修改?。⊥戤?/p>
效果圖:
后臺(tái):







