|
|
@@ -17,17 +17,23 @@ class Messages extends Base
|
|
|
$param = input('param.');
|
|
|
$limit = $param['pageSize'];
|
|
|
$offset = ($param['pageNumber'] - 1) * $limit;
|
|
|
+
|
|
|
$where = [];
|
|
|
if (empty($param['searchText']) === false) {
|
|
|
$where['account_name'] = $param['searchText'];
|
|
|
}
|
|
|
- $join = [
|
|
|
- 'accounts b' => 'a.account_id = b.id',
|
|
|
- ];
|
|
|
+ $start = '';$end = '';
|
|
|
+ if (empty($param['start']) === false && empty($param['end']) === false && $param['start'] <= $param['end']) {
|
|
|
+ $start = strtotime($param['start']);
|
|
|
+ $end = strtotime($param['end'] . ' 23:59:59');
|
|
|
+ }
|
|
|
+// $join = [
|
|
|
+// 'accounts b' => 'a.account_id = b.id',
|
|
|
+// ];
|
|
|
$leftjoin = [
|
|
|
'users c' => 'a.user_id = c.id',
|
|
|
];
|
|
|
- $result = model('Accountsmessage')->selectJoin($join,$leftjoin,$where, $offset, $limit);
|
|
|
+ $result = model('Accountsmessage')->selectJoin($leftjoin,$where, $start,$end,$offset, $limit);
|
|
|
foreach($result as $key=>$vo){
|
|
|
// 优化显示附件
|
|
|
$result[$key]['image'] = '<img src="' . $vo['image'] . '" width="40px" height="40px">';
|
|
|
@@ -51,7 +57,8 @@ class Messages extends Base
|
|
|
$result[$key]['operate'] = $this->makeBtn($vo['message_id']);
|
|
|
}
|
|
|
|
|
|
- $return['total'] = db('Accountsmessage')->count(); //总数据
|
|
|
+ //$return['total'] = db('Accountsmessage')->count(); //总数据
|
|
|
+ $return['total'] = count($result); //总数据
|
|
|
$return['rows'] = $result;
|
|
|
|
|
|
return json($return);
|
|
|
@@ -64,27 +71,38 @@ class Messages extends Base
|
|
|
// 留言详情
|
|
|
public function detail()
|
|
|
{
|
|
|
-
|
|
|
+ if(request()->isAjax()) {
|
|
|
+ //设置留言公开/不公开
|
|
|
+ $param = input('post.');
|
|
|
+ $id = $param['id'];
|
|
|
+ $if_public = $param['if_public'];
|
|
|
+ try{
|
|
|
+ db('accountsmessage')->where('message_id', $id)->update(['if_public' => $if_public]);
|
|
|
+ }catch(\Exception $e){
|
|
|
+ return json(['code' => -1, 'data' => '', 'msg' => $e->getMessage()]);
|
|
|
+ }
|
|
|
+ return json(['code' => 1, 'data' => url('messages/index'), 'msg' => '设置成功']);
|
|
|
+ }
|
|
|
$id = input('param.id/d');
|
|
|
$info = db('Accountsmessage')->where('message_id', $id)->find();
|
|
|
- $account = db('Accounts')->where('id', $info['account_id'])->find();
|
|
|
+ //$account = db('Accounts')->where('id', $info['account_id'])->find();
|
|
|
$user = db('Users')->where('id', $info['user_id'])->find();
|
|
|
- $info['account_name'] = $account['account_name'];
|
|
|
- $info['account_email'] = $account['account_email'];
|
|
|
+ //$info['account_name'] = $account['account_name'];
|
|
|
+ //$info['account_email'] = $account['account_email'];
|
|
|
$info['user_name'] = $user['user_name'];
|
|
|
|
|
|
// 优化时间
|
|
|
- if(null != $info['add_time']){
|
|
|
- $info['add_time'] = date('Y-m-d H:m:s',$info['add_time']);
|
|
|
+ if (null != $info['add_time']) {
|
|
|
+ $info['add_time'] = date('Y-m-d H:m:s', $info['add_time']);
|
|
|
}
|
|
|
- if(null != $info['dealWith_time']){
|
|
|
- $info['dealWith_time'] = date('Y-m-d H:m:s',$info['dealWith_time']);
|
|
|
+ if (null != $info['dealWith_time']) {
|
|
|
+ $info['dealWith_time'] = date('Y-m-d H:m:s', $info['dealWith_time']);
|
|
|
}
|
|
|
|
|
|
// 优化显示状态
|
|
|
- if(1 == $info['message_status']){
|
|
|
+ if (1 == $info['message_status']) {
|
|
|
$info['message_status'] = '已处理';
|
|
|
- }else{
|
|
|
+ } else {
|
|
|
$info['message_status'] = '未处理';
|
|
|
}
|
|
|
|