wupengfei 2 vuotta sitten
vanhempi
commit
0f22fad4a9

+ 5 - 2
.idea/workspace.xml

@@ -2,7 +2,10 @@
 <project version="4">
   <component name="ChangeListManager">
     <list default="true" id="1a36929e-c054-4875-a943-593a74e55fa4" name="Default Changelist" comment="">
+      <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/Recruit.php" beforeDir="false" afterPath="$PROJECT_DIR$/application/api/controller/Recruit.php" afterDir="false" />
+      <change beforePath="$PROJECT_DIR$/application/common/model/UserSearch.php" beforeDir="false" afterPath="$PROJECT_DIR$/application/common/model/UserSearch.php" afterDir="false" />
     </list>
     <option name="SHOW_DIALOG" value="false" />
     <option name="HIGHLIGHT_CONFLICTS" value="true" />
@@ -157,10 +160,10 @@
       <screen x="0" y="0" width="2560" height="1400" />
     </state>
     <state x="1175" y="519" key="#com.intellij.fileTypes.FileTypeChooser/0.0.2560.1400@0.0.2560.1400" timestamp="1659079177590" />
-    <state x="1106" y="469" key="#com.jetbrains.php.actions.copyPaste.importReferences.PhpImportReferencesDialog" timestamp="1665995801783">
+    <state x="1106" y="469" key="#com.jetbrains.php.actions.copyPaste.importReferences.PhpImportReferencesDialog" timestamp="1665996146837">
       <screen x="0" y="0" width="2560" height="1400" />
     </state>
-    <state x="1106" y="469" key="#com.jetbrains.php.actions.copyPaste.importReferences.PhpImportReferencesDialog/0.0.2560.1400@0.0.2560.1400" timestamp="1665995801783" />
+    <state x="1106" y="469" key="#com.jetbrains.php.actions.copyPaste.importReferences.PhpImportReferencesDialog/0.0.2560.1400@0.0.2560.1400" timestamp="1665996146837" />
     <state x="283" y="145" width="1942" height="1088" key="DiffContextDialog" timestamp="1659085937978">
       <screen x="0" y="0" width="2560" height="1400" />
     </state>

+ 43 - 1
application/api/controller/Activity.php

@@ -5,6 +5,7 @@ use app\common\model\ActivityApply;
 use app\common\model\PlatformLike;
 use app\common\model\User;
 use app\common\model\UserCollect;
+use app\common\model\UserSearch;
 use app\common\model\UserTrack;
 use app\common\service\OrderCallback;
 use think\Db;
@@ -25,6 +26,47 @@ class Activity extends Base
     }
 
     /**
+     * @title 活动推荐
+     * @desc 活动推荐
+     * @author qc
+     * @method GET
+     * @url /api/Activity/getRecommendList
+     * @header name:Authorization require:1 desc:Token
+     * @param  name:page type:int default:0 desc:页数
+     * @param  name:page_num type:int default:20 desc:每页数
+     * @return name:id type:string default:-- desc:资料item_id
+     * @return name:id type:int default:-- desc:id
+     * @return name:address type:string default:-- desc:地址
+     * @return name:cover type:string default:-- desc:封面
+     * @return name:label_name type:array default:-- desc:标签
+     * @return name:start_time type:string default:-- desc:开始时间
+     * @return name:end_time type:string default:-- desc:结束时候
+     * @return name:end_time type:string default:-- desc:结束时间
+     * @return name:price type:string default:-- desc:价格
+     */
+    public function getRecommendList()
+    {
+        $search_log =  UserSearch::getSearchTitle($this->user_id,11);
+        $search_arr = [];
+        $where_str = 'b.id > 0';
+        foreach ($search_log as $t){
+            $search_arr[] =  " b.title like '".'%'.$t."%'" .' ';
+        }
+        if(!empty($search_arr)) $where_str  =  implode(' OR ',$search_arr);
+        $field = 'a.id,cover,a.user_id,title,address,label,start_time,end_time,ladder,price,IFNULL(is_recommend,0) is_recommend ';
+        $table = 'dd_activity';
+        $order_by_two = 'read_num';
+        $sql = "SELECT $field FROM " .$table . " a LEFT JOIN ( SELECT id,IF(id,1,1) is_recommend FROM $table b WHERE ( $where_str )) AS c ON c.id = a.id ORDER BY is_recommend DESC , $order_by_two desc LIMIT {$this->off_set},{$this->page_num}";
+        $list = Db::query($sql);
+        array_walk($list,function (&$v,$k){
+
+        });
+        $this->success('ok',['list'=>$list]);
+    }
+
+
+
+    /**
      * @title 获取活动列表
      * @desc 获取活动列表
      * @author qc
@@ -63,7 +105,7 @@ class Activity extends Base
                 $order =  ['id'=>'desc','sort'=>'desc'];
                 break;
         }
-
+        if($title && $this->user_id) UserSearch::saveSearchTitle($this->user_id,$title,11);
         $list = \app\common\model\Activity::where(['is_deleted'=>0])
             ->when($title,function ($query)use($title){
                 if($title) $query->where('title','like','%'.$title.'%');

+ 2 - 2
application/api/controller/Recruit.php

@@ -63,8 +63,8 @@ class Recruit extends Base
 
 
     /**
-     * @title 视频推荐
-     * @desc 视频推荐
+     * @title 招聘推荐
+     * @desc 招聘推荐
      * @author qc
      * @method GET
      * @url /api/Recruit/getRecommendList

+ 1 - 0
application/common/model/UserSearch.php

@@ -17,6 +17,7 @@ class UserSearch extends Model
         8=>'招聘',
         9=>'供应商',
         10=>'供应商产品',
+        11=>'活动',
     ];
 
     /**