|
@@ -109,6 +109,13 @@ class My extends Core
|
|
|
if ($this->data['user']['role']) {
|
|
|
if ($this->data['user']['role']['levelup'] == 1) {
|
|
|
$this->data['button']['up'] = 1;
|
|
|
+ if ($this->data['user']['role']['type'] == 2 && $this->data['user']['role']['area'] == 1) {
|
|
|
+ $temp = explode(',', $this->data['user']['area']);
|
|
|
+ $city = Dever::db('area/city')->find($temp[1]);
|
|
|
+ if ($city && $city['level'] == 1) {
|
|
|
+ $this->data['button']['up'] = 2;
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
if ($this->data['user']['role']['isbuy'] == 1) {
|
|
|
$this->data['button']['buy'] = 2;//不允许购买新区域
|
|
@@ -121,8 +128,45 @@ class My extends Core
|
|
|
# 账号与代理区域
|
|
|
public function getUpInfo()
|
|
|
{
|
|
|
- $this->data['user'] = $this->getInfo();
|
|
|
- $this->data['role'] = Dever::db('setting/role')->getInfo(array('isbuy' => 1, 'type' => 2));
|
|
|
+ $this->data['user'] = Dever::load('agent/lib/member')->getInfo($this->user);
|
|
|
+
|
|
|
+ if ($this->data['user']['role']['type'] == 2) {
|
|
|
+ $temp = explode(',', $this->data['user']['area']);
|
|
|
+
|
|
|
+ # 如果当前是城市,只能升级为更高级的城市
|
|
|
+ if ($this->data['user']['role']['area'] == 1) {
|
|
|
+ $city = Dever::db('area/city')->find($temp[1]);
|
|
|
+ if ($city && $city['level_id'] == 1) {
|
|
|
+ $this->data['role'] = array();
|
|
|
+ } else {
|
|
|
+ $this->data['role'] = Dever::db('setting/role')->getInfo(array('isbuy' => 1, 'type' => 2, 'area' => 1));
|
|
|
+ }
|
|
|
+ }
|
|
|
+ # 如果当前是区县,可以升级为城市和更高级的区县
|
|
|
+ if ($this->data['user']['role']['area'] == 2) {
|
|
|
+ $area = '1,2';
|
|
|
+ $county = Dever::db('area/county')->find($temp[2]);
|
|
|
+ if ($county && $county['level'] == 1) {
|
|
|
+ $area = '1';
|
|
|
+ }
|
|
|
+ $this->data['role'] = Dever::db('setting/role')->getInfo(array('isbuy' => 1, 'type' => 2, 'area' => $area));
|
|
|
+ }
|
|
|
+ # 如果当前是街道,都可以升级
|
|
|
+ if ($this->data['user']['role']['area'] == 3) {
|
|
|
+ $area = '1,2,3';
|
|
|
+ $town = Dever::db('area/town')->find($temp[3]);
|
|
|
+ if ($town && $town['type'] == 3) {
|
|
|
+ $area = '1,2';
|
|
|
+ }
|
|
|
+
|
|
|
+ $this->data['role'] = Dever::db('setting/role')->getInfo(array('isbuy' => 1, 'type' => 2, 'area' => $area));
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ $this->data['role'] = Dever::db('setting/role')->getInfo(array('isbuy' => 1, 'type' => 2));
|
|
|
+ }
|
|
|
+
|
|
|
+ $this->data['level_total'] = count($this->data['role']) + 1;
|
|
|
+
|
|
|
$this->data['config'] = Dever::db('setting/base')->find();
|
|
|
|
|
|
return $this->data;
|
|
@@ -336,4 +380,75 @@ class My extends Core
|
|
|
|
|
|
return $this->data;
|
|
|
}
|
|
|
+
|
|
|
+ # 修改密码
|
|
|
+ public function setPass()
|
|
|
+ {
|
|
|
+ $pass = Dever::input('pass');
|
|
|
+ if (!$pass) {
|
|
|
+ Dever::alert('请输入密码');
|
|
|
+ }
|
|
|
+
|
|
|
+ $where['where_id'] = $this->uid;
|
|
|
+ $where['password'] = sha1($pass);
|
|
|
+
|
|
|
+ Dever::db('agent/member')->update($where);
|
|
|
+
|
|
|
+ return Dever::db('agent/member')->find(array('id' => $this->uid, 'clear' => true));
|
|
|
+ }
|
|
|
+
|
|
|
+ # 修改资料
|
|
|
+ public function setInfo()
|
|
|
+ {
|
|
|
+ $where = array();
|
|
|
+ $name = Dever::input('name');
|
|
|
+ if ($name) {
|
|
|
+ $where['name'] = $name;
|
|
|
+ }
|
|
|
+ $avatar = Dever::input('avatar');
|
|
|
+ if ($avatar) {
|
|
|
+ $where['avatar'] = $avatar;
|
|
|
+ }
|
|
|
+ $username = Dever::input('username');
|
|
|
+ if ($username) {
|
|
|
+ $where['username'] = $username;
|
|
|
+ }
|
|
|
+ $birthday = Dever::input('birthday');
|
|
|
+ if ($birthday) {
|
|
|
+ $where['birthday'] = Dever::maketime($birthday);
|
|
|
+ }
|
|
|
+
|
|
|
+ if ($where) {
|
|
|
+ $where['where_id'] = $this->uid;
|
|
|
+ Dever::db('agent/member')->update($where);
|
|
|
+ }
|
|
|
+
|
|
|
+ return Dever::db('agent/member')->find(array('id' => $this->uid, 'clear' => true));
|
|
|
+ }
|
|
|
+
|
|
|
+ # 发送邮件
|
|
|
+ public function sendEmail()
|
|
|
+ {
|
|
|
+ $email = Dever::input('email');
|
|
|
+ if ($email) {
|
|
|
+ if (!preg_match(Dever::rule('email'), $email)) {
|
|
|
+ Dever::alert('请输入正确的邮箱');
|
|
|
+ }
|
|
|
+
|
|
|
+ $check = Dever::db('agent/member')->find(array('email' => $email));
|
|
|
+ if ($check) {
|
|
|
+ Dever::alert('该邮箱已被认证,请更换');
|
|
|
+ }
|
|
|
+
|
|
|
+ $code = Dever::load('passport/reg')->code(false, false);
|
|
|
+
|
|
|
+ $email = base64_encode($email);
|
|
|
+ //return Dever::load('agent/lib/email')->renzheng($this->uid, $email, $code);
|
|
|
+ Dever::daemon('lib/email.renzheng?mid='.$this->uid.'&email=' . $email . '&code=' . $code, 'agent');
|
|
|
+
|
|
|
+ return '邮件已经发送成功!请到您的邮箱里查看。';
|
|
|
+ } else {
|
|
|
+ Dever::alert('请输入邮箱');
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|