wupengfei 2 rokov pred
rodič
commit
f187fec87d
2 zmenil súbory, kde vykonal 40 pridanie a 5 odobranie
  1. 3 5
      .idea/workspace.xml
  2. 37 0
      application/api/controller/Mall.php

+ 3 - 5
.idea/workspace.xml

@@ -3,9 +3,7 @@
   <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" />
+      <change beforePath="$PROJECT_DIR$/application/api/controller/Mall.php" beforeDir="false" afterPath="$PROJECT_DIR$/application/api/controller/Mall.php" afterDir="false" />
     </list>
     <option name="SHOW_DIALOG" value="false" />
     <option name="HIGHLIGHT_CONFLICTS" value="true" />
@@ -160,10 +158,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="1665996146837">
+    <state x="1106" y="469" key="#com.jetbrains.php.actions.copyPaste.importReferences.PhpImportReferencesDialog" timestamp="1665996768961">
       <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="1665996146837" />
+    <state x="1106" y="469" key="#com.jetbrains.php.actions.copyPaste.importReferences.PhpImportReferencesDialog/0.0.2560.1400@0.0.2560.1400" timestamp="1665996768961" />
     <state x="283" y="145" width="1942" height="1088" key="DiffContextDialog" timestamp="1659085937978">
       <screen x="0" y="0" width="2560" height="1400" />
     </state>

+ 37 - 0
application/api/controller/Mall.php

@@ -4,11 +4,14 @@ use app\common\model\GoodsCate;
 use app\common\model\GoodsSeason;
 use app\common\model\GoodsServe;
 use app\common\model\StoreGoods;
+use app\common\model\User;
 use app\common\model\UserCollect;
 use app\common\model\UserSearch;
 use app\common\model\UserTrack;
 use app\common\service\Activity;
 use library\tools\Data;
+use think\Db;
+
 /**
  * @title 商城
  * @controller Mall
@@ -58,6 +61,40 @@ class Mall extends Base
         $this->success('ok',['list'=>$list]);
     }
 
+
+
+    /**
+     * @title 商城商品推荐
+     * @desc 商城商品推荐
+     * @author qc
+     * @method GET
+     * @url /api/Mall/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:int default:-- desc:id
+     * @return name:name type:string default:-- desc:商品名称
+     * @return name:cover type:string default:-- desc:封面
+     * @return name:low_price type:float default:-- desc:价格
+     */
+    public function getRecommendList()
+    {
+        $search_log =  UserSearch::getSearchTitle($this->user_id,7);
+        $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,title,a.user_id,label,address,price_min,price_max,company,education,experience_min,experience_max,welfare,province,city,IFNULL(is_recommend,0) is_recommend ';
+        $table = 'dd_store_goods';
+        $order_by_two = 'id';
+        $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);
+        $this->success('ok',['list'=>$list]);
+    }
+
+
     /**
      * @title 获取商品列表
      * @desc  获取商品列表