Browse Source

支付

master
jianglong 3 years ago
parent
commit
2ef7136c31
  1. 20
      app/admin/controller/Upload.php
  2. 5
      app/admin/view/content/help/add.html
  3. 5
      app/admin/view/content/help/edit.html
  4. 8
      app/admin/view/file/lists.html
  5. 6
      app/api/controller/Community.php
  6. 8
      app/api/logic/ArticleLogic.php
  7. 2
      app/api/logic/CommunityLogic.php
  8. 19
      app/api/logic/ResourceLogic.php
  9. 50
      public/static/lib/likeedit/likeedit.js
  10. 8
      runtime/admin/temp/5b260d0cf2418d25963f5356b8c5e275.php

20
app/admin/controller/Upload.php

@ -37,11 +37,31 @@ class Upload extends AdminBase
{
try {
$cid = $this->request->post('cid');
if($this->request->get('type') == 20){
$result = FileServer::video($cid, 0); // 0 平台
}else{
$result = FileServer::image($cid, 0); // 0 平台
}
return JsonServer::success("上传成功", $result);
} catch (Exception $e) {
return JsonServer::error($e->getMessage());
}
}
/**
* NOTE: 上传图片
* @author: 张无忌
*/
public function video()
{
try {
$cid = $this->request->post('cid');
$result = FileServer::video($cid, 0); // 0 平台
return JsonServer::success("上传成功", $result);
} catch (Exception $e) {
return JsonServer::error($e->getMessage());
}
}
}

5
app/admin/view/content/help/add.html

