This commit is contained in:
2024-10-29 14:04:59 +08:00
commit 48bf3e6f33
2839 changed files with 762707 additions and 0 deletions

151
app/admin/controller/Remark.php Executable file
View File

@@ -0,0 +1,151 @@
<?php
/**
* Created by PhpStorm.
* User: ORICO
* Date: 2019-01-15
* Time: 11:01
*/
namespace app\admin\controller;
use think\Lang;
use think\Loader;
use think\Config;
class Remark extends BaseController
{
private function init_search(&$search){
$search['name'] = '';
$search['timebegin'] = '';
$search['timeend'] = '';
}
public function lists(){
$agent = Db('article_comment');
$arg_where = ['a.country_code' => $this->country_code];
$data = $this->request->param();
$search = [];
$this->init_search($search);
if (isset($data['name']) && $data['name'] != ''){
$arg_where['a.name|a.content|c.title'] = ['like', "%$data[name]%"];
$search['name'] = $data['name'];
}
//$where['a.title|b.name'] = ['like', "%$skeyword%"];
if ((isset($data['timebegin']) && $data['timebegin'] != '') || (isset($data['timeend']) && $data['timeend'] != '')){
// 时间有一个不为空就初始化
$arg_where['a.add_time'] = [];
if (isset($data['timebegin']) && $data['timebegin'] != '')
{
$time = $data['timebegin'];
array_push($arg_where['a.add_time'], ['>=', $time]);
$search['timebegin'] = $data['timebegin'];
}
else{
array_push($arg_where['a.add_time'], ['>=', "0000-00-00"]);
}
if (isset($data['timeend']) && $data['timeend'] != '')
{
$time = $data['timeend'];
array_push($arg_where['a.add_time'], ['<=', $time]);
$search['timeend'] = $data['timeend'];
}
else{
$time = date('Y-m-d H:i:s',strtotime('+1 month'));
array_push($arg_where['a.add_time'], ['<=', $time]);
}
}
// dump($arg_where); die;
$arg_order = ['a.id' => 'desc'];
$arg_field = ['a.*, c.name as title, c.stat as c_stat' ];
$dataObject = model('article_comment')->getRemarkLists($arg_where, $arg_order, $arg_field, 24);
$value = [
'list' => $dataObject->isEmpty() ? null : $dataObject->items(),
'page' => $dataObject->render(),
];
//echo model('article_comment')->getLastsql();die;
$this->assign('search',$search);
$this->assign('list',$dataObject->isEmpty() ? null : $dataObject->items());
//$this->assign('list',$list);;
//
//echo "<pre>+++++++"; print_r($dataObject->items()); die;
$this->assign('page',$dataObject->render());
return $this->fetch();
}
public function update($id = 0, $stat=0) {
$id = intval($id);
if ($id > 0) {
$data = array(
'id' => $id,
'stat' => $stat
);
//echo "<pre>+++"; print_r($data);die;
$model = model('article_comment')->updateRow($data);
//echo $model->getData('id'); die;
if ($model && $model->getData('id')) {
//$feed = $this->redirect(url('/admin/remark/lists'));
return $this->success(Lang::get('operation successed'));
} else {
return $this->error(Lang::get('operation failed'));
}
} else {
return $this->error(Lang::get('incorrect operation'));
}
return $this->error(Lang::get('incorrect operation'));
}
public function view($id = 0){
$id = intval($id);
$where = ['id '=>$id];
$agent = Db('article_comment');
$data = $agent->where($where)->find();
$this->assign('data',$data);
return $this->fetch();
}
//2021-05-29 申邵 控制blog删除
public function delete($id = 0) {
$id = intval($id);
if ($id > 0) {
$result = model('article_comment')->deleteRow($id);
//echo "<pre>====="; print_r($result);die;
if ($result) {
//echo $id."<pre>=+++++++++"; print_r($result);die;
return $this->success(Lang::get('operation successed'), url('/admin/remark/lists'));
} else {
//echo "<pre>====="; print_r($result);die;
return $this->error(Lang::get('operation failed'));
}
}
return $this->error(Lang::get('incorrect operation'));
}
public function deletes() {
$ids = $this->request->post('ids');
if ($this->request->isPost() && $ids) {
$result = model('article_comment')->deleteRows($ids);
if ($result) {
return $this->success(Lang::get('operation successed'), url('/admin/remark/lists'));
} else {
return $this->error(Lang::get('operation failed'));
}
}
return $this->error(Lang::get('incorrect operation'));
}
}