|
|
@@ -21,9 +21,9 @@ class Message extends Base
|
|
|
if(request()->isPost()){
|
|
|
|
|
|
//客服id
|
|
|
- $user_id = input('post.user_id');
|
|
|
+ $user_id = 2;
|
|
|
//留言id
|
|
|
- $message_id = input('post.message_id');
|
|
|
+ $message_id = 14;
|
|
|
|
|
|
$user = db('users')->where('id', $user_id)->find();
|
|
|
if(empty($user)){
|
|
|
@@ -37,65 +37,13 @@ class Message extends Base
|
|
|
// 更新留言状态
|
|
|
$param = [
|
|
|
'user_id' => $user_id,
|
|
|
+ 'message_status' => 1,
|
|
|
'dealWith_time' => time()
|
|
|
];
|
|
|
db('accountsmessage')->where('message_id', $message_id)->update($param);
|
|
|
|
|
|
- return json(['code' => 1, 'data' => url('message/index'), 'msg' => '登录成功']);
|
|
|
+ return json(['code' => 1, 'data' => url('message/index'), 'msg' => '处理成功']);
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- // 获取聊天记录
|
|
|
- public function getChatLog()
|
|
|
- {
|
|
|
- if(request()->isAjax()){
|
|
|
-
|
|
|
- $param = input('param.');
|
|
|
-
|
|
|
- $limit = 10; // 一次显示10 条聊天记录
|
|
|
- $offset = ($param['page'] - 1) * $limit;
|
|
|
-
|
|
|
- $logs = db('chat_log')->where(function($query) use($param){
|
|
|
- $query->where('from_id', $param['uid'])->where('to_id', 'KF' . cookie('l_user_id'));
|
|
|
- })->whereOr(function($query) use($param){
|
|
|
- $query->where('from_id', 'KF' . cookie('l_user_id'))->where('to_id', $param['uid']);
|
|
|
- })->limit($offset, $limit)->order('id', 'desc')->select();
|
|
|
-
|
|
|
- $total = db('chat_log')->where(function($query) use($param){
|
|
|
- $query->where('from_id', $param['uid'])->where('to_id', 'KF' . cookie('l_user_id'));
|
|
|
- })->whereOr(function($query) use($param){
|
|
|
- $query->where('from_id', 'KF' . cookie('l_user_id'))->where('to_id', $param['uid']);
|
|
|
- })->count();
|
|
|
-
|
|
|
- foreach($logs as $key=>$vo){
|
|
|
-
|
|
|
- $logs[$key]['type'] = 'user';
|
|
|
- $logs[$key]['time_line'] = date('Y-m-d H:i:s', $vo['time_line']);
|
|
|
-
|
|
|
- if($vo['from_id'] == 'KF' . cookie('l_user_id')){
|
|
|
- $logs[$key]['type'] = 'mine';
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- return json(['code' => 1, 'data' => $logs, 'msg' => intval($param['page']), 'total' => ceil($total / $limit)]);
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- // ip 定位
|
|
|
- public function getCity()
|
|
|
- {
|
|
|
- $ip = input('param.ip');
|
|
|
-
|
|
|
- $ip2region = new \Ip2Region();
|
|
|
- $info = $ip2region->btreeSearch($ip);
|
|
|
-
|
|
|
- $city = explode('|', $info['region']);
|
|
|
-
|
|
|
- if(0 != $info['city_id']){
|
|
|
- return json(['code' => 1, 'data' => $city['2'] . $city['3'] . $city['4'], 'msg' => 'ok']);
|
|
|
- }else{
|
|
|
-
|
|
|
- return json(['code' => 1, 'data' => $city['0'], 'msg' => 'ok']);
|
|
|
- }
|
|
|
- }
|
|
|
}
|