Skip to content

Commit

Permalink
广告
Browse files Browse the repository at this point in the history
  • Loading branch information
杰少Pakey committed Oct 10, 2014
1 parent f16ac67 commit 3853568
Show file tree
Hide file tree
Showing 8 changed files with 168 additions and 38 deletions.
34 changes: 16 additions & 18 deletions application/ad/controller/manage.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,16 +16,16 @@ public function addAction() {
if (!$param['name']){
$this->error('请输入链接名称');
}
$param['url']=I('url','url','');
if (!$param['url']){
$param['key']=I('key','en','');
if (!$param['key']){
$this->error('请输入链接地址');
}
$param['logo']=I('logo','str','');
$param['description']=I('description','str','');
$param['color']=I('color','str','');
$param['ordernum']=I('ordernum','int',50);
$param['status']=I('status','int',50);
$param['isblod']=I('isblod','int',50);
$param['width']=I('width','int',0);
$param['height']=I('height','int',0);
$param['code']=I('code','str','');
$param['intro']=I('intro','str','');
$param['status']=I('status','int',1);
$param['type']=I('isblod','int',1);
$param['create_user_id']=$_SESSION['admin']['userid'];
$param['create_time']=NOW_TIME;
if($this->model->add($param)){
Expand All @@ -45,16 +45,14 @@ public function editAction() {
if (!$param['name']){
$this->error('请输入链接名称');
}
$param['url']=I('url','url','');
if (!$param['url']){
$this->error('请输入链接地址');
}
$param['logo']=I('logo','str','');
$param['description']=I('description','str','');
$param['color']=I('color','str','');
$param['ordernum']=I('ordernum','int',50);
$param['status']=I('status','int',50);
$param['isblod']=I('isblod','int',50);
$param['width']=I('width','int',0);
$param['height']=I('height','int',0);
$param['code']=I('code','str','');
$param['intro']=I('intro','str','');
$param['status']=I('status','int',1);
$param['type']=I('isblod','int',1);
$param['update_user_id']=$_SESSION['admin']['userid'];
$param['update_time']=NOW_TIME;
$param['id']=$id;
if ($this->model->edit($param)){
$this->success('修改成功',U('index'));
Expand Down
8 changes: 4 additions & 4 deletions application/ad/view/manage_add.html
Original file line number Diff line number Diff line change
Expand Up @@ -24,13 +24,13 @@ <h4 class = "pt-msg-title"><b class = "f-fl">添加广告</b></h4>
<div class = "pt-set-info">
<div class = "line">
<b>广告宽:</b>
<label><input name = "width" type = "text" value = "0" class = "input-text w450"/></label>
<label><input name = "width" type = "text" value = "" class = "input-text w450"/></label>
</div>
</div>
<div class = "pt-set-info">
<div class = "line">
<b>广告高:</b>
<label><input name = "height" type = "text" value = "0" class = "input-text w450" /></label>
<label><input name = "height" type = "text" value = "" class = "input-text w450" /></label>
</div>
</div>
<div class = "pt-set-info">
Expand All @@ -42,10 +42,10 @@ <h4 class = "pt-msg-title"><b class = "f-fl">添加广告</b></h4>
<div class = "pt-set-info">
<div class = "line"><b>广告类型:</b>
<label>
<input name = "isbold" type = "radio" value = "1" checked/>html代码&nbsp;&nbsp;&nbsp;&nbsp;
<input name = "type" type = "radio" value = "1" checked/>html代码&nbsp;&nbsp;&nbsp;&nbsp;
</label>
<label>
<input name = "isbold" type = "radio" value = "2" />js代码&nbsp;&nbsp;&nbsp;&nbsp;
<input name = "type" type = "radio" value = "2" />js代码&nbsp;&nbsp;&nbsp;&nbsp;
</label>
</div>
</div>
Expand Down
83 changes: 83 additions & 0 deletions application/ad/view/manage_edit.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
<div class = "pt-set-wrap">
<h4 class = "pt-msg-title"><b class = "f-fl">修改广告</b></h4>
<div class = "pt-set-box">
<form action = "__SELF__" method = "post" enctype = "multipart/form-data" class = "vform">
<div class = "pt-set-content">
<div class = "pt-set-info">
<div class = "line">
<b>广告名称:</b>
<label><input name = "name" type = "text" value = "{$info.name}" class = "input-text w450" datatype = "*" /></label>
</div>
</div>
<div class = "pt-set-info">
<div class = "line">
<b>广告标识:</b>
<label><input type = "text" value = "{$info.key}" class = "input-text w450" readonly disabled/></label>
</div>
</div>
<div class = "pt-set-info">
<div class = "line">
<b>广告代码:</b>
<label><textarea name = "code" class="input-box w450" style="height:150px">{$info.code}</textarea></label>
</div>
</div>
<div class = "pt-set-info">
<div class = "line">
<b>广告宽:</b>
<label><input name = "width" type = "text" value = "{$info.width}" class = "input-text w450"/></label>
</div>
</div>
<div class = "pt-set-info">
<div class = "line">
<b>广告高:</b>
<label><input name = "height" type = "text" value = "{$info.height}" class = "input-text w450" /></label>
</div>
</div>
<div class = "pt-set-info">
<div class = "line">
<b>广告描述:</b>
<label><textarea name = "intro" class="input-box w450">{$info.intro}</textarea></label>
</div>
</div>
<div class = "pt-set-info">
<div class = "line"><b>广告类型:</b>
<label>
<input name = "type" type = "radio" value = "1" checked/>html代码&nbsp;&nbsp;&nbsp;&nbsp;
</label>
<label>
<input name = "type" type = "radio" value = "2" />js代码&nbsp;&nbsp;&nbsp;&nbsp;
</label>
</div>
</div>

<div class = "pt-set-info">
<div class = "line"><b>广告状态:</b>
<label>
<input name = "status" type = "radio" value = "1" checked />正常&nbsp;&nbsp;&nbsp;&nbsp;
</label>
<label>
<input name = "status" type = "radio" value = '0' />禁用&nbsp;&nbsp;&nbsp;&nbsp;
</label>
</div>
</div>
</div>
<div class = "pt-tab-button">
<div class = "pt-set-info">
<div class = "line">
<b></b>
<input type = "hidden" name = "id" value="{$info.id}"/>
<input class = "btn btn-success" type = "submit" value = " 修改广告 " />&nbsp;&nbsp;&nbsp;
</div>
</div>
</div>
</form>
</div>
</div>
<script type = "text/javascript" src = "__PUBLIC__/plugin/validator/jquery.validator.js"></script>
<script type = "text/javascript" src = "__PUBLIC__/plugin/datepicker/WdatePicker.js"></script>
<script type = "text/javascript">
$(function(){
$('input[name=type][value={$info.type}]').attr('checked','checked');
$('input[name=status][value={$info.status}]').attr('checked','checked');
});
</script>
64 changes: 54 additions & 10 deletions application/ad/view/manage_index.html
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,9 @@ <h4 class = "pt-msg-title"><b class = "f-fl">{$menuinfo.menu.name}</b></h4>
<div class = "pt-list-header">
<div class = "pt-list-operate f-fl">
<a class = "btn btn-success btn-sm" href = '__URL__/add'>添加</a>
<input type = "submit" class = "btn btn-primary btn-sm" value = "排序" name = "reorder">
</div>
<div class = "f-fr">
<input ng-model = 'keyword' class = "input-text w160" type = "text" onkeypress="if(event.keyCode==13) {return false;}"/>
<input ng-model = 'keyword' class = "input-text w160" type = "text" onkeypress = "if(event.keyCode==13) {return false;}" />
<input type = "button" class = "btn btn-default btn-sm" value = "搜索" />
</div>
<div class = "f-clear"></div>
Expand All @@ -24,16 +23,14 @@ <h4 class = "pt-msg-title"><b class = "f-fl">{$menuinfo.menu.name}</b></h4>
<th class = "w-word5">修改人</th>
<th class = "w-time">修改时间</th>
<th class = "w-word3">状态</th>
<th class = "operate w-operate2">操作</th>
<th class = "operate w-operate4">操作</th>
</tr>
</thead>
<tbody>
<tr ng-repeat = "loop in lists | filter:keyword">
<td class = "f-tal"><a ng-href="{{loop.url}}" title="{{loop.description}}" ng-bind-html="loop.showname | to_trusted"></a></td>
<td class = "f-tal">{{loop.url}}</td>
<td>
<input type = "text" name = "ordernum[{{loop.id}}]" value = " {{loop.ordernum}}" class = "input-text f-tac" style = "width:40px;" />
</td>
<td class = "f-tal">{{loop.name}}({{loop.key}})</td>
<td>{{loop.width}}</td>
<td>{{loop.height}}</td>
<td>{{loop.create_username}}</td>
<td>{{loop.create_time}}</td>
<td>{{loop.update_username}}</td>
Expand All @@ -43,6 +40,8 @@ <h4 class = "pt-msg-title"><b class = "f-fl">{$menuinfo.menu.name}</b></h4>
<span class = "label label-success" ng-if = "loop.status==1" ng-click = "changestatus($index,0)">正常</span>
</td>
<td class = "operate">
<a ng-href = "{{loop.url_show}}"><i class = "icon icon-search"></i>预览</a>
<a href = "javascript:;" data-key = "{{loop.key}}" class = "adcode"><i class = "icon icon-send"></i>调用</a>
<a ng-href = "{{loop.url_edit}}"><i class = "icon icon-edit"></i>编辑</a>
<a href = "javascript:;" ng-click = "del(loop.id,$index)"><i class = "icon icon-trash"></i>删除</a>
</td>
Expand All @@ -52,11 +51,56 @@ <h4 class = "pt-msg-title"><b class = "f-fl">{$menuinfo.menu.name}</b></h4>
<div class = "pt-list-footer">
<div class = "pt-list-operate f-fl">
<a class = "btn btn-success btn-sm" href = '__URL__/add'>添加</a>
<input type = "submit" class = "btn btn-primary btn-sm" value = "排序" name = "reorder">
</div>
<div class = "f-clear"></div>
</div>
</form>
</div>
</div>
{include file="/application/admin/view/public_angular.html"}
<div class = "pt-pop f-dn" id = "showbox">
<div class = "pt-set-content">
<div class = "pt-set-info">
<div class = "line"><b>调用代码:</b>
<input name = "tplcode" type = "text" value = "" class = "input-text" style = "width:300px" />
</div>
</div>
<div class = "pt-set-info">
<div class = "line">
<b></b>
<span class = "btn btn-primary" id = "copybtn">复制代码</span>
</div>
</div>
</div>
</div>
{include file="/application/admin/view/public_angular.html"}
<script type = "text/javascript" src = "__PUBLIC__/plugin/zclip/zclip.min.js"></script>
<script type = "text/javascript">
function openwin(id) {
openwindow = window.open("{link='ad.index.show' id=''}" + id, "newwin", "height=450, width=1024,toolbar=no,scrollbars=" + scroll + ",menubar=no");
}
function getcode(key) {
tplcode = '{$pt.getad.' + key + '}'
$('input[name=tplcode]').val(tplcode);
}
var copyfn = function () {
if (isbind == 0) {
isbind = 1;
$('#copybtn').zclip({
'path': '__PUBLIC__/plugin/zclip/zclip.swf',
'afterCopy': function () {
alert('复制成功');
},
'copy': function () {
return tplcode;
}
});
}
};
$(function () {
//显示广告调用代码
$('.adcode').on('click', function () {
getcode($(this).data('key'));
$.admin.tool.tipbox('#showbox', '复制代码', copyfn);
});
})
</script>
5 changes: 3 additions & 2 deletions application/common/model/ad.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,11 +31,12 @@ public function del($where) {
public function getlist() {
$list=(array)$this->select();
foreach($list as &$v){
if (isset($v['create_username'])){
if (isset($v['create_user_id'])){
//后台
$v['create_username']=dc::get('passport',$v['create_user_id'],'name');
$v['update_username']=dc::get('passport',$v['update_user_id'],'name');
$v['url_edit']=U('friendlink.index.edit',array('id'=>$v['id']));
$v['url_edit']=U('ad.manage.edit',array('id'=>$v['id']));
$v['url_show']=U('ad.manage.show',array('id'=>$v['id']));
$v['create_time']=$v['create_time']?date('Y-m-d H:i',$v['create_time']):'';
$v['update_time']=$v['update_time']?date('Y-m-d H:i',$v['update_time']):'';
}
Expand Down
4 changes: 2 additions & 2 deletions application/common/model/friendlink.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,11 +32,11 @@ public function getlist() {
$list=(array)$this->select();
foreach($list as &$v){
$v['showname']=$this->getshowname($v);
if (isset($v['create_username'])){
if (isset($v['create_user_id'])){
//后台
$v['create_username']=dc::get('passport',$v['create_user_id'],'name');
$v['update_username']=dc::get('passport',$v['update_user_id'],'name');
$v['url_edit']=U('friendlink.index.edit',array('id'=>$v['id']));
$v['url_edit']=U('friendlink.manage.edit',array('id'=>$v['id']));
$v['create_time']=$v['create_time']?date('Y-m-d H:i',$v['create_time']):'';
$v['update_time']=$v['update_time']?date('Y-m-d H:i',$v['update_time']):'';
}
Expand Down
6 changes: 4 additions & 2 deletions application/friendlink/controller/manage.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@ public function addAction() {
$param['description']=I('description','str','');
$param['color']=I('color','str','');
$param['ordernum']=I('ordernum','int',50);
$param['status']=I('status','int',50);
$param['isblod']=I('isblod','int',50);
$param['status']=I('status','int',1);
$param['isblod']=I('isblod','int',0);
$param['create_user_id']=$_SESSION['admin']['userid'];
$param['create_time']=NOW_TIME;
if($this->model->add($param)){
Expand Down Expand Up @@ -55,6 +55,8 @@ public function editAction() {
$param['ordernum']=I('ordernum','int',50);
$param['status']=I('status','int',50);
$param['isblod']=I('isblod','int',50);
$param['update_user_id']=$_SESSION['admin']['userid'];
$param['update_time']=NOW_TIME;
$param['id']=$id;
if ($this->model->edit($param)){
$this->success('修改成功',U('index'));
Expand Down
2 changes: 2 additions & 0 deletions mind.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
2、版权网址错误
3、小说小偷的namelist区块 改为模版中传递参数的值 不传递模版参数的key

##后台
各处的ajax验证

##mind
1、array(
Expand Down

0 comments on commit 3853568

Please sign in to comment.