update
This commit is contained in:
@ -6,6 +6,7 @@ use App\Model\AppNews;
|
|||||||
use App\Model\AppNewsColumn;
|
use App\Model\AppNewsColumn;
|
||||||
use App\Model\AppNewsSecondColumn;
|
use App\Model\AppNewsSecondColumn;
|
||||||
use App\Rpc\BaseService;
|
use App\Rpc\BaseService;
|
||||||
|
use Hyperf\DbConnection\Db;
|
||||||
use Hyperf\RpcServer\Annotation\RpcService;
|
use Hyperf\RpcServer\Annotation\RpcService;
|
||||||
|
|
||||||
#[RpcService(name: "news", server: "jsonrpc-http", protocol: "jsonrpc-http")]
|
#[RpcService(name: "news", server: "jsonrpc-http", protocol: "jsonrpc-http")]
|
||||||
@ -113,14 +114,25 @@ class NewsService extends BaseService
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 热门文章
|
||||||
$hot = AppNews::formatQuery(['created_at'])
|
$hot = AppNews::formatQuery(['created_at'])
|
||||||
->where('platform', $id)
|
->where('platform', $id)
|
||||||
->where('is_delete', 0)
|
->where('is_delete', 0)
|
||||||
->select(['title', 'id', 'cover', 'created_at'])
|
->select(['title', 'id', 'cover', 'created_at'])
|
||||||
->limit(5)
|
->limit(5)
|
||||||
->orderBy('id', 'desc')
|
->orderBy(Db::raw('RAND()'))
|
||||||
->get()
|
->get()
|
||||||
->toArray();
|
->toArray();
|
||||||
return $this->getResponse()->setExtra('hot', $hot)->setExtra('total', ceil($total / $limit))->setData($value)->setCode(0)->send();
|
|
||||||
|
// 猜你喜欢
|
||||||
|
$guess = AppNews::formatQuery(['created_at'])
|
||||||
|
->where('platform', $id)
|
||||||
|
->where('is_delete', 0)
|
||||||
|
->select(['title', 'id', 'cover', 'created_at'])
|
||||||
|
->limit(10)
|
||||||
|
->orderBy(Db::raw('RAND()'))
|
||||||
|
->get()
|
||||||
|
->toArray();
|
||||||
|
return $this->getResponse()->setExtra('guess', $guess)->setExtra('hot', $hot)->setExtra('total', ceil($total / $limit))->setData($value)->setCode(0)->send();
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -1,3 +1,8 @@
|
|||||||
|
<?php
|
||||||
|
$platforms = call_user_func(function () {
|
||||||
|
return json_encode(\App\Model\AppWebsiteConfig::query()->where('is_delete', 0)->get()->groupBy('id')->toArray());
|
||||||
|
});
|
||||||
|
?>
|
||||||
<!DOCTYPE html>
|
<!DOCTYPE html>
|
||||||
<html lang="zh-cn">
|
<html lang="zh-cn">
|
||||||
<head>
|
<head>
|
||||||
@ -115,6 +120,7 @@
|
|||||||
let $ = layui.$;
|
let $ = layui.$;
|
||||||
let common = layui.common;
|
let common = layui.common;
|
||||||
let util = layui.util;
|
let util = layui.util;
|
||||||
|
let platform = JSON.parse('<?= $platforms ?>')
|
||||||
|
|
||||||
// 表头参数
|
// 表头参数
|
||||||
let cols = [
|
let cols = [
|
||||||
@ -123,6 +129,11 @@
|
|||||||
}, {
|
}, {
|
||||||
title: "文章标题",
|
title: "文章标题",
|
||||||
field: "title",
|
field: "title",
|
||||||
|
templet: function(d){
|
||||||
|
let domain = platform[d.platform][0]['app_domain']
|
||||||
|
console.log(domain)
|
||||||
|
return `<a href='//${domain}/news/${d.id}' target="_blank">` + d.title + '</a>';
|
||||||
|
},
|
||||||
}, {
|
}, {
|
||||||
field:'is_record', title: '是否收录', templet: function(d){
|
field:'is_record', title: '是否收录', templet: function(d){
|
||||||
if(d.is_record == '0'){
|
if(d.is_record == '0'){
|
||||||
|
@ -70,8 +70,7 @@
|
|||||||
|
|
||||||
<!-- 表格行工具栏 -->
|
<!-- 表格行工具栏 -->
|
||||||
<script type="text/html" id="table-bar">
|
<script type="text/html" id="table-bar">
|
||||||
<button class="pear-btn pear-btn-xs tool-btn" lay-event="research">重查</button>
|
<button class="pear-btn pear-btn-xs tool-btn" lay-event="edit">编辑</button>
|
||||||
<button class="pear-btn pear-btn-xs tool-btn" lay-event="edit">编辑</button>
|
|
||||||
<button class="pear-btn pear-btn-xs tool-btn" lay-event="delete">删除</button>
|
<button class="pear-btn pear-btn-xs tool-btn" lay-event="delete">删除</button>
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
@ -84,7 +83,6 @@
|
|||||||
// 相关常量
|
// 相关常量
|
||||||
const PRIMARY_KEY = "id";
|
const PRIMARY_KEY = "id";
|
||||||
|
|
||||||
const RESEARCH_API = '/admin/api/keywords/monitor/research';
|
|
||||||
const DELETE_API = '/admin/api/website/config/delete';
|
const DELETE_API = '/admin/api/website/config/delete';
|
||||||
const INDEX_API = '/admin/api/website/config';
|
const INDEX_API = '/admin/api/website/config';
|
||||||
const VIEW_API = "/admin/api/website/config/view";
|
const VIEW_API = "/admin/api/website/config/view";
|
||||||
@ -266,31 +264,6 @@
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
let research = function (obj) {
|
|
||||||
layer.confirm("确定重查?", {
|
|
||||||
icon: 3,
|
|
||||||
title: "提示"
|
|
||||||
}, function (index) {
|
|
||||||
layer.close(index);
|
|
||||||
let loading = layer.load();
|
|
||||||
layui.$.ajax({
|
|
||||||
url: RESEARCH_API,
|
|
||||||
type: "POST",
|
|
||||||
dateType: "json",
|
|
||||||
data: {
|
|
||||||
id: obj.data.id
|
|
||||||
},
|
|
||||||
success: function (res) {
|
|
||||||
layer.close(loading);
|
|
||||||
if (res.code) {
|
|
||||||
return layui.popup.failure(res.msg);
|
|
||||||
}
|
|
||||||
return layui.popup.success("操作成功", refreshTable);
|
|
||||||
}
|
|
||||||
})
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
// 删除一行
|
// 删除一行
|
||||||
let remove = function (obj) {
|
let remove = function (obj) {
|
||||||
return doRemove(obj.data[PRIMARY_KEY]);
|
return doRemove(obj.data[PRIMARY_KEY]);
|
||||||
|
Reference in New Issue
Block a user