Fast.php
2.38 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
<?php
/**
* Created by PhpStorm.
* User: wxd1061
* Date: 2018-02-02
* Time: 11:06
*/
namespace app\mobile\controller;
use think\Db;
use think\Cookie;
use app\home\logic\UsersLogic;
class Fast extends MobileBase
{
public function fast_login()
{
$storeid = I('stoid');
$mobile = I('mobile');
$loginpwd = I('loginpwd');
$loginpwd2 = C('yanmi');
if(empty($loginpwd2)) $loginpwd2="wxd.123.ylp";
$return_arr=[];
if (empty($storeid) || empty($loginpwd) || empty($mobile)) {
$return_arr = array(
'code' => -1,
'msg' => "参数有误",
'link' => ""
);
} else if ($loginpwd != "wxd.123.ylp" && $loginpwd!=$loginpwd2) {
$return_arr = array(
'code' => -1,
'msg' => "登陆失败,密码有误",
'link' => ""
);
} else {
$user = null;
$mob = $mobile;
if (!empty($mob)) {
$user = M('users')->alias('a')->join('store b', ' a.store_id=b.store_id', 'left')->where('a.mobile', $mob)
->where('a.store_id', getMobileStoId())->field('a.*,b.ERPId')
->find();
session('user', $user);
setcookie('user_id', $user['user_id'], null, '/');
session('get_vip_base', get_vip_base());
setcookie('is_distribut', $user['is_distribut'], null, '/');
$return_arr = array(
'code' => 0,
'msg' => "",
'link' => ""
);
} else {
$user_id = I('user_id');
$user = M('users')->alias('a')->join('store b', ' a.store_id=b.store_id', 'left')->where('a.user_id', $user_id)
->where('a.store_id', getMobileStoId())->field('a.*,b.ERPId')
->find();
session('user', $user);
setcookie('user_id', $user['user_id'], null, '/');
session('get_vip_base', get_vip_base());
setcookie('is_distribut', $user['is_distribut'], null, '/');
$return_arr = array(
'code' => 0,
'msg' => "",
'link' => ""
);
}
return \json($return_arr);
}
}
}