/**
  * 商家详情
  * 
  * @return [type] [description]
  */
 public function getMerchant()
 {
     $mer_session_id = isset($_POST['mer_session_id']) ? htmlspecialchars(trim($_POST['mer_session_id'])) : '';
     $merchant_id = isset($_POST['merchant_id']) ? htmlspecialchars($_POST['merchant_id']) : '';
     if (empty($merchant_id)) {
         if (!empty($mer_session_id)) {
             $merchant = $this->session_handle->getsession_userid($mer_session_id, 1);
             $merchant_id = $merchant['id'];
         } else {
             $this->jsonUtils->echo_json_msg(6, '商家id为空');
         }
     }
     $arr = $this->dao->field(" id as merchant_id,wifi_enable,merchant_name,header,manager,business_time,tel,intro,address,pics,collect_count,comment_count,business_time,mobile,area_id ")->where("id={$merchant_id}")->select();
     if ($arr) {
         $systemid = CommonController::getSystemUserid($merchant_id, 2);
         if ($arr[0]['pics']) {
             $json_obj = json_decode($arr[0]['pics'], true);
             $arr[0]['pics'] = imgUrl($json_obj);
         }
         $arr[0]['header'] = imgUrl($arr[0]['header']);
         $star = MerchantController::getMerCommentStar($merchant_id);
         $arr[0]['system_user_id'] = $systemid;
         $arr[0]['service_quality'] = $star['service_quality'];
         $arr[0]['service_attitude'] = $star['service_attitude'];
         $arr[0]['merchant_setting'] = $star['merchant_setting'];
         $this->jsonUtils->echo_json_data(0, "ok", $arr[0]);
         exit;
     } else {
         $this->jsonUtils->echo_json_msg(1, '获取商家信息错误!');
         exit;
     }
 }
 /**
  * 获取活动详情 1未开始 2进行中 3已下架
  */
 public function get_activity()
 {
     $id = (int) $_POST['id'];
     $sessionid = isset($_POST['mer_session_id']) ? htmlspecialchars($_POST['mer_session_id']) : '';
     $merchant_id = isset($_POST['merchant_id']) ? htmlspecialchars($_POST['merchant_id']) : '';
     if (empty($merchant_id)) {
         if (!empty($sessionid)) {
             $merchant_id = $this->session_handle->getsession_userid($sessionid);
         } else {
             $this->jsonUtils->echo_json_msg(6, '商家id为空');
         }
     }
     $arr = $this->activity_dao->where("id={$id} ")->find();
     if ($arr) {
         if ($arr['pics']) {
             $json_obj = json_decode($arr['pics'], true);
             $arr['pics'] = imgUrl($json_obj);
         }
         $arr['start_time'] = date('Y-m-d H:i', $arr['start_time']);
         $arr['end_time'] = date('Y-m-d H:i', $arr['end_time']);
         $arr['valid_start_time'] = date('Y-m-d H:i', $arr['valid_start_time']);
         $arr['valid_end_time'] = date('Y-m-d H:i', $arr['valid_end_time']);
         $arr['category_name'] = CategoryController::getCategoryNames($arr['category_ids']);
         $arr['resttime'] = $arr['end_time'] - time() > 0 ? $arr['end_time'] - time() : 0;
         if ($arr['effect'] == 0) {
             // 审核中 只能下架
             $arr['instock'] = 0;
             // 0下架
         } else {
             if ($arr['end_time'] < time()) {
                 // 已过期的活动
                 $arr['instock'] = 1;
                 // 1上架
             } else {
                 $arr['instock'] = 0;
                 // 0下架
             }
         }
         $arr['merchant_name'] = MerchantController::getMerName($merchant_id);
         $star = MerchantController::getMerCommentStar($merchant_id);
         $arr['service_quality'] = $star['service_quality'];
         $arr['service_attitude'] = $star['service_attitude'];
         $arr['merchant_setting'] = $star['merchant_setting'];
         $this->jsonUtils->echo_json_data(0, 'ok', $arr);
         exit;
     } else {
         $this->jsonUtils->echo_json_msg(1, '获取失败!');
         exit;
     }
 }