<?php
/**
 *商家活动管理
 * @Copyright (C) 2017 汉潮 All rights reserved.
 * @License http://www.hanchao9999.com
 * @Author chang <13331202938@126.com>
 */
namespace Admin\Controller;
class MemberDpListController extends BaseController
{
	public function _before_delete(){exit;}
	public function index(){
		$post = I('post.');
		$map=array();
		$keyword = $post['keyword'];
		if($keyword){
			$where = array();
			$where['goods_name']=array('like','%'.$keyword.'%');
			$ids = M('Goods')->where($where)->getField('id',true);
			if($ids){
				$map['type_id'] = array('in',$ids);
			}else{
				$this->error('没有该商品的评论！');exit;
			}
		}
		if($post['type'])$map['type'] = $post['type'];	  
		if($post['shop_id'])$map['shop_id'] = $post['shop_id'];
		$data=$this->lists('MemberDpList',$map);
		// echo "<pre>";print_r($data);exit;
		foreach($data as $k=>$v){
			$data[$k]=D('Common/LocationDp')->format_dp($v);
		}
		$this->assign('list',$data);
		
		$shopsData = getShops();
        $this->assign('shopsData',$shopsData);
        $this->assign($post);
		$this->display();
	}
	public function edit(){
		$id=I('id');
		$map=array();
		$map['id']=$id;
		$info=M('MemberDpList')->where($map)->field(true)->find();
		$info=D('Common/LocationDp')->format_dp($info);
		$info['dp_img']=unserialize($info['dp_img']);
		$info['dp_group']['check_id']=explode(',',$info['dp_group']['check_id']);
		// echo "<pre>";print_r($info);exit;
		$this->assign($info);
		$this->display();
	}
	
}