3 Commits c4ca5dc889 ... 45b4623396

Autor SHA1 Mensagem Data
  shichen 45b4623396 feat(api): 添加游戏测试接口 3 meses atrás
  shichen 616cf22209 Merge branch 'dev' 3 meses atrás
  shichen f2d66c226d feat(product): 添加商品搜索来源参数并调整排序逻辑 3 meses atrás

+ 7 - 3
app/common/dao/store/product/ProductDao.php

@@ -101,7 +101,7 @@ class ProductDao extends BaseDao
101 101
      * @param array $where
102 102
      * @return mixed
103 103
      */
104
-    public function search(?int $merId, array $where)
104
+    public function search(?int $merId, array $where, string $source = 'api')
105 105
     {
106 106
 
107 107
         $query = isset($where['soft']) ? $this->getModel()::onlyTrashed() : $this->getModel()::where('product_id','>',0);
@@ -167,8 +167,12 @@ class ProductDao extends BaseDao
167 167
             }, function ($query) use ($where) {
168 168
                 $query->order('rank DESC ,create_time DESC');
169 169
             });
170
-        },function ($query){
171
-            $query->order('sort DESC')->orderRaw("RAND()");
170
+        },function ($query) use ($source){
171
+            if ($source === 'admin') {
172
+                $query->order('sort DESC')->order('create_time DESC');
173
+            } else {
174
+                $query->order('sort DESC')->orderRaw("RAND()");
175
+            }
172 176
         });
173 177
         return $query;
174 178
     }

+ 1 - 1
app/common/repositories/store/product/ProductRepository.php

@@ -737,7 +737,7 @@ class ProductRepository extends BaseRepository
737 737
      */
738 738
     public function getList(?int $merId, array $where, int $page, int $limit)
739 739
     {
740
-        $query = $this->dao->search($merId, $where)->with(['merCateId.category', 'storeCategory', 'brand']);
740
+        $query = $this->dao->search($merId, $where,'admin')->with(['merCateId.category', 'storeCategory', 'brand']);
741 741
         $count = $query->count($this->dao->getPk());
742 742
         $list = $query->page($page, $limit)->setOption('field', [])->field($this->filed)->select();
743 743
         $list->append(['max_extension', 'min_extension']);

+ 17 - 0
app/controller/api/game/Index.php

@@ -0,0 +1,17 @@
1
+<?php
2
+
3
+namespace app\controller\api\game;
4
+
5
+class Index
6
+{
7
+    public function list()
8
+    {
9
+        $status = 1;
10
+        $list = [
11
+            'name' => '拳魂觉醒',
12
+            'logo' => 'https://cdn.bjtdba.com/chuxubao/images/2026-06-01/b42af202606010920574809.jpg',
13
+            'url' => 'https://m.xingwan001.com/#/gameDetails?gameId=10245&channelId=10245_1_01',
14
+        ];
15
+        return app('json')->success(['status' => $status, 'list' => $list]);
16
+    }
17
+}

+ 4 - 0
route/api.php

@@ -1415,3 +1415,7 @@ Route::get('/test', 'api.Test/test');
1415 1415
 
1416 1416
 // 1688订阅消息通知(开放平台webhook回调)
1417 1417
 Route::any('alibaba/notify', 'api.AlibabaNotify/notify');
1418
+
1419
+
1420
+// 游戏测试接口
1421
+Route::get('index/game', 'api.game.Index/list');