| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130 | 
							- <?php
 
- namespace Option\Lib;
 
- use Dever;
 
- include('/share/lib/php/dever_package/excel/src/PHPExcel.php');
 
- class Import
 
- {
 
-     # 导入账户
 
-     public function get_api()
 
-     {
 
-         Dever::config('base')->hook = true;
 
-         $file = Dever::data() . 'qiquan.xlsx';
 
-         $data = Dever::excelImport($file, 1, 5, 'excel');
 
-         if ($data) {
 
-             $member = array();
 
-             foreach ($data as $k => $v) {
 
-                 $state = preg_match(Dever::rule('mobile'), $v['C']);
 
-                 if ($state) {
 
-                     $key = $v['A'];
 
-                     $where['key'] = $v['A'];
 
-                     $where['mobile'] = $v['C'];
 
-                     $where['clear'] = true;
 
-                     $info = Dever::db('option/member')->find($where);
 
-                     $update = $where;
 
-                     $update['idcard'] = $v['D'];
 
-                     $update['name'] = $v['B'];
 
-                     $update['main'] = $v['E'] == 1 ? 1 : 2;
 
-                     if (!$info) {
 
-                         $update['status'] = 2;
 
-                         $id = Dever::db('option/member')->insert($update);
 
-                     } else {
 
-                         $update['where_id'] = $info['id'];
 
-                         $id = Dever::db('option/member')->update($update);
 
-                     }
 
-                     if ($id && $update['main'] == 1) {
 
-                         if (!isset($member[$key])) {
 
-                             $member[$key] = array();
 
-                         }
 
-                         $account = Dever::db('option/member')->find(array('mid' => $id));
 
-                         if (!$account) {
 
-                             $member[$key] = Dever::db('option/account')->insert(array('mid' => $id, 'audit' => 1));
 
-                         } else {
 
-                             $member[$key] = $account['id'];
 
-                         }
 
-                     }
 
-                 }
 
-             }
 
-             if ($member) {
 
-                 foreach ($member as $k => $v) {
 
-                     $where = array();
 
-                     $where['option_key'] = $k;
 
-                     $where['set_aid'] = $v;
 
-                     Dever::db('option/member')->updates($where);
 
-                 }
 
-             }
 
-         }
 
-         return 'ok';
 
-     }
 
-     # 导入交付记录
 
-     public function get_jiaofu_api()
 
-     {
 
-         Dever::config('base')->hook = true;
 
-         $file = Dever::data() . 'qiquan.xlsx';
 
-         $data = Dever::excelImport($file, 2, 5, 'excel');
 
-         if ($data) {
 
-             foreach ($data as $k => $v) {
 
-                 $state = preg_match(Dever::rule('mobile'), $v['A']);
 
-                 if ($state && $v['C'] > 0) {
 
-                     $where['mobile'] = $v['A'];
 
-                     $type_name = $v['D'];
 
-                     if ($type_name == '期权') {
 
-                         $type = 1;
 
-                     } else {
 
-                         $type = 4;
 
-                     }
 
-                     $info = Dever::db('option/member')->find($where);
 
-                     if ($info) {
 
-                         $account = Dever::db('option/account')->find($info['aid']);
 
-                         if ($account && $account['status'] < 3) {
 
-                             Dever::load('option/lib/cash')->up($info['id'], $account['id'], $type, $v['C'], $v['E'], false);
 
-                         }
 
-                     }
 
-                 }
 
-             }
 
-         }
 
-         return 'ok';
 
-     }
 
-     # 导入发放记录
 
-     public function get_fafang_api()
 
-     {
 
-         Dever::config('base')->hook = true;
 
-         $file = Dever::data() . 'qiquan.xlsx';
 
-         $data = Dever::excelImport($file, 3, 5, 'excel');
 
-         if ($data) {
 
-             foreach ($data as $k => $v) {
 
-                 $state = preg_match(Dever::rule('mobile'), $v['A']);
 
-                 if ($state && $v['C'] > 0) {
 
-                     $where['mobile'] = $v['A'];
 
-                     $type_name = $v['D'];
 
-                     if ($type_name == '期权') {
 
-                         $type = 2;
 
-                     } else {
 
-                         $type = 5;
 
-                     }
 
-                     $info = Dever::db('option/member')->find($where);
 
-                     if ($info) {
 
-                         $account = Dever::db('option/account')->find($info['aid']);
 
-                         if ($account && $account['status'] < 3) {
 
-                             Dever::load('option/lib/cash')->up($info['id'], $account['id'], $type, $v['C'], $v['E'], false);
 
-                         }
 
-                     }
 
-                 }
 
-             }
 
-         }
 
-         return 'ok';
 
-     }
 
- }
 
 
  |