/** * 同步用户信息 */ public function actionSync() { try { $connection = Yii::$app->getDb(); $transaction = $connection->beginTransaction(); $member = new Member(); $pageSize = Member::$pageSize; $totalNum = $member->totalNum('mobile', true); $totalPage = intval($totalNum / $pageSize); $j = 0; if ($totalNum % $pageSize) { $totalPage += 1; } echo 'Handle ...... 请耐心等待 ^_^ ' . "\r\n"; for ($i = 1; $i <= $totalPage; $i++) { if ($i == $totalPage) { $minus = $totalNum - $j; $j += $minus; } else { $j += $pageSize; } $member->sync($i); $surplus = $totalNum - $j; echo '已同步' . $j . '条记录。 还剩' . $surplus . '条记录待同步' . "\r\n"; } echo 'finish ^_^', "\r\n"; $transaction->commit(); } catch (Exception $ex) { $transaction->rollBack(); FileLogger::getInstance('idaiyan.exception.log')->writeOne($ex->getMessage(), Logger::LEVEL_ERROR, 'idaiyan数据导出'); echo 'exception', "\r\n"; } }
public function ihm() { $now = time(); $query = Member::find()->from(self::tableName() . ' member')->where(['and', 'regtime>1439879084', "regtime<{$now}"])->asArray()->select(['member.*', 'mdetail.sex', 'mdetail.company'])->leftJoin(MemberDetail::tableName() . ' mdetail', 'member.userid=mdetail.userid'); // ->groupBy(['member.mobile']); // $query = $query->from(Member::tableName()); $user = new UserBaseInfo(); // $user_openid = new UserOpenid(); $fileLogger = FileLogger::getInstance('iheima.log'); foreach ($query->batch(1000, Yii::$app->iheima) as $rows) { $params = []; $openId = []; if (!arr_null($rows)) { foreach ($rows as $row) { $openIds = openId('iHeiMa'); $params[] = ['username' => $row['username'], 'password' => $row['password'], 'password_salt' => $row['salt'], 'mobile' => $row['mobile'], 'email' => $row['email'], 'gender' => $row['sex'], 'reg_ip' => $row['regip'], 'last_login_time' => $row['lastlogintime'], 'last_login_ip' => $row['lastloginip'], 'create_time' => $row['regtime'], 'update_time' => time(), 'status' => $row['status'], 'open_id' => $openIds]; $openId[] = ['openid' => $openIds, 'userid' => $row['userid'], 'flag' => 'iheima']; } $result = $user->batchInsertUser($params); if (!$result) { $fileLogger->writeOne('同步失败' . json_encode($row['email']), Logger::LEVEL_INFO, 'iHeiMa用户同步失败'); return false; } // $rt = $user_openid->batchInsert($openId); // if (!$rt) { // return false; // } //$fileLogger->writeOne('同步成功' . json_encode($params), Logger::LEVEL_INFO, 'iHeiMa用户同步成功'); } } $fileLogger->writeOne(json_encode($openId), Logger::LEVEL_INFO, 'iHeiMa用户openId与用户id对应关系数据'); return $openId; }
/** * 获取创业家下所有应用系统设置COOKIE接口地址 */ public function actionAppCookie() { // 获取JS回调函数 $callback = Yii::$app->getRequest()->get('callback'); $is_register = Yii::$app->getRequest()->get('is_register') ?: 0; try { $info = null; $userModel = new UserBaseInfo(); $userInfo = $userModel->getUserInfoCache(); if (isset($userInfo['id']) && $userInfo['id']) { $user = $userModel->getUserById($userInfo['id']); $info['openid'] = $user['open_id']; $info['mobile'] = $user['mobile']; $info['email'] = $user['email']; $info['password_salt'] = $user['password_salt']; $info['password'] = $user['password']; $info['username'] = $user['username']; if ($is_register) { $info['is_register'] = $is_register; $info['salt'] = $user['password_salt']; $info['password'] = $user['password']; } $json = json_encode($info); // 记录日志 $logger = FileLogger::getInstance('sso_' . date('Ymd') . '.log'); $encrypt = AsymmetryCrypt::opensslPublicEncrypt($json, dirname(Yii::$app->getBasePath()) . '/common/rsa_public_key.pem'); // $logger->writeOne($json . '====' . $encrypt, Logger::LEVEL_INFO,'SSO-IHEIMA'); // TODO:: +/ 替换成 +_ $encrypt = str_replace('+/', '+_', $encrypt); $encrypt = rawurlencode($encrypt); $logger->writeOne($json . '====' . $encrypt, Logger::LEVEL_INFO, 'SSO-IHEIMA'); $thinksns = AsymmetryCrypt::opensslPublicEncrypt($json, dirname(Yii::$app->getBasePath()) . '/common/rsa_key/100003/rsa_public_key.pem'); $thinksns = rawurlencode($thinksns); // TODO:: 获取应用系统COOKIE接口地址 $appCookie = ['code' => 0, 'sso' => [Url::toRoute(['sso/index'], true), 'http://app.iheima.net/?app=ihminterface&controller=index&action=ihmlogin&c=' . $encrypt, 'http://dev-group.chuangyejia.com/index.php?app=public&mod=Passport&act=grouplogin&c=' . $thinksns, 'http://test-group.chuangyejia.com/index.php?app=public&mod=Passport&act=grouplogin&c=' . $thinksns, 'http://group.chuangyejia.com/index.php?app=public&mod=Passport&act=grouplogin&c=' . $thinksns, 'http://cyj.zhiyicx.com/index.php?app=public&mod=Passport&act=grouplogin&c=' . $thinksns, 'http://group-t.chuangyejia.com/index.php?app=public&mod=Passport&act=grouplogin&c=' . $thinksns], 'msg' => []]; echo $callback . '(' . json_encode($appCookie) . ')'; } else { echo $callback . '(' . json_encode(['code' => 1, 'msg' => '用户未登录']) . ')'; } } catch (Exception $ex) { // TODO:: 异常处理 echo $callback . '(' . json_encode(['code' => 2, 'msg' => '系统繁忙,请稍后重试']) . ')'; } }
/** * iheima会员数据导出到数据中心 */ public function actionIhm() { $member = new Member(); $connection = Yii::$app->iheima; $transaction = $connection->beginTransaction(); try { $result = $member->ihm(); if ($result) { echo 'success', "\r\n"; $transaction->commit(); } else { echo 'failure', "\r\n"; $transaction->rollBack(); } } catch (Exception $ex) { $transaction->rollBack(); FileLogger::getInstance('iheima.exception.log')->writeOne($ex->getMessage(), Logger::LEVEL_ERROR, 'iHeiMa数据导出'); echo 'exception', "\r\n"; } }
public function beforeAction($action) { $this->_fileLogger = FileLogger::getInstance(date('Ymd') . "_email.log"); return parent::beforeAction($action); }
public function actionReport($startTime = false, $endTime = false) { date_default_timezone_set('PRC'); if (empty($startTime) && empty($endTime)) { $startTime = strtotime(date('Y-m-d 00:00:00', strtotime("-1 day"))); $endTime = strtotime(date('Y-m-d 23:59:59', strtotime("-1 day"))); } else { if (empty($startTime) || empty($endTime)) { $tmp = $startTime; $startTime = strtotime($tmp . ' 00:00:00'); $endTime = strtotime($tmp . ' 23:59:59'); } else { if ($startTime > $endTime) { $tmp = $startTime; $startTime = $endTime; $endTime = $tmp; } $startTime = strtotime($startTime); $endTime = strtotime($endTime); } } //获取i黑马注册用户的信息 $ihmUsers = Member::getByTime($startTime, $endTime); //获取数据中心注册用户的信息 $dcUsers = UserBaseInfo::getByTime($startTime, $endTime); if (empty($dcUsers) && empty($ihmUsers)) { $errorMessage[] = date('Y-m-d H:i:s', $startTime) . '至' . date('Y-m-d H:i:s', $endTime) . ' 无用户注册。'; } else { if (empty($dcUsers) && isset($ihmUsers)) { $errorMessage[] = date('Y-m-d H:i:s', $startTime) . '至' . date('Y-m-d H:i:s', $endTime) . ' 数据中心中无用户注册,而i黑马有用户注册。'; } else { $ihmOpenIds = array(); foreach ($ihmUsers as $key => $user) { $mobile = $user['mobile']; if (isset($ihmOpenIds[$mobile])) { if (is_string($ihmOpenIds[$mobile])) { $ihmOpenIds[$mobile] = [$ihmOpenIds[$mobile], $user['open_id']]; } else { if (is_array($ihmOpenIds[$mobile])) { $ihmOpenIds[$mobile][] = $user['open_id']; } } } else { $ihmOpenIds[$mobile] = $user['open_id']; } } foreach ($dcUsers as $key => $user) { $mobile = $ihmOpenIds[$user['mobile']]; if (!isset($mobile)) { $errorMessage[] = $user['mobile'] . '(' . $user['open_id'] . ') : 同步失败'; } else { if (is_array($mobile)) { $mobile = implode(", ", $mobile); $errorMessage[] = $user['mobile'] . '(' . $user['open_id'] . ') : 存在多OPENID (' . $mobile . ')'; } else { if (is_string($mobile)) { if ($mobile != $user['open_id']) { $errorMessage[] = $user['mobile'] . '(' . $user['open_id'] . ') : OPENID不匹配(' . $user['open_id'] . ',' . $mobile . ')'; } } } } } } } $errorMessage = implode("<br/>", $errorMessage); //发送邮件操作 $userID = UserBaseInfo::SYSTEM_USER; $email = Yii::$app->params['syncUserEmail']; $data = ['userID' => $userID, 'to' => $email, 'appID' => '100000', 'business' => S_SYNCUSER_CHECK, 'tplno' => 5, 'subject' => '检测同步用户报告', 'content' => $errorMessage]; $sender = Yii::$app->mailer; $result = $sender->check($data, true); if (!$result[0]) { $result = $sender->exec($result[1]); } else { //邮箱发送失败记录到日志文件中 FileLogger::getInstance(date('Ymd') . '_sync_user_report.log')->writeOne('邮箱发送失败', Logger::LEVEL_ERROR, 'report'); } }
/** * 修改个人信息 */ public function actionModify() { $this->layout = false; if (!$this->isLogin) { $this->redirect(Url::toRoute('user/login')); return false; } $mUser = new UserBaseInfo(); //获取登录用户信息 //$user = $mUser::getLoginUser(); $params = Yii::$app->request->post(); $params = array_map('trim', $params); $mAvatar = new Avatar(); $ocutpos = json_decode($params['ocutpos'], true); $options = ['pointer' => [$ocutpos['x'], $ocutpos['y']], 'size' => $ocutpos['w']]; try { $avatar = $mAvatar->upload('avatarfile', $options); if (!empty($avatar)) { //存储图片 $mPicture = new UserImage(); $datas = ['uid' => $params['id'], 'url' => $avatar, 'type' => UserImage::USER_AVATAR, 'status' => UserImage::STATUS_USABLE]; $picture = $mPicture->store($datas); } else { //将失败的信息记录到日志 FileLogger::getInstance(date('Ymd') . '_uc_profile.log')->writeOne($params['oavatar'], Logger::LEVEL_ERROR, 'image'); } } catch (\Exception $e) { // throw new \Exception('上传图片失败,请重试!!!'); } $session = Yii::$app->session; $cookies = Yii::$app->getResponse()->cookies; //session更新 $tmp = $mUser->getUserInfoCache(); if ($avatar) { $data['avatar'] = $avatar; if ($tmp) { $tmp['avatar'] = $avatar; } $cookie = new Cookie(['name' => 'avatar', 'value' => $avatar]); $cookies->add($cookie); } $tmp['name'] = $params['username']; $session[UserBaseInfo::SESSION_KEY_USER] = $tmp; //cookie更新 $cookie = new Cookie(['name' => 'avatar', 'value' => $avatar]); $cookie = new Cookie(['name' => 'username', 'value' => $params['username']]); $cookies->add($cookie); //4-20个字符,可全部由字母组成,或数字、字母、“_”、“-”任意两种以上组合 $preg = '/^((?!^\\d+$)(?!^\\-+$)(?!^\\_+$)[\\x{4e00}-\\x{9fa5}a-zA-Z0-9\\_\\-]{2,20})$/u'; $res = preg_match($preg, $params['username']); if (!$res) { echo "<script>alert('4-20个字符,可全部由字母组成,或数字、字母、“_”、“-”任意两种以上组合');history.go(-1);</script>"; return false; } $data['id'] = $params['id']; if (!empty($params['username'])) { $data['username'] = strip_tags($params['username']); } else { echo "<script>alert('昵称不能为空');history.go(-1);</script>"; return false; } $relname = preg_match($preg, $params['realname']); if (!$relname) { echo "<script>alert('4-20个字符,可全部由字母组成,或数字、字母、“_”、“-”任意两种以上组合');history.go(-1);</script>"; return false; } if (!empty($params['realname'])) { $data['realname'] = strip_tags($params['realname']); } else { echo "<script>alert('昵称不能为空');history.go(-1);</script>"; return false; } $data['gender'] = intval($params['gender']); $genderArr = [UserBaseInfo::GENDER_UNKNOWN, UserBaseInfo::GENDER_MALE, UserBaseInfo::GENDER_FEMALE]; if (!in_array($data['gender'], $genderArr)) { echo "<script>alert('性别非法修改');history.go(-1);</script>"; return false; } if (!is_numeric($params['year'])) { echo "<script>alert('年份非法修改');history.go(-1);</script>"; return false; } $month = str_pad(intval($params['month']), 2, "0", STR_PAD_LEFT); $day = str_pad(intval($params['day']), 2, "0", STR_PAD_LEFT); if (checkdate($month, $day, $params['year'])) { if ($params['year'] <= date('Y', time()) && $params['year'] >= 1950) { $data['birthday'] = $params['year'] . '-' . $month . '-' . $day; } else { echo "<script>alert('日期不在规定时间之内');history.go(-1);</script>"; return false; } } else { echo "<script>alert('非法日期');history.go(-1);</script>"; return false; } $params['province'] = intval($params['province']); $params['city'] = intval($params['city']); if (!$params['province']) { echo "<script>alert('请选择省');history.go(-1);</script>"; return false; } if (!$params['city']) { echo "<script>alert('请选择市');history.go(-1);</script>"; return false; } $params['province'] = intval($params['province']); $params['city'] = intval($params['city']); $region = District::getById($params['city'], true); if (!$region) { echo "<script>alert('城市信息不存在');history.go(-1);</script>"; return false; } $data['city'] = $params['city']; //用户行业配置 $industry = Yii::$app->util->loadConfig('user-industry', '/platform_i/config/'); $data['industry'] = $params['industry']; if (!isset($industry[$data['industry']])) { echo "<script>alert('行业信息不存在');history.go(-1);</script>"; return false; } $comStrLength = mb_strlen($params['company'], 'utf8'); $posStrLength = mb_strlen($params['position'], 'utf8'); if ($comStrLength < 0 || $comStrLength > 50) { echo "<script>alert('公司名称填写仅限于50个字以内');history.go(-1);</script>"; return false; } if ($posStrLength < 0 || $posStrLength > 30) { echo "<script>alert('职位填写仅限于30个字以内');history.go(-1);</script>"; return false; } $data['company'] = strip_tags($params['company']); $data['position'] = strip_tags($params['position']); $data['gender'] = $params['gender']; $this->syncProfile($data); //根据id获取用户修改前的信息 $oriUser = $mUser->getUserById($tmp['id'], UserBaseInfo::USER_NORMAL_STATUS, true); array_pop($oriUser); if ($mUser->updateUserById($data)) { //将成功信息记录到日志 $this->profileLog($oriUser, $data); echo "<script type='text/javascript'>window.location.href='" . Url::toRoute('user/profile') . "'</script>"; } else { //将失败的信息记录到日志 FileLogger::getInstance(date('Ymd') . '_uc_profile.log')->writeOne($params, Logger::LEVEL_ERROR, 'profile'); echo "<script type='text/javascript'>alert('修改失败');history.go(-1);</script>"; return false; } }
/** * 修改用户地址信息 */ public function actionUpdate() { $util = Yii::$app->util; $request = Yii::$app->getRequest(); $params = Yii::$app->request->post(); //判断用户是否登录 if (!UserBaseInfo::isLogin()) { $util->formatResData(1202, 'please_login', ['redirect' => Url::toRoute('user/login')]); } //判断是否是Ajax请求 if (!$request->getIsAjax($params)) { $util->formatResData(1301, 'illegal_request', ['msg' => '非法请求']); } if (!isset($params['id'])) { $util->formatResData(1101, 'addressid_not_empty', ['msg' => '地址ID不能为空']); } $id = intval($params['id']); $address = new Address(); $result = $address->getById($id); if (!$result) { $util->formatResData(1102, 'address_message_not_exist', ['msg' => '地址信息不存在']); } //从session或cookie中获取用户id $userId = UserBaseInfo::getUserId(); if ($result['user_id'] != $userId) { $util->formatResData(1103, 'can_not_operate_other\'s_order_message', ['msg' => '不能操作其他人的地址信息']); } $data['id'] = $id; $params['addressee'] = strip_tags(trim($params['addressee'])); if (!$params['addressee']) { $util->formatResData(1104, 'name_not_empty', ['msg' => '姓名不能为空']); } $length = mb_strlen($params['addressee'], 'utf8'); if ($length > 10) { $util->formatResData(1105, 'name_over_specified_length', ['msg' => '名字长度不能超过10']); } $data['addressee'] = $params['addressee']; if (!$params['mobile']) { $util->formatResData(1106, 'mobile_not_empty', ['msg' => '手机号码不能为空']); } $mobile = Yii::$app->util->regularMobile($params['mobile']); if (!$mobile) { $util->formatResData(1107, 'mobile_format_illegal', ['msg' => '手机号码格式非法']); } $data['mobile'] = $params['mobile']; if (!$params['province']) { $util->formatResData(1108, 'province_message_not_exists', ['msg' => '请选择省']); } if (!$params['city']) { $util->formatResData(1109, 'city_message_not_exists', ['msg' => '请选择市']); } if (!$params['county']) { $util->formatResData(1110, 'county_message_not_exists', ['msg' => '请选择区/县']); } $region = District::getById($params['county'], true); if (!$region) { $util->formatResData(1111, 'region_message_not_exists', ['msg' => '区域信息不存在']); } if ($region['level'] != 3) { $util->formatResData(1112, 'region_message_not_exists', ['msg' => '不属于区/县']); } $data['county'] = $params['county']; $params['countyName'] = $region['name']; $params['cityName'] = $region['parent']['name']; $params['provinceName'] = District::getById($region['parent']['upid'])['name']; $params['address'] = strip_tags(trim($params['address'])); if (!$params['address']) { $util->formatResData(1113, 'address_not_empty', ['msg' => '地址不能为空']); } $length = mb_strlen($params['address'], 'utf8'); if ($length > 30) { $util->formatResData(1114, 'address_over_specified_length', ['msg' => '地址长度不能超过30']); } if ($result['county'] == $params['county']) { $data['address'] = $params['address']; } else { $data['address'] = $params['provinceName'] . $params['cityName'] . $params['countyName'] . ' ' . $params['address']; $params['address'] = $params['provinceName'] . $params['cityName'] . $params['countyName'] . ' ' . $params['address']; } $data['user_id'] = $userId; if (isset($params['post_code'])) { $postCode = YII::$app->util->regularPostCode($params['post_code']); if (!$postCode) { $util->formatResData(1115, 'postcode_illegal', ['msg' => '邮政编码非法']); } $data['post_code'] = $params['post_code']; } else { unset($params['post_code']); } $result = $address->renew($data); $addressLog = new UserOperateLog(); if ($result) { $data = json_encode($data); $data = $addressLog->store('用户地址修改', '', $data, $result); if (!$data) { FileLogger::getInstance(date('Ymd') . '_address_operate_fail.log')->writeOne($id, Logger::LEVEL_ERROR, 'add_log_fail'); } $util->formatResData(0, 'success', $params); } else { $data = $addressLog->index($userId, 'update-yes', json_encode($data)); $data = $addressLog->store('用户地址修改', '', $data, $result); if (!$data) { FileLogger::getInstance(date('Ymd') . '_address_operate_fail.log')->writeOne($id, Logger::LEVEL_ERROR, 'add_log_fail'); } $util->formatResData(1201, 'update_fail', ['msg' => '修改失败']); } }
/** * actionLog */ public function actionLog() { $logFile = Yii::$app->getRuntimePath() . '/logs/test.log'; $log = FileLogger::getInstance($logFile); $log->writeOne(mt_rand(100000, 999999)); }
/** * 同步个人信息日志记录 * * @param boolean $resp 同步响应数据 * @param string $data 同步数据 * @return void */ public function syncProfileLog($resp, $data, $business) { if ($resp && $data && $business) { $logFileName = date('Ymd') . '_profile_sync_' . ($resp['state'] ? 'succ' : 'failed') . '.log'; $resp = json_encode($resp); $logger = FileLogger::getInstance($logFileName); $logger->writeOne($resp . '||' . $data, Logger::LEVEL_INFO, $business); } }
public function actionRepair() { $cityData = $this->getCitys(); if (!$cityData) { echo '无数据可修复' . "\r\n"; die; } try { $cityData = array_unique($cityData); $data = $this->districtProcess($cityData); $result = $this->renew($data); if ($result) { echo '已全部完成! @ _ @ ' . "\r\n"; die; } else { echo '失败 @ - @' . "\r\n"; die; } } catch (Exception $ex) { FileLogger::getInstance('area.exception.log')->writeOne($ex->getMessage(), Logger::LEVEL_ERROR, '区域修复'); echo 'exception', "\r\n"; } }
/** * 添加图片 * * @param array $data * @return mixed */ public function store($data) { if (!empty($data)) { $uid = intval($data['uid']); $status = intval($data['status']); $type = intval($data['type']); } $now = time(); $number = $this->count($uid, $status, $type); $field = ['modify_time' => $now, 'create_time' => $now]; $data = array_merge($data, $field); if ($number < self::MAX_STORAGE_NUMBERS) { foreach ($data as $key => $value) { $this->{$key} = $value; } return $this->save(); } else { unset($data['create_time']); $result = self::find()->where(['uid' => $data['uid']])->orderBy('modify_time ASC')->one(); $url = ltrim(parse_url($result['url'], PHP_URL_PATH), '/'); $avatar = new Avatar(); $bucket = $avatar->ossBucket; //删除OSS上超过限制的最早的那张图片 $status = OSS::delete_object($bucket, $url)['status']; if ($status != '204') { //将失败信息记录到日志文件中 $errorMessage = 'status:' . $status . '--->删除失败的图片:' . $url; FileLogger::getInstance('del_image_error.log')->writeOne($errorMessage, Logger::LEVEL_ERROR, '删除上传到OSS的图片失败'); } foreach ($data as $key => $val) { $result->{$key} = $val; } return $result->save(); } }
public function actionLog() { $fileLogger = FileLogger::getInstance(date('Ymd') . "_yanghaibin.log"); $fileLogger->writeOne('无效的应用ID!!!', Logger::LEVEL_INFO, Yii::$app->util->getCurRoute()); echo 'test'; }
/** * 分页同步数据 * select * from i_member where length(mobile)>11 手机长度超过11位 * @param int $page 数据库分页当前页数 * @param int $totalNum 数据库总记录 */ public function sync($page) { $params = null; $prefixAvatar = 'http://www.idaiyan.cn'; $sexMap = [1 => 1, 2 => 2, 3 => 0, 0 => 0]; $statusMap = [0 => 1, 1 => 0]; if ($page <= 0) { $page = 1; } $page = ($page - 1) * self::$pageSize; $multiMobile = $this->multi(); $multiMobile = implode(',', $multiMobile); $query = self::find()->where(['AND', "mobile not in ({$multiMobile})", "mobile<>''", "is_admin=0", "is_del<>2"])->orderBy('uid')->offset($page)->limit(self::$pageSize)->asArray(); $fileLogger = FileLogger::getInstance('idaiyan.log'); $fileLog = FileLogger::getInstance('idaiyan_dc.log'); $user = new UserBaseInfo(); foreach ($query->batch(self::$batchSize) as $members) { $now = time(); foreach ($members as $member) { // $exists = $user->uniqueUser($member['mobile']); // if ($exists) { // $fileLog->writeOne($member['mobile'] , Logger::LEVEL_INFO, 'i代言语句数据中心用户同步手机重复检测'); // continue; // } if ($member['avatar']) { $avatar = $prefixAvatar . $member['avatar']; } else { $avatar = ''; } $openId = openId('idaiyan'); $params[] = ['username' => $member['nickname'], 'realname' => $member['truename'], 'password' => $member['password'], 'password_salt' => $member['random'], 'mobile' => $member['mobile'], 'email' => $member['email'], 'gender' => $sexMap[$member['sex']], 'avatar' => $avatar, 'birthday' => date('Y-m-d', $member['birthday']), 'reg_ip' => $member['create_ip'], 'reg_channel' => 'idaiyan', 'last_login_time' => $member['update_at'], 'last_login_ip' => '', 'create_time' => $now, 'update_time' => $member['update_at'], 'status' => $statusMap[$member['is_del']], 'open_id' => $openId]; } $result = $user->batchInsertUser($params); if (!$result) { $mobiles = i_array_column($members, 'mobile'); $fileLogger->writeOne('同步失败' . json_encode($mobiles), Logger::LEVEL_INFO, 'iDaiyan用户同步失败'); } unset($params); } }