wupengfei 2 years ago
parent
commit
3764b8eefc

+ 11 - 14
.idea/workspace.xml

@@ -2,13 +2,10 @@
 <project version="4">
   <component name="ChangeListManager">
     <list default="true" id="1a36929e-c054-4875-a943-593a74e55fa4" name="Default Changelist" comment="">
+      <change afterPath="$PROJECT_DIR$/application/common/service/CheckPower.php" afterDir="false" />
       <change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
-      <change beforePath="$PROJECT_DIR$/application/api/controller/Activity.php" beforeDir="false" afterPath="$PROJECT_DIR$/application/api/controller/Activity.php" afterDir="false" />
-      <change beforePath="$PROJECT_DIR$/application/api/controller/Demand.php" beforeDir="false" afterPath="$PROJECT_DIR$/application/api/controller/Demand.php" afterDir="false" />
-      <change beforePath="$PROJECT_DIR$/application/api/controller/Forum.php" beforeDir="false" afterPath="$PROJECT_DIR$/application/api/controller/Forum.php" afterDir="false" />
-      <change beforePath="$PROJECT_DIR$/application/api/controller/Mall.php" beforeDir="false" afterPath="$PROJECT_DIR$/application/api/controller/Mall.php" afterDir="false" />
-      <change beforePath="$PROJECT_DIR$/application/api/controller/Recruit.php" beforeDir="false" afterPath="$PROJECT_DIR$/application/api/controller/Recruit.php" afterDir="false" />
-      <change beforePath="$PROJECT_DIR$/application/api/controller/Supplier.php" beforeDir="false" afterPath="$PROJECT_DIR$/application/api/controller/Supplier.php" afterDir="false" />
+      <change beforePath="$PROJECT_DIR$/application/api/controller/Qc.php" beforeDir="false" afterPath="$PROJECT_DIR$/application/api/controller/Qc.php" afterDir="false" />
+      <change beforePath="$PROJECT_DIR$/application/api/controller/Video.php" beforeDir="false" afterPath="$PROJECT_DIR$/application/api/controller/Video.php" afterDir="false" />
     </list>
     <option name="SHOW_DIALOG" value="false" />
     <option name="HIGHLIGHT_CONFLICTS" value="true" />
@@ -126,7 +123,7 @@
   <component name="PropertiesComponent">
     <property name="RunOnceActivity.ShowReadmeOnStart" value="true" />
     <property name="WebServerToolWindowFactoryState" value="false" />
-    <property name="last_opened_file_path" value="$PROJECT_DIR$/../dineng" />
+    <property name="last_opened_file_path" value="$PROJECT_DIR$/application/common/service" />
     <property name="node.js.detected.package.eslint" value="true" />
     <property name="node.js.detected.package.tslint" value="true" />
     <property name="node.js.path.for.package.eslint" value="project" />
@@ -136,15 +133,15 @@
     <property name="settings.editor.selected.configurable" value="reference.idesettings.emmet" />
   </component>
   <component name="RecentsManager">
+    <key name="MoveFile.RECENT_KEYS">
+      <recent name="D:\zs\gaoyixia\application\api\controller" />
+    </key>
     <key name="CopyFile.RECENT_KEYS">
+      <recent name="D:\zs\gaoyixia\application\common\service" />
       <recent name="D:\zs\gaoyixia\application\common\model" />
       <recent name="D:\zs\gaoyixia\application\user\view\tag" />
       <recent name="D:\zs\gaoyixia\public" />
       <recent name="D:\zs\gaoyixia\application\api\controller" />
-      <recent name="D:\zs\gaoyixia\application\nutrition\view\video_cate" />
-    </key>
-    <key name="MoveFile.RECENT_KEYS">
-      <recent name="D:\zs\gaoyixia\application\api\controller" />
     </key>
   </component>
   <component name="SvnConfiguration">
@@ -203,7 +200,7 @@
       <workItem from="1669952538953" duration="9708000" />
       <workItem from="1670201125142" duration="9015000" />
       <workItem from="1670287594399" duration="11535000" />
-      <workItem from="1670461023846" duration="5118000" />
+      <workItem from="1670461023846" duration="11933000" />
     </task>
     <servers />
   </component>
@@ -302,10 +299,10 @@
     </state>
     <state x="875" y="449" key="com.intellij.openapi.vcs.update.UpdateOrStatusOptionsDialogupdate-v2/0.0.1920.1040@0.0.1920.1040" timestamp="1665835639346" />
     <state x="1166" y="605" key="com.intellij.openapi.vcs.update.UpdateOrStatusOptionsDialogupdate-v2/0.0.2560.1400@0.0.2560.1400" timestamp="1670461034563" />
-    <state x="1057" y="460" width="746" height="548" key="find.popup" timestamp="1670462385819">
+    <state x="1057" y="460" width="746" height="548" key="find.popup" timestamp="1670466534922">
       <screen x="0" y="0" width="2560" height="1400" />
     </state>
-    <state x="1057" y="460" width="746" height="548" key="find.popup/0.0.2560.1400@0.0.2560.1400" timestamp="1670462385819" />
+    <state x="1057" y="460" width="746" height="548" key="find.popup/0.0.2560.1400@0.0.2560.1400" timestamp="1670466534922" />
     <state x="1291" y="317" key="run.anything.popup" timestamp="1668056889671">
       <screen x="0" y="0" width="2560" height="1400" />
     </state>

+ 1 - 1
application/api/controller/Qc.php

