'/index.php/Retail/Comment/deleteComment', 'deleteComments' => '/index.php/Retail/Comment/deleteComments', ); $authArr = checkFunction($arr); $this->assign('authArr', $authArr); $this->display(); } public function commentList() { $addtime = I('post.add_time'); $where = array( 'storeid' => $this->store_id, 'merchantid' => $this->merchant_id, 'status' => 1, ); if (!empty($addtime)) { $start_time = strtotime($addtime[0]); $end_time = strtotime($addtime[1]); $where['addtime'] = array('between', array($start_time, $end_time)); } //根据商户id查询出门店评价信息 $comment_count = M('retail_evalute') ->where($where) ->count(); $comments = M('retail_evalute') ->where($where) ->order('addtime desc')->page($_POST['page'], $_POST['limit'])->select(); foreach ($comments as $key => &$value) { $value['key'] = $key + 1; //序号 //用户昵称 $value['vip_name'] = M('retail_xcxvip')->where(array('id' => $value['uid']))->getField('nickname'); //门店名称 $value['store_name'] = M('retail_store')->where(array('id' => $value['storeid']))->getField('storetag'); //转换时间戳 $value['addtime'] = date('Y-m-d H:i:s', $value['addtime']); } $res['code'] = 0; $res['msg'] = ''; $res['data'] = $comments; $res['count'] = $comment_count; $this->ajaxReturn($res); } //单个删除 public function deleteComment() { if (IS_POST) { $id = $_POST['id']; // var_dump($id); if ($id) { $delete = M('retail_evalute')->where(array('id' => $id))->setField('status', 0); if ($delete) { $res['status'] = 1; $res['msg'] = '删除成功'; //操作日志记录 $source = 0; //请求来源: 0pc系统 1小助手 $type = 4; //平台:1合伙人端 2代理商端 3商户端 4门店端 $request_data = json_encode($_POST); //请求参数 json数据 $desc = '外卖订单-评价信息单个删除'; //操作行为描述 action_log($source, $type, $request_data, $desc); //end } else { $res['status'] = 0; $res['msg'] = '删除失败'; } } else { $res['status'] = 0; $res['msg'] = '删除失败'; } $this->ajaxReturn($res); } } /** * 批量选择删除 */ public function deleteComments() { if (IS_POST) { $ids = $_POST['id']; $new_id = explode(',', trim($ids, ',')); // var_dump($new_id); foreach ($new_id as $key => $value) { $delete = M('retail_evalute')->where(array('id' => $value))->setField('status', 0); } if ($delete) { $res['status'] = 1; $res['msg'] = '删除成功'; //操作日志记录 $source = 0; //请求来源: 0pc系统 1小助手 $type = 4; //平台:1合伙人端 2代理商端 3商户端 4门店端 $request_data = json_encode($_POST); //请求参数 json数据 $desc = '外卖订单-评价信息批量删除'; //操作行为描述 action_log($source, $type, $request_data, $desc); //end } else { $res['status'] = 0; $res['msg'] = '删除失败'; } $this->ajaxReturn($res); } } }