1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586 |
- <?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';
- }
-
- public function get_jiaofu_api()
- {
- $file = Dever::data() . 'qiquan.xlsx';
- $data = Dever::excelImport($file, 2, 5, 'excel');
- if ($data) {
- $update = array();
- foreach ($data as $k => $v) {
- $state = preg_match(Dever::rule('mobile'), $v['A']);
- if ($state) {
- $where['mobile'] = $v['A'];
- $type_name = $v['D'];
- if ($type_name == '期权') {
- $type = 1;
- } else {
- $type = 2;
- }
- $info = Dever::db('option/account')->find($where);
- if ($info && $info['status'] < 3) {
- $info = Dever::db('option/account')->find(array('key' => $info['key'], 'type' => 2));
- if ($info && $info['status'] < 3) {
- if (!isset($update[$info['id']][$type])) {
- $update[$info['id']][$type] = array();
- $update[$info['id']][$type]['total'] = 0;
- $update[$info['id']][$type]['desc'] = array();
- }
- $update[$info['id']][$type]['total'] += $v['C'];
- if ($v['E']) {
- $update[$info['id']][$type]['desc'][] = $v['E'];
- }
- }
- }
- }
- }
- if ($update) {
- }
- }
- return 'ok';
- }
- }
|