1
1
齐博 1 жил өмнө
parent
commit
c211a9fb0b

+ 10 - 0
application/common/controller/index/Search.php

@@ -91,6 +91,16 @@ class Search extends IndexBase
 	    if($data['fid']){
 	        $map['fid'] = $data['fid'];
 	    }
+	    
+	    //只搜索圈子里边的信息
+	    if ($data['qun_id']) {
+	        $map['ext_id'] = $data['qun_id'];
+	    }elseif (get_wxappAppid()) {
+	        $info = get_wxappinfo(get_wxappAppid());
+	        if ($info['qun_id']) {
+	            $map['ext_id'] = $info['qun_id'];
+	        }
+	    }
 	    return $map;
 	}
 

+ 3 - 2
application/common/field/Base.php

@@ -204,9 +204,10 @@ class Base
      * 把单选\多选\下拉框架的参数转义为可选项数组
      * @param string $str 可以是类 app\bbs\model\Sort@getTitleList
      * @param array $info 内容信息
+     * @param string $exp 数组分隔符
      * @return void|string|array|unknown[]
      */
-    protected static function options_2array($str='',$info=[]){
+    protected static function options_2array($str='',$info=[],$exp=""){
         if($str==''){
             return ;
         }
@@ -236,7 +237,7 @@ class Base
             $array = Db::name($table_name)->where($map)->column($fields);
         }elseif(preg_match('/("|\[)/',$str)&&is_array($array = json_decode($str,true))){
         }else{
-            $array = str_array($str);
+            $array = str_array($str,$exp);
         }
         return $array;
     }

+ 3 - 3
application/common/field/Form.php

@@ -637,17 +637,17 @@ $(function(){
         $array=[];
         $field_array = get_field($mid);
         foreach ($field_array AS $rs){            
-            $array[] = self::format_data_field($rs,$info);
+            $array[] = self::format_data_field($rs,$info,"\n");
         }
         return $array;
     }
     
-    public static function format_data_field($rs=[],$info=[]){
+    public static function format_data_field($rs=[],$info=[],$exp=''){
         //$rs['options'] && $rs['options'] = str_array($rs['options']);
         if($rs['type'] == 'usergroup2'||$rs['type'] == 'usergroup3'){    //用户组多选 及单选
             $rs['options'] = 'app\common\model\Group@getTitleList';
         }
-        $rs['options'] = static::options_2array($rs['options'],$info);
+        $rs['options'] = static::options_2array($rs['options'],$info,$exp);
         if($rs['type']=='hidden'){   //隐藏域比较特别些
             $rs['title'] = $rs['value'];
         }

+ 19 - 0
application/common/traits/ModuleContent.php

@@ -583,10 +583,14 @@ trait ModuleContent
 	            return '你所在用户组,无权在此栏目发布!';
 	        }
 	    }
+	    
+	    $data['ext_id'] = intval($this->get_qun_ext($data['ext_id']));
+	    
 	    if($s_config['ext_id'] && !$data['ext_id']){
 	        $data['ext_id'] = $s_config['ext_id']; //比如论坛栏目自动绑定到圈子
 	    }
 	    
+	    
 	    if(!$this->admin){
 	        if($data['title']){
 	            if(get_cookie('cms_title')==md5($data['title'])){
@@ -629,6 +633,20 @@ trait ModuleContent
 	    return true;
 	}
 	
+	/**
+	 * 在商家小程序中,如果没有设置ext_id值的话,就自动补上
+	 * @param number $ext_id
+	 * @return number
+	 */
+	protected function get_qun_ext($ext_id=0){
+	    if (!$ext_id && get_wxappAppid()) {
+	        $info = get_wxappinfo(get_wxappAppid());
+	        return $info['qun_id'] ?: 0;
+	    }else{
+	        return $ext_id;
+	    }
+	}
+	
 	/**
 	 * 检查字段
 	 * @param array $data
@@ -868,6 +886,7 @@ trait ModuleContent
 	    set_cookie('cms_content', md5($data['content']));
 	}
 	
+	
 	/**
 	 * 对审核员进行消息通知
 	 * @param number $id

+ 4 - 0
template/index_style/default/index/nav.htm

@@ -4,6 +4,8 @@
 		<li>
 			<a href='/' class="home">网站首页</a>
 
+<?php if(!get_wxappAppid()&&!input('qun_id')): ?><!--圈子内判断开始-->
+
 <!-- 频道 -->
 <?php $array = config('system_dirname') ? modules_config(config('system_dirname')):''; if($array): $url=iurl(config('system_dirname').'/index/index'); ?>
 <a href="<?php echo $url; ?>"><?php echo $array['name']; ?></a>
@@ -14,6 +16,8 @@
  <a href="<?php echo $url; ?>"><?php echo $name; ?></a>
 <?php endforeach; ?>
 
+<?php endif; ?><!--圈子内判断结束-->
+
 <!-- 自定义标题与链接 -->
 <?php if($link_name!=''): $url=$link_url?$link_url:'#'; ?>
 <a href="<?php echo $url; ?>"><?php echo $link_name; ?></a>

+ 5 - 0
template/index_style/default/index/wap_nav.htm

@@ -1,5 +1,8 @@
 <div class="qb_ui_wap_nav">
 	<a href='/' class="home"><i class="si si-home"></i>首页</a>
+
+<?php if(!get_wxappAppid()&&!input('qun_id')): ?><!--圈子内判断开始-->
+
 <!-- 频道 -->
 <?php $array = config('system_dirname') ? modules_config(config('system_dirname')):''; if($array): $url=iurl(config('system_dirname').'/index/index'); ?>
 <a href="<?php echo $url; ?>"><?php echo $array['name']; ?></a>
@@ -10,6 +13,8 @@
  <a href="<?php echo $url; ?>"><?php echo $name; ?></a>
 <?php endforeach; ?>
 
+<?php endif; ?><!--圈子内判断结束-->
+
 <!-- 自定义标题与链接 -->
 <?php if($link_name!=''): $url=$link_url?$link_url:'#'; ?>
 <a href="<?php echo $url; ?>"><?php echo $link_name; ?></a>