Browse Source

subscribe templte except

zz 5 years ago
parent
commit
55ba36c407

+ 2 - 19
app/Http/Controllers/Wap/Subscribe/LinkSubscribeController.php

@@ -129,25 +129,8 @@ class LinkSubscribeController extends Controller
     private function appad($uid, $distribution_channel_id)
     {
         //自由人站点强关走老的
-        $ziyouren_sites = [
-            180,181,182,189,222,224,225,253,276,277,278,279,
-            280,434,692,713,714,725,726,732,733,734,735,738,
-            739,763,764,766,768,780,787,817,833,834,835,836,
-            841,842,843,844,846,884,885,889,890,891,895,896,
-            898,928,931,932,935,976,1021,4042,4043,4044,4045,
-            4143,4273,4285,4286,4287,4322,4347,4369,4390,4392,
-            4393,4394,4395,4396,4397,4398,4399,4400,4401,4402,
-            4403,4404,4405,4406,4413,4414,4415,4416,4433,4434,
-            4435,4436,4438,4439,4440,4441,4442,4443,4444,4445,
-            4456,4483,4511,4512,4561,4562,4563,4564,4565,4566,
-            4567,4568,4569,4603,4604,4605,4606,4607,4608,4609,
-            4624,4905,4906,4907,4908,4909,4910,5188,5250,5252,
-            5261,5262,5263,5274,5282,5283,5284,5310,5311,5312,
-            5313,5314,5315,5321,5322,5323,5324,5344,5348,5361,
-            5372,5466,5474,5552,5568,5576,5581,5594,5612,5615,5621,5674,5690,5691,5692,5717,5722,5732,5733,5734,5735,5847,5848,5849,5850,5891,5892,5893,5894,5895,5896,5897,5898,5899,5900,5952,6005,6057,6058,6059,6060,6218,6586,6587,6588,6589,6590,6591,6592,6593,6594,6595,6596,6619,6620,6621,6622,
-            6623,6624,6625,6626,6670,6840,6854,6855,6896,6947
-        ];
-        if(in_array($distribution_channel_id,$ziyouren_sites)){
+        $company = \App\Modules\Channel\Services\ChannelService::getCompanyIdByDistributionchannelid($distribution_channel_id);
+        if($company && in_array($company,[52,556,557,637])){
             return false;
         }
         /*$ads_open_site = env('ADS_OPEN_SITE','');

+ 46 - 33
app/Modules/Channel/Services/ChannelService.php

@@ -61,9 +61,9 @@ class ChannelService
      * @param unknown_type $distribution_channel_id
      * @param unknown_type $channel_user_id
      */
-    static function deleteChannel($distribution_channel_id, $channel_user_id)
+    static function deleteChannel($distribution_channel_id, $channel_user_id)
     {
-    	return Channel::deleteChannel($distribution_channel_id, $channel_user_id);
+    	return Channel::deleteChannel($distribution_channel_id, $channel_user_id);
     }
     
 
@@ -338,13 +338,13 @@ class ChannelService
     	return DistributionSelfDefineConfig::getDistributionSelfDefineConfig($distribution_channel_id,$category);
     }
     
-    /**
-     * 获取渠道信息
-     * @return mixed
-     */
-    static function getDistributionChannelSwitchByCategoryAndCompany($company_id,$category)
-    {
-    	return DistributionSelfDefineConfig::getDistributionChannelSwitchByCategoryAndCompany($company_id,$category);
+    /**
+     * 获取渠道信息
+     * @return mixed
+     */
+    static function getDistributionChannelSwitchByCategoryAndCompany($company_id,$category)
+    {
+    	return DistributionSelfDefineConfig::getDistributionChannelSwitchByCategoryAndCompany($company_id,$category);
     }
     
     // 判断渠道的某个分类的 按照公司的权限
@@ -352,26 +352,26 @@ class ChannelService
     	$distribution = self::getDistributionChannel($distribution_channel_id);
     	$channel_user_id = isset($distribution->channel_user_id)?$distribution->channel_user_id:'';
     	$channel_user = ChannelUserService::getById($channel_user_id);
-    	$company_id = isset($channel_user->company_id)?$channel_user->company_id:'';
+    	$company_id = isset($channel_user->company_id)?$channel_user->company_id:'';
     	 
     	\Log::info('check_channel_company_priv:category:'.$category.' distribution_channel_id:'.$distribution_channel_id.' channel_user_id:'.$channel_user_id.' company_id:'.$company_id);
     	return self::getDistributionChannelSwitchByCategoryAndCompany($company_id,$category);
     }
     
-    // 判断渠道的某个分类的 按照登录账号的权限
-    static function check_channel_account_priv($distribution_channel_id,$category){
-    	$distribution = self::getDistributionChannel($distribution_channel_id);
-    	$channel_user_id = isset($distribution->channel_user_id)?$distribution->channel_user_id:'';
-    	$channel_user = ChannelUserService::getById($channel_user_id);
-    	$account = isset($channel_user->phone)?$channel_user->phone:'';
-    
-    	\Log::info('check_channel_company_priv:category:'.$category.' distribution_channel_id:'.$distribution_channel_id.' channel_user_id:'.$channel_user_id.' account:'.$account);
-    	return self::getDistributionChannelSwitchByCategoryAndAccount($account,$category);
-    }
-    
-    static function getDistributionChannelSwitchByCategoryAndAccount($account,$category)
-    {
-    	return DistributionSelfDefineConfig::getDistributionChannelSwitchByCategoryAndAccount($account,$category);
+    // 判断渠道的某个分类的 按照登录账号的权限
+    static function check_channel_account_priv($distribution_channel_id,$category){
+    	$distribution = self::getDistributionChannel($distribution_channel_id);
+    	$channel_user_id = isset($distribution->channel_user_id)?$distribution->channel_user_id:'';
+    	$channel_user = ChannelUserService::getById($channel_user_id);
+    	$account = isset($channel_user->phone)?$channel_user->phone:'';
+    
+    	\Log::info('check_channel_company_priv:category:'.$category.' distribution_channel_id:'.$distribution_channel_id.' channel_user_id:'.$channel_user_id.' account:'.$account);
+    	return self::getDistributionChannelSwitchByCategoryAndAccount($account,$category);
+    }
+    
+    static function getDistributionChannelSwitchByCategoryAndAccount($account,$category)
+    {
+    	return DistributionSelfDefineConfig::getDistributionChannelSwitchByCategoryAndAccount($account,$category);
     }
     
     /**
@@ -446,15 +446,28 @@ class ChannelService
             ->first();
     }
     
-    public static function getChannelCompanySex($distribution_channel_id){
-    	$company =  Channel::select(DB::raw("companies.*"))
-    	->leftjoin('channel_users','channel_users.id','=','distribution_channels.channel_user_id')
-    	->leftjoin('companies','companies.id','=','channel_users.company_id')
-    	->where('distribution_channels.id',$distribution_channel_id)
-    	->first();
-    	// 1男 2女 3混合
-    	$sex = isset($company->fans_gender)?$company->fans_gender:'3';
-    	return $sex;
+    public static function getChannelCompanySex($distribution_channel_id){
+    	$company =  Channel::select(DB::raw("companies.*"))
+    	->leftjoin('channel_users','channel_users.id','=','distribution_channels.channel_user_id')
+    	->leftjoin('companies','companies.id','=','channel_users.company_id')
+    	->where('distribution_channels.id',$distribution_channel_id)
+    	->first();
+    	// 1男 2女 3混合
+    	$sex = isset($company->fans_gender)?$company->fans_gender:'3';
+    	return $sex;
+    }
+
+
+    //根据站点id获取公司id  强关页面需要用
+    public static function getCompanyIdByDistributionchannelid(int $distribution_channel_id){
+        $company =  Channel::select('channel_users.company_id')
+            ->join('channel_users','channel_users.id','=','distribution_channels.channel_user_id')
+            ->where('distribution_channels.id',$distribution_channel_id)
+            ->first();
+        if($company && $company->company_id){
+            return $company->company_id;
+        }
+        return 0;
     }
     
 }

+ 3 - 0
app/Modules/Channel/Services/ChannelUserService.php

@@ -179,4 +179,7 @@ class ChannelUserService
             ->orderBy('distribution_channels.created_at', 'desc');
         return $search_object->whereIn('distribution_channels.channel_user_id', $channelUserIds)->get();
     }
+
+
+
 }