Explorar o código

多处,数字大于一万,就改用w单位后缀

lizhen_gitee hai 1 ano
pai
achega
151a9e9ac6

+ 5 - 5
application/api/controller/Party.php

@@ -839,7 +839,7 @@ class Party extends Api
         } else {
             $partyInfo["type_name"] = "普通房";
         }
-        $partyInfo["party_hot"] = $this->changeW($partyInfo["party_hot"]);
+        $partyInfo["party_hot"] = changeW($partyInfo["party_hot"]);
         $partyInfo['is_new'] = $partyInfo["status"] == 0 ? 1 : 0;
         $partyInfo['join_days'] = $this->getUserJoinPartyDays($user_id,$party_id);
         $lsetList["partyInfo"] = $partyInfo;
@@ -1121,7 +1121,7 @@ class Party extends Api
             // 获取技能信息
 
             $partyInfo["userInfo"] = $userInfo;
-            $partyInfo["party_hot"] = $this->changeW($partyInfo["party_hot"]);
+            $partyInfo["party_hot"] = changeW($partyInfo["party_hot"]);
         }
         $this->success("获取成功!",$partyInfo);
 
@@ -1747,7 +1747,7 @@ class Party extends Api
         $money_to_jewel = config('site.money_to_jewel') ?: 10; //余额兑换金币
 
         // 不可以赠送给自己
-        //if(in_array($userauthid,$user_id_arr)) $this->error("不可以赠送给自己!");
+        if(in_array($userauthid,$user_id_arr)) $this->error("不可以赠送给自己!");
 
         $backGiftId = 0; //背包礼物表的 gift_id
         $boxgiftInfo = [];
@@ -2264,7 +2264,7 @@ class Party extends Api
         $userModel = new \app\common\model\User();
         // 获取条数
         $num = 3;
-        // 获取3条财富排行记录
+        // 获取3条财富排行记录
         $getweek = $this->redis->zRevRange("hourWealth_".$party_info['id'],0,$num-1,true);
         $userList = $userModel->rankList($getweek);
         $avatarArr = [];
@@ -2319,7 +2319,7 @@ class Party extends Api
         if($users) {
             foreach($users as $k => $v){
                 if($userId == $k){
-                    $charm = $this->changeW($v);
+                    $charm = changeW($v);
                 }
             }
         }

+ 6 - 1
application/common.php

@@ -841,4 +841,9 @@ if(!function_exists('touch_file')) {
     }
 }
 
-
+/**
+ * 数字转化
+ */
+function changeW($val) {
+    return $val > 10000 ? round($val/10000,4)."w":$val;
+}

+ 1 - 6
application/common/controller/Api.php

@@ -644,12 +644,7 @@ class Api
         return date("Ymd",$now - ($diff_day * 60 * 60 * 24));
     }
 
-    /**
-     * 数字转化
-     */
-    public function changeW($val) {
-        return $val > 10000 ? round($val/10000,4)."w":$val;
-    }
+
 
 
 }

+ 1 - 1
application/common/model/User.php

@@ -180,7 +180,7 @@ class User extends Model
                     'avatar'   => localpath_to_netpath($v['avatar']),
                     'nickname' => $v['nickname'],
                     'gender'   => $v['gender'],
-                    'jewel'    => $data[$v['id']], // 财富数
+                    'jewel'    => changeW($data[$v['id']]), // 财富数
                 ];
 
                 $rank ++;

+ 1 - 7
application/index/controller/Plantask.php

@@ -182,7 +182,7 @@ class Plantask extends Controller
         if($users) {
             foreach($users as $k => $v){
                 if(isset($seatdata['userNo']) && $seatdata['userNo'] == $k){
-                    $seatdata['charm'] = $this->changeW($v);
+                    $seatdata['charm'] = changeW($v);
                 }
             }
         }
@@ -200,12 +200,6 @@ class Plantask extends Controller
         return true;
     }
 
-    /**
-     * 数字转化
-     */
-    private function changeW($val) {
-        return $val > 10000 ? round($val/10000,4)."w":$val;
-    }
 
 
 }