hrjy 2 年之前
父節點
當前提交
653767b7f4

+ 1 - 1
app/admin/controller/setting/SystemAdmin.php

@@ -120,7 +120,7 @@ class SystemAdmin extends AuthController
         })->multiple(1);
 
         $f[] = Form::selectOne('uid', '绑定会员', $admin->uid)
-            ->options(User::field('uid as value,nickname as label')->select()->toArray());
+            ->options(User::field('uid as value,nickname as label')->select()->toArray())->filterable(1);
 
         $f[] = Form::radio('status', '状态', 1)->options([['label' => '开启', 'value' => 1], ['label' => '关闭', 'value' => 0]]);
         $form = Form::make_post_form('编辑管理员', $f, Url::buildUrl('update', compact('id')));

+ 6 - 3
app/api/controller/auction/AuctionProductController.php

@@ -4,7 +4,6 @@ namespace app\api\controller\auction;
 
 
 use app\admin\model\system\SystemConfig;
-use app\common\model\Config;
 use app\models\auction\Auction;
 use app\models\auction\AuctionBooking;
 use app\models\auction\AuctionFrozen;
@@ -15,6 +14,7 @@ use app\models\auction\AuctionTime;
 use app\models\user\User;
 use app\models\user\UserBill;
 use app\Request;
+use crmeb\utils\Redis;
 use Monolog\Handler\Curl\Util;
 use think\facade\Cache;
 use crmeb\services\{
@@ -83,11 +83,14 @@ class AuctionProductController
         ]);
         if (!$data['product_id']) return app('json')->fail('数据传入错误');
 
-
         $product = AuctionProduct::where('id', $data['product_id'])->find();
         if ($product['is_show'] == 0) return app('json')->fail('商品未挂售');
         $auction  = Auction::where('id', $product['auction_id'])->find();
-
+        $redis = new \Redis();
+        $redis->connect('127.0.0.1','6379'); // redis 缓存
+        if (!$redis->lPop($data['product_id'])){
+            return app('json')->fail('商品已卖出');
+        }
         $user = $request->user();
         $time = strtotime(date('Y-m-d', time()));// 今天
         $today = strtotime(date('Y-m-d', strtotime('+1day')));// 明天

+ 8 - 1
app/models/auction/AuctionProduct.php

@@ -80,8 +80,15 @@ class AuctionProduct extends BaseModel
 
         $a = [];
         $b = [];
+        $redis = new \Redis();
+        $redis->connect('127.0.0.1','6379', 3600);
         foreach ($lists as $k => $v){
-            if ($v['status']  == 1) $a[] = $v; // 未卖出的商品
+            if ($v['status']  == 1){
+                if (!$redis->lPop($v['id'])){
+                    $redis->lPush($v['id'], json_encode($v));
+                }
+                $a[] = $v; // 未卖出的商品
+            }
             if ($v['status']  == 2) $b[] = $v; // 卖出的商品
         }
         foreach ($b as $k => $v){

+ 9 - 0
config/cache.php

@@ -35,6 +35,15 @@ return [
             'serialize'  => [],
         ],
         // 更多的缓存连接
+        // redis缓存
+        'redis' => [
+            'host' => '127.0.0.1',
+            'port' => 6379,
+            'auth' => '',
+            //Redis链接密码
+            'timeout'=> 5
+        ],
+        // 更多的缓存连接
     ],
 ];
 //crmeb