wupengfei 2 年之前
父节点
当前提交
ed7b6f0f54

+ 3 - 1
application/api/controller/Order.php

@@ -538,10 +538,12 @@ class Order extends Base
 
                 $array = [];
                 for ($i=0;$i<$order['num'];$i++){
+
                     //获取排名
-                    $rank = getRanking($order['c_id'])+1;
+                    $rank = getRanking($order['c_id']);
                     $tag = getTag($order['c_id'],$rank,$order['inventory']);
                     saveRanking($order['c_id']);
+
                     $company = '象寻数字科技(上海)有限公司';
                     $company_hash = '';
                     $company_hash_time = '';

+ 2 - 1
application/api/controller/Pay.php

@@ -127,9 +127,10 @@ class Pay extends Controller
             $pro_info = json_decode($order['pro_info'],true);
             for ($i=0;$i<$order['num'];$i++){
                 //获取排名
-                $rank = getRanking($order['c_id'])+1;
+                $rank = getRanking($order['c_id']);
                 $tag = getTag($order['c_id'],$rank,$order['inventory']);
                 saveRanking($order['c_id']);
+
                 $company = '象链数藏';
                 $hash = getCompanyHash($order['c_id']);
                 $company_hash = $hash['hash'];

+ 2 - 1
application/api/controller/Pay2.php

@@ -87,9 +87,10 @@ class Pay2 extends Controller
             $pro_info = json_decode($order['pro_info'],true);
             for ($i=0;$i<$order['num'];$i++){
                 //获取排名
-                $rank = getRanking($order['c_id'])+1;
+                $rank = getRanking($order['c_id']);
                 $tag = getTag($order['c_id'],$rank,$order['inventory']);
                 saveRanking($order['c_id']);
+
                 $company = '象寻数字科技(上海)有限公司';
                 $hash = getCompanyHash($order['c_id']);
                 $company_hash = $hash['hash'];

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

@@ -200,7 +200,7 @@ class Synthetic extends Base
 
 
             //获取排名
-            $rank = getRanking($id)+1;
+            $rank = getRanking($id);
             $tag = getTag($id,$rank,$info['inventory']);
             saveRanking($id);
             $company = '象链数藏';

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

@@ -283,7 +283,7 @@ class Timedtask
                 ->leftJoin('store_member u','u.id=o.mid')
                 ->where($where)->order('o.id desc')->select();
             foreach ($user_list as $user_coll) {
-                $rank = getRanking($v['send_goods'])+1;
+                $rank = getRanking($v['send_goods']);
                 $inventory = Db::name('store_collect')->where('id',$v['send_goods'])->value('inventory');
                 $tag = getTag($v['send_goods'],$rank,$inventory);
                 saveRanking($v['send_goods']);

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

@@ -1160,7 +1160,7 @@ class UserCenter extends Base
                     ];
                     Db::name('store_blind_box_log')->insert($data);
                     //获取排名
-                    $rank = getRanking($win_prize_id)+1;
+                    $rank = getRanking($win_prize_id);
                     $tag = getTag($win_prize_id,$rank,$coll_info['inventory']);
                     saveRanking($win_prize_id);
                     $company = '象链数藏';

+ 4 - 12
application/common.php

@@ -366,23 +366,15 @@ function addCollectionInventory($id,$num){
  * 用户购买藏品排名更新
  */
 function saveRanking($id){
-    $redis = new \think\cache\driver\Redis();
-    $redis->Incr('ranking'.$id);
+
 }
-/**
- * 获取用户购买藏品排名更新
- */
+
+
 function getRanking($id){
     $redis = new \think\cache\driver\Redis();
-    $count =  $redis->get('ranking'.$id);
-    if (empty($count)){
-        $redis->set('ranking'.$id,0);
-    }
-    $count = empty($count) ? 0 : $count;
+    $count =  $redis->Incr('ranking'.$id);
     return $count;
 }
-
-
 /**
  * 藏品信息存入redis hash
  */

+ 1 - 2
thinkphp/library/think/cache/driver/Redis.php

@@ -305,8 +305,7 @@ class Redis extends Driver
 	 *如果 key 不存在,那么 key 的值会先被初始化为 0 ,然后再执行 INCR 操作。
 	 */
     public function Incr($key){
-
-        $this->handler->incr($key);
+       return $this->handler->incr($key);
     }
 
     /*