|
@@ -74,6 +74,68 @@ class User extends Backend
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
+ * 注册会员
|
|
|
+ *
|
|
|
+ * @ApiMethod (POST)
|
|
|
+ * @param string $username 用户名
|
|
|
+ * @param string $password 密码
|
|
|
+ * @param string $email 邮箱
|
|
|
+ * @param string $mobile 手机号
|
|
|
+ * @param string $code 验证码
|
|
|
+ */
|
|
|
+ public function add()
|
|
|
+ {
|
|
|
+ $firstname = input('firstname');
|
|
|
+ $lastname = input('lastname');
|
|
|
+
|
|
|
+ $countrycode = input('countrycode',65,'intval');
|
|
|
+ $mobile = input('mobile');
|
|
|
+
|
|
|
+ $email = input('email');
|
|
|
+
|
|
|
+ $password = input('password');
|
|
|
+
|
|
|
+ if (!$firstname || !$lastname || !$mobile || !$email || !$password) {
|
|
|
+ $this->error(__('Invalid parameters'));
|
|
|
+ }
|
|
|
+
|
|
|
+ if ($email && !Validate::is($email, "email")) {
|
|
|
+ $this->error(__('Email is incorrect'));
|
|
|
+ }
|
|
|
+
|
|
|
+ $fullmobile = $countrycode.$mobile;
|
|
|
+
|
|
|
+ $extend = [
|
|
|
+ 'firstname' => $firstname,
|
|
|
+ 'lastname' => $lastname,
|
|
|
+ 'simplemobile' => $mobile,
|
|
|
+
|
|
|
+ 'birthday' => strtotime(input('birthday','')),
|
|
|
+ 'height' => input('height',''),
|
|
|
+ 'weight' => input('weight',''),
|
|
|
+ 'age' => input('age',''),
|
|
|
+ 'residential' => input('residential',''),
|
|
|
+ 'health' => input('health',''),
|
|
|
+ 'emergency' => input('emergency',''),
|
|
|
+ 'emergency_phone' => input('emergency_phone',''),
|
|
|
+ 'knowus' => input('knowus',''),
|
|
|
+ 'is_first' => input('is_first',''),
|
|
|
+
|
|
|
+ 'notice_email' => input('notice_email',0),
|
|
|
+ 'notice_whatsapp' => input('notice_whatsapp',0),
|
|
|
+ 'notice_phonecall' => input('notice_phonecall',0),
|
|
|
+ 'whatsapp' => input('whatsapp',''),
|
|
|
+ ];
|
|
|
+ $auth = new \app\common\library\auth;
|
|
|
+ $ret = $auth->register('',$password, $email, $fullmobile, $extend);
|
|
|
+ if ($ret != true) {
|
|
|
+ $this->success('注册完成');
|
|
|
+ } else {
|
|
|
+ $this->error($auth->getError());
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
* 充值积分
|
|
|
*/
|
|
|
public function updatescore(){
|