Ejemplo n.º 1
0
 public function index()
 {
     $op = ggp('op');
     if ($op == 'do') {
         $this->isLogin();
         list($address, $realname) = explode('@', $this->my['device_token']);
         $this->my['decive_token'] = unserialize($this->my['device_token']);
         if (!$address || !$this->my['mobile'] || !$realname) {
             $this->myError('请完善您的收货信息', U('member/address'));
         }
         $jf_goods_id = ggp('jf_goods_id:i');
         $jfitem = M('jf_goods')->where('state=1')->find($jf_goods_id);
         empty($jfitem) && $this->myError('没有该商品');
         $jfitem['jf_goods_jf'] > $this->my['jifen'] && $this->myError('您的积分不足');
         MemberModel::I()->decJf($this->my['uid'], $jfitem['jf_goods_jf']);
         M('jf_log')->add(array('uid' => $this->my['uid'], 'uname' => $this->my['uname'], 'order_id' => $jfitem['jf_goods_id'], 'state' => 0, 'jf_goods_jf' => -$jfitem['jf_goods_jf'], 'ctime' => TIME, 'beizhu' => serialize(array('jf_goods_name' => $jfitem['jf_goods_name'], 'address' => $address, 'realname' => $realname, 'mobile' => $this->my['mobile']))));
         if ($jfitem['jf_goods_num'] > 0) {
             if (intval($jfitem['jf_goods_num']) === 1) {
                 M('jf_goods')->where("jf_goods_id='{$jfitem['jf_goods_id']}'")->save(array('state' => 0));
             }
             M('jf_goods')->where("jf_goods_id='{$jfitem['jf_goods_id']}'")->setDec('jf_goods_num');
         }
         $this->mySuccess('兑换成功');
     }
     $hot_goods = M('goods')->where("state=1")->order('`order` DESC,hits DESC,goods_id DESC')->limit(8)->select();
     $this->assign('hot_goods', $hot_goods);
     $list = M('jf_goods')->where("state=1")->order('`order` desc,jf_goods_id desc')->select();
     $this->a('$list', $list);
     $this->d();
 }
Ejemplo n.º 2
0
 public function finishOrder()
 {
     $order_id = gg('order_id:i');
     $where = "state=3 and order_id={$order_id} and buy_id={$this->my['uid']}";
     $pay_price = M("order")->where($where)->getField("pay_price");
     if (M('order')->where($where)->save(array('state' => '4'))) {
         $jifen = ceil($this->setting['jifen_order'] * $pay_price);
         MemberModel::I()->addJifen($this->my['uid'], $jifen);
         MemberModel::I()->addjfLog($this->my['uid'], $this->my['uname'], $order_id, 0 - $jifen, '3', "完成订单送积分");
         $this->mySuccess('msg_common_update_success');
     }
     $this->mySuccess('error_common_error');
 }
Ejemplo n.º 3
0
 public function login()
 {
     $op = $this->gp['op'];
     $uname = ggp('uname:t2');
     $password = ggp('password:t2');
     if ($op == 'dologin') {
         $member = MemberModel::I()->getUserByUname($uname);
         if (empty($member)) {
             $this->myError('error_member_uname_6');
         }
         if ($member['level'] < 1) {
             $this->myError('error_member_not_admin');
         }
         if (md5($password) != $member['password']) {
             $this->myError('error_member_password_2');
         }
         cookie('authcookie', authcode("{$member['uid']}\t{$member['password']}\t", 'ENCODE'), 31536000);
         $this->mySuccess('登录成功', U('admin/index'));
     }
     C('DEFAULT_THEME', 'a_tpl');
     $this->d();
 }
Ejemplo n.º 4
0
 public function login()
 {
     if ($this->my) {
         header("location:http://{$_SERVER['SERVER_NAME']}");
         exit;
     }
     $op = ggp('op');
     if ($op == 'do') {
         $openid = ggp('open_id:t2');
         if ($openid) {
             $nickname = ggp('nickname:t2');
             $user = M('member')->where("openid='{$openid}'")->find();
             if (empty($user)) {
                 header("location:http://{$_SERVER['SERVER_NAME']}/index.php?m=member&a=register&openid={$openid}&nickname={$nickname}");
                 exit;
             }
         } else {
             $uname = ggp('uname:t2');
             $password = md5(ggp('password:t2'));
             $user = MemberModel::I()->getUserByParam(array('uname' => $uname, 'password' => $password));
             empty($user) && $this->myError('用户名不存在或密码错误');
             $user['password'] != $password && $this->myError('密码错误');
         }
         $this->_login($user);
     }
     $this->display();
 }