本文整理汇总了PHP中Phone::authVCode方法的典型用法代码示例。如果您正苦于以下问题:PHP Phone::authVCode方法的具体用法?PHP Phone::authVCode怎么用?PHP Phone::authVCode使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Phone
的用法示例。
在下文中一共展示了Phone::authVCode方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: postUserFromWechat
public function postUserFromWechat()
{
$mobile = Input::get('mobile');
$pass = Input::get('pass');
$school_id = Input::get('school');
$vCode = Input::get('vcode');
DB::beginTransaction();
try {
$user = new User();
$user->u_school_id = $school_id;
$user->u_mobile = $mobile;
$user->u_password = $pass;
// verify vcode via phone
$phone = new Phone($mobile);
$phone->authVCode($vCode);
$data = $user->register();
// add user wallet
$wallet = new UsersWalletBalances();
$wallet->u_id = $user->u_id;
$wallet->w_balance = 0.0;
$wallet->w_freez = 0.0;
$wallet->save();
$re = ['data' => $data, 'result' => 2000, 'info' => '注册成功'];
DB::commit();
} catch (Exception $e) {
$re = ['data' => [], 'info' => $e->getMessage(), 'result' => 2001];
DB::rollback();
}
return Response::json($re);
}
示例2: resetPassForWechat
public function resetPassForWechat()
{
$mobile = Input::get('mobile');
$vcode = Input::get('vcode');
$newPass = Input::get('pass');
try {
$user = User::where('u_mobile', '=', $mobile)->first();
// chcek if mobile exsits
if (!isset($user->u_id)) {
throw new Exception("没有查找到与该手机号码绑定的用户", 2001);
}
$phone = new Phone($mobile);
if ($phone->authVCode($vcode)) {
$user->u_password = $newPass;
$user->updateUser();
}
$re = Tools::reTrue('重置密码成功');
} catch (Exception $e) {
$re = Tools::reFalse($e->getCode(), '重置密码失败:' . $e->getMessage());
}
return Response::json($re);
}