Search in sources :

Example 1 with MyUser

use of com.yuxuan.admin.expression.entity.MyUser in project expression by happy-yuxuan.

the class UIdentifyPhoneActivity method bindMobilePhone.

// 绑定手机
private void bindMobilePhone(String phone) {
    // 开发者在给用户绑定手机号码的时候需要提交两个字段的值:mobilePhoneNumber、mobilePhoneNumberVerified
    MyUser user = new MyUser();
    user.setMobilePhoneNumber(phone);
    user.setMobilePhoneNumberVerified(true);
    MyUser cur = BmobUser.getCurrentUser(MyUser.class);
    user.update(cur.getObjectId(), new UpdateListener() {

        @Override
        public void done(BmobException e) {
            if (e == null) {
                L.i("手机号码绑定成功");
                Toast.makeText(UIdentifyPhoneActivity.this, "手机号码验证成功", Toast.LENGTH_LONG).show();
                finish();
            } else {
                L.i("手机号码失败:" + e.getMessage());
                Toast.makeText(UIdentifyPhoneActivity.this, "sorry 失败了", Toast.LENGTH_LONG).show();
            }
        }
    });
}
Also used : MyUser(com.yuxuan.admin.expression.entity.MyUser) BmobException(cn.bmob.v3.exception.BmobException) UpdateListener(cn.bmob.v3.listener.UpdateListener)

Example 2 with MyUser

use of com.yuxuan.admin.expression.entity.MyUser in project expression by happy-yuxuan.

the class UMyInfomationActivity method updataUser.

/**
 * 修改User表,主要修改username, real_name, phone, email, idCard 字段
 */
private void updataUser() {
    String username = et_nichen.getText().toString().trim();
    String real_name = et_real_name.getText().toString().trim();
    String phoneNumber = et_phoneNumber.getText().toString().trim();
    String idCard = et_idCard.getText().toString().trim();
    String email = et_mail.getText().toString().trim();
    // 获取缓存用户的信息
    final String cacheUsername = BmobUser.getCurrentUser().getUsername();
    BmobUser cachebUser = BmobUser.getCurrentUser();
    MyUser newUser = new MyUser();
    if (!email.equals(cachebUser.getEmail())) {
        newUser.setEmail(email);
    }
    if (!username.equals(cachebUser.getUsername())) {
        newUser.setUsername(username);
    }
    if (!phoneNumber.equals(cachebUser.getMobilePhoneNumber())) {
        newUser.setMobilePhoneNumber(phoneNumber);
    }
    newUser.setRealName(real_name);
    newUser.setIdCard(idCard);
    newUser.update(cachebUser.getObjectId(), new UpdateListener() {

        @Override
        public void done(BmobException e) {
            dialog.dismiss();
            if (e == null) {
                Toast.makeText(UMyInfomationActivity.this, "修改资料成功", Toast.LENGTH_SHORT).show();
                // 更新UserDqInfomation表(cacheUsername 是修改关键字)
                updataUserDqInfomation(cacheUsername);
                // 设置 EditText 为 未激活状态
                setEditTextEnable(false);
            } else {
                Toast.makeText(UMyInfomationActivity.this, "修改失败:" + e.getMessage(), Toast.LENGTH_SHORT).show();
            }
        }
    });
}
Also used : MyUser(com.yuxuan.admin.expression.entity.MyUser) BmobException(cn.bmob.v3.exception.BmobException) BmobUser(cn.bmob.v3.BmobUser) UpdateListener(cn.bmob.v3.listener.UpdateListener)

Example 3 with MyUser

use of com.yuxuan.admin.expression.entity.MyUser in project expression by happy-yuxuan.

the class UMyPaiJianActivity method initData.

// 从bmob获取数据
private void initData() {
    dialog.show();
    // 查询所有下单代取的用户
    BmobQuery<UserDqInfomation> query = new BmobQuery<UserDqInfomation>();
    query.addWhereEqualTo("success", false);
    query.findObjects(new FindListener<UserDqInfomation>() {

        @Override
        public void done(List<UserDqInfomation> object, BmobException e) {
            if (e == null) {
                L.i("queryAllData = " + object.size());
                for (final UserDqInfomation u : object) {
                    String dq_phone = u.getDq_phone();
                    // 查询当前用户需要派送的用户
                    BmobQuery<MyUser> q = new BmobQuery<MyUser>();
                    q.addWhereEqualTo("mobilePhoneNumber", dq_phone);
                    q.findObjects(new FindListener<MyUser>() {

                        @Override
                        public void done(List<MyUser> object, BmobException e) {
                            dialog.dismiss();
                            if (e == null) {
                                MyOrdersData buffer;
                                String sendUsername = object.get(0).getUsername();
                                String username = BmobUser.getCurrentUser().getUsername();
                                L.i(username + "--" + sendUsername);
                                if (sendUsername.equals(username)) {
                                    String rusername = u.getUsername();
                                    String addr = u.getAddr();
                                    String phone = u.getPhone();
                                    String status = u.getStatus();
                                    String other = u.getOther();
                                    buffer = new MyOrdersData();
                                    buffer.setUsername(rusername);
                                    buffer.setAddr(addr);
                                    buffer.setPhoneNumber(phone);
                                    buffer.setOther(other);
                                    buffer.setStatus(status);
                                    data.add(buffer);
                                    hander.sendEmptyMessage(StaticClass.LOAD_DATA_OK);
                                }
                            } else {
                                L.i("querDqUsername fail:" + e.getMessage());
                                hander.sendEmptyMessage(StaticClass.LOAD_DATA_FAIL);
                                Toast.makeText(UMyPaiJianActivity.this, "加载数据失败", Toast.LENGTH_SHORT).show();
                            }
                        }
                    });
                }
            } else {
                L.i("queryteamFlag fail:" + e.getMessage());
                hander.sendEmptyMessage(StaticClass.LOAD_DATA_FAIL);
                Toast.makeText(UMyPaiJianActivity.this, "加载数据失败", Toast.LENGTH_SHORT).show();
            }
        }
    });
}
Also used : MyUser(com.yuxuan.admin.expression.entity.MyUser) BmobException(cn.bmob.v3.exception.BmobException) UserDqInfomation(com.yuxuan.admin.expression.entity.UserDqInfomation) MyOrdersData(com.yuxuan.admin.expression.entity.MyOrdersData) FindListener(cn.bmob.v3.listener.FindListener) BmobQuery(cn.bmob.v3.BmobQuery) ArrayList(java.util.ArrayList) List(java.util.List)

