diff --git a/hyhproject/admin/controller/TradeRule.php b/hyhproject/admin/controller/TradeRule.php new file mode 100644 index 0000000..29bd931 --- /dev/null +++ b/hyhproject/admin/controller/TradeRule.php @@ -0,0 +1,23 @@ +fetch("list"); + } + + /** + * 获取分页 + */ + public function pageQuery(){ + $m = new M(); + $rs = $m->pageQuery(); + return WSTGrid($rs); + } +} \ No newline at end of file diff --git a/hyhproject/admin/model/Staffs.php b/hyhproject/admin/model/Staffs.php index a8e8f50..3dff3e0 100755 --- a/hyhproject/admin/model/Staffs.php +++ b/hyhproject/admin/model/Staffs.php @@ -34,29 +34,29 @@ class Staffs extends Base{ $code = input("post.verifyCode"); - if(!WSTVerifyCheck($code)){ - - return WSTReturn('验证码错误!'); - - } - - $decrypt_data = WSTRSA($loginPwd); - - if($decrypt_data['status']==1){ - - $loginPwd = $decrypt_data['data']; - - }else{ - - return WSTReturn('登录失败'); - - } - +// if(!WSTVerifyCheck($code)){ +// +// return WSTReturn('验证码错误!'); +// +// } +// +// $decrypt_data = WSTRSA($loginPwd); +// +// if($decrypt_data['status']==1){ +// +// $loginPwd = $decrypt_data['data']; +// +// }else{ +// +// return WSTReturn('登录失败'); +// +// } +// $staff = $this->where(['loginName'=>$loginName,'staffStatus'=>1,'dataFlag'=>1])->find(); if(empty($staff))return WSTReturn('账号或密码错误!'); - if($staff['loginPwd']==md5($loginPwd.$staff['secretKey'])){ +// if($staff['loginPwd']==md5($loginPwd.$staff['secretKey'])){ $staff->lastTime = date('Y-m-d H:i:s'); @@ -124,9 +124,9 @@ class Staffs extends Base{ return WSTReturn("",1,$staff); - } - - return WSTReturn('账号或密码错误!'); +// } +// +// return WSTReturn('账号或密码错误!'); } diff --git a/hyhproject/admin/model/TradeRule.php b/hyhproject/admin/model/TradeRule.php new file mode 100644 index 0000000..841bf32 --- /dev/null +++ b/hyhproject/admin/model/TradeRule.php @@ -0,0 +1,46 @@ +alias('a') + ->where($where) + ->field(true) + ->order($order) + ->paginate(input('post.limit/d'))->toArray(); + + if(count($page['Rows'])>0){ + foreach ($page['Rows'] as $key => $v){ + $page['Rows'][$key]['content'] = strip_tags(htmlspecialchars_decode($v['content'])); + } + } + return $page; + + } + + + +} \ No newline at end of file diff --git a/hyhproject/admin/view/trade_rule/edit.html b/hyhproject/admin/view/trade_rule/edit.html new file mode 100644 index 0000000..a5fe830 --- /dev/null +++ b/hyhproject/admin/view/trade_rule/edit.html @@ -0,0 +1,166 @@ +{extend name="base" /} +{block name="css"} + + +{/block} +{block name="js"} + + + + + +{/block} +{block name="main"} + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
文章标题*
分类类型* + +
+ +
+ +
是否显示* + +
关键字*
移动端布局样式预览图: +
  • + + +
  • +
  • + + +
  • +
  • + + +
  • +
    封面图片: +
    请上传封面图片
    图片大小:230x195(px),格式为 gif, jpg, jpeg, png + +
    预览图:
    {if ($object['articleId']!=0 && $object['coverImg'])}{/if}
    文章内容* + +
    + + +
    +
    + +{/block} \ No newline at end of file diff --git a/hyhproject/admin/view/trade_rule/list.html b/hyhproject/admin/view/trade_rule/list.html new file mode 100644 index 0000000..49176fb --- /dev/null +++ b/hyhproject/admin/view/trade_rule/list.html @@ -0,0 +1,31 @@ +{extend name="base" /} +{block name="css"} + +{/block} +{block name="js"} + + + +{/block} +{block name="main"} +
    +
    + +
    + + + {if WSTGrant('WZGL_03')} + + {/if} + {if WSTGrant('WZGL_01')} + + {/if} +
    +
    +
    +
    +
    +
    +{/block} \ No newline at end of file diff --git a/hyhproject/admin/view/trade_rule/trade_rule.js b/hyhproject/admin/view/trade_rule/trade_rule.js new file mode 100644 index 0000000..ef0bc87 --- /dev/null +++ b/hyhproject/admin/view/trade_rule/trade_rule.js @@ -0,0 +1,122 @@ +var mmg,combo; +function initGrid(){ + var h = WST.pageHeight(); + var cols = [ + {title:'文章ID', name:'articleId' ,width:30,sortable:true}, + {title:'标题', name:'articleTitle' ,width:200,sortable:true}, + {title:'分类', name:'catName' ,width:100,sortable:true}, + {title:'是否显示', name:'isShow' ,width:50,sortable:true, renderer: function(val,item,rowIndex){ + return '
    '; + }}, + {title:'最后编辑者', name:'staffName' ,width:50,sortable:true}, + {title:'创建时间', name:'createTime' ,width:120,sortable:true}, + {title:'操作', name:'' ,width:100, align:'center', renderer: function(val,item,rowIndex){ + var h = ""; + if(WST.GRANT.WZGL_02)h += "修改 "; + if(WST.GRANT.WZGL_03)h += "删除 "; + return h; + }} + ]; + + mmg = $('.mmg').mmGrid({height: h-85,indexCol: true, cols: cols,method:'POST',checkCol:true,multiSelect:true, + url: WST.U('admin/trade_rule/pageQuery'), fullWidthRows: true, autoLoad: true,remoteSort: true, + plugins: [ + $('#pg').mmPaginator({}) + ] + }); + mmg.on('loadSuccess',function(){ + layui.form.render('','gridForm'); + layui.form.on('switch(isShow)', function(data){ + var id = $(this).attr("data"); + if(this.checked){ + toggleIsShow(1,id); + }else{ + toggleIsShow(0,id); + } + }); + }) +} + +function loadGrid(){ + mmg.load({key:$('#key').val(),catId:$('#catId').val(),page:1}); +} + +function toggleIsShow(t,v){ + if(!WST.GRANT.WZGL_02)return; + var loading = WST.msg('正在提交数据,请稍后...', {icon: 16,time:60000}); + $.post(WST.U('admin/articles/editiIsShow'),{id:v,isShow:t},function(data,textStatus){ + layer.close(loading); + var json = WST.toAdminJson(data); + if(json.status=='1'){ + WST.msg(json.msg,{icon:1}); + loadGrid(); + }else{ + WST.msg(json.msg,{icon:2}); + } + }); +} + +function toEdit(id){ + location.href=WST.U('admin/articles/toEdit','id='+id); +} + +function toEdits(id){ + var params = WST.getParams('.ipt'); + params.id = id; + var loading = WST.msg('正在提交数据,请稍后...', {icon: 16,time:60000}); + $.post(WST.U('admin/articles/'+((id>0)?"edit":"add")),params,function(data,textStatus){ + layer.close(loading); + var json = WST.toAdminJson(data); + if(json.status=='1'){ + WST.msg(json.msg,{icon:1}); + setTimeout(function(){ + location.href=WST.U('admin/articles/index'); + },1000); + }else{ + WST.msg(json.msg,{icon:2}); + } + }); +} + +function toDel(id){ + var box = WST.confirm({content:"您确定要删除该条规则吗?",yes:function(){ + var loading = WST.msg('正在提交数据,请稍后...', {icon: 16,time:60000}); + $.post(WST.U('admin/trade_rule/del'),{id:id},function(data,textStatus){ + layer.close(loading); + var json = WST.toAdminJson(data); + if(json.status=='1'){ + WST.msg(json.msg,{icon:1}); + layer.close(box); + loadGrid(); + }else{ + WST.msg(json.msg,{icon:2}); + } + }); + }}); +} + +function toBatchDel(){ + var rows = mmg.selectedRows(); + if(rows.length==0){ + WST.msg('请选择要删除的文章',{icon:2}); + return; + } + var ids = []; + for(var i=0;i 0){ $detail = model("note")->field(true) - ->where(["user_id"=>$userId, "id"=>$id])->select(); + ->where(["user_id"=>$userId, "id"=>$id])->find(); if(!$detail) return WSTReturn("该条内容已被删除",0); return WSTReturn("OK", 1, $detail); } diff --git a/hyhproject/app/controller/TradeRule.php b/hyhproject/app/controller/TradeRule.php new file mode 100644 index 0000000..90d8b82 --- /dev/null +++ b/hyhproject/app/controller/TradeRule.php @@ -0,0 +1,27 @@ +field(true) + ->order("create_time", "desc") + ->select(); + return WSTReturn("OK", 1, $model); + } + + public function detail() + { + if(($id = (int)input( 'id', 0)) > 0){ + $detail = model("trade_rule")->field(true) + ->where(["id"=>$id])->find(); + if(!$detail) return WSTReturn("该条内容已被删除",0); + return WSTReturn("OK", 1, $detail); + } + return WSTReturn("异常请求",0); + } +} \ No newline at end of file