rabin 2 年之前
父節點
當前提交
b34fd7d68f
共有 2 個文件被更改,包括 33 次插入16 次删除
  1. 2 2
      app/card/src/Api.php
  2. 31 14
      service/agent/lib/Import.php

+ 2 - 2
app/card/src/Api.php

@@ -44,9 +44,9 @@ class Api extends Core
                 $w['buy'] = 1;
                 $list = Dever::db('card/info')->select($w);
                 if (!$list) {
-                    unset(this->data['card'][$k]);
+                    unset($this->data['card'][$k]);
                 } else {
-                    this->data['card'][$k]['value'] = $list;
+                    $this->data['card'][$k]['value'] = $list;
                 }
             }
         }

+ 31 - 14
service/agent/lib/Import.php

@@ -458,26 +458,43 @@ class Import
         $key = 9;
         if ($data) {
             foreach ($data as $k => $v) {
+                if ($v['id'] >= 50000) {
+                    continue;
+                }
                 $update = array();
-                $update['avatar'] = $this->upload($v['avatar']);
-                $update['sign'] = $this->upload($v['sign']);
-                $update['idcard_front'] = $this->upload($v['idcard_front']);
-                $update['idcard_back'] = $this->upload($v['idcard_back']);
+                if ($v['avatar']) {
+                    $update['avatar'] = $this->upload($v['avatar']);
+                }
+                if ($v['sign']) {
+                    $update['sign'] = $this->upload($v['sign']);
+                }
+                if ($v['idcard_front']) {
+                    $update['idcard_front'] = $this->upload($v['idcard_front']);
+                }
                 
-                $update['where_id'] = $v['id'];
-                Dever::db('agent/member')->update($update);
+                if ($v['idcard_back']) {
+                    $update['idcard_back'] = $this->upload($v['idcard_back']);
+                }
 
-                $order = Dever::db('agent/order')->find($v['id']);
-                if ($order) {
-                    if ($order['pay_pic']) {
-                        $temp = explode(',', $order['pay_pic']);
-                        foreach ($temp as $k1 => $v1) {
-                            $temp[$k1] = $this->upload($v1);
+                if ($update) {
+                    $update['where_id'] = $v['id'];
+                    Dever::db('agent/member')->update($update);
+
+                    $order = Dever::db('agent/order')->find($v['id']);
+                    if ($order) {
+                        if ($order['pay_pic']) {
+                            $temp = explode(',', $order['pay_pic']);
+                            foreach ($temp as $k1 => $v1) {
+                                $temp[$k1] = $this->upload($v1);
+                            }
+                            $update['pay_pic'] = implode(',', $temp);
+                        }
+                        if ($update) {
+                            Dever::db('agent/order')->update($update);
                         }
-                        $update['pay_pic'] = implode(',', $temp);
                     }
-                    Dever::db('agent/order')->update($update);
                 }
+                
                 echo $v['id'];
                 echo "\r\n";
             }