|
|
@@ -20,39 +20,6 @@ use yii\helpers\Json;
|
|
|
class AuthController extends PublicController
|
|
|
{
|
|
|
|
|
|
- //微信手机号一键登录 ssh 20220607
|
|
|
- public function actionWxMobileLogin()
|
|
|
- {
|
|
|
- $post = Yii::$app->request->post();
|
|
|
- $iv = $post['iv'];
|
|
|
- $encryptedData = $post['encryptedData'];
|
|
|
- $merchant = WxOpenClass::getMallWxMiniBase();
|
|
|
- $appId = $merchant['miniAppId'];
|
|
|
- $miniOpenId = $post['miniOpenId'] ?? '';
|
|
|
- if (empty($miniOpenId)) {
|
|
|
- util::success(['hasNoOpenId' => 1], '登录失败');
|
|
|
- }
|
|
|
- $cacheKey = 'MALL_MINI_SESSION_KEY_' . $miniOpenId;
|
|
|
- $sessionKey = Yii::$app->redis->executeCommand('GET', [$cacheKey]);
|
|
|
- if (empty($sessionKey)) {
|
|
|
- util::fail('登录失败了哦');
|
|
|
- }
|
|
|
- $wxMiniSecret = Yii::getAlias("@vendor/weixinMiniSecret");
|
|
|
- require_once($wxMiniSecret . '/wxBizDataCrypt.php');
|
|
|
- $pc = new \WXBizDataCrypt($appId, $sessionKey);
|
|
|
- $errCode = $pc->decryptData($encryptedData, $iv, $result);
|
|
|
- if ($errCode != 0) {
|
|
|
- util::fail('登录失败...');
|
|
|
- }
|
|
|
- $arr = Json::decode($result);
|
|
|
- $phoneNumber = isset($arr['purePhoneNumber']) ? $arr['purePhoneNumber'] : '';
|
|
|
- if (empty($phoneNumber)) {
|
|
|
- util::fail('登录失败了');
|
|
|
- }
|
|
|
- $params = ['mobile' => $phoneNumber];
|
|
|
- util::success($params);
|
|
|
- }
|
|
|
-
|
|
|
//准备授权 ssh 2019.11.19
|
|
|
public function actionPrepare()
|
|
|
{
|