/**
* @param $openid | string
* 通过微信的openid 得到 user
*/
protected function actionGetByWxOpenid($openid)
{
$one = $this->_customerModel->findOne(['wx_openid' => $openid]);
if(!$one){
$model = $this->_customerRegisterModel;
$model->type='wx';
$model->password=rand(111111,99999);
$model->wx_openid=$openid;
$model->created_at = time();
$model->updated_at = time();
$model->save();
}
$one = $this->_customerModel->findOne(['wx_openid' => $openid]);
$primaryKey = $this->getPrimaryKey();
if ($one[$primaryKey]) {
return $one;
}
return null;
}
临时修改为如上所示,暂时可以直接创建账号并直接登陆。
希望能够提供一个不影响以后升级的解决方案。