|
@@ -17,16 +17,16 @@ class Import
|
|
|
$data = Dever::excelImport($file, 1, 5, 'excel');
|
|
|
|
|
|
$table = array();
|
|
|
- $table['head'] = array('账户类型', '待交付', '已交付总额', '已发放剩余', '未发放', '已兑付');
|
|
|
+ $table['head'] = array('序列号', '姓名', '手机号', '身份证号', '说明');
|
|
|
$table['body'] = array();
|
|
|
- $result['已导入'] = array
|
|
|
- (
|
|
|
- 'type' => 'table',
|
|
|
- 'content' => $table,
|
|
|
- );
|
|
|
- $html = Dever::show('', $result, false, false);
|
|
|
- echo $html;die;
|
|
|
|
|
|
+ $table_status = array();
|
|
|
+ $table_status['head'] = array('主账号', '子账号');
|
|
|
+ $table_status['body'] = array();
|
|
|
+ $table_status['body'][0][0] = 0;
|
|
|
+ $table_status['body'][0][1] = 0;
|
|
|
+
|
|
|
+ $check = array();
|
|
|
|
|
|
if ($data) {
|
|
|
$member = array();
|
|
@@ -49,7 +49,16 @@ class Import
|
|
|
$update['where_id'] = $info['id'];
|
|
|
$id = Dever::db('option/member')->update($update);
|
|
|
}
|
|
|
+ if (!$id) {
|
|
|
+ $table['body'][] = array($update['key'], $update['name'], $update['mobile'], $update['idcard'], '账户导入失败,请重新导入');
|
|
|
+ } else {
|
|
|
+ if ($update['main'] == 2) {
|
|
|
+ $table_status['body'][0][1] += 1;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ $check[$key] = 2;
|
|
|
if ($id && $update['main'] == 1) {
|
|
|
+ $check[$key] = 1;
|
|
|
if (!isset($member[$key])) {
|
|
|
$member[$key] = array();
|
|
|
}
|
|
@@ -59,6 +68,11 @@ class Import
|
|
|
} else {
|
|
|
$member[$key] = $account['id'];
|
|
|
}
|
|
|
+ if (!$member[$key]) {
|
|
|
+ $table['body'][] = array($update['key'], $update['name'], $update['mobile'], $update['idcard'], '生成主账户失败');
|
|
|
+ } else {
|
|
|
+ $table_status['body'][0][0] += 1;
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
}
|
|
@@ -68,12 +82,91 @@ class Import
|
|
|
$where = array();
|
|
|
$where['option_key'] = $k;
|
|
|
$where['set_aid'] = $v;
|
|
|
- Dever::db('option/member')->updates($where);
|
|
|
+ $state = Dever::db('option/member')->updates($where);
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
- $table = Dever::table($result);
|
|
|
- return $table;
|
|
|
+ $result['导入状态'] = array
|
|
|
+ (
|
|
|
+ 'type' => 'table',
|
|
|
+ 'content' => $table_status,
|
|
|
+ );
|
|
|
+
|
|
|
+ $result['导入异常'] = array
|
|
|
+ (
|
|
|
+ 'type' => 'table',
|
|
|
+ 'content' => $table,
|
|
|
+ );
|
|
|
+ $html = Dever::show('', $result, false, false);
|
|
|
+ return $html;
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ public function check_api()
|
|
|
+ {
|
|
|
+ Dever::config('base')->hook = true;
|
|
|
+ $file = Dever::data() . 'q.xlsx';
|
|
|
+
|
|
|
+ $data = Dever::excelImport($file, 1, 5, 'excel');
|
|
|
+
|
|
|
+ $table = array();
|
|
|
+ $table['head'] = array('序列号', '说明');
|
|
|
+ $table['body'] = array();
|
|
|
+
|
|
|
+ $table_status = array();
|
|
|
+ $table_status['head'] = array('主账号', '子账号');
|
|
|
+ $table_status['body'] = array();
|
|
|
+ $table_status['body'][0][0] = 0;
|
|
|
+ $table_status['body'][0][1] = 0;
|
|
|
+
|
|
|
+ $check = array();
|
|
|
+
|
|
|
+ if ($data) {
|
|
|
+ $member = array();
|
|
|
+ foreach ($data as $k => $v) {
|
|
|
+ $state = preg_match(Dever::rule('mobile'), $v['C']);
|
|
|
+ if ($state) {
|
|
|
+ $key = $v['A'];
|
|
|
+ $update = array();
|
|
|
+ $update['main'] = $v['E'] == 1 ? 1 : 2;
|
|
|
+ $check[$key] = 2;
|
|
|
+ if ($update['main'] == 1) {
|
|
|
+ $check[$key] = 1;
|
|
|
+ $table_status['body'][0][0] += 1;
|
|
|
+ } else {
|
|
|
+ $table_status['body'][0][1] += 1;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ if ($member) {
|
|
|
+ foreach ($member as $k => $v) {
|
|
|
+ $where = array();
|
|
|
+ $where['option_key'] = $k;
|
|
|
+ $where['set_aid'] = $v;
|
|
|
+ $state = Dever::db('option/member')->updates($where);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ $result['数据统计'] = array
|
|
|
+ (
|
|
|
+ 'type' => 'table',
|
|
|
+ 'content' => $table_status,
|
|
|
+ );
|
|
|
+
|
|
|
+ foreach ($check as $k => $v) {
|
|
|
+ if ($v == 2) {
|
|
|
+ $table[$k] => array($k, '无主账号');
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ $result['数据异常'] = array
|
|
|
+ (
|
|
|
+ 'type' => 'table',
|
|
|
+ 'content' => $table,
|
|
|
+ );
|
|
|
+ $html = Dever::show('', $result, false, false);
|
|
|
+ return $html;
|
|
|
}
|
|
|
|
|
|
|