@@ -14,7 +14,7 @@ class Qc extends Base {
 
     public function index()
     {
-
+        var_dump($this->request);
     }
 
 

+ 4 - 0
application/api/controller/Video.php

@@ -15,6 +15,7 @@ use app\common\model\VideoCommentLike;
 use app\common\model\VideoIntro;
 use app\common\model\VideoLabel;
 use app\common\model\VideoUrl;
+use app\common\service\CheckPower;
 use library\tools\Data;
 use think\Db;
 /**
@@ -1169,6 +1170,9 @@ class Video extends Base
             ->order('id desc')
             ->limit($this->off_set,$this->page_num)
             ->select()->toArray();
+        array_walk($list,function (&$v){
+            $v['is_normal'] = CheckPower::checkModulesPower($v['video_id'],$v['url_id'],'A');
+        });
         $this->success('ok',['list'=>$list]);
     }
 

+ 116 - 0
application/common/service/CheckPower.php

@@ -0,0 +1,116 @@
+<?php
+namespace app\common\service;
+use app\common\model\ArticleCate;
+use app\common\model\ArticleIntro;
+use app\common\model\ArticleItem;
+use app\common\model\DatumCate;
+use app\common\model\DatumIntro;
+use app\common\model\DatumUrl;
+use app\common\model\DiscountActivity;
+use app\common\model\DiscountGoods;
+use app\common\model\GoodsCate;
+use app\common\model\GroupActivity;
+use app\common\model\GroupGoods;
+use app\common\model\PlatformDemand;
+use app\common\model\Press;
+use app\common\model\Recruit;
+use app\common\model\RecruitCate;
+use app\common\model\ReductionActivity;
+use app\common\model\SeckillActivity;
+use app\common\model\SeckillGoods;
+use app\common\model\StoreGoods;
+use app\common\model\Supplier;
+use app\common\model\SupplierCate;
+use app\common\model\SupplierGoods;
+use app\common\model\UserForum;
+use app\common\model\VideoCate;
+use app\common\model\VideoIntro;
+use app\common\model\VideoUrl;
+
+/**
+ * 验证权限
+ * Class Activity
+ */
+class CheckPower
+{
+    // 检查各个模块是否能跳转
+    public static function checkModulesPower($first_id,$second_id,$module)
+    {
+        $check_val = 1;
+        $module= strtolower($module);
+        switch ($module)
+        {
+            case 'video':
+                $item = VideoUrl::where('id',$second_id)->where('status',1)->where('is_deleted',0)->value('id');
+                if(!$item) return 0;
+                $parent = VideoIntro::where('id',$first_id)->where('status',1)->where('is_deleted',0)->find();
+                if(!$parent) return 0;
+                $cate = VideoCate::where('id','in',[$parent->first_classify,$parent->second_classify])
+                    ->where('status',1)->where('is_deleted',0)->count();
+                if(count($cate) != 2) return 0;
+                break;
+            case 'article':
+                $item = ArticleItem::where('id',$second_id)->where('status',1)->where('is_deleted',0)->value('id');
+                if(!$item) return 0;
+                $parent = ArticleIntro::where('id',$first_id)->where('status',1)->where('is_deleted',0)->find();
+                if(!$parent) return 0;
+                $cate = ArticleCate::where('id','in',[$parent->first_classify,$parent->second_classify])
+                    ->where('status',1)->where('is_deleted',0)->count();
+                if(count($cate) != 2) return 0;
+                break;
+            case 'datum':
+                $item = DatumUrl::where('id',$second_id)->where('status',1)->where('is_deleted',0)->value('id');
+                if(!$item) return 0;
+                $parent = DatumIntro::where('id',$first_id)->where('status',1)->where('is_deleted',0)->find();
+                if(!$parent) return 0;
+                $cate = DatumCate::where('id','in',[$parent->first_classify,$parent->second_classify])
+                    ->where('status',1)->where('is_deleted',0)->count();
+                if(count($cate) != 2) return 0;
+                break;
+            case 'press':
+                $item = Press::where('id',$first_id)->where('status',1)->where('is_deleted',0)->value('id');
+                if(!$item) return 0;
+                break;
+            case 'forum':
+                $item = UserForum::where('id',$first_id)->where('status',1)->where('is_deleted',0)->value('id');
+                if(!$item) return 0;
+                break;
+            case 'recruit':
+                $item = Recruit::where('id',$first_id)->where('status',1)->where('is_deleted',0)->find();
+                if(!$item) return 0;
+                $cate = RecruitCate::where('id','in',[$item->first_classify,$item->second_classify])
+                    ->where('status',1)->where('is_deleted',0)->count();
+                if(count($cate) != 2) return 0;
+                break;
+            case 'mall':
+                $item = StoreGoods::where('id',$first_id)->where('status',1)->where('is_deleted',0)->find();
+                if(!$item) return 0;
+                $cate = GoodsCate::where('id','in',[$item->first_classify,$item->second_classify])
+                    ->where('status',1)->where('is_deleted',0)->count();
+                if(count($cate) != 2) return 0;
+                break;
+            case 'supplier':
+                $item = SupplierGoods::where('id',$first_id)->where('status',1)->where('is_deleted',0)->find();
+                if(!$item) return 0;
+                $parent = Supplier::where('id',$item->supplier_id)->where('status',1)->where('is_deleted',0)->find();
+                if(!$parent) return 0;
+                $cate = SupplierCate::where('id','in',[$parent->first_classify,$parent->second_classify])
+                    ->where('status',1)->where('is_deleted',0)->count();
+                if(count($cate) != 2) return 0;
+                break;
+            case 'demand':
+                $item = PlatformDemand::where('id',$first_id)->where('status',1)->where('is_deleted',0)->find();
+                if(!$item) return 0;
+                break ;
+        }
+        return $check_val;
+    }
+
+    // 检查各个模块是否能跳转
+    public static function checkItemPower($first_id,$second_id,$module)
+    {
+
+    }
+
+
+}