123456789101112131415161718192021222324252627282930313233343536373839404142 |
- <?php
- namespace Option\Lib;
- use Dever;
- include('/share/lib/php/dever_package/excel/src/PHPExcel.php');
- class Import
- {
- public function get_api()
- {
- $file = Dever::data() . 'qiquan.xlsx';
- $data = Dever::excelImport($file, 1, 5, 'excel');
- # 主账户表
- if ($data) {
- foreach ($data as $k => $v) {
- $state = preg_match(Dever::rule('mobile'), $v['C']);
- if ($state) {
- $where['key'] = $v['A'];
- $where['mobile'] = $v['C'];
- $info = Dever::db('option/account')->find($where);
- $update = $where;
- $update['idcard'] = $v['D'];
- $update['name'] = $v['B'];
- $update['type'] = $v['E'] ? 2 : 1;
- if (!$info) {
- $update['audit'] = 1;
- Dever::db('option/account')->insert($update);
- } else {
- $update['where_id'] = $info['id'];
- Dever::db('option/account')->update($update);
- }
- }
- }
- }
- return 'ok';
- }
- }
|