123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104 |
- <?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) {
- 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/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) {
- Dever::load('option/lib/cash')->up($info['id'], $type, $v['C'], $v['E'], false);
- }
- }
- }
- }
- }
- return 'ok';
- }
-
- public function get_fafang_api()
- {
- $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/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) {
- Dever::load('option/lib/cash')->up($info['id'], $type, $v['C'], $v['E'], false);
- }
- }
- }
- }
- }
- return 'ok';
- }
- }
|