Commit 5d48e65f authored by zhuwei's avatar zhuwei

bug

parent 9027be65
......@@ -41,16 +41,27 @@ class ShareShop extends Basic
if (!$code) {
$this->_wxApi->getWxCodesnSapiBase($this->url.'?'.http_build_query($params));
} else {
$data = $this->_wxApi->getUserInfoByAccessToken($code);
$userInfo = $this->_wxApi->getUserInfoByAccessToken($code);
$wx_union_id = $userInfo['wx_union_id'] ? $userInfo['wx_union_id'] : $userInfo['wx_open_id'];
if(!$userInfo['wx_union_id']){
$userInfo['wx_union_id'] = $userInfo['wx_open_id'];
}
$user_service = new UserService();
$is_user = $user_service->isUserByweiXin($data['wx_union_id']);
$is_user = $user_service->isUserByweiXin($wx_union_id);
$userInfo["source"] = 0;
$data["source"] = 0;
$this->wxInfoModel->addWxInfo($data);
// 验证open_id是否已经存在,存在则更新
$wxInfoObj = $this->wxInfoModel->getWxInfoByOpenId($wx_union_id);
if ($wxInfoObj && count($wxInfoObj) > 0) {
$userInfo["id"] = $wxInfoObj[0]["id"];
$id = $this->wxInfoModel->updateWxInfo($userInfo);
} else {
$id = $this->wxInfoModel->addWxInfo($userInfo);
}
$params['is_user'] = $is_user;
$params['wx_union_id'] = $data['wx_union_id'];
$params['wx_union_id'] = $wx_union_id;
$params['device_id'] = $this->createOrderNumber();
}
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment