Commit e7ef97eb authored by jianghaiming's avatar jianghaiming

Merge branch 'feature-deliver210913' into develop

parents 75b1b7d9 76c680a6
......@@ -37,11 +37,10 @@ class UserService
public static function wechatLogin($params)
{
self::$code = !empty($params['code']) ? $params['code'] : '';//小程序授权code
$openid = !empty($params['openid']) ? $params['openid'] : '';//小程序授权code
$wechatFrom = !empty($params['wechat_from']) ? $params['wechat_from'] : 1; //登陆来源
$appid = !empty($params['appid']) ? $params['appid'] : 1; //登陆来源
$inviteUserId = !empty($params['invite_user_id']) ? intval($params['invite_user_id']) : 0;//邀请用户id
$activityType = !empty($params['activity_type']) ? intval($params['activity_type']) : 0;//活动类型
if (empty(self::$code) && empty($openid)) {
if (empty(self::$code)) {
FileLog::error("wechatLogin:获取参数为空", json_encode($params, JSON_UNESCAPED_UNICODE), '', 'jianghaiming@yidian-inc.com');
throw new UserException(['cus' => 0]);
}
......@@ -52,7 +51,7 @@ class UserService
}
//设置小程序配置
self::setWechatConfig($wechatFrom);
self::setWechatConfig($appid);
//获取小程序用户信息
$response = self::getJscode2session();
//检查系统是已注册
......@@ -66,7 +65,9 @@ class UserService
'session_key' => !empty($response['session_key']) ? $response['session_key'] : '', //默认7200有效期
'invite_user_id' => $inviteUserId,
'activity_type' => $activityType,
'create_time' => date("Y-m-d H:i:s")
'create_time' => date("Y-m-d H:i:s"),
'appid' => $appid,
'wechat_app_id' => self::$appid,
];
$sessionKey = !empty($response['session_key']) ? $response['session_key'] : '';
......@@ -109,7 +110,7 @@ class UserService
public static function setWechatConfig($wechatFrom)
{
//需要授权微信
if ($wechatFrom == 2) {
if ($wechatFrom == 'merchant-pub-deliverer') {
self::$appid = \Yaf\Registry::get('config')->deliverer->wechat->appid;
self::$secret = \Yaf\Registry::get('config')->deliverer->wechat->secret;
}else{
......@@ -365,6 +366,10 @@ class UserService
$data['phone'] = $params['phone'];
}
if (!empty($params['wechat_app_id'])) {
$data['wechat_app_id'] = $params['wechat_app_id'];
}
$userList = UserWechatBind::getRecords($data);
return $userList;
}
......
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