Пример #1
3
 function actionModify()
 {
     $id = (int) $this->_context->get('id');
     $rs = Account::find('user_id = ?', $id)->getOne();
     if (!$rs->id()) {
         return $this->msg($tip = '参数错误', url('manage::account'));
     }
     $form = Form_Common::createForm('', 'manage/profile');
     if ($this->_context->isPOST() && $form->validate($_POST)) {
         $post = $form->values();
         $user_mail = $post['user_mail'];
         $user_pass = $post['user_pass'];
         $is_locked = $post['is_locked'] ? '1' : '0';
         #dump($post);
         if ($user_pass) {
             $user_pass = sha1(md5('sike' . $post['user_pass'] . Q::ini('appini/secret_key')));
             $rs->user_pass;
         }
         $rs->user_mail = $user_mail;
         $rs->is_locked = $is_locked;
         $rs->save();
         return $this->msg($tip = '修改成功', url('manage::account/modify', array('id' => $id)));
     }
     $form->import($rs->toArray());
     $form->element('user_pass')->value = '';
     $form->element('is_locked')->checked = $rs->is_locked;
     #dump($form->element('is_locked'));
     $this->_view['form'] = $form;
     $this->_view['rs'] = $rs;
     $order = Order::find('user_id = ?', $id)->order('created DESC')->getAll();
     $this->_view['order'] = $order;
     $this->_view['_UDI'] = 'manage::account/index';
 }
Пример #2
0
 function actionModify()
 {
     $id = (int) $this->_context->get('id');
     $rs = Plans::find('plan_id = ?', $id)->getOne();
     $form = Form_Common::createForm('', 'manage/plans');
     if ($this->_context->isPOST() && $form->validate($_POST)) {
         $post = $this->_context->post();
         $dsp = array_combine($post['config']['val'], $post['config']['dsp']);
         $tmp = array();
         foreach ($dsp as $val => $dsp) {
             $tmp[] = array('price' => $val, 'print' => $dsp);
         }
         $sku = array_combine($post['config']['key'], $tmp);
         $rs->name = $post['name'];
         $rs->desc = $post['desc'];
         $rs->groupname = $post['groupname'];
         $rs->sku = phpversion() >= '5.4' ? json_encode($sku, JSON_UNESCAPED_UNICODE) : json_encode($sku);
         $rs->save();
         return $this->msg($tip = '修改成功', url('manage::plans/modify', array('id' => $id)));
     }
     $groupname_list = Radgroupcheck::find()->group('groupname')->getAll()->toHashMap('groupname', 'groupname');
     $form->element('groupname')->items = $groupname_list;
     $form->import($rs->toArray());
     $this->_view['_UDI'] = 'manage::plans/index';
     $this->_view['form'] = $form;
     $this->_view['rs'] = $rs;
 }
Пример #3
0
 function actionSignup()
 {
     $form = Form_Common::createForm('', 'signup');
     if ($this->_context->isPOST() && $form->validate($_POST)) {
         #return $this->msg('关闭注册中。',url('default::default/index'));
         $msg = null;
         $post = $form->values();
         $user_mail = $post['user_mail'];
         $user_pass = $post['user_pass'];
         $user_ip = $_SERVER['REMOTE_ADDR'];
         if ($user_pass != $post['user_pass_checked']) {
             $msg = '两次密码输入不一致;';
         }
         $user_pass = sha1(md5('sike' . $user_pass . Q::ini('appini/secret_key')));
         #dump($user_pass);exit;
         $test = Account::find('user_mail = ? ', $user_mail)->getOne();
         if ($test->id()) {
             $msg = '邮箱帐号已被使用;';
         }
         if ($msg === null) {
             $rs = new Account(array('user_mail' => $user_mail, 'user_pass' => $user_pass, 'user_ip' => $user_ip));
             if (Q::ini('appini/email_activate')) {
                 $rs->is_locked = '1';
                 $verify_hash = md5('sike' . rand(1000, 9999) . time());
                 $rs->verify_hash = $verify_hash;
                 $rs->save();
                 $send = Mail_Api::send('[' . Q::ini('appini/meta/title') . ']帐号激活邮件', '请点击连接激活您的帐号:' . Q::ini('appini/meta/url') . '/activate?verify=' . $verify_hash, $user_mail, '客户');
                 if ($send === true) {
                     return $this->msg('注册成功,请登陆您的邮箱获取激活连接。', url('default::default/signin'));
                 }
             }
             $rs->is_locked = '0';
             $rs->save();
             $this->_app->changeCurrentUser($rs->id());
             return $this->msg('注册成功', url('default::service'));
         }
         $this->_view['_MSG'] = $msg;
         #dump($post);
         $form->element('services')->checked = $post['services'];
     }
     $this->_view['_META_TITLE'] = '注册帐号';
     $this->_view['form'] = $form;
     $this->_viewname = 'account/signup';
 }
Пример #4
0
 function actionIndex()
 {
     $account = QDB::getConn()->getOne($sql = "SELECT count(`groupname`) as total FROM radusergroup WHERE groupname =  'NOR'");
     $this->_view['account'] = $account;
     if (15 - $account < 1) {
         $this->_view['_MSG'] = '目前产品已经卖光了,请填写您有效的邮箱,以便接收到货通知。';
     }
     $rs = $this->_user;
     $form = Form_Common::createForm('', 'profile');
     if ($this->_context->isPOST() && $form->validate($_POST)) {
         $post = $form->values();
         $user_mail = $post['user_mail'];
         $user_pass = $post['user_pass'];
         $msg = null;
         if ($user_pass) {
             if ($user_pass != $post['user_pass_checked']) {
                 $msg = '两次密码输入不一致;';
             }
         }
         if ($msg === null) {
             if (!Q::ini('isDemo')) {
                 $rs->user_pass = sha1(md5('sike' . $user_pass . Q::ini('appini/secret_key')));
                 $rs->save();
                 return $this->msg('修改成功。', url('default::account/index'));
             }
             $msg = '演示用户禁止修改密码';
         }
         $this->_view['_MSG'] = $msg;
     }
     #$form->add(QForm::ELEMENT, $prop, array('_ui' => 'dropdownlist','_label'=>$label_text . ':', 'class' => 'slt toggle_input'));
     #$elem = $form->element($prop);
     $this->_view['_META_TITLE'] = '我的账户';
     $form->element('user_mail')->value = $rs->user_mail;
     $form->element('user_mail')->disabled = 'disabled';
     $this->_view['form'] = $form;
 }