Merge branch 'master' of http://git.excellentkk.cn/mkm/nk-lihaink-cn
This commit is contained in:
commit
5492e6e26b
@ -44,57 +44,36 @@ class Index extends BaseController
|
|||||||
|
|
||||||
public function main()
|
public function main()
|
||||||
{
|
{
|
||||||
|
|
||||||
$street_id=Db::table('fa_szxc_information_useraddress')->where('admin_id',$this->adminInfo['id'])->value('street_id');
|
$street_id=Db::table('fa_szxc_information_useraddress')->where('admin_id',$this->adminInfo['id'])->value('street_id');
|
||||||
$street_name=Db::table('fa_geo_street')->where('street_code',$street_id)->value('street_name');
|
$street_name=Db::table('fa_geo_street')->where('street_code',$street_id)->value('street_name');
|
||||||
if ($this->adminInfo['group_access']==4){
|
if ($this->adminInfo['group_access']==4){
|
||||||
$urls="http://zhen.lihaink.cn/#/?street_id=$street_id"."&street_name=".$street_name;
|
$urls="http://zhen.lihaink.cn/#/?street_id=$street_id"."&street_name=".$street_name;
|
||||||
return <<<EOT
|
View::assign('urls',$urls);
|
||||||
<div id="your-element-selector" style="height: 100%">
|
return View('main3');
|
||||||
<a href="$urls" target="_blank" style="font-size: 100px;
|
|
||||||
color: aliceblue;
|
|
||||||
display: block;
|
|
||||||
text-align: center;
|
|
||||||
text-decoration:none;
|
|
||||||
top: 40%;">跳转大屏</a>
|
|
||||||
</div>
|
|
||||||
<script src="https://cdnjs.cloudflare.com/ajax/libs/three.js/r134/three.min.js"></script>
|
|
||||||
<script src="https://cdn.jsdelivr.net/npm/vanta@0.5.24/dist/vanta.waves.min.js"></script>
|
|
||||||
<script>
|
|
||||||
VANTA.WAVES({
|
|
||||||
el: "#your-element-selector",
|
|
||||||
mouseControls: true,
|
|
||||||
touchControls: true,
|
|
||||||
gyroControls: false,
|
|
||||||
scale: 1.00,
|
|
||||||
scaleMobile: 1.00
|
|
||||||
})
|
|
||||||
</script>
|
|
||||||
EOT;
|
|
||||||
}elseif($this->adminInfo['group_access']==5){
|
}elseif($this->adminInfo['group_access']==5){
|
||||||
|
$day_price=Db::connect('shop')->table('eb_product_order_log')->where('street_id',$street_id)
|
||||||
|
->where('status',1)
|
||||||
|
->whereDay('create_time')
|
||||||
|
->sum('product_price');
|
||||||
|
$day_order=Db::connect('shop')->table('eb_product_order_log')->where('street_id',$street_id)
|
||||||
|
->where('status',1)
|
||||||
|
->whereDay('create_time')
|
||||||
|
->count();
|
||||||
|
$Month_price=Db::connect('shop')->table('eb_product_order_log')->where('street_id',$street_id)
|
||||||
|
->where('status',1)
|
||||||
|
->whereMonth('create_time')
|
||||||
|
->sum('product_price');
|
||||||
|
$Month_order=Db::connect('shop')->table('eb_product_order_log')->where('street_id',$street_id)
|
||||||
|
->where('status',1)
|
||||||
|
->whereMonth('create_time')
|
||||||
|
->count();
|
||||||
$urls="http://zhenqiye.lihaink.cn/#/?street_id=$street_id"."&street_name=".$street_name;
|
$urls="http://zhenqiye.lihaink.cn/#/?street_id=$street_id"."&street_name=".$street_name;
|
||||||
return <<<EOT
|
View::assign('urls',$urls);
|
||||||
<div id="your-element-selector" style="height: 100%">
|
View::assign('day_order',$day_order);
|
||||||
<a href="$urls" target="_blank" style="font-size: 100px;
|
View::assign('day_price',$day_price);
|
||||||
color: aliceblue;
|
View::assign('month_price',$Month_price);
|
||||||
display: block;
|
View::assign('month_order',$Month_order);
|
||||||
text-align: center;
|
return View('main2');
|
||||||
text-decoration:none;
|
|
||||||
top: 40%;">跳转大屏</a>
|
|
||||||
</div>
|
|
||||||
<script src="https://cdnjs.cloudflare.com/ajax/libs/three.js/r134/three.min.js"></script>
|
|
||||||
<script src="https://cdn.jsdelivr.net/npm/vanta@0.5.24/dist/vanta.waves.min.js"></script>
|
|
||||||
<script>
|
|
||||||
VANTA.WAVES({
|
|
||||||
el: "#your-element-selector",
|
|
||||||
mouseControls: true,
|
|
||||||
touchControls: true,
|
|
||||||
gyroControls: false,
|
|
||||||
scale: 1.00,
|
|
||||||
scaleMobile: 1.00
|
|
||||||
})
|
|
||||||
</script>
|
|
||||||
EOT;
|
|
||||||
}
|
}
|
||||||
if ($this->adminInfo['id']!=1){
|
if ($this->adminInfo['id']!=1){
|
||||||
$find = Db::table('fa_szxc_information_useraddress')->where('user_id', $this->adminInfo['user_id'])->find();
|
$find = Db::table('fa_szxc_information_useraddress')->where('user_id', $this->adminInfo['user_id'])->find();
|
||||||
|
263
app/admin/controller/nk/ArticleCommon.php
Normal file
263
app/admin/controller/nk/ArticleCommon.php
Normal file
@ -0,0 +1,263 @@
|
|||||||
|
<?php
|
||||||
|
namespace app\admin\controller\nk;
|
||||||
|
|
||||||
|
use think\db\exception\DbException as ExceptionDbException;
|
||||||
|
use think\exception\ValidateException;
|
||||||
|
use app\admin\BaseController;
|
||||||
|
use think\facade\Db;
|
||||||
|
use think\facade\View;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 文娱旅游
|
||||||
|
* 公共父类
|
||||||
|
*/
|
||||||
|
class ArticleCommon extends BaseController {
|
||||||
|
|
||||||
|
const ARTICLE = 'fa_article';
|
||||||
|
|
||||||
|
protected $category_id;
|
||||||
|
|
||||||
|
function __construct(){
|
||||||
|
$this->adminInfo = get_login_admin();
|
||||||
|
// $this->pid = 361;
|
||||||
|
$this->category_id = 362;
|
||||||
|
$this->url=[
|
||||||
|
'/admin/nk.culturatour/index?category_id='.$this->category_id,
|
||||||
|
'/admin/nk.culturatour/add',
|
||||||
|
'/admin/nk.culturatour/edit',
|
||||||
|
'/admin/nk.culturatour/del',
|
||||||
|
'/admin/nk.culturatour/read',
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 文章列表
|
||||||
|
*/
|
||||||
|
function Index(){
|
||||||
|
if (request()->isAjax()) {
|
||||||
|
$params= get_params();
|
||||||
|
$params['category_id']=$this->category_id;
|
||||||
|
|
||||||
|
$where = ['category_id'=>$this->category_id];
|
||||||
|
$list = Db::table('fa_article')->field('id')->where($where)
|
||||||
|
->page(1)
|
||||||
|
->limit(1)
|
||||||
|
->order('id desc')
|
||||||
|
->select();
|
||||||
|
(new Article())->index($params);
|
||||||
|
}
|
||||||
|
return view('nk/article/index',['url'=>$this->url]);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查看文章 【无关联表】
|
||||||
|
*/
|
||||||
|
function Read(){
|
||||||
|
$params = get_params();
|
||||||
|
(new Article())->read($params);
|
||||||
|
|
||||||
|
return view('nk/article/read',['url'=>$this->url]);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 添加文章【无关联表】
|
||||||
|
*/
|
||||||
|
function Add(){
|
||||||
|
if (request()->isAjax()) {
|
||||||
|
$params= get_params();
|
||||||
|
$params['category_id']=$this->category_id;
|
||||||
|
// unset($params['amp;']);
|
||||||
|
(new Article())->add($params);
|
||||||
|
}else{
|
||||||
|
View::assign('editor', get_system_config('other','editor'));
|
||||||
|
View::assign('url', $this->url);
|
||||||
|
// 获取用户信息
|
||||||
|
$this->users = Db::table('fa_szxc_information_usermsg')->where('status',1)->field('user_id,name')->select();
|
||||||
|
View::assign('users', $this->users);
|
||||||
|
$street = Db::table('fa_geo_area')->where(['switch' => 1, 'city_code' => '510500'])
|
||||||
|
->field('area_id id,area_code code,area_name name')
|
||||||
|
->select();
|
||||||
|
View::assign('street', $street);
|
||||||
|
return view('nk/article/add');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 编辑文章 【无关联表】
|
||||||
|
*/
|
||||||
|
function Edit(){
|
||||||
|
$params= get_params();
|
||||||
|
(new Article())->edit($params);
|
||||||
|
return view('nk/article/edit',['url'=>$this->url]);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除文章【无关联表】
|
||||||
|
*/
|
||||||
|
function Del(){
|
||||||
|
$params= get_params();
|
||||||
|
(new Article())->del($params);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 添加文章与关联表数据.
|
||||||
|
* 【有关联表】
|
||||||
|
*/
|
||||||
|
function addArticle($param, $callback){
|
||||||
|
// 检验完整性
|
||||||
|
try {
|
||||||
|
validate(\app\admin\validate\nk\ArticleValidate::class)->check($param);
|
||||||
|
} catch (ValidateException $e) {
|
||||||
|
// 验证失败 输出错误信息
|
||||||
|
return to_assign(1, $e->getError());
|
||||||
|
}
|
||||||
|
$adds=Db::table('fa_szxc_information_useraddress')->where('admin_id',$this->adminInfo['id'])->find();
|
||||||
|
if($this->adminInfo['position_id'] != 1) { //不是超级管理员
|
||||||
|
$param['county']=$adds['area_id'];
|
||||||
|
$param['township']=$adds['street_id'];
|
||||||
|
$param['village']=$adds['village_id'];
|
||||||
|
$param['user_id']=$adds['user_id'];
|
||||||
|
}else{
|
||||||
|
if(empty($param['county'])){
|
||||||
|
$param['county']=$adds['area_id'];
|
||||||
|
}
|
||||||
|
if(empty($param['township'])){
|
||||||
|
$param['township']=$adds['street_id'];
|
||||||
|
}
|
||||||
|
if(empty($param['village'])){
|
||||||
|
$param['village']=$adds['village_id'];
|
||||||
|
}
|
||||||
|
if(empty($param['user_id'])){
|
||||||
|
$param['user_id']=$adds['user_id'];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$param['view_time']=date('Y-m-d H:i:s');
|
||||||
|
if(empty($param['category_type'])){
|
||||||
|
$param['category_type'] = 0;
|
||||||
|
}
|
||||||
|
if(empty($param['end_time'])){
|
||||||
|
$param['end_time'] = date('Y-m-d H:i:s');
|
||||||
|
}
|
||||||
|
|
||||||
|
Db::startTrans();
|
||||||
|
try{
|
||||||
|
// 新建文章
|
||||||
|
$aid = Db::table('fa_article')->strict(false)->field(true)->insertGetId($param);
|
||||||
|
|
||||||
|
// 新建文章相关表的信息
|
||||||
|
$pid = $callback($aid);
|
||||||
|
}catch(ExceptionDbException $e){
|
||||||
|
Db::rollback();
|
||||||
|
return to_assign(1, '操作失败,原因:'.$e->getMessage());
|
||||||
|
}
|
||||||
|
if (!empty($aid) && !empty($pid)) {
|
||||||
|
Db::commit();
|
||||||
|
if(!empty($param['is_vote']) && $param['is_vote']==1){
|
||||||
|
$data=['start_time'=>date('Y-m-d H:i:s'),'end_time'=>$param['end_time'],'article_id'=>$aid,'county'=>$adds['area_id'],'township'=>$adds['street_id'],'village'=>$adds['village_id']];
|
||||||
|
Db::table('fa_article_vote_side_tables')->insert($data);
|
||||||
|
}
|
||||||
|
return to_assign(0,'操作成功',['aid'=>$aid]);
|
||||||
|
}
|
||||||
|
|
||||||
|
return to_assign(1, '操作失败,原因:'.$aid);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 1. 获取编辑页展示文章与关联表数据.
|
||||||
|
* 【有关联表】
|
||||||
|
*/
|
||||||
|
function getEditData($param, $id, $callback){
|
||||||
|
|
||||||
|
// 获取指定文章
|
||||||
|
$detail = Db::table('fa_article')->where('id',$id)->withAttr('lesson',
|
||||||
|
$callback
|
||||||
|
)->find();
|
||||||
|
|
||||||
|
View::assign('editor', get_system_config('other','editor'));
|
||||||
|
|
||||||
|
// 获取此文章的用户信息
|
||||||
|
if (!empty($detail)) {
|
||||||
|
View::assign('detail', $detail);
|
||||||
|
//获取用户信息
|
||||||
|
$this->users = Db::table('fa_szxc_information_usermsg')->where('status',1)->field('user_id,name')->select();
|
||||||
|
View::assign('users', $this->users);
|
||||||
|
$street = Db::table('fa_geo_area')->where(['switch' => 1, 'city_code' => '510500'])
|
||||||
|
->field('area_id id,area_code code,area_name name')
|
||||||
|
->select();
|
||||||
|
View::assign('street', $street);
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
throw new \think\exception\HttpException(404, '找不到页面');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 2. ajax提交编辑更新文章与关联表数据.
|
||||||
|
* 【有关联表】
|
||||||
|
*/
|
||||||
|
function updateEditData($param, $id, $callback){
|
||||||
|
try {
|
||||||
|
validate(\app\admin\validate\nk\ArticleValidate::class)->check($param);
|
||||||
|
} catch (ValidateException $e) {
|
||||||
|
// 验证失败 输出错误信息
|
||||||
|
return to_assign(1, $e->getError());
|
||||||
|
}
|
||||||
|
|
||||||
|
$adds=Db::table('fa_szxc_information_useraddress')->where('admin_id',$this->adminInfo['id'])->find();
|
||||||
|
if($this->adminInfo['position_id'] == 1) { //是超级管理员
|
||||||
|
if(empty($param['county'])){
|
||||||
|
$param['county']=$adds['area_id'];
|
||||||
|
}
|
||||||
|
if(empty($param['township'])){
|
||||||
|
$param['township']=$adds['street_id'];
|
||||||
|
}
|
||||||
|
if(empty($param['village'])){
|
||||||
|
$param['village']=$adds['village_id'];
|
||||||
|
}
|
||||||
|
if(empty($param['user_id'])){
|
||||||
|
$param['user_id']=$adds['user_id'];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 更新文章信息
|
||||||
|
$res=Db::table('fa_article')->where('id',$id)->strict(false)->field(true)->update($param);
|
||||||
|
|
||||||
|
// 更新文章相关的扩展信息
|
||||||
|
$callback($param);
|
||||||
|
if ($res){
|
||||||
|
// 更新文章相关的投票信息
|
||||||
|
if(!empty($param['is_vote']) && $param['is_vote']==1){
|
||||||
|
Db::table('fa_article_vote_side_tables')->where('article_id',$id)->update(['end_time'=>$param['end_time']]);
|
||||||
|
}
|
||||||
|
return to_assign();
|
||||||
|
}else{
|
||||||
|
return to_assign(1, '操作失败,原因:'.$res);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 文章与关联表删除
|
||||||
|
* 【有关联表】
|
||||||
|
*/
|
||||||
|
function delArticle($id, $callback){
|
||||||
|
|
||||||
|
// 此处同时删除两个表
|
||||||
|
Db::startTrans();
|
||||||
|
try{
|
||||||
|
$res1 = Db::table('fa_article')->where('id',$id)->delete();
|
||||||
|
$pid = $callback($id);
|
||||||
|
}catch (ExceptionDbException $e){
|
||||||
|
Db::rollback();
|
||||||
|
$res1 = $pid = '';
|
||||||
|
return ["code"=>1, "msg"=>'操作失败,原因:'.$e->getMessage()];
|
||||||
|
}
|
||||||
|
if ($res1 && $pid){
|
||||||
|
Db::commit();
|
||||||
|
return ["code"=>0, "msg"=>'操作成功'];
|
||||||
|
}else{
|
||||||
|
return ["code"=>1, "msg"=>'操作失败,原因:两表一起删除失败[主表:'.$res1.'][联表:'.$pid.']'];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
21
app/admin/controller/nk/CulturalArticle.php
Normal file
21
app/admin/controller/nk/CulturalArticle.php
Normal file
@ -0,0 +1,21 @@
|
|||||||
|
<?php
|
||||||
|
namespace app\admin\controller\nk;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 文娱旅游
|
||||||
|
* -- 文章文创
|
||||||
|
*/
|
||||||
|
class CulturalArticle extends ArticleCommon{
|
||||||
|
function __construct()
|
||||||
|
{
|
||||||
|
$this->category_id = 362;
|
||||||
|
$this->url=[
|
||||||
|
'/admin/nk.cultural_article/index?category_id='.$this->category_id,
|
||||||
|
'/admin/nk.cultural_article/add',
|
||||||
|
'/admin/nk.cultural_article/edit',
|
||||||
|
'/admin/nk.cultural_article/del',
|
||||||
|
'/admin/nk.cultural_article/read',
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
21
app/admin/controller/nk/CulturalCard.php
Normal file
21
app/admin/controller/nk/CulturalCard.php
Normal file
@ -0,0 +1,21 @@
|
|||||||
|
<?php
|
||||||
|
namespace app\admin\controller\nk;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 文娱旅游
|
||||||
|
* -- 全民打卡
|
||||||
|
*/
|
||||||
|
class CulturalCard extends ArticleCommon{
|
||||||
|
function __construct()
|
||||||
|
{
|
||||||
|
$this->category_id = 361;
|
||||||
|
$this->url=[
|
||||||
|
'/admin/nk.cultural_card/index?category_id='.$this->category_id,
|
||||||
|
'/admin/nk.cultural_card/add',
|
||||||
|
'/admin/nk.cultural_card/edit',
|
||||||
|
'/admin/nk.cultural_card/del',
|
||||||
|
'/admin/nk.cultural_card/read',
|
||||||
|
];
|
||||||
|
}
|
||||||
|
}
|
21
app/admin/controller/nk/CulturalPlay.php
Normal file
21
app/admin/controller/nk/CulturalPlay.php
Normal file
@ -0,0 +1,21 @@
|
|||||||
|
<?php
|
||||||
|
namespace app\admin\controller\nk;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 文娱旅游
|
||||||
|
* -- 官网攻略
|
||||||
|
*/
|
||||||
|
class CulturalPlay extends ArticleCommon{
|
||||||
|
function __construct()
|
||||||
|
{
|
||||||
|
$this->category_id = 360;
|
||||||
|
$this->url=[
|
||||||
|
'/admin/nk.cultural_play/index?category_id='.$this->category_id,
|
||||||
|
'/admin/nk.cultural_play/add',
|
||||||
|
'/admin/nk.cultural_play/edit',
|
||||||
|
'/admin/nk.cultural_play/del',
|
||||||
|
'/admin/nk.cultural_play/read',
|
||||||
|
];
|
||||||
|
}
|
||||||
|
}
|
21
app/admin/controller/nk/CulturalStrategy.php
Normal file
21
app/admin/controller/nk/CulturalStrategy.php
Normal file
@ -0,0 +1,21 @@
|
|||||||
|
<?php
|
||||||
|
namespace app\admin\controller\nk;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 文娱旅游
|
||||||
|
* -- 官网攻略
|
||||||
|
*/
|
||||||
|
class CulturalStrategy extends ArticleCommon{
|
||||||
|
function __construct()
|
||||||
|
{
|
||||||
|
$this->category_id = 364;
|
||||||
|
$this->url=[
|
||||||
|
'/admin/nk.cultural_strategy/index?category_id='.$this->category_id,
|
||||||
|
'/admin/nk.cultural_strategy/add',
|
||||||
|
'/admin/nk.cultural_strategy/edit',
|
||||||
|
'/admin/nk.cultural_strategy/del',
|
||||||
|
'/admin/nk.cultural_strategy/read',
|
||||||
|
];
|
||||||
|
}
|
||||||
|
}
|
171
app/admin/controller/nk/EducationLive.php
Normal file
171
app/admin/controller/nk/EducationLive.php
Normal file
@ -0,0 +1,171 @@
|
|||||||
|
<?php
|
||||||
|
namespace app\admin\controller\nk;
|
||||||
|
|
||||||
|
// use app\admin\controller\nk\common\Article as ArticleCommon1;
|
||||||
|
use think\db\exception\DbException as ExceptionDbException;
|
||||||
|
use think\exception\ValidateException;
|
||||||
|
use think\facade\Db;
|
||||||
|
use think\facade\View;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 教育培训 直播
|
||||||
|
*
|
||||||
|
*
|
||||||
|
CREATE TABLE `fa_article_education_live` (
|
||||||
|
`id` int unsigned NOT NULL AUTO_INCREMENT COMMENT '主键id',
|
||||||
|
`article_id` int NOT NULL COMMENT '文章id',
|
||||||
|
`lesson_period` int unsigned NOT NULL DEFAULT '0' COMMENT '课时',
|
||||||
|
`tag_ids` varchar(255) DEFAULT NULL COMMENT '文章标签id字符串',
|
||||||
|
`is_recommend` tinyint unsigned DEFAULT '0' COMMENT '是否推荐',
|
||||||
|
PRIMARY KEY (`id`),
|
||||||
|
UNIQUE KEY `article_id_index` (`article_id`) COMMENT '文章id'
|
||||||
|
) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci COMMENT='教育培训类直播文章扩展表';
|
||||||
|
|
||||||
|
CREATE TABLE `fa_article_education_live_series` (
|
||||||
|
`id` int unsigned NOT NULL AUTO_INCREMENT COMMENT '主键id',
|
||||||
|
`article_id` int unsigned DEFAULT NULL COMMENT '文章id',
|
||||||
|
`url` varchar(255) DEFAULT NULL COMMENT '视频地址',
|
||||||
|
`num` int unsigned NOT NULL COMMENT '第几集',
|
||||||
|
`title` varchar(255) DEFAULT NULL COMMENT '视频标题',
|
||||||
|
PRIMARY KEY (`id`),
|
||||||
|
KEY `article_id_index` (`article_id`) COMMENT '文章id'
|
||||||
|
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci COMMENT='教育培训视频文章扩展表';
|
||||||
|
|
||||||
|
CREATE TABLE `fa_tag` (
|
||||||
|
`id` int unsigned NOT NULL AUTO_INCREMENT COMMENT '主键id',
|
||||||
|
`tag` varchar(255) DEFAULT NULL COMMENT '标签',
|
||||||
|
`display` tinyint unsigned NOT NULL DEFAULT '0' COMMENT '禁止显示',
|
||||||
|
PRIMARY KEY (`id`),
|
||||||
|
KEY `tag_index` (`tag`) COMMENT '标签名'
|
||||||
|
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci COMMENT='标签表';
|
||||||
|
|
||||||
|
*/
|
||||||
|
class EducationLive extends ArticleCommon {
|
||||||
|
const ARTICLE_EDUCATION_LIVE = 'fa_article_education_live';
|
||||||
|
const TAG = 'fa_tag';
|
||||||
|
|
||||||
|
function __construct()
|
||||||
|
{
|
||||||
|
// 课程name
|
||||||
|
// *课时
|
||||||
|
// 观看人数
|
||||||
|
$this->adminInfo = get_login_admin();
|
||||||
|
$this->category_id = 370;
|
||||||
|
$this->url=[
|
||||||
|
'/admin/nk.education_live/index?category_id='.$this->category_id,
|
||||||
|
'/admin/nk.education_live/add',
|
||||||
|
'/admin/nk.education_live/edit',
|
||||||
|
'/admin/nk.education_live/del',
|
||||||
|
'/admin/nk.education_live/read',
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查看 待完
|
||||||
|
*/
|
||||||
|
function Read() {
|
||||||
|
$param = get_params();
|
||||||
|
$id = isset($param['id']) ? $param['id'] : 0;
|
||||||
|
$detail = Db::table('fa_article')->where('id',$id)->withAttr('lesson',
|
||||||
|
function($value, $data)use($id){
|
||||||
|
return Db::table(self::ARTICLE_EDUCATION_LIVE)->field('lesson_period,tag_ids as series_num')->where('article_id', $id)->find();
|
||||||
|
}
|
||||||
|
)->find();
|
||||||
|
|
||||||
|
// !待开发--课程集数\ 学习人数
|
||||||
|
// ->withAttr('learner',
|
||||||
|
// function($value, $data)use($id){
|
||||||
|
// return Db::table(self::ARTICLE_EDUCATION_LIVE)->field('lesson_period,tag_ids as num')->where('article_id', $id)->find();
|
||||||
|
// }
|
||||||
|
// )
|
||||||
|
// echo '<pre>';print_r($detail);
|
||||||
|
// exit();
|
||||||
|
if (!empty($detail)) {
|
||||||
|
$detail['comment'] = Db::table('fa_article_comment')
|
||||||
|
->where('vote_id',$id)
|
||||||
|
->withAttr('user_info',function ($value,$data){
|
||||||
|
return Db::table('fa_szxc_information_usermsg')->where('user_id',$data['user_id'])->value('name');
|
||||||
|
})->select();
|
||||||
|
View::assign('detail', $detail);
|
||||||
|
View::assign('admin_id', $this->adminInfo['id']);
|
||||||
|
return view('nk/educationlive/read',['url'=>$this->url]);
|
||||||
|
}else{
|
||||||
|
throw new \think\exception\HttpException(404, '找不到页面');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 添加
|
||||||
|
*/
|
||||||
|
function Add(){
|
||||||
|
if (request()->isAjax()) {
|
||||||
|
$params= get_params();
|
||||||
|
$params['category_id']=$this->category_id;
|
||||||
|
// unset($params['amp;']);
|
||||||
|
$this->addArticle($params, function($aid)use($params){
|
||||||
|
$params['article_id'] = $aid;
|
||||||
|
return Db::table(self::ARTICLE_EDUCATION_LIVE)->strict(false)->field(true)->insertGetId($params);
|
||||||
|
});
|
||||||
|
}else{
|
||||||
|
View::assign('editor', get_system_config('other','editor'));
|
||||||
|
View::assign('url', $this->url);
|
||||||
|
// 获取用户信息
|
||||||
|
$this->users = Db::table('fa_szxc_information_usermsg')->where('status',1)->field('user_id,name')->select();
|
||||||
|
View::assign('users', $this->users);
|
||||||
|
$street = Db::table('fa_geo_area')->where(['switch' => 1, 'city_code' => '510500'])
|
||||||
|
->field('area_id id,area_code code,area_name name')
|
||||||
|
->select();
|
||||||
|
View::assign('street', $street);
|
||||||
|
return view('nk/educationlive/add');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 编辑
|
||||||
|
*/
|
||||||
|
function Edit(){
|
||||||
|
$params= get_params();
|
||||||
|
$aid = isset($params['id']) ? $params['id'] : 0;
|
||||||
|
if (request()->isAjax()) {
|
||||||
|
$this->updateEditData($params, $aid, function($param)use($aid){
|
||||||
|
if (!empty($param['tags_id'])){
|
||||||
|
Db::table(self::ARTICLE_EDUCATION_LIVE)->where('article_id',$aid)->update(['tags_id'=>$param['tags_id']]);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
}else{
|
||||||
|
|
||||||
|
$this->getEditData($params, $aid, function()use($aid){
|
||||||
|
return Db::table(self::ARTICLE_EDUCATION_LIVE)->field('lesson_period,tag_ids as series_num')->where('article_id', $aid)->find();
|
||||||
|
});
|
||||||
|
|
||||||
|
}
|
||||||
|
return view('nk/educationlive/edit',['url'=>$this->url]);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除
|
||||||
|
*/
|
||||||
|
function Del(){
|
||||||
|
$param = get_params();
|
||||||
|
$id = isset($param['id']) ? $param['id'] : 0;
|
||||||
|
// $type = isset($param['type']) ? $param['type'] : 0;
|
||||||
|
|
||||||
|
// 此处同时删除两个表
|
||||||
|
$res = $this->delArticle($id, function($id){
|
||||||
|
$vid = Db::table(self::ARTICLE_EDUCATION_LIVE)->where('article_id', $id)->value('id');
|
||||||
|
if (!empty($vid)) {
|
||||||
|
return Db::table(self::ARTICLE_EDUCATION_LIVE)->where('id', $vid)->delete();
|
||||||
|
}else{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
if ($res["code"]==1){
|
||||||
|
return to_assign(1, $res['msg']);
|
||||||
|
}else{
|
||||||
|
return to_assign();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
21
app/admin/controller/nk/HouseDecorationCase.php
Normal file
21
app/admin/controller/nk/HouseDecorationCase.php
Normal file
@ -0,0 +1,21 @@
|
|||||||
|
<?php
|
||||||
|
namespace app\admin\controller\nk;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 房屋装修
|
||||||
|
* -- 精品案例
|
||||||
|
*/
|
||||||
|
class HouseDecorationCase extends ArticleCommon{
|
||||||
|
function __construct()
|
||||||
|
{
|
||||||
|
$this->category_id = 371;
|
||||||
|
$this->url=[
|
||||||
|
'/admin/nk.house_decoration_case/index?category_id='.$this->category_id,
|
||||||
|
'/admin/nk.house_decoration_case/add',
|
||||||
|
'/admin/nk.house_decoration_case/edit',
|
||||||
|
'/admin/nk.house_decoration_case/del',
|
||||||
|
'/admin/nk.house_decoration_case/read',
|
||||||
|
];
|
||||||
|
}
|
||||||
|
}
|
21
app/admin/controller/nk/HouseDecorationCompany.php
Normal file
21
app/admin/controller/nk/HouseDecorationCompany.php
Normal file
@ -0,0 +1,21 @@
|
|||||||
|
<?php
|
||||||
|
namespace app\admin\controller\nk;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 房屋装修
|
||||||
|
* -- 推荐商家
|
||||||
|
*/
|
||||||
|
class HouseDecorationCompany extends ArticleCommon{
|
||||||
|
function __construct()
|
||||||
|
{
|
||||||
|
$this->category_id = 372;
|
||||||
|
$this->url=[
|
||||||
|
'/admin/nk.house_decoration_company/index?category_id='.$this->category_id,
|
||||||
|
'/admin/nk.house_decoration_company/add',
|
||||||
|
'/admin/nk.house_decoration_company/edit',
|
||||||
|
'/admin/nk.house_decoration_company/del',
|
||||||
|
'/admin/nk.house_decoration_company/read',
|
||||||
|
];
|
||||||
|
}
|
||||||
|
}
|
21
app/admin/controller/nk/PublicBenefitActivities.php
Normal file
21
app/admin/controller/nk/PublicBenefitActivities.php
Normal file
@ -0,0 +1,21 @@
|
|||||||
|
<?php
|
||||||
|
namespace app\admin\controller\nk;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 民生公益
|
||||||
|
* -- 公益活动
|
||||||
|
*/
|
||||||
|
class PublicBenefitActivities extends ArticleCommon{
|
||||||
|
function __construct()
|
||||||
|
{
|
||||||
|
$this->adminInfo = get_login_admin();
|
||||||
|
$this->category_id = 369;
|
||||||
|
$this->url=[
|
||||||
|
'/admin/nk.publicbenefitactivities/index?category_id='.$this->category_id,
|
||||||
|
'/admin/nk.public_benefit_activities/add',
|
||||||
|
'/admin/nk.public_benefit_activities/edit',
|
||||||
|
'/admin/nk.public_benefit_activities/del',
|
||||||
|
'/admin/nk.public_benefit_activities/read',
|
||||||
|
];
|
||||||
|
}
|
||||||
|
}
|
198
app/admin/controller/nk/PublicBenefitEnroll.php
Normal file
198
app/admin/controller/nk/PublicBenefitEnroll.php
Normal file
@ -0,0 +1,198 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace app\admin\controller\nk;
|
||||||
|
|
||||||
|
use think\db\exception\DbException as ExceptionDbException;
|
||||||
|
use think\exception\ValidateException;
|
||||||
|
use think\facade\Db;
|
||||||
|
use think\facade\View;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 民生公益
|
||||||
|
* -- 公益项目
|
||||||
|
*
|
||||||
|
|
||||||
|
CREATE TABLE `fa_article_public_benefit` (
|
||||||
|
`id` int unsigned NOT NULL AUTO_INCREMENT COMMENT '主键ID',
|
||||||
|
`article_id` int unsigned NOT NULL COMMENT '文章id',
|
||||||
|
`promoter` varchar(255) NOT NULL DEFAULT '' COMMENT '发起人',
|
||||||
|
`enrolled_num` int unsigned NOT NULL COMMENT '已报名人数',
|
||||||
|
`is_enrolled` tinyint unsigned NOT NULL DEFAULT '0' COMMENT '是否报名',
|
||||||
|
PRIMARY KEY (`id`),
|
||||||
|
UNIQUE KEY `article_id` (`article_id`)
|
||||||
|
) ENGINE=InnoDB AUTO_INCREMENT=6 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci COMMENT='民生公益类(公益项目报名)文章扩展表';
|
||||||
|
|
||||||
|
*/
|
||||||
|
class PublicBenefitEnroll extends ArticleCommon{
|
||||||
|
|
||||||
|
const ARTICLE_PUBLIC_BENEFIT = 'fa_article_public_benefit';
|
||||||
|
|
||||||
|
function __construct()
|
||||||
|
{
|
||||||
|
$this->adminInfo = get_login_admin();
|
||||||
|
$this->category_id = 368;
|
||||||
|
$this->url=[
|
||||||
|
'/admin/nk.public_benefit_enroll/index?category_id='.$this->category_id,
|
||||||
|
'/admin/nk.public_benefit_enroll/add',
|
||||||
|
'/admin/nk.public_benefit_enroll/edit',
|
||||||
|
'/admin/nk.public_benefit_enroll/del',
|
||||||
|
'/admin/nk.public_benefit_enroll/read',
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 添加
|
||||||
|
*/
|
||||||
|
function Add(){
|
||||||
|
if (request()->isAjax()) {
|
||||||
|
$params= get_params();
|
||||||
|
$params['category_id']=$this->category_id;
|
||||||
|
// unset($params['amp;']);
|
||||||
|
|
||||||
|
// 更新文章信息
|
||||||
|
$this->addArticle($params, function($aid)use($params){
|
||||||
|
$params['article_id'] = $aid;
|
||||||
|
// 更新文章相关的报名信息
|
||||||
|
return Db::table(ARTICLE_EDUCATION_LIVE)->strict(false)->field(true)->insertGetId(['article_id'=>$aid,'promoter'=>$params['promoter'],'enrolled_num'=>$params['enrolled_num']]);
|
||||||
|
});
|
||||||
|
}else{
|
||||||
|
View::assign('editor', get_system_config('other','editor'));
|
||||||
|
View::assign('url', $this->url);
|
||||||
|
// 获取用户信息
|
||||||
|
$this->users = Db::table('fa_szxc_information_usermsg')->where('status',1)->field('user_id,name')->select();
|
||||||
|
View::assign('users', $this->users);
|
||||||
|
$street = Db::table('fa_geo_area')->where(['switch' => 1, 'city_code' => '510500'])
|
||||||
|
->field('area_id id,area_code code,area_name name')
|
||||||
|
->select();
|
||||||
|
View::assign('street', $street);
|
||||||
|
return view('nk/publicbenefitenroll/add');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查看
|
||||||
|
*/
|
||||||
|
function Read(){
|
||||||
|
$param = get_params();
|
||||||
|
$id = isset($param['id']) ? $param['id'] : 0;
|
||||||
|
$detail = Db::table('fa_article')->where('id',$id)->withAttr('enroll', function($value, $data)use($id){
|
||||||
|
return Db::table(self::ARTICLE_PUBLIC_BENEFIT)->field('promoter,enrolled_num')->where('article_id', $id)->find();
|
||||||
|
})->find();
|
||||||
|
|
||||||
|
if (!empty($detail)) {
|
||||||
|
$detail['comment'] = Db::table('fa_article_comment')
|
||||||
|
->where('vote_id',$id)
|
||||||
|
->withAttr('user_info',function ($value,$data){
|
||||||
|
return Db::table('fa_szxc_information_usermsg')->where('user_id',$data['user_id'])->value('name');
|
||||||
|
})->select();
|
||||||
|
View::assign('detail', $detail);
|
||||||
|
View::assign('admin_id', $this->adminInfo['id']);
|
||||||
|
return view('nk/publicbenefitenroll/read',['url'=>$this->url]);
|
||||||
|
}else{
|
||||||
|
throw new \think\exception\HttpException(404, '找不到页面');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 公益项目报名修改
|
||||||
|
*/
|
||||||
|
function Edit(){
|
||||||
|
$param= get_params();
|
||||||
|
$id = isset($param['id']) ? $param['id'] : 0;
|
||||||
|
if (request()->isAjax()) {
|
||||||
|
try {
|
||||||
|
validate(\app\admin\validate\nk\ArticleValidate::class)->check($param);
|
||||||
|
} catch (ValidateException $e) {
|
||||||
|
// 验证失败 输出错误信息
|
||||||
|
return to_assign(1, $e->getError());
|
||||||
|
}
|
||||||
|
|
||||||
|
$adds=Db::table('fa_szxc_information_useraddress')->where('admin_id',$this->adminInfo['id'])->find();
|
||||||
|
if($this->adminInfo['position_id'] == 1) { //是超级管理员
|
||||||
|
if(empty($param['county'])){
|
||||||
|
$param['county']=$adds['area_id'];
|
||||||
|
}
|
||||||
|
if(empty($param['township'])){
|
||||||
|
$param['township']=$adds['street_id'];
|
||||||
|
}
|
||||||
|
if(empty($param['village'])){
|
||||||
|
$param['village']=$adds['village_id'];
|
||||||
|
}
|
||||||
|
if(empty($param['user_id'])){
|
||||||
|
$param['user_id']=$adds['user_id'];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 更新文章信息
|
||||||
|
$res=Db::table('fa_article')->where('id',$param['id'])->strict(false)->field(true)->update($param);
|
||||||
|
// 更新文章相关的报名信息
|
||||||
|
if (!empty($param['promoter'] || !empty($param['enrolled_num']))){
|
||||||
|
$res = Db::table(self::ARTICLE_PUBLIC_BENEFIT)->where('article_id',$id)->update(['promoter'=>$param['promoter'],'enrolled_num'=>$param['enrolled_num']]);
|
||||||
|
}
|
||||||
|
if ($res){
|
||||||
|
// 更新文章相关的投票信息
|
||||||
|
if(!empty($param['is_vote']) && $param['is_vote']==1){
|
||||||
|
Db::table('fa_article_vote_side_tables')->where('article_id',$param['id'])->update(['end_time'=>$param['end_time']]);
|
||||||
|
}
|
||||||
|
return to_assign();
|
||||||
|
}else{
|
||||||
|
return to_assign(1, '操作失败,原因:'.$res);
|
||||||
|
}
|
||||||
|
}else{
|
||||||
|
// 获取指定公益项目文章
|
||||||
|
$detail = Db::table('fa_article')->where('id',$id)->withAttr('enroll', function($value, $data)use($id){
|
||||||
|
return Db::table(self::ARTICLE_PUBLIC_BENEFIT)->field('promoter,enrolled_num')->where('article_id', $id)->find();
|
||||||
|
})->find();
|
||||||
|
View::assign('editor', get_system_config('other','editor'));
|
||||||
|
|
||||||
|
// 获取此文章的用户信息
|
||||||
|
if (!empty($detail)) {
|
||||||
|
// echo '<pre>';print_r($detail);
|
||||||
|
View::assign('detail', $detail);
|
||||||
|
// 获取用户信息
|
||||||
|
$this->users = Db::table('fa_szxc_information_usermsg')->where('status',1)->field('user_id,name')->select();
|
||||||
|
View::assign('users', $this->users);
|
||||||
|
$street = Db::table('fa_geo_area')->where(['switch' => 1, 'city_code' => '510500'])
|
||||||
|
->field('area_id id,area_code code,area_name name')
|
||||||
|
->select();
|
||||||
|
View::assign('street', $street);
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
throw new \think\exception\HttpException(404, '找不到页面');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return view('nk/publicbenefitenroll/edit',['url'=>$this->url]);
|
||||||
|
}
|
||||||
|
|
||||||
|
function Del(){
|
||||||
|
$param = get_params();
|
||||||
|
$id = isset($param['id']) ? $param['id'] : 0;
|
||||||
|
// $type = isset($param['type']) ? $param['type'] : 0;
|
||||||
|
|
||||||
|
// 此处同时删除两个表
|
||||||
|
Db::startTrans();
|
||||||
|
|
||||||
|
try{
|
||||||
|
$res1 = Db::table('fa_article')->where('id',$id)->delete();
|
||||||
|
|
||||||
|
$pid = Db::table(self::ARTICLE_PUBLIC_BENEFIT)->where('article_id', $id)->value('id');
|
||||||
|
|
||||||
|
if (!empty($pid)) {
|
||||||
|
$res2 = Db::table(self::ARTICLE_PUBLIC_BENEFIT)->where('article_id', $pid)->delete();
|
||||||
|
}else{
|
||||||
|
$pid = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
}catch (ExceptionDbException $e){
|
||||||
|
Db::rollback();
|
||||||
|
$res1 = $pid = '';
|
||||||
|
return to_assign(1, '操作失败,原因:'.$e->getMessage());
|
||||||
|
}
|
||||||
|
if ($res1 && $pid){
|
||||||
|
Db::commit();
|
||||||
|
return to_assign();
|
||||||
|
}else{
|
||||||
|
return to_assign(1, '操作失败,原因1:'.$res1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
263
app/admin/controller/nk/common/Article.php
Normal file
263
app/admin/controller/nk/common/Article.php
Normal file
@ -0,0 +1,263 @@
|
|||||||
|
<?php
|
||||||
|
namespace app\admin\controller\nk\common;
|
||||||
|
|
||||||
|
use think\db\exception\DbException as ExceptionDbException;
|
||||||
|
use think\exception\ValidateException;
|
||||||
|
use app\admin\BaseController;
|
||||||
|
use think\facade\Db;
|
||||||
|
use think\facade\View;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 文章处理
|
||||||
|
* 公共父类
|
||||||
|
*/
|
||||||
|
class Article extends BaseController {
|
||||||
|
|
||||||
|
const ARTICLE = 'fa_article';
|
||||||
|
|
||||||
|
protected $category_id;
|
||||||
|
|
||||||
|
function __construct(){
|
||||||
|
$this->adminInfo = get_login_admin();
|
||||||
|
// $this->pid = 361;
|
||||||
|
$this->category_id = 362;
|
||||||
|
$this->url=[
|
||||||
|
'/admin/nk.culturatour/index?category_id='.$this->category_id,
|
||||||
|
'/admin/nk.culturatour/add',
|
||||||
|
'/admin/nk.culturatour/edit',
|
||||||
|
'/admin/nk.culturatour/del',
|
||||||
|
'/admin/nk.culturatour/read',
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 文章列表
|
||||||
|
*/
|
||||||
|
function Index(){
|
||||||
|
if (request()->isAjax()) {
|
||||||
|
$params= get_params();
|
||||||
|
$params['category_id']=$this->category_id;
|
||||||
|
|
||||||
|
$where = ['category_id'=>$this->category_id];
|
||||||
|
$list = Db::table('fa_article')->field('id')->where($where)
|
||||||
|
->page(1)
|
||||||
|
->limit(1)
|
||||||
|
->order('id desc')
|
||||||
|
->select();
|
||||||
|
(new Article())->index($params);
|
||||||
|
}
|
||||||
|
return view('nk/article/index',['url'=>$this->url]);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查看文章 【无关联表】
|
||||||
|
*/
|
||||||
|
function Read(){
|
||||||
|
$params = get_params();
|
||||||
|
(new Article())->read($params);
|
||||||
|
|
||||||
|
return view('nk/article/read',['url'=>$this->url]);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 添加文章【无关联表】
|
||||||
|
*/
|
||||||
|
function Add(){
|
||||||
|
if (request()->isAjax()) {
|
||||||
|
$params= get_params();
|
||||||
|
$params['category_id']=$this->category_id;
|
||||||
|
// unset($params['amp;']);
|
||||||
|
(new Article())->add($params);
|
||||||
|
}else{
|
||||||
|
View::assign('editor', get_system_config('other','editor'));
|
||||||
|
View::assign('url', $this->url);
|
||||||
|
// 获取用户信息
|
||||||
|
$this->users = Db::table('fa_szxc_information_usermsg')->where('status',1)->field('user_id,name')->select();
|
||||||
|
View::assign('users', $this->users);
|
||||||
|
$street = Db::table('fa_geo_area')->where(['switch' => 1, 'city_code' => '510500'])
|
||||||
|
->field('area_id id,area_code code,area_name name')
|
||||||
|
->select();
|
||||||
|
View::assign('street', $street);
|
||||||
|
return view('nk/article/add');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 编辑文章 【无关联表】
|
||||||
|
*/
|
||||||
|
function Edit(){
|
||||||
|
$params= get_params();
|
||||||
|
(new Article())->edit($params);
|
||||||
|
return view('nk/article/edit',['url'=>$this->url]);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除文章【无关联表】
|
||||||
|
*/
|
||||||
|
function Del(){
|
||||||
|
$params= get_params();
|
||||||
|
(new Article())->del($params);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 添加文章与关联表数据.
|
||||||
|
* 【有关联表】
|
||||||
|
*/
|
||||||
|
function addArticle($param, $callback){
|
||||||
|
// 检验完整性
|
||||||
|
try {
|
||||||
|
validate(\app\admin\validate\nk\ArticleValidate::class)->check($param);
|
||||||
|
} catch (ValidateException $e) {
|
||||||
|
// 验证失败 输出错误信息
|
||||||
|
return to_assign(1, $e->getError());
|
||||||
|
}
|
||||||
|
$adds=Db::table('fa_szxc_information_useraddress')->where('admin_id',$this->adminInfo['id'])->find();
|
||||||
|
if($this->adminInfo['position_id'] != 1) { //不是超级管理员
|
||||||
|
$param['county']=$adds['area_id'];
|
||||||
|
$param['township']=$adds['street_id'];
|
||||||
|
$param['village']=$adds['village_id'];
|
||||||
|
$param['user_id']=$adds['user_id'];
|
||||||
|
}else{
|
||||||
|
if(empty($param['county'])){
|
||||||
|
$param['county']=$adds['area_id'];
|
||||||
|
}
|
||||||
|
if(empty($param['township'])){
|
||||||
|
$param['township']=$adds['street_id'];
|
||||||
|
}
|
||||||
|
if(empty($param['village'])){
|
||||||
|
$param['village']=$adds['village_id'];
|
||||||
|
}
|
||||||
|
if(empty($param['user_id'])){
|
||||||
|
$param['user_id']=$adds['user_id'];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$param['view_time']=date('Y-m-d H:i:s');
|
||||||
|
if(empty($param['category_type'])){
|
||||||
|
$param['category_type'] = 0;
|
||||||
|
}
|
||||||
|
if(empty($param['end_time'])){
|
||||||
|
$param['end_time'] = date('Y-m-d H:i:s');
|
||||||
|
}
|
||||||
|
|
||||||
|
Db::startTrans();
|
||||||
|
try{
|
||||||
|
// 新建文章
|
||||||
|
$aid = Db::table('fa_article')->strict(false)->field(true)->insertGetId($param);
|
||||||
|
|
||||||
|
// 新建文章相关表的信息
|
||||||
|
$pid = $callback($aid);
|
||||||
|
}catch(ExceptionDbException $e){
|
||||||
|
Db::rollback();
|
||||||
|
return to_assign(1, '操作失败,原因:'.$e->getMessage());
|
||||||
|
}
|
||||||
|
if (!empty($aid) && !empty($pid)) {
|
||||||
|
Db::commit();
|
||||||
|
if(!empty($param['is_vote']) && $param['is_vote']==1){
|
||||||
|
$data=['start_time'=>date('Y-m-d H:i:s'),'end_time'=>$param['end_time'],'article_id'=>$aid,'county'=>$adds['area_id'],'township'=>$adds['street_id'],'village'=>$adds['village_id']];
|
||||||
|
Db::table('fa_article_vote_side_tables')->insert($data);
|
||||||
|
}
|
||||||
|
return to_assign(0,'操作成功',['aid'=>$aid]);
|
||||||
|
}
|
||||||
|
|
||||||
|
return to_assign(1, '操作失败,原因:'.$aid);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 1. 获取编辑页展示文章与关联表数据.
|
||||||
|
* 【有关联表】
|
||||||
|
*/
|
||||||
|
function getEditData($param, $id, $callback){
|
||||||
|
|
||||||
|
// 获取指定文章
|
||||||
|
$detail = Db::table('fa_article')->where('id',$id)->withAttr('lesson',
|
||||||
|
$callback
|
||||||
|
)->find();
|
||||||
|
|
||||||
|
View::assign('editor', get_system_config('other','editor'));
|
||||||
|
|
||||||
|
// 获取此文章的用户信息
|
||||||
|
if (!empty($detail)) {
|
||||||
|
View::assign('detail', $detail);
|
||||||
|
//获取用户信息
|
||||||
|
$this->users = Db::table('fa_szxc_information_usermsg')->where('status',1)->field('user_id,name')->select();
|
||||||
|
View::assign('users', $this->users);
|
||||||
|
$street = Db::table('fa_geo_area')->where(['switch' => 1, 'city_code' => '510500'])
|
||||||
|
->field('area_id id,area_code code,area_name name')
|
||||||
|
->select();
|
||||||
|
View::assign('street', $street);
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
throw new \think\exception\HttpException(404, '找不到页面');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 2. ajax提交编辑更新文章与关联表数据.
|
||||||
|
* 【有关联表】
|
||||||
|
*/
|
||||||
|
function updateEditData($param, $id, $callback){
|
||||||
|
try {
|
||||||
|
validate(\app\admin\validate\nk\ArticleValidate::class)->check($param);
|
||||||
|
} catch (ValidateException $e) {
|
||||||
|
// 验证失败 输出错误信息
|
||||||
|
return to_assign(1, $e->getError());
|
||||||
|
}
|
||||||
|
|
||||||
|
$adds=Db::table('fa_szxc_information_useraddress')->where('admin_id',$this->adminInfo['id'])->find();
|
||||||
|
if($this->adminInfo['position_id'] == 1) { //是超级管理员
|
||||||
|
if(empty($param['county'])){
|
||||||
|
$param['county']=$adds['area_id'];
|
||||||
|
}
|
||||||
|
if(empty($param['township'])){
|
||||||
|
$param['township']=$adds['street_id'];
|
||||||
|
}
|
||||||
|
if(empty($param['village'])){
|
||||||
|
$param['village']=$adds['village_id'];
|
||||||
|
}
|
||||||
|
if(empty($param['user_id'])){
|
||||||
|
$param['user_id']=$adds['user_id'];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 更新文章信息
|
||||||
|
$res=Db::table('fa_article')->where('id',$id)->strict(false)->field(true)->update($param);
|
||||||
|
|
||||||
|
// 更新文章相关的扩展信息
|
||||||
|
$callback($param);
|
||||||
|
if ($res){
|
||||||
|
// 更新文章相关的投票信息
|
||||||
|
if(!empty($param['is_vote']) && $param['is_vote']==1){
|
||||||
|
Db::table('fa_article_vote_side_tables')->where('article_id',$id)->update(['end_time'=>$param['end_time']]);
|
||||||
|
}
|
||||||
|
return to_assign();
|
||||||
|
}else{
|
||||||
|
return to_assign(1, '操作失败,原因:'.$res);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 文章与关联表删除
|
||||||
|
* 【有关联表】
|
||||||
|
*/
|
||||||
|
function delArticle($id, $callback){
|
||||||
|
|
||||||
|
// 此处同时删除两个表
|
||||||
|
Db::startTrans();
|
||||||
|
try{
|
||||||
|
$res1 = Db::table('fa_article')->where('id',$id)->delete();
|
||||||
|
$pid = $callback($id);
|
||||||
|
}catch (ExceptionDbException $e){
|
||||||
|
Db::rollback();
|
||||||
|
$res1 = $pid = '';
|
||||||
|
return ["code"=>1, "msg"=>'操作失败,原因:'.$e->getMessage()];
|
||||||
|
}
|
||||||
|
if ($res1 && $pid){
|
||||||
|
Db::commit();
|
||||||
|
return ["code"=>0, "msg"=>'操作成功'];
|
||||||
|
}else{
|
||||||
|
return ["code"=>1, "msg"=>'操作失败,原因:两表一起删除失败[主表:'.$res1.'][联表:'.$pid.']'];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -18,7 +18,7 @@ class StoreProduct extends Model
|
|||||||
{
|
{
|
||||||
$rows = empty($param['limit']) ? get_config('app . page_size') : $param['limit'];
|
$rows = empty($param['limit']) ? get_config('app . page_size') : $param['limit'];
|
||||||
$order = empty($param['order']) ? 'product_id desc' : $param['order'];
|
$order = empty($param['order']) ? 'product_id desc' : $param['order'];
|
||||||
$list = self::where($where)->field('product_id,mer_id,store_name,store_info,keyword,brand_id,cate_id,unit_name,sort,sales,price,cost,ot_price,stock,is_hot,is_benefit,temp_id,spec_type,image,slider_image,once_max_count,once_min_count,integral_rate,integral_total,integral_price_total,labels,delivery_free,type,extend,pay_limit,svip_price_type,svip_price,mer_svip_status,param_temp_id')->order($order)->paginate($rows, false, ['query' => $param]);
|
$list = self::where($where)->order($order)->paginate($rows, false, ['query' => $param]);
|
||||||
return $list;
|
return $list;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
104
app/admin/view/index/main2.html
Normal file
104
app/admin/view/index/main2.html
Normal file
@ -0,0 +1,104 @@
|
|||||||
|
{extend name="common/base"/}
|
||||||
|
{block name="style"}
|
||||||
|
<style type="text/css">
|
||||||
|
.dashboard-num table {width: 100%;}
|
||||||
|
.dashboard-num td {text-align: center; padding: 16px 0; width: 20%;border-left: 1px solid #f1f1f1; position: relative;}
|
||||||
|
.dashboard-num td:nth-child(1) { border-left: none}
|
||||||
|
.dashboard-num .num-title { padding-bottom: 10px; color: #999;}
|
||||||
|
.dashboard-num .blue {font-size: 20px; font-weight: 300;}
|
||||||
|
.dashboard-num td .badge {position: absolute;top: 0; right: 0;}
|
||||||
|
.dashboard-num td .badge span { padding: 2px 4px; font-size: 12px; border-radius: 0 0 0 4px;}
|
||||||
|
.dashboard-total td {border-top: 1px solid #f1f1f1}
|
||||||
|
.dashboard-logs .layui-timeline-item {padding-bottom: 1px;}
|
||||||
|
.info-td { width: 90px; text-align: right;background-color: #fafafa; color: #999; padding: 5px 3px;}
|
||||||
|
.info-td {width: 90px; text-align: right;background-color: #fafafa; color: #999; padding: 5px 3px;}
|
||||||
|
.layui-card-body .layui-timeline-title {
|
||||||
|
padding-bottom: 0;
|
||||||
|
font-size: 14px;
|
||||||
|
}
|
||||||
|
.layui-card-body .layui-timeline-item {
|
||||||
|
padding-bottom: 5px;
|
||||||
|
}
|
||||||
|
.layui-sales {
|
||||||
|
margin-bottom: 0;
|
||||||
|
overflow: hidden;
|
||||||
|
color: rgba(0,0,0,.85);
|
||||||
|
font-size: 30px;
|
||||||
|
padding: 25px;
|
||||||
|
text-align: center;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
{/block}
|
||||||
|
<!-- 主体 -->
|
||||||
|
{block name="body"}
|
||||||
|
<div class="p-3">
|
||||||
|
<div class="layui-row layui-col-space15">
|
||||||
|
<div class="layui-col-xs6 layui-col-md3">
|
||||||
|
<div class="layui-card">
|
||||||
|
<div class="layui-card-header">今日订单金额<span class="layui-badge layui-badge-green pull-right">日</span></div>
|
||||||
|
<div class="layui-card-body">
|
||||||
|
<div class="layui-sales">{$day_price}</div>
|
||||||
|
<!-- <div class="layui-sales-info" style="height: 100px;">-->
|
||||||
|
<!-- 周同比 <span>12%</span>-->
|
||||||
|
<!-- <i class="layui-edge layui-edge-top" style="border-bottom-color: green"></i>-->
|
||||||
|
<!-- 日同比 <span>3%</span>-->
|
||||||
|
<!-- <i class="layui-edge layui-edge-bottom" style="border-top-color: red"></i>-->
|
||||||
|
<!-- <fieldset class="layui-elem-field layui-field-title" style="margin-top: 66px;"></fieldset>-->
|
||||||
|
<!-- </div>-->
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="layui-col-xs6 layui-col-md3">
|
||||||
|
<div class="layui-card">
|
||||||
|
<div class="layui-card-header">今日订单数<span class="layui-badge layui-badge-green pull-right">日</span></div>
|
||||||
|
<div class="layui-card-body">
|
||||||
|
<div class="layui-sales">{$day_order}</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="layui-col-xs6 layui-col-md3">
|
||||||
|
<div class="layui-card">
|
||||||
|
<div class="layui-card-header">当月订单金额<span class="layui-badge layui-badge-green pull-right">月</span></div>
|
||||||
|
<div class="layui-card-body">
|
||||||
|
<div class="layui-sales">{$month_price}</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="layui-col-xs6 layui-col-md3">
|
||||||
|
<div class="layui-card">
|
||||||
|
<div class="layui-card-header">当月订单数<span class="layui-badge layui-badge-green pull-right">月</span></div>
|
||||||
|
<div class="layui-card-body">
|
||||||
|
<div class="layui-sales">{$month_order}</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div id="your-element-selector" style="height: 100%;margin-top: 20px;padding-top:26px">
|
||||||
|
<a href="{$urls}" target="_blank" style="font-size: 100px;
|
||||||
|
color: aliceblue;
|
||||||
|
display: block;
|
||||||
|
text-align: center;
|
||||||
|
text-decoration:none;
|
||||||
|
top: 40%;">跳转大屏</a></div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
{/block}
|
||||||
|
<!-- /主体 -->
|
||||||
|
|
||||||
|
<!-- 脚本 -->
|
||||||
|
{block name="script"}
|
||||||
|
<script src="https://cdnjs.cloudflare.com/ajax/libs/three.js/r134/three.min.js"></script>
|
||||||
|
<script src="https://cdn.jsdelivr.net/npm/vanta@0.5.24/dist/vanta.waves.min.js"></script>
|
||||||
|
<script>
|
||||||
|
VANTA.WAVES({
|
||||||
|
el: "#your-element-selector",
|
||||||
|
mouseControls: true,
|
||||||
|
touchControls: true,
|
||||||
|
gyroControls: false,
|
||||||
|
scale: 1.00,
|
||||||
|
scaleMobile: 1.00
|
||||||
|
})
|
||||||
|
</script>
|
||||||
|
{/block}
|
||||||
|
<!-- /脚本 -->
|
63
app/admin/view/index/main3.html
Normal file
63
app/admin/view/index/main3.html
Normal file
@ -0,0 +1,63 @@
|
|||||||
|
{extend name="common/base"/}
|
||||||
|
{block name="style"}
|
||||||
|
<style type="text/css">
|
||||||
|
.dashboard-num table {width: 100%;}
|
||||||
|
.dashboard-num td {text-align: center; padding: 16px 0; width: 20%;border-left: 1px solid #f1f1f1; position: relative;}
|
||||||
|
.dashboard-num td:nth-child(1) { border-left: none}
|
||||||
|
.dashboard-num .num-title { padding-bottom: 10px; color: #999;}
|
||||||
|
.dashboard-num .blue {font-size: 20px; font-weight: 300;}
|
||||||
|
.dashboard-num td .badge {position: absolute;top: 0; right: 0;}
|
||||||
|
.dashboard-num td .badge span { padding: 2px 4px; font-size: 12px; border-radius: 0 0 0 4px;}
|
||||||
|
.dashboard-total td {border-top: 1px solid #f1f1f1}
|
||||||
|
.dashboard-logs .layui-timeline-item {padding-bottom: 1px;}
|
||||||
|
.info-td { width: 90px; text-align: right;background-color: #fafafa; color: #999; padding: 5px 3px;}
|
||||||
|
.info-td {width: 90px; text-align: right;background-color: #fafafa; color: #999; padding: 5px 3px;}
|
||||||
|
.layui-card-body .layui-timeline-title {
|
||||||
|
padding-bottom: 0;
|
||||||
|
font-size: 14px;
|
||||||
|
}
|
||||||
|
.layui-card-body .layui-timeline-item {
|
||||||
|
padding-bottom: 5px;
|
||||||
|
}
|
||||||
|
.layui-sales {
|
||||||
|
margin-bottom: 0;
|
||||||
|
overflow: hidden;
|
||||||
|
color: rgba(0,0,0,.85);
|
||||||
|
font-size: 30px;
|
||||||
|
padding: 25px;
|
||||||
|
text-align: center;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
{/block}
|
||||||
|
<!-- 主体 -->
|
||||||
|
{block name="body"}
|
||||||
|
|
||||||
|
|
||||||
|
<div id="your-element-selector" style="height: 100%;margin-top: 20px;padding-top:26px">
|
||||||
|
<a href="{$urls}" target="_blank" style="font-size: 100px;
|
||||||
|
color: aliceblue;
|
||||||
|
display: block;
|
||||||
|
text-align: center;
|
||||||
|
text-decoration:none;
|
||||||
|
top: 40%;">跳转大屏</a></div>
|
||||||
|
|
||||||
|
|
||||||
|
{/block}
|
||||||
|
<!-- /主体 -->
|
||||||
|
|
||||||
|
<!-- 脚本 -->
|
||||||
|
{block name="script"}
|
||||||
|
<script src="https://cdnjs.cloudflare.com/ajax/libs/three.js/r134/three.min.js"></script>
|
||||||
|
<script src="https://cdn.jsdelivr.net/npm/vanta@0.5.24/dist/vanta.waves.min.js"></script>
|
||||||
|
<script>
|
||||||
|
VANTA.WAVES({
|
||||||
|
el: "#your-element-selector",
|
||||||
|
mouseControls: true,
|
||||||
|
touchControls: true,
|
||||||
|
gyroControls: false,
|
||||||
|
scale: 1.00,
|
||||||
|
scaleMobile: 1.00
|
||||||
|
})
|
||||||
|
</script>
|
||||||
|
{/block}
|
||||||
|
<!-- /脚本 -->
|
276
app/admin/view/nk/educationlive/add.html
Normal file
276
app/admin/view/nk/educationlive/add.html
Normal file
@ -0,0 +1,276 @@
|
|||||||
|
{extend name="common/base"/}
|
||||||
|
{block name="style"}
|
||||||
|
<style type="text/css">
|
||||||
|
.editormd-code-toolbar select {display: inline-block}
|
||||||
|
.editormd li {list-style: inherit;}
|
||||||
|
</style>
|
||||||
|
{/block}
|
||||||
|
<!-- 主体 -->
|
||||||
|
{block name="body"}
|
||||||
|
<form class="layui-form p-4">
|
||||||
|
<h3 class="pb-3">新建文章</h3>
|
||||||
|
<table class="layui-table layui-table-form">
|
||||||
|
<tr>
|
||||||
|
<td class="layui-td-gray">文章标题<font>*</font></td>
|
||||||
|
<td colspan="7"><input type="text" name="title" lay-verify="required" lay-reqText="请输入文章标题"
|
||||||
|
autocomplete="off" placeholder="请输入文章标题" class="layui-input"></td>
|
||||||
|
</tr>
|
||||||
|
{notempty name="is_vote"}
|
||||||
|
<tr>
|
||||||
|
<td class="layui-td-gray">结束时间<font>*</font></td>
|
||||||
|
<td colspan="7"> <input type="text" placeholder="yyyy-MM-dd" autocomplete="off" class="layui-input" id="test1" name="end_time">
|
||||||
|
<input type="hidden" name="is_vote" value="1">
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
{/notempty}
|
||||||
|
<tr>
|
||||||
|
<td class="layui-td-gray" style="vertical-align:top;">文章摘要</td>
|
||||||
|
<td colspan="3">
|
||||||
|
<textarea name="describe" placeholder="请输入摘要,不能超过200个字" class="layui-textarea"></textarea>
|
||||||
|
</td>
|
||||||
|
<td class="layui-td-gray" style="vertical-align:top;">缩略图</td>
|
||||||
|
<td>
|
||||||
|
<div class="layui-upload">
|
||||||
|
<button type="button" class="layui-btn layui-btn-sm" id="upload_btn_thumb">上传缩略图(尺寸:640x360)</button>
|
||||||
|
<div class="layui-upload-list" id="upload_box_thumb" style="width: 120px; height:66px; overflow: hidden;">
|
||||||
|
<img src="" onerror="javascript:this.src='{__GOUGU__}/gougu/images/nonepic600x360.jpg';this.onerror=null;" width="100" style="max-width: 100%; height:66px;"/>
|
||||||
|
<input type="hidden" name="image" value="">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td class="layui-td-gray" style="vertical-align:top;">课时<font>*</font></td>
|
||||||
|
<td>
|
||||||
|
<td>
|
||||||
|
<input type="number" name="esson_period" lay-verify="required" lay-reqText="请输入课时"
|
||||||
|
autocomplete="off" placeholder="请输入课时" class="layui-input"
|
||||||
|
value="">
|
||||||
|
</td>
|
||||||
|
<td>分钟</td>
|
||||||
|
</td>
|
||||||
|
<td class="layui-td-gray" style="vertical-align:top;">课程数</td>
|
||||||
|
<td>
|
||||||
|
<input type="number" name="lesson_num" lay-verify="required"
|
||||||
|
class="layui-input"
|
||||||
|
value="">
|
||||||
|
</td>
|
||||||
|
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td class="layui-td-gray">标签(多选)<font>*</font></td>
|
||||||
|
<td colspan="3">
|
||||||
|
<div class="layui-col-md6">
|
||||||
|
<div >
|
||||||
|
<div id="tags" ></div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
{if {:session('gougu_admin')['group_access']==1}
|
||||||
|
|
||||||
|
<tr>
|
||||||
|
<td class="layui-td-gray" style="vertical-align:top;">区县</td>
|
||||||
|
<td colspan="3">
|
||||||
|
<div class="layui-col-md6">
|
||||||
|
<div >
|
||||||
|
<select name="county" lay-filter="area_id" >
|
||||||
|
{volist name='street' id='vo'}
|
||||||
|
<option value="{$vo.code}" >{$vo.name}</option>
|
||||||
|
{/volist}
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td class="layui-td-gray" style="vertical-align:top;">街道/镇</td>
|
||||||
|
<td colspan="3">
|
||||||
|
<div class="layui-col-md6">
|
||||||
|
<div >
|
||||||
|
<div id="demo1" ></div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td class="layui-td-gray" style="vertical-align:top;">村/社区</td>
|
||||||
|
<td colspan="3">
|
||||||
|
<div class="layui-col-md6">
|
||||||
|
<div >
|
||||||
|
<div id="demo2" ></div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
|
||||||
|
<tr>
|
||||||
|
<td class="layui-td-gray">用户<font>*</font></td>
|
||||||
|
<td colspan="3">
|
||||||
|
<div class="layui-col-md6">
|
||||||
|
<select name="user_id" lay-verify="required" lay-search="">
|
||||||
|
<option value="" >请选择</option>
|
||||||
|
{volist name='users' id='vo'}
|
||||||
|
<option value="{$vo.user_id}" >{$vo.name}</option>
|
||||||
|
{/volist}
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
|
||||||
|
{/if}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<tr>
|
||||||
|
<td colspan="6" class="layui-td-gray" style="text-align:left">文章内容</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td colspan="6">
|
||||||
|
<textarea class="layui-textarea" id="container_content"></textarea>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
|
||||||
|
</table>
|
||||||
|
<div class="pt-3">
|
||||||
|
<button class="layui-btn layui-btn-normal" lay-submit="" lay-filter="webform">立即提交</button>
|
||||||
|
<button type="reset" class="layui-btn layui-btn-primary">重置</button>
|
||||||
|
</div>
|
||||||
|
</form>
|
||||||
|
{/block}
|
||||||
|
<!-- /主体 -->
|
||||||
|
|
||||||
|
<!-- 脚本 -->
|
||||||
|
{block name="script"}
|
||||||
|
<script src="/static/assets/js/xm-select.js"></script>
|
||||||
|
<script>
|
||||||
|
const editorType = '{$editor}';
|
||||||
|
var moduleInit = ['tool', 'tagpicker', 'tinymce'];
|
||||||
|
var group_access = "{:session('gougu_admin')['group_access']}"
|
||||||
|
function gouguInit() {
|
||||||
|
var form =layui.form, tool = layui.tool,tagspicker = layui.tagpicker,laydate=layui.laydate;
|
||||||
|
laydate.render({
|
||||||
|
elem: '#test1' //指定元素
|
||||||
|
});
|
||||||
|
//上传缩略图
|
||||||
|
var upload_thumb = layui.upload.render({
|
||||||
|
elem: '#upload_btn_thumb',
|
||||||
|
url: '/admin/api/upload',
|
||||||
|
done: function (res) {
|
||||||
|
//如果上传失败
|
||||||
|
if (res.code == 1) {
|
||||||
|
return layer.msg('上传失败');
|
||||||
|
}
|
||||||
|
//上传成功
|
||||||
|
$('#upload_box_thumb input').attr('value', res.data.filepath);
|
||||||
|
$('#upload_box_thumb img').attr('src', res.data.filepath);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
street();
|
||||||
|
village();
|
||||||
|
form.on('select(area_id)', function (data) {
|
||||||
|
street(data.value)
|
||||||
|
});
|
||||||
|
function street (id) {
|
||||||
|
var demo1 = xmSelect.render({
|
||||||
|
name: 'township',
|
||||||
|
el: '#demo1',
|
||||||
|
initValue: [],
|
||||||
|
prop: {
|
||||||
|
name: 'name',
|
||||||
|
value: 'code',
|
||||||
|
},
|
||||||
|
data: [],
|
||||||
|
radio: true,
|
||||||
|
disabled: group_access == 2 ||group_access == 4? true : false,
|
||||||
|
on: function (data) {
|
||||||
|
var arr = data.arr;
|
||||||
|
if(arr.length > 0){
|
||||||
|
village(arr[0]['code']);
|
||||||
|
}else{
|
||||||
|
village();
|
||||||
|
}
|
||||||
|
},
|
||||||
|
})
|
||||||
|
$.get('/api/geo/street?pcode=' + id, function (result) {
|
||||||
|
demo1.update({
|
||||||
|
data: result.data
|
||||||
|
})
|
||||||
|
});
|
||||||
|
}
|
||||||
|
function village (id) {
|
||||||
|
var demo2 = xmSelect.render({
|
||||||
|
name: 'village',
|
||||||
|
el: '#demo2',
|
||||||
|
initValue: [],
|
||||||
|
prop: {
|
||||||
|
name: 'name',
|
||||||
|
value: 'id',
|
||||||
|
},
|
||||||
|
data: [],
|
||||||
|
radio: true,
|
||||||
|
disabled: group_access == 2 ? true : false,
|
||||||
|
})
|
||||||
|
$.get('/api/geo/village?pcode=' + id, function (result) {
|
||||||
|
demo2.update({
|
||||||
|
data: result.data
|
||||||
|
})
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
function tags (id) {
|
||||||
|
var tag = xmSelect.render({
|
||||||
|
name: 'tag',
|
||||||
|
el: '#tags',
|
||||||
|
initValue: [],
|
||||||
|
prop: {
|
||||||
|
name: 'name',
|
||||||
|
value: 'code',
|
||||||
|
},
|
||||||
|
data: [],
|
||||||
|
radio: true,
|
||||||
|
disabled: group_access == 2 ||group_access == 4? true : false,
|
||||||
|
on: function (data) {
|
||||||
|
var arr = data.arr;
|
||||||
|
if(arr.length > 0){
|
||||||
|
village(arr[0]['code']);
|
||||||
|
}else{
|
||||||
|
village();
|
||||||
|
}
|
||||||
|
},
|
||||||
|
})
|
||||||
|
$.get('/api/geo/street?pcode=' + id, function (result) {
|
||||||
|
tag.update({
|
||||||
|
data: result.data
|
||||||
|
})
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
var editor = layui.tinymce;
|
||||||
|
var edit = editor.render({
|
||||||
|
selector: "#container_content",
|
||||||
|
height: 500
|
||||||
|
});
|
||||||
|
//监听提交
|
||||||
|
form.on('submit(webform)', function (data) {
|
||||||
|
data.field.content = tinyMCE.editors['container_content'].getContent();
|
||||||
|
if (data.field.content == '') {
|
||||||
|
layer.msg('请先完善文章内容');
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
let callback = function (e) {
|
||||||
|
layer.msg(e.msg);
|
||||||
|
if (e.code == 0) {
|
||||||
|
tool.tabRefresh(71);
|
||||||
|
tool.sideClose(1000);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
tool.post('{$url[1]}', data.field, callback);
|
||||||
|
return false;
|
||||||
|
});
|
||||||
|
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
{/block}
|
||||||
|
<!-- /脚本 -->
|
245
app/admin/view/nk/educationlive/edit.html
Normal file
245
app/admin/view/nk/educationlive/edit.html
Normal file
@ -0,0 +1,245 @@
|
|||||||
|
{extend name="common/base"/}
|
||||||
|
{block name="style"}
|
||||||
|
<style type="text/css">
|
||||||
|
.editormd-code-toolbar select {
|
||||||
|
display: inline-block
|
||||||
|
}
|
||||||
|
|
||||||
|
.editormd li {
|
||||||
|
list-style: inherit;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
{/block}
|
||||||
|
<!-- 主体 -->
|
||||||
|
{block name="body"}
|
||||||
|
<form class="layui-form p-4">
|
||||||
|
<h3 class="pb-3">编辑文章表</h3>
|
||||||
|
<table class="layui-table layui-table-form">
|
||||||
|
<tr>
|
||||||
|
<td class="layui-td-gray">文章标题<font>*</font></td>
|
||||||
|
<td colspan="7"><input type="text" name="title" lay-verify="required" lay-reqText="请输入文章标题"
|
||||||
|
autocomplete="off" placeholder="请输入文章标题" class="layui-input"
|
||||||
|
value="{$detail.title}"></td>
|
||||||
|
</tr>
|
||||||
|
{notempty name="is_vote"}
|
||||||
|
<tr>
|
||||||
|
<td class="layui-td-gray">结束时间<font>*</font></td>
|
||||||
|
<td colspan="7"> <input type="text" placeholder="yyyy-MM-dd" autocomplete="off" class="layui-input" id="test1" name="end_time">
|
||||||
|
<input type="hidden" name="is_vote" value="1">
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
{/notempty}
|
||||||
|
<tr>
|
||||||
|
<td class="layui-td-gray" style="vertical-align:top;">摘要</td>
|
||||||
|
<td colspan="3">
|
||||||
|
<textarea name="describe" placeholder="请输入摘要,不能超过200个字"
|
||||||
|
class="layui-textarea">{$detail.describe}</textarea>
|
||||||
|
</td>
|
||||||
|
<td class="layui-td-gray" style="vertical-align:top;">缩略图</td>
|
||||||
|
<td>
|
||||||
|
<div class="layui-upload">
|
||||||
|
<button type="button" class="layui-btn layui-btn-sm" id="upload_btn_thumb">
|
||||||
|
上传缩略图(尺寸:640x360)
|
||||||
|
</button>
|
||||||
|
<div class="layui-upload-list" id="upload_box_thumb"
|
||||||
|
style="width: 120px; height:66px; overflow: hidden;">
|
||||||
|
<img src="{$detail.image}"
|
||||||
|
onerror="javascript:this.src='{__GOUGU__}/gougu/images/nonepic600x360.jpg';this.onerror=null;"
|
||||||
|
style="max-width: 100%; height:66px;"/>
|
||||||
|
<input type="hidden" name="image" value="{$detail.image}">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td class="layui-td-gray">课时</td>
|
||||||
|
<td>{$detail.lesson.lesson_period}</td>
|
||||||
|
<td class="layui-td-gray">学习人数</td>
|
||||||
|
<td >{$detail.lesson.series_num}</td>
|
||||||
|
</tr>
|
||||||
|
{if {:session('gougu_admin')['group_access']==1}
|
||||||
|
|
||||||
|
<tr>
|
||||||
|
<td class="layui-td-gray" style="vertical-align:top;">区县</td>
|
||||||
|
<td colspan="3">
|
||||||
|
<div class="layui-col-md6">
|
||||||
|
<div >
|
||||||
|
<select name="county" lay-filter="area_id">
|
||||||
|
{volist name='street' id='vo'}
|
||||||
|
<option value="{$vo.code}" {if $detail.county==$vo.code} selected {/if}>{$vo.name}</option>
|
||||||
|
{/volist}
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td class="layui-td-gray" style="vertical-align:top;">街道/镇</td>
|
||||||
|
<td colspan="3">
|
||||||
|
<div class="layui-col-md6">
|
||||||
|
<div >
|
||||||
|
<div id="demo1" ></div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td class="layui-td-gray" style="vertical-align:top;">村/社区</td>
|
||||||
|
<td colspan="3">
|
||||||
|
<div class="layui-col-md6">
|
||||||
|
<div >
|
||||||
|
<div id="demo2" ></div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
|
||||||
|
<tr>
|
||||||
|
<td class="layui-td-gray">用户<font>*</font></td>
|
||||||
|
<td colspan="3">
|
||||||
|
<div class="layui-col-md6">
|
||||||
|
<select name="user_id" lay-verify="required" lay-search="">
|
||||||
|
<option value="" >请选择</option>
|
||||||
|
{volist name='users' id='vo'}
|
||||||
|
<option value="{$vo.user_id}" {if $detail.user_id==$vo.user_id} selected {/if}>{$vo.name}</option>
|
||||||
|
{/volist}
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
{/if}
|
||||||
|
|
||||||
|
<tr>
|
||||||
|
<td colspan="6" class="layui-td-gray" style="text-align:left">文章内容</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td colspan="6">
|
||||||
|
<textarea placeholder="请输入内容" class="layui-textarea"
|
||||||
|
id="container_content">{$detail.content}</textarea>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
</table>
|
||||||
|
<div class="pt-3">
|
||||||
|
<input type="hidden" name="id" value="{$detail.id}"/>
|
||||||
|
<button class="layui-btn layui-btn-normal" lay-submit="" lay-filter="webform">立即提交</button>
|
||||||
|
<button type="reset" class="layui-btn layui-btn-primary">重置</button>
|
||||||
|
</div>
|
||||||
|
</form>
|
||||||
|
{/block}
|
||||||
|
<!-- /主体 -->
|
||||||
|
|
||||||
|
<!-- 脚本 -->
|
||||||
|
{block name="script"}
|
||||||
|
<script src="/static/assets/js/xm-select.js"></script>
|
||||||
|
<script>
|
||||||
|
const editorType = '{$editor}';
|
||||||
|
var moduleInit;
|
||||||
|
if (editorType == 1) {
|
||||||
|
moduleInit = ['tool', 'tagpicker', 'tinymce'];
|
||||||
|
} else {
|
||||||
|
moduleInit = ['tool', 'tagpicker', 'editormd'];
|
||||||
|
}
|
||||||
|
var group_access = "{:session('gougu_admin')['group_access']}";
|
||||||
|
var area_id = "{$detail.county}";
|
||||||
|
var street_id = "{$detail.township}";
|
||||||
|
function gouguInit() {
|
||||||
|
var form =layui.form, tool = layui.tool,tagspicker = layui.tagpicker,laydate=layui.laydate;
|
||||||
|
laydate.render({
|
||||||
|
elem: '#test1' //指定元素
|
||||||
|
});
|
||||||
|
//上传缩略图
|
||||||
|
var upload_thumb = layui.upload.render({
|
||||||
|
elem: '#upload_btn_thumb',
|
||||||
|
url: '/admin/api/upload',
|
||||||
|
done: function (res) {
|
||||||
|
//如果上传失败
|
||||||
|
if (res.code == 1) {
|
||||||
|
layer.msg('上传失败');
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
//上传成功
|
||||||
|
$('#upload_box_thumb input').attr('value', res.data.filepath);
|
||||||
|
$('#upload_box_thumb img').attr('src', res.data.filepath);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
if (area_id != 0) {
|
||||||
|
street(area_id)
|
||||||
|
}
|
||||||
|
if (street_id != 0) {
|
||||||
|
village(street_id)
|
||||||
|
}
|
||||||
|
form.on('select(area_id)', function (data) {
|
||||||
|
street(data.value)
|
||||||
|
});
|
||||||
|
function street (id) {
|
||||||
|
var demo1 = xmSelect.render({
|
||||||
|
name: 'township',
|
||||||
|
el: '#demo1',
|
||||||
|
initValue: ["{$detail.township}"],
|
||||||
|
prop: {
|
||||||
|
name: 'name',
|
||||||
|
value: 'code',
|
||||||
|
},
|
||||||
|
data: [],
|
||||||
|
radio: true,
|
||||||
|
disabled: group_access == 2 ||group_access == 4? true : false,
|
||||||
|
on: function (data) {
|
||||||
|
var arr = data.arr;
|
||||||
|
if(arr.length > 0){
|
||||||
|
village(arr[0]['code']);
|
||||||
|
}else{
|
||||||
|
village();
|
||||||
|
}
|
||||||
|
},
|
||||||
|
})
|
||||||
|
$.get('/api/geo/street?pcode=' + id, function (result) {
|
||||||
|
demo1.update({
|
||||||
|
data: result.data
|
||||||
|
})
|
||||||
|
});
|
||||||
|
}
|
||||||
|
function village (id) {
|
||||||
|
var demo2 = xmSelect.render({
|
||||||
|
name: 'village',
|
||||||
|
el: '#demo2',
|
||||||
|
initValue: ["{$detail.village}"],
|
||||||
|
prop: {
|
||||||
|
name: 'name',
|
||||||
|
value: 'id',
|
||||||
|
},
|
||||||
|
data: [],
|
||||||
|
radio: true,
|
||||||
|
disabled: group_access == 2 ? true : false,
|
||||||
|
})
|
||||||
|
$.get('/api/geo/village?pcode=' + id, function (result) {
|
||||||
|
demo2.update({
|
||||||
|
data: result.data
|
||||||
|
})
|
||||||
|
});
|
||||||
|
}
|
||||||
|
var editor = layui.tinymce;
|
||||||
|
var edit = editor.render({
|
||||||
|
selector: "#container_content",
|
||||||
|
height: 500
|
||||||
|
});
|
||||||
|
//监听提交
|
||||||
|
form.on('submit(webform)', function (data) {
|
||||||
|
data.field.content = tinyMCE.editors['container_content'].getContent();
|
||||||
|
if (data.field.content == '') {
|
||||||
|
layer.msg('请先完善文章内容');
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
let callback = function (e) {
|
||||||
|
layer.msg(e.msg);
|
||||||
|
if (e.code == 0) {
|
||||||
|
tool.sideClose(1000);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
tool.post("{$url[2]}", data.field, callback);
|
||||||
|
return false;
|
||||||
|
});
|
||||||
|
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
{/block}
|
||||||
|
<!-- /脚本 -->
|
100
app/admin/view/nk/educationlive/read.html
Normal file
100
app/admin/view/nk/educationlive/read.html
Normal file
@ -0,0 +1,100 @@
|
|||||||
|
{extend name="common/base"/}
|
||||||
|
{block name="style"}
|
||||||
|
<style>
|
||||||
|
.content-article img{max-width:88%!important; height:auto!important; margin:6px 0!important; border-radius:4px;}
|
||||||
|
</style>
|
||||||
|
{/block}
|
||||||
|
<!-- 主体 -->
|
||||||
|
{block name="body"}
|
||||||
|
<div class="layui-form p-4">
|
||||||
|
<h3 class="pb-3">文章详情</h3>
|
||||||
|
<table class="layui-table layui-table-form">
|
||||||
|
<tr>
|
||||||
|
<td class="layui-td-gray">文章标题</td>
|
||||||
|
<td colspan="3">{$detail.title}</td>
|
||||||
|
</tr>
|
||||||
|
|
||||||
|
<tr>
|
||||||
|
<td class="layui-td-gray">创建时间</td>
|
||||||
|
<td>{$detail.view_time}</td>
|
||||||
|
<td class="layui-td-gray">状态</td>
|
||||||
|
<td>
|
||||||
|
{eq name="$detail.status" value="1"}正常{/eq}
|
||||||
|
{eq name="$detail.status" value="0"}下架{/eq}
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td class="layui-td-gray">文章摘要</td>
|
||||||
|
<td colspan="3">{$detail.describe}</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td class="layui-td-gray">课时</td>
|
||||||
|
<td>{$detail.lesson.lesson_period}</td>
|
||||||
|
<td class="layui-td-gray">学习人数</td>
|
||||||
|
<td >{$detail.lesson.series_num}</td>
|
||||||
|
</tr>
|
||||||
|
|
||||||
|
<tr>
|
||||||
|
<td class="layui-td-gray">文章内容</td>
|
||||||
|
<td colspan="5" class="content-article">
|
||||||
|
{$detail.content|raw}
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
|
||||||
|
{if in_array($detail.category_id,[149,157,158,148,147,165]) }
|
||||||
|
<tr >
|
||||||
|
<td class="layui-td-gray">回复内容:</td>
|
||||||
|
<td colspan="6">
|
||||||
|
{volist name="$detail.comment" id="vo"}
|
||||||
|
{$vo.user_info}的回复:{$vo.content}<br>
|
||||||
|
{/volist}
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
{/if}
|
||||||
|
|
||||||
|
{if in_array($detail.category_id,[149,157,158,148,147,165]) }
|
||||||
|
<tr >
|
||||||
|
<td class="layui-td-gray">回复:</td>
|
||||||
|
<td colspan="6">
|
||||||
|
<textarea class="layui-textarea" name="reply" ></textarea>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
{/if}
|
||||||
|
|
||||||
|
|
||||||
|
</table>
|
||||||
|
{if in_array($detail.category_id,[149,157,158,148,147,165]) }
|
||||||
|
<div class="pt-3">
|
||||||
|
<input type="hidden" name="id" value="{$detail.id}"/>
|
||||||
|
<input type="hidden" name="admin_id" value="{$admin_id}"/>
|
||||||
|
<input type="hidden" name="content" value="{$detail.content}"/>
|
||||||
|
<button class="layui-btn layui-btn-normal" lay-submit="" lay-filter="webform">立即回复</button>
|
||||||
|
</div>
|
||||||
|
{/if}
|
||||||
|
</div>
|
||||||
|
{/block}
|
||||||
|
<!-- /主体 -->
|
||||||
|
|
||||||
|
<!-- 脚本 -->
|
||||||
|
{block name="script"}
|
||||||
|
<script>
|
||||||
|
var moduleInit = ['tool', 'tagpicker', 'tinymce'];
|
||||||
|
function gouguInit() {
|
||||||
|
var form = layui.form, tool = layui.tool, tagpicker = layui.tagpicker,laydate = layui.laydate;
|
||||||
|
|
||||||
|
//监听提交
|
||||||
|
form.on('submit(webform)', function (data) {
|
||||||
|
|
||||||
|
let callback = function (e) {
|
||||||
|
layer.msg(e.msg);
|
||||||
|
if (e.code == 0) {
|
||||||
|
tool.sideClose(1000);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
tool.post("/admin/api/reply", data.field, callback);
|
||||||
|
return false;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
{/block}
|
||||||
|
<!-- /脚本 -->
|
234
app/admin/view/nk/publicbenefitenroll/add.html
Normal file
234
app/admin/view/nk/publicbenefitenroll/add.html
Normal file
@ -0,0 +1,234 @@
|
|||||||
|
{extend name="common/base"/}
|
||||||
|
{block name="style"}
|
||||||
|
<style type="text/css">
|
||||||
|
.editormd-code-toolbar select {display: inline-block}
|
||||||
|
.editormd li {list-style: inherit;}
|
||||||
|
</style>
|
||||||
|
{/block}
|
||||||
|
<!-- 主体 -->
|
||||||
|
{block name="body"}
|
||||||
|
<form class="layui-form p-4">
|
||||||
|
<h3 class="pb-3">新建文章</h3>
|
||||||
|
<table class="layui-table layui-table-form">
|
||||||
|
<tr>
|
||||||
|
<td class="layui-td-gray">文章标题<font>*</font></td>
|
||||||
|
<td colspan="7"><input type="text" name="title" lay-verify="required" lay-reqText="请输入文章标题"
|
||||||
|
autocomplete="off" placeholder="请输入文章标题" class="layui-input"></td>
|
||||||
|
</tr>
|
||||||
|
{notempty name="is_vote"}
|
||||||
|
<tr>
|
||||||
|
<td class="layui-td-gray">结束时间<font>*</font></td>
|
||||||
|
<td colspan="7"> <input type="text" placeholder="yyyy-MM-dd" autocomplete="off" class="layui-input" id="test1" name="end_time">
|
||||||
|
<input type="hidden" name="is_vote" value="1">
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
{/notempty}
|
||||||
|
<tr>
|
||||||
|
<td class="layui-td-gray" style="vertical-align:top;">文章摘要</td>
|
||||||
|
<td colspan="3">
|
||||||
|
<textarea name="describe" placeholder="请输入摘要,不能超过200个字" class="layui-textarea"></textarea>
|
||||||
|
</td>
|
||||||
|
<td class="layui-td-gray" style="vertical-align:top;">缩略图</td>
|
||||||
|
<td>
|
||||||
|
<div class="layui-upload">
|
||||||
|
<button type="button" class="layui-btn layui-btn-sm" id="upload_btn_thumb">上传缩略图(尺寸:640x360)</button>
|
||||||
|
<div class="layui-upload-list" id="upload_box_thumb" style="width: 120px; height:66px; overflow: hidden;">
|
||||||
|
<img src="" onerror="javascript:this.src='{__GOUGU__}/gougu/images/nonepic600x360.jpg';this.onerror=null;" width="100" style="max-width: 100%; height:66px;"/>
|
||||||
|
<input type="hidden" name="image" value="">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td class="layui-td-gray" style="vertical-align:top;">发起人<font>*</font></td>
|
||||||
|
<td>
|
||||||
|
<input type="text" name="promoter" lay-verify="required" lay-reqText="请输入发起人"
|
||||||
|
autocomplete="off" placeholder="请输入发起人" class="layui-input"
|
||||||
|
value="">
|
||||||
|
</td>
|
||||||
|
<td class="layui-td-gray" style="vertical-align:top;">报名人数</td>
|
||||||
|
<td>
|
||||||
|
<input type="number" name="enrolled_num" lay-verify="required"
|
||||||
|
class="layui-input"
|
||||||
|
value="">
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
{if {:session('gougu_admin')['group_access']==1}
|
||||||
|
|
||||||
|
<tr>
|
||||||
|
<td class="layui-td-gray" style="vertical-align:top;">区县</td>
|
||||||
|
<td colspan="3">
|
||||||
|
<div class="layui-col-md6">
|
||||||
|
<div >
|
||||||
|
<select name="county" lay-filter="area_id" >
|
||||||
|
{volist name='street' id='vo'}
|
||||||
|
<option value="{$vo.code}" >{$vo.name}</option>
|
||||||
|
{/volist}
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td class="layui-td-gray" style="vertical-align:top;">街道/镇</td>
|
||||||
|
<td colspan="3">
|
||||||
|
<div class="layui-col-md6">
|
||||||
|
<div >
|
||||||
|
<div id="demo1" ></div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td class="layui-td-gray" style="vertical-align:top;">村/社区</td>
|
||||||
|
<td colspan="3">
|
||||||
|
<div class="layui-col-md6">
|
||||||
|
<div >
|
||||||
|
<div id="demo2" ></div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
|
||||||
|
<tr>
|
||||||
|
<td class="layui-td-gray">用户<font>*</font></td>
|
||||||
|
<td colspan="3">
|
||||||
|
<div class="layui-col-md6">
|
||||||
|
<select name="user_id" lay-verify="required" lay-search="">
|
||||||
|
<option value="" >请选择</option>
|
||||||
|
{volist name='users' id='vo'}
|
||||||
|
<option value="{$vo.user_id}" >{$vo.name}</option>
|
||||||
|
{/volist}
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
|
||||||
|
{/if}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<tr>
|
||||||
|
<td colspan="6" class="layui-td-gray" style="text-align:left">文章内容</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td colspan="6">
|
||||||
|
<textarea class="layui-textarea" id="container_content"></textarea>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
|
||||||
|
</table>
|
||||||
|
<div class="pt-3">
|
||||||
|
<button class="layui-btn layui-btn-normal" lay-submit="" lay-filter="webform">立即提交</button>
|
||||||
|
<button type="reset" class="layui-btn layui-btn-primary">重置</button>
|
||||||
|
</div>
|
||||||
|
</form>
|
||||||
|
{/block}
|
||||||
|
<!-- /主体 -->
|
||||||
|
|
||||||
|
<!-- 脚本 -->
|
||||||
|
{block name="script"}
|
||||||
|
<script src="/static/assets/js/xm-select.js"></script>
|
||||||
|
<script>
|
||||||
|
const editorType = '{$editor}';
|
||||||
|
var moduleInit = ['tool', 'tagpicker', 'tinymce'];
|
||||||
|
var group_access = "{:session('gougu_admin')['group_access']}"
|
||||||
|
function gouguInit() {
|
||||||
|
var form =layui.form, tool = layui.tool,tagspicker = layui.tagpicker,laydate=layui.laydate;
|
||||||
|
laydate.render({
|
||||||
|
elem: '#test1' //指定元素
|
||||||
|
});
|
||||||
|
//上传缩略图
|
||||||
|
var upload_thumb = layui.upload.render({
|
||||||
|
elem: '#upload_btn_thumb',
|
||||||
|
url: '/admin/api/upload',
|
||||||
|
done: function (res) {
|
||||||
|
//如果上传失败
|
||||||
|
if (res.code == 1) {
|
||||||
|
return layer.msg('上传失败');
|
||||||
|
}
|
||||||
|
//上传成功
|
||||||
|
$('#upload_box_thumb input').attr('value', res.data.filepath);
|
||||||
|
$('#upload_box_thumb img').attr('src', res.data.filepath);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
street();
|
||||||
|
village();
|
||||||
|
form.on('select(area_id)', function (data) {
|
||||||
|
street(data.value)
|
||||||
|
});
|
||||||
|
function street (id) {
|
||||||
|
var demo1 = xmSelect.render({
|
||||||
|
name: 'township',
|
||||||
|
el: '#demo1',
|
||||||
|
initValue: [],
|
||||||
|
prop: {
|
||||||
|
name: 'name',
|
||||||
|
value: 'code',
|
||||||
|
},
|
||||||
|
data: [],
|
||||||
|
radio: true,
|
||||||
|
disabled: group_access == 2 ||group_access == 4? true : false,
|
||||||
|
on: function (data) {
|
||||||
|
var arr = data.arr;
|
||||||
|
if(arr.length > 0){
|
||||||
|
village(arr[0]['code']);
|
||||||
|
}else{
|
||||||
|
village();
|
||||||
|
}
|
||||||
|
},
|
||||||
|
})
|
||||||
|
$.get('/api/geo/street?pcode=' + id, function (result) {
|
||||||
|
demo1.update({
|
||||||
|
data: result.data
|
||||||
|
})
|
||||||
|
});
|
||||||
|
}
|
||||||
|
function village (id) {
|
||||||
|
var demo2 = xmSelect.render({
|
||||||
|
name: 'village',
|
||||||
|
el: '#demo2',
|
||||||
|
initValue: [],
|
||||||
|
prop: {
|
||||||
|
name: 'name',
|
||||||
|
value: 'id',
|
||||||
|
},
|
||||||
|
data: [],
|
||||||
|
radio: true,
|
||||||
|
disabled: group_access == 2 ? true : false,
|
||||||
|
})
|
||||||
|
$.get('/api/geo/village?pcode=' + id, function (result) {
|
||||||
|
demo2.update({
|
||||||
|
data: result.data
|
||||||
|
})
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
var editor = layui.tinymce;
|
||||||
|
var edit = editor.render({
|
||||||
|
selector: "#container_content",
|
||||||
|
height: 500
|
||||||
|
});
|
||||||
|
//监听提交
|
||||||
|
form.on('submit(webform)', function (data) {
|
||||||
|
data.field.content = tinyMCE.editors['container_content'].getContent();
|
||||||
|
if (data.field.content == '') {
|
||||||
|
layer.msg('请先完善文章内容');
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
let callback = function (e) {
|
||||||
|
layer.msg(e.msg);
|
||||||
|
if (e.code == 0) {
|
||||||
|
tool.tabRefresh(71);
|
||||||
|
tool.sideClose(1000);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
tool.post('{$url[1]}', data.field, callback);
|
||||||
|
return false;
|
||||||
|
});
|
||||||
|
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
{/block}
|
||||||
|
<!-- /脚本 -->
|
253
app/admin/view/nk/publicbenefitenroll/edit.html
Normal file
253
app/admin/view/nk/publicbenefitenroll/edit.html
Normal file
@ -0,0 +1,253 @@
|
|||||||
|
{extend name="common/base"/}
|
||||||
|
{block name="style"}
|
||||||
|
<style type="text/css">
|
||||||
|
.editormd-code-toolbar select {
|
||||||
|
display: inline-block
|
||||||
|
}
|
||||||
|
|
||||||
|
.editormd li {
|
||||||
|
list-style: inherit;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
{/block}
|
||||||
|
<!-- 主体 -->
|
||||||
|
{block name="body"}
|
||||||
|
<form class="layui-form p-4">
|
||||||
|
<h3 class="pb-3">编辑文章表</h3>
|
||||||
|
<table class="layui-table layui-table-form">
|
||||||
|
<tr>
|
||||||
|
<td class="layui-td-gray">文章标题<font>*</font></td>
|
||||||
|
<td colspan="7"><input type="text" name="title" lay-verify="required" lay-reqText="请输入文章标题"
|
||||||
|
autocomplete="off" placeholder="请输入文章标题" class="layui-input"
|
||||||
|
value="{$detail.title}"></td>
|
||||||
|
</tr>
|
||||||
|
{notempty name="is_vote"}
|
||||||
|
<tr>
|
||||||
|
<td class="layui-td-gray">结束时间<font>*</font></td>
|
||||||
|
<td colspan="7"> <input type="text" placeholder="yyyy-MM-dd" autocomplete="off" class="layui-input" id="test1" name="end_time">
|
||||||
|
<input type="hidden" name="is_vote" value="1">
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
{/notempty}
|
||||||
|
<tr>
|
||||||
|
<td class="layui-td-gray" style="vertical-align:top;">摘要</td>
|
||||||
|
<td colspan="3">
|
||||||
|
<textarea name="describe" placeholder="请输入摘要,不能超过200个字"
|
||||||
|
class="layui-textarea">{$detail.describe}</textarea>
|
||||||
|
</td>
|
||||||
|
<td class="layui-td-gray" style="vertical-align:top;">缩略图</td>
|
||||||
|
<td>
|
||||||
|
<div class="layui-upload">
|
||||||
|
<button type="button" class="layui-btn layui-btn-sm" id="upload_btn_thumb">
|
||||||
|
上传缩略图(尺寸:640x360)
|
||||||
|
</button>
|
||||||
|
<div class="layui-upload-list" id="upload_box_thumb"
|
||||||
|
style="width: 120px; height:66px; overflow: hidden;">
|
||||||
|
<img src="{$detail.image}"
|
||||||
|
onerror="javascript:this.src='{__GOUGU__}/gougu/images/nonepic600x360.jpg';this.onerror=null;"
|
||||||
|
style="max-width: 100%; height:66px;"/>
|
||||||
|
<input type="hidden" name="image" value="{$detail.image}">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td class="layui-td-gray" style="vertical-align:top;">发起人<font>*</font></td>
|
||||||
|
<td>
|
||||||
|
<input type="text" name="promoter" lay-verify="required" lay-reqText="请输入发起人"
|
||||||
|
autocomplete="off" placeholder="请输入发起人" class="layui-input"
|
||||||
|
value="{$detail.enroll.promoter}">
|
||||||
|
</td>
|
||||||
|
<td class="layui-td-gray" style="vertical-align:top;">报名人数</td>
|
||||||
|
<td>
|
||||||
|
<input type="number" name="enrolled_num" lay-verify="required"
|
||||||
|
class="layui-input"
|
||||||
|
value="{$detail.enroll.enrolled_num}">
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
{if {:session('gougu_admin')['group_access']==1}
|
||||||
|
|
||||||
|
<tr>
|
||||||
|
<td class="layui-td-gray" style="vertical-align:top;">区县</td>
|
||||||
|
<td colspan="3">
|
||||||
|
<div class="layui-col-md6">
|
||||||
|
<div >
|
||||||
|
<select name="county" lay-filter="area_id">
|
||||||
|
{volist name='street' id='vo'}
|
||||||
|
<option value="{$vo.code}" {if $detail.county==$vo.code} selected {/if}>{$vo.name}</option>
|
||||||
|
{/volist}
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td class="layui-td-gray" style="vertical-align:top;">街道/镇</td>
|
||||||
|
<td colspan="3">
|
||||||
|
<div class="layui-col-md6">
|
||||||
|
<div >
|
||||||
|
<div id="demo1" ></div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td class="layui-td-gray" style="vertical-align:top;">村/社区</td>
|
||||||
|
<td colspan="3">
|
||||||
|
<div class="layui-col-md6">
|
||||||
|
<div >
|
||||||
|
<div id="demo2" ></div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
|
||||||
|
<tr>
|
||||||
|
<td class="layui-td-gray">用户<font>*</font></td>
|
||||||
|
<td colspan="3">
|
||||||
|
<div class="layui-col-md6">
|
||||||
|
<select name="user_id" lay-verify="required" lay-search="">
|
||||||
|
<option value="" >请选择</option>
|
||||||
|
{volist name='users' id='vo'}
|
||||||
|
<option value="{$vo.user_id}" {if $detail.user_id==$vo.user_id} selected {/if}>{$vo.name}</option>
|
||||||
|
{/volist}
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
{/if}
|
||||||
|
|
||||||
|
<tr>
|
||||||
|
<td colspan="6" class="layui-td-gray" style="text-align:left">文章内容</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td colspan="6">
|
||||||
|
<textarea placeholder="请输入内容" class="layui-textarea"
|
||||||
|
id="container_content">{$detail.content}</textarea>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
</table>
|
||||||
|
<div class="pt-3">
|
||||||
|
<input type="hidden" name="id" value="{$detail.id}"/>
|
||||||
|
<button class="layui-btn layui-btn-normal" lay-submit="" lay-filter="webform">立即提交</button>
|
||||||
|
<button type="reset" class="layui-btn layui-btn-primary">重置</button>
|
||||||
|
</div>
|
||||||
|
</form>
|
||||||
|
{/block}
|
||||||
|
<!-- /主体 -->
|
||||||
|
|
||||||
|
<!-- 脚本 -->
|
||||||
|
{block name="script"}
|
||||||
|
<script src="/static/assets/js/xm-select.js"></script>
|
||||||
|
<script>
|
||||||
|
const editorType = '{$editor}';
|
||||||
|
var moduleInit;
|
||||||
|
if (editorType == 1) {
|
||||||
|
moduleInit = ['tool', 'tagpicker', 'tinymce'];
|
||||||
|
} else {
|
||||||
|
moduleInit = ['tool', 'tagpicker', 'editormd'];
|
||||||
|
}
|
||||||
|
var group_access = "{:session('gougu_admin')['group_access']}";
|
||||||
|
var area_id = "{$detail.county}";
|
||||||
|
var street_id = "{$detail.township}";
|
||||||
|
function gouguInit() {
|
||||||
|
var form =layui.form, tool = layui.tool,tagspicker = layui.tagpicker,laydate=layui.laydate;
|
||||||
|
laydate.render({
|
||||||
|
elem: '#test1' //指定元素
|
||||||
|
});
|
||||||
|
//上传缩略图
|
||||||
|
var upload_thumb = layui.upload.render({
|
||||||
|
elem: '#upload_btn_thumb',
|
||||||
|
url: '/admin/api/upload',
|
||||||
|
done: function (res) {
|
||||||
|
//如果上传失败
|
||||||
|
if (res.code == 1) {
|
||||||
|
layer.msg('上传失败');
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
//上传成功
|
||||||
|
$('#upload_box_thumb input').attr('value', res.data.filepath);
|
||||||
|
$('#upload_box_thumb img').attr('src', res.data.filepath);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
if (area_id != 0) {
|
||||||
|
street(area_id)
|
||||||
|
}
|
||||||
|
if (street_id != 0) {
|
||||||
|
village(street_id)
|
||||||
|
}
|
||||||
|
form.on('select(area_id)', function (data) {
|
||||||
|
street(data.value)
|
||||||
|
});
|
||||||
|
function street (id) {
|
||||||
|
var demo1 = xmSelect.render({
|
||||||
|
name: 'township',
|
||||||
|
el: '#demo1',
|
||||||
|
initValue: ["{$detail.township}"],
|
||||||
|
prop: {
|
||||||
|
name: 'name',
|
||||||
|
value: 'code',
|
||||||
|
},
|
||||||
|
data: [],
|
||||||
|
radio: true,
|
||||||
|
disabled: group_access == 2 ||group_access == 4? true : false,
|
||||||
|
on: function (data) {
|
||||||
|
var arr = data.arr;
|
||||||
|
if(arr.length > 0){
|
||||||
|
village(arr[0]['code']);
|
||||||
|
}else{
|
||||||
|
village();
|
||||||
|
}
|
||||||
|
},
|
||||||
|
})
|
||||||
|
$.get('/api/geo/street?pcode=' + id, function (result) {
|
||||||
|
demo1.update({
|
||||||
|
data: result.data
|
||||||
|
})
|
||||||
|
});
|
||||||
|
}
|
||||||
|
function village (id) {
|
||||||
|
var demo2 = xmSelect.render({
|
||||||
|
name: 'village',
|
||||||
|
el: '#demo2',
|
||||||
|
initValue: ["{$detail.village}"],
|
||||||
|
prop: {
|
||||||
|
name: 'name',
|
||||||
|
value: 'id',
|
||||||
|
},
|
||||||
|
data: [],
|
||||||
|
radio: true,
|
||||||
|
disabled: group_access == 2 ? true : false,
|
||||||
|
})
|
||||||
|
$.get('/api/geo/village?pcode=' + id, function (result) {
|
||||||
|
demo2.update({
|
||||||
|
data: result.data
|
||||||
|
})
|
||||||
|
});
|
||||||
|
}
|
||||||
|
var editor = layui.tinymce;
|
||||||
|
var edit = editor.render({
|
||||||
|
selector: "#container_content",
|
||||||
|
height: 500
|
||||||
|
});
|
||||||
|
//监听提交
|
||||||
|
form.on('submit(webform)', function (data) {
|
||||||
|
data.field.content = tinyMCE.editors['container_content'].getContent();
|
||||||
|
if (data.field.content == '') {
|
||||||
|
layer.msg('请先完善文章内容');
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
let callback = function (e) {
|
||||||
|
layer.msg(e.msg);
|
||||||
|
if (e.code == 0) {
|
||||||
|
tool.sideClose(1000);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
tool.post("{$url[2]}", data.field, callback);
|
||||||
|
return false;
|
||||||
|
});
|
||||||
|
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
{/block}
|
||||||
|
<!-- /脚本 -->
|
105
app/admin/view/nk/publicbenefitenroll/read.html
Normal file
105
app/admin/view/nk/publicbenefitenroll/read.html
Normal file
@ -0,0 +1,105 @@
|
|||||||
|
{extend name="common/base"/}
|
||||||
|
{block name="style"}
|
||||||
|
<style>
|
||||||
|
.content-article img{max-width:88%!important; height:auto!important; margin:6px 0!important; border-radius:4px;}
|
||||||
|
</style>
|
||||||
|
{/block}
|
||||||
|
<!-- 主体 -->
|
||||||
|
{block name="body"}
|
||||||
|
<div class="layui-form p-4">
|
||||||
|
<h3 class="pb-3">文章详情</h3>
|
||||||
|
<table class="layui-table layui-table-form">
|
||||||
|
<tr>
|
||||||
|
<td class="layui-td-gray">文章标题</td>
|
||||||
|
<td colspan="3">{$detail.title}</td>
|
||||||
|
</tr>
|
||||||
|
|
||||||
|
<tr>
|
||||||
|
<td class="layui-td-gray">创建时间</td>
|
||||||
|
<td>{$detail.view_time}</td>
|
||||||
|
<td class="layui-td-gray">状态</td>
|
||||||
|
<td>
|
||||||
|
{eq name="$detail.status" value="1"}正常{/eq}
|
||||||
|
{eq name="$detail.status" value="0"}下架{/eq}
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td class="layui-td-gray">文章摘要</td>
|
||||||
|
<td colspan="3">{$detail.describe}</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td class="layui-td-gray">发起人</td>
|
||||||
|
<td>{$detail.enroll.promoter}</td>
|
||||||
|
<td class="layui-td-gray">参与人数</td>
|
||||||
|
<td >{$detail.enroll.enrolled_num}</td>
|
||||||
|
<!-- <td class="layui-td-gray">标签(多选)<font>*</font></td> -->
|
||||||
|
<!-- <td>
|
||||||
|
<input type="checkbox" name="is_hot" title="热门" {if $detail.is_hot==1} checked {/if}>
|
||||||
|
<input type="checkbox" name="is_tourism" title="文旅" {if $detail.is_tourism==1} checked {/if>
|
||||||
|
</td> -->
|
||||||
|
</tr>
|
||||||
|
|
||||||
|
<tr>
|
||||||
|
<td class="layui-td-gray">文章内容</td>
|
||||||
|
<td colspan="5" class="content-article">
|
||||||
|
{$detail.content|raw}
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
|
||||||
|
{if in_array($detail.category_id,[149,157,158,148,147,165]) }
|
||||||
|
<tr >
|
||||||
|
<td class="layui-td-gray">回复内容:</td>
|
||||||
|
<td colspan="6">
|
||||||
|
{volist name="$detail.comment" id="vo"}
|
||||||
|
{$vo.user_info}的回复:{$vo.content}<br>
|
||||||
|
{/volist}
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
{/if}
|
||||||
|
|
||||||
|
{if in_array($detail.category_id,[149,157,158,148,147,165]) }
|
||||||
|
<tr >
|
||||||
|
<td class="layui-td-gray">回复:</td>
|
||||||
|
<td colspan="6">
|
||||||
|
<textarea class="layui-textarea" name="reply" ></textarea>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
{/if}
|
||||||
|
|
||||||
|
|
||||||
|
</table>
|
||||||
|
{if in_array($detail.category_id,[149,157,158,148,147,165]) }
|
||||||
|
<div class="pt-3">
|
||||||
|
<input type="hidden" name="id" value="{$detail.id}"/>
|
||||||
|
<input type="hidden" name="admin_id" value="{$admin_id}"/>
|
||||||
|
<input type="hidden" name="content" value="{$detail.content}"/>
|
||||||
|
<button class="layui-btn layui-btn-normal" lay-submit="" lay-filter="webform">立即回复</button>
|
||||||
|
</div>
|
||||||
|
{/if}
|
||||||
|
</div>
|
||||||
|
{/block}
|
||||||
|
<!-- /主体 -->
|
||||||
|
|
||||||
|
<!-- 脚本 -->
|
||||||
|
{block name="script"}
|
||||||
|
<script>
|
||||||
|
var moduleInit = ['tool', 'tagpicker', 'tinymce'];
|
||||||
|
function gouguInit() {
|
||||||
|
var form = layui.form, tool = layui.tool, tagpicker = layui.tagpicker,laydate = layui.laydate;
|
||||||
|
|
||||||
|
//监听提交
|
||||||
|
form.on('submit(webform)', function (data) {
|
||||||
|
|
||||||
|
let callback = function (e) {
|
||||||
|
layer.msg(e.msg);
|
||||||
|
if (e.code == 0) {
|
||||||
|
tool.sideClose(1000);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
tool.post("/admin/api/reply", data.field, callback);
|
||||||
|
return false;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
{/block}
|
||||||
|
<!-- /脚本 -->
|
@ -68,10 +68,10 @@
|
|||||||
<td>
|
<td>
|
||||||
<div class="layui-upload">
|
<div class="layui-upload">
|
||||||
<button type="button" class="layui-btn layui-btn-sm" id="upload_btn_thumb">
|
<button type="button" class="layui-btn layui-btn-sm" id="upload_btn_thumb">
|
||||||
上传缩略图(尺寸:428x270)
|
上传缩略图(尺寸:750x750)
|
||||||
</button>
|
</button>
|
||||||
<div class="layui-upload-list" id="upload_box_thumb"
|
<div class="layui-upload-list" id="upload_box_thumb"
|
||||||
style="width: 428px; height:270px; overflow: hidden;">
|
style=" overflow: hidden;">
|
||||||
<img src=""
|
<img src=""
|
||||||
onerror="javascript:this.src='{__GOUGU__}/gougu/images/nonepic600x360.jpg';this.onerror=null;"
|
onerror="javascript:this.src='{__GOUGU__}/gougu/images/nonepic600x360.jpg';this.onerror=null;"
|
||||||
width="100" style="max-width: 100%; height:66px;"/>
|
width="100" style="max-width: 100%; height:66px;"/>
|
||||||
@ -90,7 +90,7 @@
|
|||||||
</button>
|
</button>
|
||||||
|
|
||||||
<div class="layui-upload-list" id="upload_box_thumb2"
|
<div class="layui-upload-list" id="upload_box_thumb2"
|
||||||
style="width: 428px; height:270px; overflow: hidden;">
|
style="overflow: hidden;">
|
||||||
<input type="hidden" name="slider_image" value="">
|
<input type="hidden" name="slider_image" value="">
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
@ -67,10 +67,10 @@
|
|||||||
<td>
|
<td>
|
||||||
<div class="layui-upload">
|
<div class="layui-upload">
|
||||||
<button type="button" class="layui-btn layui-btn-sm" id="upload_btn_thumb">
|
<button type="button" class="layui-btn layui-btn-sm" id="upload_btn_thumb">
|
||||||
上传缩略图(尺寸:428x270)
|
上传缩略图(尺寸:750x750)
|
||||||
</button>
|
</button>
|
||||||
<div class="layui-upload-list" id="upload_box_thumb"
|
<div class="layui-upload-list" id="upload_box_thumb"
|
||||||
style="width: 428px; height:270px; overflow: hidden;">
|
style=" overflow: hidden;">
|
||||||
<img src="{$detail.image}"
|
<img src="{$detail.image}"
|
||||||
onerror="javascript:this.src='{__GOUGU__}/gougu/images/nonepic600x360.jpg';this.onerror=null;"
|
onerror="javascript:this.src='{__GOUGU__}/gougu/images/nonepic600x360.jpg';this.onerror=null;"
|
||||||
width="100" style="max-width: 100%; height:66px;"/>
|
width="100" style="max-width: 100%; height:66px;"/>
|
||||||
@ -85,10 +85,10 @@
|
|||||||
<td>
|
<td>
|
||||||
<div class="layui-upload">
|
<div class="layui-upload">
|
||||||
<button type="button" class="layui-btn layui-btn-sm" id="upload_btn_thumb2">
|
<button type="button" class="layui-btn layui-btn-sm" id="upload_btn_thumb2">
|
||||||
上传缩略图(尺寸:428x270)
|
上传缩略图(尺寸:750x750)
|
||||||
</button>
|
</button>
|
||||||
<div class="layui-upload-list" id="upload_box_thumb2"
|
<div class="layui-upload-list" id="upload_box_thumb2"
|
||||||
style="width: 428px; height:270px; overflow: hidden;">
|
style=" overflow: hidden;">
|
||||||
{volist name='detail.slider_image_arr' id='vo'}
|
{volist name='detail.slider_image_arr' id='vo'}
|
||||||
{if $vo}
|
{if $vo}
|
||||||
<img src="{$vo}"
|
<img src="{$vo}"
|
||||||
|
@ -64,7 +64,7 @@
|
|||||||
<!-- 上传缩略图(尺寸:428x270)-->
|
<!-- 上传缩略图(尺寸:428x270)-->
|
||||||
<!-- </button>-->
|
<!-- </button>-->
|
||||||
<div class="layui-upload-list" id="upload_box_thumb"
|
<div class="layui-upload-list" id="upload_box_thumb"
|
||||||
style="width: 428px; height:270px; overflow: hidden;">
|
style="overflow: hidden;">
|
||||||
<img src="{$detail.image}"
|
<img src="{$detail.image}"
|
||||||
onerror="javascript:this.src='{__GOUGU__}/gougu/images/nonepic600x360.jpg';this.onerror=null;"
|
onerror="javascript:this.src='{__GOUGU__}/gougu/images/nonepic600x360.jpg';this.onerror=null;"
|
||||||
width="100" style="max-width: 100%; height:66px;"/>
|
width="100" style="max-width: 100%; height:66px;"/>
|
||||||
@ -82,7 +82,7 @@
|
|||||||
<!-- 上传缩略图(尺寸:428x270)-->
|
<!-- 上传缩略图(尺寸:428x270)-->
|
||||||
<!-- </button>-->
|
<!-- </button>-->
|
||||||
<div class="layui-upload-list" id="upload_box_thumb2"
|
<div class="layui-upload-list" id="upload_box_thumb2"
|
||||||
style="width: 428px; height:270px; overflow: hidden;">
|
style="overflow: hidden;">
|
||||||
{volist name='detail.slider_image_arr' id='vo'}
|
{volist name='detail.slider_image_arr' id='vo'}
|
||||||
{if $vo}
|
{if $vo}
|
||||||
<img src="{$vo}"
|
<img src="{$vo}"
|
||||||
|
516
app/api/controller/Cultural.php
Normal file
516
app/api/controller/Cultural.php
Normal file
@ -0,0 +1,516 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace app\api\controller;
|
||||||
|
|
||||||
|
use app\api\BaseController;
|
||||||
|
use app\api\middleware\Auth;
|
||||||
|
use think\facade\Db;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 文娱 旅游
|
||||||
|
*/
|
||||||
|
class Cultural extends BaseController
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* 控制器中间件 [不需要鉴权]
|
||||||
|
* @var array
|
||||||
|
*/
|
||||||
|
protected $middleware = [
|
||||||
|
Auth::class => ['except' => ['WebStrategy','HotParty','PunchCard','Article'] ]
|
||||||
|
];
|
||||||
|
|
||||||
|
protected function getData($cid){
|
||||||
|
$where = ['category_id'=>$cid];
|
||||||
|
$list = Db::table('fa_article')->where($where)
|
||||||
|
->page(1)
|
||||||
|
->limit(10)
|
||||||
|
->order('id desc')
|
||||||
|
->select();
|
||||||
|
|
||||||
|
return $list;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function WebStrategy(){
|
||||||
|
$data = $this->getData(364);
|
||||||
|
$this->apiSuccess('ok', ['list' => $data]);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function HotParty() {
|
||||||
|
$data = $this->getData(360);
|
||||||
|
$this->apiSuccess('ok', ['list' => $data]);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function PunchCard(){
|
||||||
|
$data = $this->getData(361);
|
||||||
|
$this->apiSuccess('ok', ['list' => $data]);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function Article(){
|
||||||
|
$data = $this->getData(362);
|
||||||
|
$this->apiSuccess('ok', ['list' => $data]);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
public function index1($search = '', $category_id = 1, $page = 1, $is_time = 0, $category_type = 0)
|
||||||
|
{
|
||||||
|
$param = get_params();
|
||||||
|
|
||||||
|
$screen = $param['screen']??1;
|
||||||
|
$solve = $param['solve']??1;
|
||||||
|
$order = $param['order']??1;
|
||||||
|
// $model = Db::table('fa_article');
|
||||||
|
$where = [
|
||||||
|
['status', '=', 1],
|
||||||
|
['category_id', '=', $category_id]
|
||||||
|
];
|
||||||
|
//查询升降序
|
||||||
|
if($order==1){
|
||||||
|
$orders='desc';
|
||||||
|
}else{
|
||||||
|
$orders='asc';
|
||||||
|
}
|
||||||
|
if (!$category_id) {
|
||||||
|
unset($where[1]);
|
||||||
|
}
|
||||||
|
//根据个人村id进行查询
|
||||||
|
if (JWT_UID) {
|
||||||
|
$find = Db::table('fa_szxc_information_useraddress')->where('user_id', JWT_UID)->find();
|
||||||
|
if ($find) {
|
||||||
|
if ($find['auth_range']==1){
|
||||||
|
$where[] = ['village', '=', $find['village_id']];
|
||||||
|
}elseif ($find['auth_range']==2){
|
||||||
|
$where[] = ['township', '=', $find['street_id']];
|
||||||
|
}elseif ($find['auth_range']==3){
|
||||||
|
$where[] = ['county', '=', $find['area_id']];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// 登录返回村名和村地址
|
||||||
|
$cun_arr['cun_name'] = Db::table('fa_geo_village')->where('village_id', $find['village_id'])->value('village_name');
|
||||||
|
$cun_arr['cun_address'] = Db::table('fa_szxc_information_usermsg')->where('user_id', JWT_UID)->value('address_name');
|
||||||
|
}else{
|
||||||
|
$cun_arr = [];
|
||||||
|
}
|
||||||
|
|
||||||
|
if(isset($param['street_id']) && !empty($param['street_id'])){
|
||||||
|
$where[] = ['township', '=', $param['street_id']];
|
||||||
|
}
|
||||||
|
if(isset($param['village_id']) && !empty($param['village_id'])){
|
||||||
|
$where[] = ['village', '=', $param['village_id']];
|
||||||
|
}
|
||||||
|
|
||||||
|
//总条数
|
||||||
|
$count = Db::table('fa_article')->where($where)->count();
|
||||||
|
//当月条数
|
||||||
|
$month_count = Db::table('fa_article')->where($where)->whereMonth('view_time')->count();
|
||||||
|
if ($search != '') {
|
||||||
|
$where[] = ['title', 'like', '%' . $search . '%'];
|
||||||
|
}
|
||||||
|
if ($category_type != 0) {
|
||||||
|
$where[] = ['category_type', '=', $category_type];
|
||||||
|
}
|
||||||
|
//判断筛选查询
|
||||||
|
if ($screen==2){
|
||||||
|
foreach ($where as $key =>$value){
|
||||||
|
$where[$key][0] = 'a.'.$value[0];
|
||||||
|
}
|
||||||
|
//查询
|
||||||
|
$select = Db::table('fa_article')->where($where)->page($page)->limit(20)
|
||||||
|
->alias('a')
|
||||||
|
->join(['fa_article_vote_side_tables' => 'avst'],"a.id = avst.article_id and avst.end_time >=".date('Y-m-d'))
|
||||||
|
->field('a.id,a.title,a.describe,a.user_id,a.view,a.view_time,a.image,a.end_time,a.is_solve,a.is_vote,a.is_nickname,a.video,a.category_type,avst.end_time as die_time')
|
||||||
|
->order('a.id DESC')
|
||||||
|
->select()->toArray();
|
||||||
|
}else if ($screen==3){
|
||||||
|
foreach ($where as $key =>$value){
|
||||||
|
$where[$key][0] = 'a.'.$value[0];
|
||||||
|
}
|
||||||
|
//查询
|
||||||
|
$select = Db::table('fa_article')->where($where)->page($page)->limit(20)
|
||||||
|
->alias('a')
|
||||||
|
->join(['fa_article_vote_side_tables' => 'avst'],"a.id = avst.article_id and avst.end_time <=".date('Y-m-d'))
|
||||||
|
->field('a.id,a.title,a.describe,a.user_id,a.view,a.view_time,a.image,a.end_time,a.is_solve,a.is_vote,a.is_nickname,a.video,a.category_type,avst.end_time as die_time')
|
||||||
|
->order('a.id DESC')->select()->toArray();
|
||||||
|
}else{
|
||||||
|
//查询是否解决
|
||||||
|
if($solve==2){
|
||||||
|
$where[] = ['is_solve', '=', 0];
|
||||||
|
}else if($solve==3){
|
||||||
|
$where[] = ['is_solve', '=', 1];
|
||||||
|
}
|
||||||
|
$select = Db::table('fa_article')->with('user')->where($where)->page($page)->limit(20)
|
||||||
|
->field('id,title,user_id,view,view_time,image,end_time,is_solve,is_vote,is_nickname,video,category_type,describe')
|
||||||
|
->order('id',$orders)->select()->toArray();
|
||||||
|
}
|
||||||
|
|
||||||
|
foreach ($select as $key => $value) {
|
||||||
|
if ($value['is_nickname'] == 1) {
|
||||||
|
$select[$key]['nickname'] = "匿名人员";
|
||||||
|
$select[$key]['avatar'] = "";
|
||||||
|
$select[$key]['user_id'] = 0;
|
||||||
|
} else {
|
||||||
|
$select[$key]['nickname'] = Db::table('fa_szxc_information_usermsg')->where('user_id', $value['user_id'])->value('name');
|
||||||
|
}
|
||||||
|
//投票处理
|
||||||
|
if ($value['is_vote'] == 1) {
|
||||||
|
$article_vote = Db::table('fa_article_vote_side_tables')->where('article_id', $value['id'])->find();
|
||||||
|
if ($article_vote) {
|
||||||
|
$data = $article_vote;
|
||||||
|
$data['agree_percentage'] = 0;
|
||||||
|
$data['opposition_percentage'] = 0;
|
||||||
|
$count_vote = $data['agree'] + $data['opposition'] + $data['other'];
|
||||||
|
if ($count_vote != 0) {
|
||||||
|
if ($data['agree'] != 0) {
|
||||||
|
$data['agree_percentage'] = round(($data['agree'] / $count_vote) * 100);
|
||||||
|
}
|
||||||
|
if ($data['opposition'] != 0) {
|
||||||
|
$data['opposition_percentage'] = round(($data['opposition'] / $count_vote) * 100);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
$select[$key]['extend']['vote'] = $data;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
$select[$key]['extend'] = [];
|
||||||
|
}
|
||||||
|
if ($is_time == 1) {
|
||||||
|
if ($value['end_time'] < date('Y-m-d H:i:s')) {
|
||||||
|
if ($value['end_time'] == '0000-00-00 00:00:00') {
|
||||||
|
$select[$key]['overdue_time'] = '显示错误';
|
||||||
|
} else {
|
||||||
|
if($value['is_solve']==1){
|
||||||
|
$select[$key]['overdue_time'] = 0;
|
||||||
|
}else{
|
||||||
|
$cle = time() - strtotime($value['end_time']);
|
||||||
|
$select[$key]['overdue_time'] = ceil($cle / 3600 / 24);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
$select[$key]['overdue_time'] = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
if ($category_id == 165) {
|
||||||
|
if ($value['category_type'] != 0) {
|
||||||
|
$find = Db::table('fa_category')->where('id', $value['category_type'])->find();
|
||||||
|
$select[$key]['extend']['category_type_name'] = $find ? $find['name'] . ':' : '';
|
||||||
|
} else {
|
||||||
|
$select[$key]['extend']['category_type_name'] = '';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
$this->apiSuccess('ok', ['list' => $select, 'cun'=>$cun_arr, 'count' => ['count' => $count, 'month_count' => $month_count]]);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**首页推荐
|
||||||
|
* @param $category_id
|
||||||
|
* @param $page
|
||||||
|
*/
|
||||||
|
public function hot_list($category_id = 0, $page = 1, $county = 0, $township = 0, $village = 0)
|
||||||
|
{
|
||||||
|
$where = [
|
||||||
|
['status', '=', 1],
|
||||||
|
];
|
||||||
|
if (!$category_id) {
|
||||||
|
unset($where[1]);
|
||||||
|
}
|
||||||
|
// 如果登录
|
||||||
|
if (JWT_UID) {
|
||||||
|
$find = Db::table('fa_szxc_information_useraddress')->where('user_id', JWT_UID)->find();
|
||||||
|
if ($find) {
|
||||||
|
if ($find['auth_range']==1){
|
||||||
|
$where[] = ['village', '=', $find['village_id']];
|
||||||
|
}elseif ($find['auth_range']==2){
|
||||||
|
$where[] = ['township', '=', $find['street_id']];
|
||||||
|
}elseif ($find['auth_range']==3){
|
||||||
|
$where[] = ['county', '=', $find['area_id']];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// if ($county != 0) {
|
||||||
|
// $where[] = ['county', '=', $county];
|
||||||
|
// }
|
||||||
|
// if ($township != 0) {
|
||||||
|
// $where[] = ['township', '=', $township];
|
||||||
|
// }
|
||||||
|
// if ($village != 0) {
|
||||||
|
// $where[] = ['village', '=', $village];
|
||||||
|
// }
|
||||||
|
if ($category_id == 0) {
|
||||||
|
$where[] = ['category_id', 'in', [176, 162, 161, 160, 152]];
|
||||||
|
$sos = Db::table('fa_article')->where('category_id', 150)->where('status', 1)
|
||||||
|
->whereTime('view_time','between', [date("H:i:s",strtotime("-5 minute")), date("H:i:s",strtotime("+5 minute"))])
|
||||||
|
->page($page)->limit(3)
|
||||||
|
->withAttr('user_info', function ($value, $data) {
|
||||||
|
$user = Db::table('fa_user')->where('id', $data['user_id'])->field('nickname,avatar')->find();
|
||||||
|
$user['name'] = Db::table('fa_szxc_information_usermsg')->where('user_id', $data['user_id'])->value('name');
|
||||||
|
return $user;
|
||||||
|
})
|
||||||
|
->withAttr('article_comment', function ($value, $data) {
|
||||||
|
return Db::table('fa_article_comment')->where([['vote_id','=',$data['id']],['status','=',1]])->count();
|
||||||
|
})
|
||||||
|
->withAttr('article_type', function ($value, $data) {
|
||||||
|
return '一键求救';
|
||||||
|
})
|
||||||
|
->field('id,title,user_id,view,view_time,image,end_time,is_solve,is_vote,is_nickname,video,category_id,source')->order('id DESC')
|
||||||
|
->withAttr('image', function ($value, $data) {
|
||||||
|
if ($data['image'] != '') {
|
||||||
|
return explode(',', $data['image']);
|
||||||
|
}
|
||||||
|
})
|
||||||
|
->select()->toArray();
|
||||||
|
} else {
|
||||||
|
$where[] = ['category_id', '=', $category_id];
|
||||||
|
$sos = [];
|
||||||
|
}
|
||||||
|
//查询
|
||||||
|
$mapo[] = [['category_id','=','1'],['status','=','1']];
|
||||||
|
$select = Db::table('fa_article')->where($where)->whereOr($mapo)->page($page)->limit(20)
|
||||||
|
->withAttr('user_info', function ($value, $data) {
|
||||||
|
$user = Db::table('fa_user')->where('id', $data['user_id'])->field('nickname,avatar')->find();
|
||||||
|
$user['name'] = Db::table('fa_szxc_information_usermsg')->where('user_id', $data['user_id'])->value('name');
|
||||||
|
return $user;
|
||||||
|
})
|
||||||
|
->field('id,title,describe,user_id,view,view_time,image,end_time,is_solve,is_vote,is_nickname,video,category_id')->order('id DESC')
|
||||||
|
->withAttr('image', function ($value, $data) {
|
||||||
|
if ($data['image'] != '') {
|
||||||
|
return explode(',', $data['image']);
|
||||||
|
}
|
||||||
|
})
|
||||||
|
->withAttr('article_comment', function ($value, $data) {
|
||||||
|
return Db::table('fa_article_comment')->where([['vote_id','=',$data['id']],['status','=',1]])->count();
|
||||||
|
})
|
||||||
|
->withAttr('article_type', function ($value, $data) {
|
||||||
|
if($data['category_id'] == 1){
|
||||||
|
return '实时信息';
|
||||||
|
}elseif($data['category_id'] == 176){
|
||||||
|
return '党务公开';
|
||||||
|
}elseif($data['category_id'] == 162){
|
||||||
|
return '议事大厅';
|
||||||
|
}elseif($data['category_id'] == 161){
|
||||||
|
return '财务公开';
|
||||||
|
}elseif($data['category_id'] == 160){
|
||||||
|
return '村务公开';
|
||||||
|
}elseif($data['category_id'] == 152){
|
||||||
|
return '好人好事';
|
||||||
|
}else{
|
||||||
|
return '';
|
||||||
|
}
|
||||||
|
})
|
||||||
|
->select()->toArray();
|
||||||
|
$personal=Db::table('fa_szxc_personal_news')
|
||||||
|
->withAttr('user_info', function ($value, $data) {
|
||||||
|
$user = Db::table('fa_user')->where('id', $data['user_id'])->field('nickname,avatar')->find();
|
||||||
|
$user['name'] = Db::table('fa_szxc_information_usermsg')->where('user_id', $data['user_id'])->value('name');
|
||||||
|
return $user;
|
||||||
|
})
|
||||||
|
->withAttr('image', function ($value, $data) {
|
||||||
|
if ($data['image'] != '') {
|
||||||
|
return json_decode($data['image'],true);
|
||||||
|
}
|
||||||
|
})
|
||||||
|
->withAttr('article_comment', function ($value, $data) {
|
||||||
|
return Db::table('fa_szxc_personal_news_comment')->where([['personal_news_id','=',$data['id']],['status','=',1]])->count();
|
||||||
|
})
|
||||||
|
->withAttr('article_type', function ($value, $data) {
|
||||||
|
return Db::table('fa_category')->where('id', $data['category_id'])->value('name');
|
||||||
|
})
|
||||||
|
->withAttr('view_time', function ($value, $data) {
|
||||||
|
return date('Y-m-d H:i:s', $value);
|
||||||
|
})
|
||||||
|
->field('id,id as personal_news_id,content as title,user_id,view,createtime as view_time,images as image,video,category_id')
|
||||||
|
->limit(5)->order('id desc')->page($page)->select()->toArray();
|
||||||
|
$i=0;
|
||||||
|
$personal_count=count($personal);
|
||||||
|
if ($select && $personal){
|
||||||
|
foreach($select as $key=>$value){
|
||||||
|
if ($key!=0 &&$key%2==0 &&$i<$personal_count){
|
||||||
|
array_splice($select,$key+$i,0,[$personal[$i]]);
|
||||||
|
++$i;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
$this->apiSuccess('ok', ['list' => array_merge($sos, $select)]);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**首页分类列表
|
||||||
|
* @param $category_id
|
||||||
|
* @param $page
|
||||||
|
*/
|
||||||
|
public function getArticleList($category_id = 0, $page = 1, $type = 1)
|
||||||
|
{
|
||||||
|
// $model = Db::table('fa_article');
|
||||||
|
$where = [
|
||||||
|
['status', '=', 1],
|
||||||
|
];
|
||||||
|
//根据个人村id进行查询
|
||||||
|
if (JWT_UID) {
|
||||||
|
$find = Db::table('fa_szxc_information_useraddress')->where('user_id', JWT_UID)->find();
|
||||||
|
if ($find) {
|
||||||
|
if ($find['auth_range']==1){
|
||||||
|
$where[] = ['village', '=', $find['village_id']];
|
||||||
|
}elseif ($find['auth_range']==2){
|
||||||
|
$where[] = ['township', '=', $find['street_id']];
|
||||||
|
}elseif ($find['auth_range']==3){
|
||||||
|
$where[] = ['county', '=', $find['area_id']];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if ($type == 1) {
|
||||||
|
$where[] = ['category_id', 'in', [162, 161, 160, 152]];
|
||||||
|
|
||||||
|
} else {
|
||||||
|
$where[] = ['category_id', '=', $category_id];
|
||||||
|
}
|
||||||
|
//查询
|
||||||
|
$select = Db::table('fa_article')->where($where)->page($page)->limit(20)
|
||||||
|
->field('id,title,user_id,view,view_time,image,end_time,is_solve,is_vote,is_nickname,video,category_id')->order('id DESC')
|
||||||
|
->withAttr('image', function ($value, $data) {
|
||||||
|
if ($data['image'] != '') {
|
||||||
|
return explode(',', $data['image']);
|
||||||
|
}
|
||||||
|
})
|
||||||
|
->withAttr('user_info', function ($value, $data) {
|
||||||
|
$user = Db::table('fa_user')->where('id', $data['user_id'])->field('nickname,avatar')->find();
|
||||||
|
$user['name'] = Db::table('fa_szxc_information_usermsg')->where('user_id', $data['user_id'])->value('name');
|
||||||
|
return $user;
|
||||||
|
})
|
||||||
|
->withAttr('article_comment', function ($value, $data) {
|
||||||
|
return Db::table('fa_article_comment')->where([['vote_id','=',$data['id']],['status','=',1]])->count();
|
||||||
|
})
|
||||||
|
->withAttr('article_type', function ($value, $data) {
|
||||||
|
if($data['category_id'] == 176){
|
||||||
|
return '党务公开';
|
||||||
|
}elseif($data['category_id'] == 162){
|
||||||
|
return '议事大厅';
|
||||||
|
}elseif($data['category_id'] == 161){
|
||||||
|
return '财务公开';
|
||||||
|
}elseif($data['category_id'] == 160){
|
||||||
|
return '村务公开';
|
||||||
|
}elseif($data['category_id'] == 152){
|
||||||
|
return '好人好事';
|
||||||
|
}else{
|
||||||
|
return '';
|
||||||
|
}
|
||||||
|
})
|
||||||
|
->select()->toArray();
|
||||||
|
return $this->apiSuccess('ok', ['list' => $select]);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**详情
|
||||||
|
* @param $id
|
||||||
|
* @return null
|
||||||
|
* @throws \think\db\exception\DataNotFoundException
|
||||||
|
* @throws \think\db\exception\DbException
|
||||||
|
* @throws \think\db\exception\ModelNotFoundException
|
||||||
|
*/
|
||||||
|
public function details($id)
|
||||||
|
{
|
||||||
|
// 增加阅读数
|
||||||
|
// $ip = 'article-details-'.$this->request->ip().'-'.$id;
|
||||||
|
// $ip_cache = Cache::get($ip);
|
||||||
|
// if(empty($ip_cache)){
|
||||||
|
// Cache::set($ip,$id,3600*24);
|
||||||
|
$map[] =['id','=', $id];
|
||||||
|
Db::table('fa_article')->where($map)->inc('view','1')->update();
|
||||||
|
// }
|
||||||
|
|
||||||
|
$where = [
|
||||||
|
['status', '=', 1],
|
||||||
|
['id', '=', $id]
|
||||||
|
];
|
||||||
|
$find = Db::table('fa_article')->where($where)
|
||||||
|
->withAttr('user_info', function ($data, $value) {
|
||||||
|
$find['nickname'] = "匿名人员";
|
||||||
|
$find['mobile'] = "匿名状态无法显示";
|
||||||
|
$find['gender'] = "匿名状态无法显示";
|
||||||
|
$find['avatar'] = "";
|
||||||
|
$find['user_id'] = 0;
|
||||||
|
$find['count'] = 0;
|
||||||
|
$find['end_count'] = 0;
|
||||||
|
$find['overdue_count'] = 0;
|
||||||
|
if ($value['is_nickname'] == 0) {
|
||||||
|
$user = Db::table('fa_user')->where('id', $value['user_id'])->field('nickname,avatar,mobile')->find();
|
||||||
|
if ($user) {
|
||||||
|
$find = $user;
|
||||||
|
}
|
||||||
|
$find['nickname'] = Db::table('fa_szxc_information_usermsg')->where('user_id', $value['user_id'])->value('name');
|
||||||
|
}
|
||||||
|
$config_find = Db::table('fa_config')->where('id', 20)->find();
|
||||||
|
//是否查询提案数
|
||||||
|
if (in_array($value['category_id'], explode(',', $config_find['value']))) {
|
||||||
|
//提案总数
|
||||||
|
$where = [
|
||||||
|
['category_id', '=', $value['category_id']],
|
||||||
|
['user_id', '=', $value['user_id']]
|
||||||
|
];
|
||||||
|
//处理总数
|
||||||
|
$whereTwo = [
|
||||||
|
['category_id', '=', $value['category_id']],
|
||||||
|
['user_id', '=', $value['user_id']],
|
||||||
|
['is_solve', '=', 1]
|
||||||
|
];
|
||||||
|
$find['count'] = Db::table('fa_article')->where($where)->count();
|
||||||
|
$find['end_count'] = Db::table('fa_article')->where($whereTwo)->count();
|
||||||
|
//逾期总数
|
||||||
|
$where[] = ['is_solve', '=', 0];
|
||||||
|
$find['overdue_count'] = Db::table('fa_article')->where($where)->whereTime('end_time', '<=', date('Y-m-d H:i:s'))
|
||||||
|
->count();
|
||||||
|
$usermsg = Db::table('fa_szxc_information_usermsg')->where('user_id', $value['user_id'])->field('age,address_name,gender,name')->find();
|
||||||
|
if ($value['is_nickname']==1){
|
||||||
|
$find['age'] ='匿名状态无法显示';
|
||||||
|
$find['address'] = '匿名状态无法显示';
|
||||||
|
$find['gender'] = '匿名状态无法显示';
|
||||||
|
}else{
|
||||||
|
$find['age'] = $usermsg?$usermsg['age']:'';
|
||||||
|
$find['address'] = $usermsg?$usermsg['address_name']:'';
|
||||||
|
if ($usermsg){
|
||||||
|
$find['gender'] =$usermsg['gender']==1?'男':'女';
|
||||||
|
}
|
||||||
|
$find['nickname'] = $usermsg['name'];
|
||||||
|
}
|
||||||
|
$insurance = Db::table('fa_szxc_information_insurance')->where('user_id', $value['user_id'])->field('insurance_type')->find();
|
||||||
|
if ($insurance) {
|
||||||
|
$find['insurance_type'] = $insurance['insurance_type'];
|
||||||
|
} else {
|
||||||
|
$find['insurance_type'] = "";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return $find;
|
||||||
|
})->withAttr('category_type_title', function ($data, $value) {
|
||||||
|
if ($value['category_type'] != 0) {
|
||||||
|
$find = Db::table('fa_category')->where('id', $value['category_type'])->find();
|
||||||
|
return $find['name'];
|
||||||
|
}
|
||||||
|
})
|
||||||
|
->find();
|
||||||
|
//投票处理
|
||||||
|
if ($find['is_vote'] == 1) {
|
||||||
|
$article_vote = Db::table('fa_article_vote_side_tables')->where('article_id', $find['id'])->find();
|
||||||
|
if ($article_vote) {
|
||||||
|
$data = $article_vote;
|
||||||
|
$data['agree_percentage'] = 0;
|
||||||
|
$data['opposition_percentage'] = 0;
|
||||||
|
$count_vote = $data['agree'] + $data['opposition'] + $data['other'];
|
||||||
|
if ($count_vote != 0) {
|
||||||
|
if ($data['agree'] != 0) {
|
||||||
|
$data['agree_percentage'] = round(($data['agree'] / $count_vote) * 100);
|
||||||
|
}
|
||||||
|
if ($data['opposition'] != 0) {
|
||||||
|
$data['opposition_percentage'] = round(($data['opposition'] / $count_vote) * 100);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
$find['extend']['vote'] = $data;
|
||||||
|
}
|
||||||
|
|
||||||
|
} else {
|
||||||
|
$find['extend'] = [];
|
||||||
|
|
||||||
|
}
|
||||||
|
return $this->apiSuccess('ok', $find);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
47
app/api/controller/Education.php
Normal file
47
app/api/controller/Education.php
Normal file
@ -0,0 +1,47 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace app\api\controller;
|
||||||
|
|
||||||
|
use app\api\BaseController;
|
||||||
|
use app\api\middleware\Auth;
|
||||||
|
use think\facade\Db;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 教育培训
|
||||||
|
*/
|
||||||
|
class Education extends BaseController
|
||||||
|
{
|
||||||
|
const ARTICLE_EDUCATION_LIVE = 'fa_article_education_live';
|
||||||
|
const TAG = 'fa_tag';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 控制器中间件 [不需要鉴权]
|
||||||
|
* @var array
|
||||||
|
*/
|
||||||
|
protected $middleware = [
|
||||||
|
Auth::class => ['except' => ['Index'] ]
|
||||||
|
];
|
||||||
|
|
||||||
|
protected function getData($cid){
|
||||||
|
$where = ['category_id'=>$cid];
|
||||||
|
$list = Db::table('fa_article')->withAttr('lesson',
|
||||||
|
function($value, $data){
|
||||||
|
return Db::table(self::ARTICLE_EDUCATION_LIVE)->field('lesson_period,tag_ids as series_num')->where('article_id', $data['id'])->find();
|
||||||
|
}
|
||||||
|
)
|
||||||
|
->where($where)
|
||||||
|
->page(1)
|
||||||
|
->limit(10)
|
||||||
|
->order('id desc')
|
||||||
|
->select();
|
||||||
|
|
||||||
|
return $list;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function Index(){
|
||||||
|
$data = $this->getData(370);
|
||||||
|
$this->apiSuccess('ok', ['list' => $data]);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
50
app/api/controller/HouseDecoration.php
Normal file
50
app/api/controller/HouseDecoration.php
Normal file
@ -0,0 +1,50 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace app\api\controller;
|
||||||
|
|
||||||
|
use app\api\BaseController;
|
||||||
|
use app\api\middleware\Auth;
|
||||||
|
use think\facade\Db;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 教育培训
|
||||||
|
*/
|
||||||
|
class HouseDecoration extends BaseController
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* 控制器中间件 [不需要鉴权]
|
||||||
|
* @var array
|
||||||
|
*/
|
||||||
|
protected $middleware = [
|
||||||
|
Auth::class => ['except' => ['case','store'] ]
|
||||||
|
];
|
||||||
|
|
||||||
|
protected function getData($cid){
|
||||||
|
$where = ['category_id'=>$cid];
|
||||||
|
$list = Db::table('fa_article')
|
||||||
|
// ->withAttr('enroll',
|
||||||
|
// function($value, $data){
|
||||||
|
// return Db::table(self::ARTICLE_PUBLIC_BENEFIT)->field('promoter,enrolled_num')->where('article_id', $data['id'])->find();
|
||||||
|
// }
|
||||||
|
// )
|
||||||
|
->where($where)
|
||||||
|
->page(1)
|
||||||
|
->limit(10)
|
||||||
|
->order('id desc')
|
||||||
|
->select();
|
||||||
|
|
||||||
|
return $list;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function case(){
|
||||||
|
$data = $this->getData(499);
|
||||||
|
$this->apiSuccess('ok', ['list' => $data]);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function store(){
|
||||||
|
$data = $this->getData(501);
|
||||||
|
$this->apiSuccess('ok', ['list' => $data]);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
51
app/api/controller/PublicBenefit.php
Normal file
51
app/api/controller/PublicBenefit.php
Normal file
@ -0,0 +1,51 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace app\api\controller;
|
||||||
|
|
||||||
|
use app\api\BaseController;
|
||||||
|
use app\api\middleware\Auth;
|
||||||
|
use think\facade\Db;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 教育培训
|
||||||
|
*/
|
||||||
|
class PublicBenefit extends BaseController
|
||||||
|
{
|
||||||
|
const ARTICLE_PUBLIC_BENEFIT = 'fa_article_public_benefit';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 控制器中间件 [不需要鉴权]
|
||||||
|
* @var array
|
||||||
|
*/
|
||||||
|
protected $middleware = [
|
||||||
|
Auth::class => ['except' => ['Enroll','Activites'] ]
|
||||||
|
];
|
||||||
|
|
||||||
|
protected function getData($cid){
|
||||||
|
$where = ['category_id'=>$cid];
|
||||||
|
$list = Db::table('fa_article')->withAttr('enroll',
|
||||||
|
function($value, $data){
|
||||||
|
return Db::table(self::ARTICLE_PUBLIC_BENEFIT)->field('promoter,enrolled_num')->where('article_id', $data['id'])->find();
|
||||||
|
}
|
||||||
|
)
|
||||||
|
->where($where)
|
||||||
|
->page(1)
|
||||||
|
->limit(10)
|
||||||
|
->order('id desc')
|
||||||
|
->select();
|
||||||
|
|
||||||
|
return $list;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function Enroll(){
|
||||||
|
$data = $this->getData(368);
|
||||||
|
$this->apiSuccess('ok', ['list' => $data]);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function Activites(){
|
||||||
|
$data = $this->getData(369);
|
||||||
|
$this->apiSuccess('ok', ['list' => $data]);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
51
public/nginx.htaccess
Normal file
51
public/nginx.htaccess
Normal file
@ -0,0 +1,51 @@
|
|||||||
|
#此文件为Nginx的伪静态文件 PHPCUSTOM官方网址:http://www.phpcustom.com http://www.lccee.com
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
# 将以下是301跳转设置,请自定修改为您的域名
|
||||||
|
if ($Host = 'xxx.com'){
|
||||||
|
rewrite ^/(.*)$ http://www.phpcustom.com/$1 permanent;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#以下为phpwind9.0伪静态规则,去掉下面的#即可生效
|
||||||
|
#------------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
# if (-f $request_filename) {
|
||||||
|
# break;
|
||||||
|
# }
|
||||||
|
# if ($request_filename ~* "\.(js|ico|gif|jpe?g|bmp|png|css)$") {
|
||||||
|
# break;
|
||||||
|
# }
|
||||||
|
# if (!-e $request_filename) {
|
||||||
|
# rewrite . /index.php last;
|
||||||
|
# }
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
# 这个是ThinkPHP V5伪静态规则示例 请去掉以下代码前边的#号即可生效
|
||||||
|
|
||||||
|
#------------------------------------------------------------------------------------------------
|
||||||
|
#if (!-e $request_filename) {
|
||||||
|
# rewrite ^(.*)$ /index.php?s=/$1 last;
|
||||||
|
# break;
|
||||||
|
# }
|
||||||
|
|
||||||
|
#------------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
x
Reference in New Issue
Block a user