|
@@ -12,7 +12,7 @@ class MobilePage extends Page
|
12
|
12
|
{
|
13
|
13
|
global $_W;
|
14
|
14
|
global $_GPC;
|
15
|
|
-
|
|
15
|
+
|
16
|
16
|
//如果在圣卫士app
|
17
|
17
|
$sws = isINSwsApp($_W, $_GPC, true);
|
18
|
18
|
if($sws ) {
|
|
@@ -30,6 +30,7 @@ class MobilePage extends Page
|
30
|
30
|
if($member) {
|
31
|
31
|
pdo_update('ewei_shop_member_ky_bind', ['member_id'=>$member['id']], ['id'=>$ky['id']]);
|
32
|
32
|
m('account')->setLogin($member);
|
|
33
|
+ $_W["openid"] = $member['openid'];
|
33
|
34
|
$this->sws['login'] = true;
|
34
|
35
|
}else {
|
35
|
36
|
$mobile = $kyUser['mobile'];
|
|
@@ -43,11 +44,13 @@ class MobilePage extends Page
|
43
|
44
|
|
44
|
45
|
$member = pdo_get('ewei_shop_member', ['id'=>$uid]);
|
45
|
46
|
m('account')->setLogin($member);
|
|
47
|
+ $_W["openid"] = $member['openid'];
|
46
|
48
|
$this->sws['login'] = true;
|
47
|
49
|
}
|
48
|
50
|
}
|
49
|
51
|
}else {
|
50
|
52
|
m('account')->setLogin($member);
|
|
53
|
+ $_W["openid"] = $member['openid'];
|
51
|
54
|
$this->sws['login'] = true;
|
52
|
55
|
}
|
53
|
56
|
} else {
|
|
@@ -57,6 +60,7 @@ class MobilePage extends Page
|
57
|
60
|
if($member) {
|
58
|
61
|
pdo_insert('ewei_shop_member_ky_bind', ['member_id'=>$member['id'], 'ky_user_id'=>$kyUser['id']]);
|
59
|
62
|
m('account')->setLogin($member);
|
|
63
|
+ $_W["openid"] = $member['openid'];
|
60
|
64
|
$this->sws['login'] = true;
|
61
|
65
|
}else {
|
62
|
66
|
$mobile = $kyUser['mobile'];
|
|
@@ -70,6 +74,7 @@ class MobilePage extends Page
|
70
|
74
|
|
71
|
75
|
$member = pdo_get('ewei_shop_member', ['id'=>$uid]);
|
72
|
76
|
m('account')->setLogin($member);
|
|
77
|
+ $_W["openid"] = $member['openid'];
|
73
|
78
|
$this->sws['login'] = true;
|
74
|
79
|
}
|
75
|
80
|
}
|
|
@@ -78,6 +83,87 @@ class MobilePage extends Page
|
78
|
83
|
}
|
79
|
84
|
|
80
|
85
|
}
|
|
86
|
+
|
|
87
|
+ //如果在分销系统(不是人人商城的分销系统,而且用beego新建的系统,在系统里通过ifram加载人人商城的分销系统)的iframe
|
|
88
|
+ if(isset($_GPC['fxtoken']) && isset($_GPC['fxorgid']) && isset($_GPC['timestamp']) && isset($_GPC['fxadmin'])) {
|
|
89
|
+
|
|
90
|
+ if(checkFxToken($_GPC['fxtoken'], $_GPC['fxorgid'], $_GPC['timestamp']) && !m("account")->checkAppLogin()) {
|
|
91
|
+ $org = getOrg($_GPC['fxorgid']);
|
|
92
|
+ $orgName = $org? $org['org_name']:'';
|
|
93
|
+ $orgLogo = $org? $org['org_logo']:'';
|
|
94
|
+ $ky = pdo_get('ewei_shop_member_org_bind', ['org_id'=>$_GPC['fxorgid']]);
|
|
95
|
+ if($ky) {
|
|
96
|
+ $member = pdo_get('ewei_shop_member', ['id'=>$ky['member_id']]);
|
|
97
|
+ if (empty($member)) {
|
|
98
|
+ $kyAdmin = getOrgCreate($_GPC['fxadmin']);
|
|
99
|
+ if($kyAdmin) {
|
|
100
|
+ $member = pdo_get('ewei_shop_member', ['mobile'=>$kyAdmin['mobile']]);
|
|
101
|
+ if($member) {
|
|
102
|
+ pdo_update('ewei_shop_member_org_bind', ['member_id'=>$member['id']], ['id'=>$ky['id']]);
|
|
103
|
+ if($member["isagent"] != 1 || $member["status"] != 1) {
|
|
104
|
+ $member["isagent"] = 1;
|
|
105
|
+ $member["status"] = 1;
|
|
106
|
+ pdo_update('ewei_shop_member', ['isagent'=>1, 'status'=>1], ['id'=>$member['id']]);
|
|
107
|
+ }
|
|
108
|
+ m('account')->setLogin($member);
|
|
109
|
+ $_W["openid"] = $member['openid'];
|
|
110
|
+ }else {
|
|
111
|
+ $mobile = $kyAdmin['mobile'];
|
|
112
|
+ $salt = m('account')->getSalt();
|
|
113
|
+ $openid = 'wap_user_' . $_W['uniacid'] . '_' . $mobile . '_' . time();
|
|
114
|
+ $nickname = substr($mobile, 0, 3) . 'xxxx' . substr($mobile, 7, 4);
|
|
115
|
+ $data = array('isagent'=>1, 'status'=>1, 'uniacid' => $_W['uniacid'], 'mobile' => $kyAdmin['mobile'], 'nickname' => $orgName?:$nickname, 'openid' => $openid, 'pwd' => '', 'salt' => $salt, 'createtime' => time(), 'mobileverify' => 1, 'comefrom' => 'mobile');
|
|
116
|
+
|
|
117
|
+ pdo_insert('ewei_shop_member', $data);
|
|
118
|
+ $uid = pdo_insertid();
|
|
119
|
+ pdo_update('ewei_shop_member_org_bind', ['member_id'=>$uid], ['id'=>$ky['id']]);
|
|
120
|
+
|
|
121
|
+ $member = pdo_get('ewei_shop_member', ['id'=>$uid]);
|
|
122
|
+ m('account')->setLogin($member);
|
|
123
|
+ $_W["openid"] = $member['openid'];
|
|
124
|
+ }
|
|
125
|
+ }
|
|
126
|
+ }else {
|
|
127
|
+ m('account')->setLogin($member);
|
|
128
|
+ $_W["openid"] = $member['openid'];
|
|
129
|
+ }
|
|
130
|
+ } else {
|
|
131
|
+ $kyAdmin = getOrgCreate($_GPC['fxadmin']);
|
|
132
|
+ if($kyAdmin) {
|
|
133
|
+ $member = pdo_get('ewei_shop_member', ['mobile'=>$kyAdmin['mobile']]);
|
|
134
|
+ if($member) {
|
|
135
|
+ pdo_insert('ewei_shop_member_org_bind', ['member_id'=>$member['id'], 'org_id'=>$_GPC['fxorgid']]);
|
|
136
|
+ if($member["isagent"] != 1 || $member["status"] != 1) {
|
|
137
|
+ $member["isagent"] = 1;
|
|
138
|
+ $member["status"] = 1;
|
|
139
|
+ pdo_update('ewei_shop_member', ['isagent'=>1, 'status'=>1], ['id'=>$member['id']]);
|
|
140
|
+ }
|
|
141
|
+ m('account')->setLogin($member);
|
|
142
|
+ $_W["openid"] = $member['openid'];
|
|
143
|
+ }else {
|
|
144
|
+ $mobile = $kyAdmin['mobile'];
|
|
145
|
+ $salt = m('account')->getSalt();
|
|
146
|
+ $openid = 'wap_user_' . $_W['uniacid'] . '_' . $mobile . '_' . time();
|
|
147
|
+ $nickname = substr($mobile, 0, 3) . 'xxxx' . substr($mobile, 7, 4);
|
|
148
|
+ $data = array('isagent'=>1, 'status'=>1, 'uniacid' => $_W['uniacid'], 'mobile' => $kyAdmin['mobile'], 'nickname' => $orgName?:$nickname, 'openid' => $openid, 'pwd' => '', 'salt' => $salt, 'createtime' => time(), 'mobileverify' => 1, 'comefrom' => 'mobile');
|
|
149
|
+
|
|
150
|
+ pdo_insert('ewei_shop_member', $data);
|
|
151
|
+ $uid = pdo_insertid();
|
|
152
|
+ pdo_insert('ewei_shop_member_org_bind', ['member_id'=>$uid, 'org_id'=>$_GPC['fxorgid']]);
|
|
153
|
+
|
|
154
|
+ $member = pdo_get('ewei_shop_member', ['id'=>$uid]);
|
|
155
|
+ m('account')->setLogin($member);
|
|
156
|
+ $_W["openid"] = $member['openid'];
|
|
157
|
+ }
|
|
158
|
+ }
|
|
159
|
+
|
|
160
|
+ }
|
|
161
|
+
|
|
162
|
+ }
|
|
163
|
+
|
|
164
|
+ }
|
|
165
|
+
|
|
166
|
+
|
81
|
167
|
m("shop")->checkClose();
|
82
|
168
|
$preview = intval($_GPC["preview"]);
|
83
|
169
|
$wap = m("common")->getSysset("wap");
|