@ -67,7 +67,7 @@
</div>
</div>
</div>
<script src="/static/lib/likeedit/likeedit.js?v={:time()}"></script>
<script>
layui.config({
base: "/static/lib/"
@ -79,6 +79,9 @@
var content = likeedit.build("content", {
uploadImage: {
url: '{:url("file/lists")}?type=10'
},
uploadVideo: {
url: '{:url("file/lists")}?type=20'
}
});

5
app/admin/view/content/help/edit.html

@ -76,7 +76,7 @@
</div>
</div>
</div>
<script src="/static/lib/likeedit/likeedit.js?v=16"></script>
<script>
layui.config({
base: "/static/lib/"
@ -88,6 +88,9 @@
var content = likeedit.build("content", {
uploadImage: {
url: '{:url("file/lists")}?type=10'
},
uploadVideo: {
url: '{:url("file/lists")}?type=20'
}
});

8
app/admin/view/file/lists.html

@ -16,7 +16,7 @@
<ul class="warehouse">
{{# layui.each(d, function(index, item){ }}
<li lay-id="{{item.id}}" lay-href="{{item.uri}}">
<div class="file-icon"><img class="file-image" src="{{item.uri}}"></div>
<div class="file-icon"> {if $type == 10}<img class="file-image" src="{{item.uri}}"></div>{elseif $type == 20}<video class="file-image" src="{{item.uri}}"></video></div>{else/}上传文件{/if}
<div class="file-name"><a href="javascript:">{{item.name}}</a></div>
</li>
{{# }); }}
@ -52,10 +52,10 @@
var uploadIns = upload.render({
elem: "#upload"
,url: "{:url('Upload/image')}"
,url: "{:url('Upload/image')}?type={$type}"
,accept: "images"
,exts: "jpg|png|gif|bmp|jpeg|ico"
,size: 4096
,exts: "jpg|png|gif|bmp|jpeg|ico|doc|mp4|mp3"
,size: 409600
,data : {
"cid": curCid,
"type": "{$type}"

6
app/api/controller/Community.php

@ -375,6 +375,12 @@ class Community extends Api
}
public function newArticleLists()
{
$get = $this->request->get();
$result = CommunityLogic::getArticleLists($get, $this->page_no, $this->page_size, $this->user_id);
return JsonServer::success('', $result);
}
}

8
app/api/logic/ArticleLogic.php

@ -23,9 +23,9 @@ class ArticleLogic extends Logic
try {
$where = [];
if(isset($get['type']) && $get['type'] == 2){
$where[] = ['id','in',[7,8]];
$where[] = ['id','in',[7,8,9,11,12]];
}else{
$where[] = ['id','not in',[7,8]];
$where[] = ['id','not in',[7,8,9,11,12]];
}
$model = new ArticleCategory();
return $model->field(['id', 'name'])
@ -55,9 +55,9 @@ class ArticleLogic extends Logic
['c.is_show', '=', 1],
];
if(isset($get['type']) && $get['type'] == 2){
$where[] = ['c.id','in',[7,8]];
$where[] = ['c.id','in',[7,8,9,11,12]];
}else{
$where[] = ['c.id','not in',[7,8]];
$where[] = ['c.id','not in',[7,8,9,11,12]];
}
if(isset($get['cid']) && !empty($get['cid'])) {

2
app/api/logic/CommunityLogic.php

@ -287,7 +287,7 @@ class CommunityLogic extends Logic
$query->field(['id', 'nickname', 'avatar']);
}])
->where($where)
->field(['a.id', 'user_id', 'cate_id', 'image', 'content', 'like', 'a.create_time'])
->field(['a.id', 'user_id', 'cate_id', 'image', 'content', 'like', 'a.create_time','b.type'])
->page($page, $size)
->order($sort)
->select()

19
app/api/logic/ResourceLogic.php

@ -27,11 +27,20 @@ class ResourceLogic extends Logic
{
try {
$model = new ResourceCategory();
$where = [];
if(isset($get['cate_type']) ){
if($get['cate_type'] == 0){
$where[] = ['id','not in',[17,18,19,20,21]];
}else{
$where[] = ['id','in',[17,18,19,20,21]];
}
}
return $model->field(['id', 'name'])
->where([
['del', '=', 0],
['is_show', '=', 1]
])->select()->toArray();
])->where($where)->select()->toArray();
} catch (\Exception $e) {
return ['error'=>$e->getMessage()];
@ -68,6 +77,14 @@ class ResourceLogic extends Logic
$where[] = ['a.city_id', '=', str_replace("city_","",$get['cid'])];
}
if(isset($get['cate_type']) ){
if($get['cate_type'] == 0){
$where[] = ['id','not in',[17,18,19,20,21]];
}else{
$where[] = ['id','in',[17,18,19,20,21]];
}
}
$order = [
'sort' => 'asc',

50
public/static/lib/likeedit/likeedit.js

@ -1,9 +1,10 @@
layui.define(["layer", "form", "layedit"], function (t) {
var e = layui.$, i = layui.layer, a = layui.form, l = (layui.hint(), layui.device()), n = "layedit",
o = "layui-show", r = "layui-disabled", layedit=layui.layedit, c = function () {
var t = this;
t.index = 0, t.config = {
tool: ["strong", "italic", "underline", "del", "|", "left", "center", "right", "|", "link", "unlink", "face", "image"],
tool: ["strong", "italic", "underline", "del", "|", "left", "center", "right", "|", "link", "unlink", "face", "image","video"],
hideTool: [],
height: 500
}
@ -47,6 +48,7 @@ layui.define(["layer", "form", "layedit"], function (t) {
}
}, c.prototype.getSelection = function (t) {
var e = u(t);
console.log("e::",e[0])
if (e[0]) {
var i = m(e[0].document);
return document.selection ? i.text : i.toString()
@ -133,13 +135,15 @@ layui.define(["layer", "form", "layedit"], function (t) {
var n = t.document, o = e(n.body), c = {
link: function (i) {
var a = p(i), l = e(a).parent();
b.call(o, {href: l.attr("href"), target: l.attr("target")}, function (e) {
b.call(o, {href: l.attr("href"), target: l.attr("target"),tag:l.attr("tag")}, function (e) {
var a = l[0];
"A" === a.tagName ? a.href = e.url : v.call(t, "a", {target: e.target, href: e.url, text: e.url}, i)
console.log(1212,a)
( a.tag===undefined || a.tag==='link' ? v.call(t, "a", {target: e.target, href: e.url, text: e.url}, i):v.call(t, "video", { src: e.url, text: e.url}, i))
})
}, unlink: function (t) {
n.execCommand("unlink")
}, face: function (e) {
},
face: function (e) {
x.call(this, function (i) {
v.call(t, "img", {src: i.src, alt: i.alt}, e)
})
@ -157,7 +161,23 @@ layui.define(["layer", "form", "layedit"], function (t) {
v.call(t, "img", {src: "/" + uri}, a);
layer.close(windows)
}
}, code: function (e) {
},
video: function (a) {
var n = this;
var uploadVideo = l.uploadVideo;
var windows = layer.open({type: 2, title: "上传视频", content: uploadVideo.url, area: ["90%", "90%"]});
window.callback = function (uri) {
console.log(uri,1112222)
uri.forEach(function (item) {
v.call(t, "video", {src: item}, a)
});
};
window.callbackSetUri = function (uri) {
v.call(t, "video", {src: "/" + uri}, a);
layer.close(windows)
}
},
code: function (e) {
k.call(o, function (i) {
v.call(t, "pre", {text: i.code, "lay-lang": i.lang}, e)
})
@ -185,12 +205,20 @@ layui.define(["layer", "form", "layedit"], function (t) {
}, d = /image/;
s.find(">i").on("mousedown", function () {
var t = e(this), i = t.attr("layedit-event");
d.test(i) || u.call(this)
d.test(i) || /video/.test(i) || u.call(this)
}).on("click", function () {
var t = e(this), i = t.attr("layedit-event");
d.test(i) && u.call(this)
( d.test(i) || /video/.test(i) ) && u.call(this)
}), o.on("click", function () {
h.call(t, s), i.close(x.index)
}),
o.on("paste", function () {
iframeDOM.execCommand('formatBlock', false, '<p>');
setTimeout(function(){
filter.call(iframeWin, o);
o.find('img').not('.layedit-face').addClass('layedit-img');//粘贴的添加类名layedit-img
textArea.value = o.html();
}, 100);
})
}, b = function (t, e) {
var l = this, n = i.open({
@ -204,11 +232,15 @@ layui.define(["layer", "form", "layedit"], function (t) {
skin: "layui-layer-msg",
content: ['<ul class="layui-form" style="margin: 15px;">', '<li class="layui-form-item">', '<label class="layui-form-label" style="width: 60px;">URL</label>', '<div class="layui-input-block" style="margin-left: 90px">', '<input name="url" lay-verify="url" value="' + (t.href || "") + '" autofocus="true" autocomplete="off" class="layui-input">', "</div>", "</li>", '<li class="layui-form-item">', '<label class="layui-form-label" style="width: 60px;">打开方式</label>', '<div class="layui-input-block" style="margin-left: 90px">', '<input type="radio" name="target" value="_self" class="layui-input" title="当前窗口"' + ("_self" !== t.target && t.target ? "" : "checked") + ">", '<input type="radio" name="target" value="_blank" class="layui-input" title="新窗口" ' + ("_blank" === t.target ? "checked" : "") + ">", "</div>", "</li>", '<li class="layui-form-item" style="text-align: center;">', '<button type="button" lay-submit lay-filter="layedit-link-yes" class="layui-btn"> 确定 </button>', '<button style="margin-left: 20px;" type="button" class="layui-btn layui-btn-primary"> 取消 </button>', "</li>", "</ul>"].join(""),
success: function (t, n) {
var o = "submit(layedit-link-yes)";
a.render("radio"), t.find(".layui-btn-primary").on("click", function () {
i.close(n), l.focus()
}), a.on(o, function (t) {
console.log("1111",t)
console.log("22",e)
i.close(b.index) , e && e(t.field)
})
}
});
@ -271,7 +303,9 @@ layui.define(["layer", "form", "layedit"], function (t) {
face: '<i class="layui-icon layedit-tool-face" title="表情" layedit-event="face"">&#xe650;</i>',
image: '<i class="layui-icon layedit-tool-image" title="图片" layedit-event="image">&#xe64a;</i>',
code: '<i class="layui-icon layedit-tool-code" title="插入代码" layedit-event="code">&#xe64e;</i>',
help: '<i class="layui-icon layedit-tool-help" title="帮助" layedit-event="help">&#xe607;</i>'
help: '<i class="layui-icon layedit-tool-help" title="帮助" layedit-event="help">&#xe607;</i>',
video: '<i class="layui-icon layedit-tool-image" title="视频" layedit-event="video">&#xe6ed;</i>'
}, w = new c;
t("likeedit", w)
});

8
runtime/admin/temp/5b260d0cf2418d25963f5356b8c5e275.php

@ -1,4 +1,4 @@
<?php /*a:2:{s:54:"E:\waibao\ahbcqz\server\app\admin\view\file\lists.html";i:1679478874;s:51:"E:\waibao\ahbcqz\server\app\admin\view\layout2.html";i:1679478874;}*/ ?>
<?php /*a:2:{s:54:"E:\waibao\ahbcqz\server\app\admin\view\file\lists.html";i:1691043952;s:51:"E:\waibao\ahbcqz\server\app\admin\view\layout2.html";i:1679478874;}*/ ?>
<!DOCTYPE html>
<html>
<head>
@ -35,7 +35,7 @@
<ul class="warehouse">
{{# layui.each(d, function(index, item){ }}
<li lay-id="{{item.id}}" lay-href="{{item.uri}}">
<div class="file-icon"><img class="file-image" src="{{item.uri}}"></div>
<div class="file-icon"> <?php if($type == 10): ?><img class="file-image" src="{{item.uri}}"></div><?php elseif($type == 20): ?><video class="file-image" src="{{item.uri}}"></video></div><?php else: ?>上传文件<?php endif; ?>
<div class="file-name"><a href="javascript:">{{item.name}}</a></div>
</li>
{{# }); }}
@ -71,9 +71,9 @@
var uploadIns = upload.render({
elem: "#upload"
,url: "<?php echo url('Upload/image'); ?>"
,url: "<?php echo url('Upload/image'); ?>?type=<?php echo htmlentities($type); ?>"
,accept: "images"
,exts: "jpg|png|gif|bmp|jpeg|ico"
,exts: "jpg|png|gif|bmp|jpeg|ico|doc|mp4|mp3"
,size: 4096
,data : {
"cid": curCid,

Loading…
Cancel
Save