Просмотр исходного кода

Weenier 168otc项目部署 0630

wesmiler 3 лет назад
Родитель
Сommit
bdc31f15ea

+ 2 - 2
app/Http/Controllers/Api/MemberController.php

@@ -35,7 +35,7 @@ class MemberController extends webApp
      */
     public function payment()
     {
-        $userInfo = MemberPaymentService::make()->getOptionList($this->userId);
-        return message(1010, true,  $userInfo);
+        $list = MemberPaymentService::make()->getOptionList($this->userId);
+        return message(1010, true,  array_values($list));
     }
 }

+ 7 - 11
app/Models/CacheModel.php

@@ -102,7 +102,7 @@ class CacheModel extends Model
             }
         }
         $cache_key = implode("_", $arg_list);
-        return "models:".$cache_key;
+        return "models:" . $cache_key;
     }
 
     /**
@@ -201,17 +201,13 @@ class CacheModel extends Model
      */
     public function getCacheFunc($funcName, $id = '')
     {
-        $cache_key = $this->getCacheKey($funcName, $id);
-        $data = $this->getCache($cache_key);
-        if (!$data) {
-            $arg_list = func_get_args();
-            if ($this->table) {
-                array_shift($arg_list);
-            }
-            $act = "cache" . ucfirst($funcName);
-            $data = call_user_func_array(array($this, $act), $arg_list);
-            $this->setCache($cache_key, $data, rand(1, 3));
+
+        $arg_list = func_get_args();
+        if ($this->table) {
+            array_shift($arg_list);
         }
+        $act = "cache" . ucfirst($funcName);
+        $data = call_user_func_array(array($this, $act), $arg_list);
         return $data;
     }
 

+ 3 - 1
app/Services/Api/MemberPaymentService.php

@@ -52,7 +52,7 @@ class MemberPaymentService extends BaseService
      */
     public function getOptionList($userId)
     {
-        return $this->model->where(['user_id'=> $userId,'status'=>1])
+        $list =  $this->model->where(['user_id'=> $userId,'status'=>1])
             ->whereRaw('(trade_num-used_num>0 and trade_quota-used_quota>0)')
             ->selectRaw('id,type,real_name,bank_name,account,bank_card,trade_quota,used_quota,(trade_quota - used_quota) as credit')
             ->get()
@@ -66,6 +66,8 @@ class MemberPaymentService extends BaseService
                     $item['show_text'] = $item['realname_text'].' '.$item['account_text'];
                 }
             });
+
+        return $list? $list->toArray() : [];
     }