wesmiler 2 лет назад
Родитель
Сommit
5aaa34d74d
1 измененных файлов с 10 добавлено и 2 удалено
  1. 10 2
      app/Services/Api/AcceptorService.php

+ 10 - 2
app/Services/Api/AcceptorService.php

@@ -177,13 +177,21 @@ class AcceptorService extends BaseService
      * @param array $field
      * @return array|mixed
      */
-    public function getInfo($id, $field = [])
+    public function getInfo($id, $field = [], $userId=0)
     {
+        if($id){
+           $where = ['a.id'=> $id,'a.mark'=>1];
+        }else if($userId){
+            $where = ['a.user_id'=> $userId,'a.mark'=>1];
+        }else{
+            return false;
+        }
+
         $defaultField = ['a.id', 'a.user_id', 'a.realname','a.name', 'a.mobile','a.telegram', 'a.quota','a.pay_type', 'a.usdt', 'a.status','b.nickname','b.avatar'];
         $field = $field ? $field : $defaultField;
         $info = $this->model->from('acceptor as a')
             ->leftjoin('member as b','b.id','=','a.user_id')
-            ->where(['a.id'=> $id,'a.mark'=>1])
+            ->where($where)
             ->select($field)
             ->first();
         $info = $info ? $info->toArray() : [];