فهرست منبع

轮播图 屏蔽书名

zhoulj 6 سال پیش
والد
کامیت
d64feed1f0

+ 16 - 0
app/Modules/Channel/Services/ChannelService.php

@@ -358,6 +358,22 @@ class ChannelService
     	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);
+    }
+    
     /**
      * 根据站点属性,转换对应的回复链接
      */

+ 5 - 1
app/Modules/OfficialAccount/Models/DistributionSelfDefineConfig.php

@@ -8,7 +8,7 @@ class DistributionSelfDefineConfig extends Model
 {
     protected $tables = 'distribution_self_define_configs';
 
-    protected $fillable = ['distribution_channel_id','company_id','desc','status','type','created_at','updated_at'];
+    protected $fillable = ['distribution_channel_id','company_id','account','content','desc','status','type','created_at','updated_at'];
 
 
     static function getDistributionSelfDefineConfig($distribution_channel_id,$type)
@@ -20,6 +20,10 @@ class DistributionSelfDefineConfig extends Model
     {
     	return self::where(['company_id'=>$company_id,'type'=>$type,'status'=>1])->first();
     }
+    
+    static function getDistributionChannelSwitchByCategoryAndAccount($account,$type){
+    	return self::where(['account'=>$account,'type'=>$type,'status'=>1])->first();
+    }
     
     static function getDistributionsByType($type)
     {