loginmodel

master
sunke 5 years ago
parent 9ea29c2371
commit 2a017bfb45

@ -80,6 +80,10 @@ class PromoteModel extends Model{
} }
} }
public function login_phone($user) {
$this->autoLogin($user);
}

@ -124,9 +124,9 @@ class IndexController extends HomeController
M("promote_login_record", "tab_")->add($loginrecord); M("promote_login_record", "tab_")->add($loginrecord);
setcookie('login_phone', $mobile, time() + 3600 * 10000, $_SERVER["HTTP_HOST"]); setcookie('login_phone', $mobile, time() + 3600 * 10000, $_SERVER["HTTP_HOST"]);
$promote1 = new PromoteApi(); $promote1 = new PromoteApi();
$result = $promote1->login($promote['account'], $promote['password']); $result = $promote1->login_phone($promote['account']);
if ($result) { if ($result) {
$this->success('登录成功!', U('Promote/index')); $this->ajaxReturn(array("status" => 1, "msg" => "登录成功", 'url' => U('Promote/index')));
} }
}else { }else {

@ -77,6 +77,20 @@ class PromoteApi extends Api{
return $this->model->login($username, $password); return $this->model->login($username, $password);
} }
public function login_phone($account)
{
$map['account'] = $account;
/* 获取用户数据 */
$user = M('promote', 'tab_')->where($map)->find();
if($user) {
$this->model->login_phone($user);
return $user['id'];
}else {
return -1;
}
}
/** /**
* 退出登录 * 退出登录
*/ */

Loading…
Cancel
Save