浏览代码

feat(数据转移):bx数据

geek 4 年之前
父节点
当前提交
c9a841d712
共有 3 个文件被更改,包括 9 次插入4 次删除
  1. 1 1
      application/common/model/bx/BxModel.php
  2. 5 2
      application/cron/controller/MigrateData.php
  3. 3 1
      composer.json

+ 1 - 1
application/common/model/bx/BxModel.php

@@ -17,7 +17,7 @@ class BxModel extends Model {
         // 服务器地址
         'hostname'       => '180.166.104.67',
         // 数据库名
-        'database'       => 'bx',
+        'database'       => 'smddTestCopy',
         // 用户名
         'username'       => 'member_org',
         // 密码

+ 5 - 2
application/cron/controller/MigrateData.php

@@ -39,7 +39,8 @@ class MigrateData {
         $where = ['strHQCode' => self::BX];
         $count = $userModel->where($where)->count();
         $pageNum = ceil($count / $pageSize);
-        for ($i = 1; $i <= 1; $i++) {
+        var_dump("共{$pageNum}页");
+        for ($i = 1; $i <= $pageNum; $i++) {
             $res = $userModel->order(['intMemberID' => 'asc'])->where($where)->page($i, $pageSize)->select();
             $res = HelperService::object2Arr($res);
             foreach ($res as $v) {
@@ -55,9 +56,11 @@ class MigrateData {
                     'smdd_openid'  => $v['strWxXcxOpenID'],
                     'usable_score' => $v['intBonus'],
                     'total_score'  => $v['intBonusCumulative'],
-                    'other_id'     => $v['strMemberCode']
+                    'other_id'     => $v['strMemberCode'],
+                     'bloc_code' => 'BAIXIONG'
                 ];
                 $this->insertMemberData($data);
+
             }
         }
     }

+ 3 - 1
composer.json

@@ -32,7 +32,9 @@
         "topthink/think-sae": "^1.0",
         "topthink/think-worker": "^1.0",
         "topthink/think-queue": "^1.0",
-        "topthink/think-testing": "^1.0"
+        "topthink/think-testing": "^1.0",
+        "ext-json": "*",
+        "guzzlehttp/guzzle": "^7.2"
     },
     "extra": {
         "think-path": "thinkphp"