Authored by hf

code review by hf: fixes bug refs YW-1815 bind mobile check phone format

@@ -19,16 +19,18 @@ class BindData @@ -19,16 +19,18 @@ class BindData
19 19
20 /** 20 /**
21 * 绑定前检查 21 * 绑定前检查
  22 + *
  23 + * @param string $mobile 绑定输入手机号
22 * @param string $openId 第三方唯一识别码 24 * @param string $openId 第三方唯一识别码
23 * @param string $sourceType 登录方式 qq,sina,alipay,wechat 25 * @param string $sourceType 登录方式 qq,sina,alipay,wechat
24 - * @param string $mobile 绑定输入手机号  
25 - * @return array 登录返回结果 26 + * @param int $area 所在地区
  27 + * @return array 登录返回结果
26 */ 28 */
27 - public static function bindCheck($mobile, $openId, $sourceType) 29 + public static function bindCheck($mobile, $openId, $sourceType, $area)
28 { 30 {
29 $param = Yohobuy::param(); 31 $param = Yohobuy::param();
30 -  
31 $param['method'] = 'app.passport.check'; 32 $param['method'] = 'app.passport.check';
  33 + $param['area'] = $area;
32 $param['mobile'] = $mobile; 34 $param['mobile'] = $mobile;
33 $param['open_id'] = $openId; 35 $param['open_id'] = $openId;
34 $param['source_type'] = $sourceType; 36 $param['source_type'] = $sourceType;
@@ -45,7 +47,6 @@ class BindData @@ -45,7 +47,6 @@ class BindData
45 public static function sendBindMsg($area, $mobile) 47 public static function sendBindMsg($area, $mobile)
46 { 48 {
47 $param = Yohobuy::param(); 49 $param = Yohobuy::param();
48 -  
49 $param['method'] = 'app.passport.smsbind'; 50 $param['method'] = 'app.passport.smsbind';
50 $param['mobile'] = $mobile; 51 $param['mobile'] = $mobile;
51 $param['area'] = $area; 52 $param['area'] = $area;
@@ -61,7 +62,6 @@ class BindData @@ -61,7 +62,6 @@ class BindData
61 public static function checkBindCode($area, $mobile, $code) 62 public static function checkBindCode($area, $mobile, $code)
62 { 63 {
63 $param = Yohobuy::param(); 64 $param = Yohobuy::param();
64 -  
65 $param['method'] = 'app.register.validRegCode'; 65 $param['method'] = 'app.register.validRegCode';
66 $param['mobile'] = $mobile; 66 $param['mobile'] = $mobile;
67 $param['code'] = $code; 67 $param['code'] = $code;
@@ -73,8 +73,9 @@ class BindData @@ -73,8 +73,9 @@ class BindData
73 73
74 /** 74 /**
75 * 第三方绑定手机号 75 * 第三方绑定手机号
76 - * @param string $nickname 姓名 76 + *
77 * @param string $openId 第三方唯一识别码 77 * @param string $openId 第三方唯一识别码
  78 + * @param string $nickname 姓名
78 * @param string $sourceType 登录方式 79 * @param string $sourceType 登录方式
79 * @param string $mobile 手机号 80 * @param string $mobile 手机号
80 * @param string $area 国别码 81 * @param string $area 国别码
@@ -90,11 +91,9 @@ class BindData @@ -90,11 +91,9 @@ class BindData
90 $param['nickname'] = $nickname; 91 $param['nickname'] = $nickname;
91 $param['source_type'] = $sourceType; 92 $param['source_type'] = $sourceType;
92 $param['area'] = $area; 93 $param['area'] = $area;
93 - if (!empty($password))  
94 - { 94 + if (!empty($password)) {
95 $param['password'] = $password; 95 $param['password'] = $password;
96 } 96 }
97 -  
98 $param['client_secret'] = Sign::getSign($param); 97 $param['client_secret'] = Sign::getSign($param);
99 98
100 return Yohobuy::get(Yohobuy::API_URL, $param); 99 return Yohobuy::get(Yohobuy::API_URL, $param);
@@ -109,11 +108,9 @@ class BindData @@ -109,11 +108,9 @@ class BindData
109 public static function changeCheck($mobile, $area) 108 public static function changeCheck($mobile, $area)
110 { 109 {
111 $param = Yohobuy::param(); 110 $param = Yohobuy::param();
112 -  
113 $param['method'] = 'app.passport.changeCheck'; 111 $param['method'] = 'app.passport.changeCheck';
114 $param['mobile'] = $mobile; 112 $param['mobile'] = $mobile;
115 $param['area'] = $area; 113 $param['area'] = $area;
116 -  
117 $param['client_secret'] = Sign::getSign($param); 114 $param['client_secret'] = Sign::getSign($param);
118 115
119 return Yohobuy::get(Yohobuy::API_URL, $param); 116 return Yohobuy::get(Yohobuy::API_URL, $param);
@@ -123,9 +120,9 @@ class BindData @@ -123,9 +120,9 @@ class BindData
123 /** 120 /**
124 * 换绑手机 121 * 换绑手机
125 * @param string $uid 用户Id 122 * @param string $uid 用户Id
126 - * @param string $code 验证码  
127 * @param string $mobile 手机号 123 * @param string $mobile 手机号
128 * @param string $area 国别码 124 * @param string $area 国别码
  125 + * @param string $code 验证码
129 */ 126 */
130 public static function changeMobile($uid, $mobile, $area, $code) 127 public static function changeMobile($uid, $mobile, $area, $code)
131 { 128 {
@@ -136,7 +133,6 @@ class BindData @@ -136,7 +133,6 @@ class BindData
136 $param['uid'] = $uid; 133 $param['uid'] = $uid;
137 $param['code'] = $code; 134 $param['code'] = $code;
138 $param['area'] = $area; 135 $param['area'] = $area;
139 -  
140 $param['client_secret'] = Sign::getSign($param); 136 $param['client_secret'] = Sign::getSign($param);
141 137
142 return Yohobuy::get(Yohobuy::API_URL, $param); 138 return Yohobuy::get(Yohobuy::API_URL, $param);
@@ -125,7 +125,7 @@ class BindController extends AbstractAction @@ -125,7 +125,7 @@ class BindController extends AbstractAction
125 break; 125 break;
126 } 126 }
127 127
128 - $res = BindData::bindCheck($phoneNum, $openId, $sourceType); 128 + $res = BindData::bindCheck($phoneNum, $openId, $sourceType, $areaCode);
129 if (!isset($res['code'])) { 129 if (!isset($res['code'])) {
130 break; 130 break;
131 } 131 }