Example 4 with MyUser

use of com.yuxuan.admin.expression.entity.MyUser in project expression by happy-yuxuan.

the class KDGerenZhuceActivity method regiestPerson.

private void regiestPerson() {
    String phoneNumber = et_phoneNumber.getText().toString().trim();
    String email = et_mail.getText().toString().trim();
    String realName = et_real_name.getText().toString().trim();
    String idCard = et_idcard.getText().toString().trim();
    if (UtilTools.checkMobileNumber(phoneNumber) && !TextUtils.isEmpty(realName) && !TextUtils.isEmpty(idCard) && UtilTools.checkEmail(email)) {
        // 更新
        MyUser newUser = new MyUser();
        newUser.setEmail(email);
        newUser.setMobilePhoneNumber(phoneNumber);
        newUser.setRealName(realName);
        newUser.setIdCard(idCard);
        newUser.setTeamFlag("1");
        BmobUser bmobUser = MyUser.getCurrentUser();
        newUser.update(bmobUser.getObjectId(), new UpdateListener() {

            @Override
            public void done(BmobException e) {
                if (e == null) {
                    Toast.makeText(KDGerenZhuceActivity.this, "加入成功", Toast.LENGTH_SHORT).show();
                    dealResult();
                } else {
                    Toast.makeText(KDGerenZhuceActivity.this, "加入失败" + e, Toast.LENGTH_SHORT).show();
                    L.d(e.getErrorCode() + "");
                }
            }
        });
    } else {
        if (!UtilTools.checkMobileNumber(phoneNumber)) {
            Toast.makeText(this, "电话输入格式不正确", Toast.LENGTH_SHORT).show();
        } else if (!UtilTools.checkEmail(email)) {
            Toast.makeText(this, "邮箱格式不正确", Toast.LENGTH_SHORT).show();
        } else {
            Toast.makeText(this, "信息填写不完整", Toast.LENGTH_SHORT).show();
        }
    }
}
Also used : MyUser(com.yuxuan.admin.expression.entity.MyUser) BmobException(cn.bmob.v3.exception.BmobException) BmobUser(cn.bmob.v3.BmobUser) UpdateListener(cn.bmob.v3.listener.UpdateListener)

Example 5 with MyUser

use of com.yuxuan.admin.expression.entity.MyUser in project expression by happy-yuxuan.

the class LoginActivity method loginInBmob.

/**
 * 登录到Bmob 云平台
 *
 * @param username
 * @param password
 */
private void loginInBmob(final String username, final String password) {
    dialog.show();
    MyUser myUser = new MyUser();
    myUser.setUsername(username);
    myUser.setPassword(password);
    myUser.login(new SaveListener<BmobUser>() {

        @Override
        public void done(BmobUser bmobUser, BmobException e) {
            dialog.dismiss();
            if (e == null) {
                Intent intent = new Intent();
                intent.setAction("com.index.IndexActivity");
                intent.putExtra("username", username);
                remberPWD(username, password);
                startActivity(intent);
                finish();
            } else {
                Toast.makeText(LoginActivity.this, e.getMessage(), Toast.LENGTH_SHORT).show();
            }
        }
    });
}
Also used : MyUser(com.yuxuan.admin.expression.entity.MyUser) BmobException(cn.bmob.v3.exception.BmobException) BmobUser(cn.bmob.v3.BmobUser) Intent(android.content.Intent)

Aggregations

BmobException (cn.bmob.v3.exception.BmobException)10 MyUser (com.yuxuan.admin.expression.entity.MyUser)10 BmobUser (cn.bmob.v3.BmobUser)7 UpdateListener (cn.bmob.v3.listener.UpdateListener)5 BmobQuery (cn.bmob.v3.BmobQuery)3 Intent (android.content.Intent)2 ArrayList (java.util.ArrayList)2 BitmapDrawable (android.graphics.drawable.BitmapDrawable)1 FindListener (cn.bmob.v3.listener.FindListener)1 MyOrdersData (com.yuxuan.admin.expression.entity.MyOrdersData)1 UserDqInfomation (com.yuxuan.admin.expression.entity.UserDqInfomation)1 List (java.util.List)1