getFind(array('id'=>$vid)); if($vip['plus_type'] == 2){ $vip['card_name'] = 'PLUS会员'; }else{ $grade = A('Api/Vipintegral')->getGrade($vip['merchantid'], $vip['grade_integral']);//查找会员等级 $vip['card_name'] = $grade['cardname']?$grade['cardname']:'普通会员'; } $vip['phone'] = substr($vip['mobile_phone'],0,4)."****".substr($vip['mobile_phone'],-(strlen($vip['mobile_phone'])-8)); $map['vid'] = $vid; $map['isuse'] = 1; $map['status'] = 2; $map['endtime'] = array('gt',time()); $vip['coupon_num'] = M('retail_vipmcoupon')->where($map)->count(); $this->assign('vip',$vip); $userInfo = session('userinfo'); if ($userInfo['style_model'] == 2) { $this->display('dynamic2'); } else if ($userInfo['style_model'] == 3) { $this->display('dynamic3'); } else { $this->display(); } } Public function index() { $vid = session('vid'); $where1['id'] = $vid; $vip = D('Vip')->getFind($where1); $where['vid'] = $vid; $where['type'] = array('in', '1,3'); $where['status'] = 1; $where['type'] = array('neq', 3); $list = D('RechargeOrder')->getSelect($where, '*', 'addtime desc'); for ($i = 0; $i < count($list); $i++) { $list[$i]['timeymd'] = date('Y-m-d', $list[$i]['addtime']); $list[$i]['timedetail'] = date('Y-m-d H:i:s', $list[$i]['addtime']); } $this->assign('vip', $vip); $this->assign('list', $list); $userInfo = session('userinfo'); if ($userInfo['style_model'] == 2) { $this->display('index2'); } else if ($userInfo['style_model'] == 3) { $this->display('index3'); } else { $this->display(); } } //获取交易记录 public function getlist() { $vid = session('vid'); $where1['id'] = $vid; $res = D('Vip')->getFind($where1); $where['vid'] = $vid; $where['status'] = 1; $list = D('RechargeOrder')->getSelect($where, '*', 'addtime desc'); for ($i = 0; $i < count($list); $i++) { $list[$i]['timeymd'] = date('Y-m-d', $list[$i]['addtime']); $list[$i]['timedetail'] = date('Y-m-d H:i:s', $list[$i]['addtime']); } if ($res && $list) { $data['success'] = 1; $data['msg'] = '交易记录已刷新'; $data['money'] = $res['money']; $data['list'] = $list; } else { $data['success'] = 0; $data['msg'] = '暂无记录'; } $this->ajaxReturn($data); } public function getCode(){ if(IS_POST){ $vid = session('vid'); $isRefresh = I('post.isRefresh'); if(!empty($vid)){ $vip = D('Vip')->getFind(array('id'=>$vid)); $old = M('vip_dynamic_code')->where(array('status' => 0, 'state' => 0, 'vid' => $vid))->order('id desc')->find(); if (empty($old) || $old['failure_time'] <= time() || $isRefresh == 1) { $add['vid'] = $vid; $add['merchantid'] = $vip['merchantid']; $add['add_time'] = time(); $add['failure_time'] = round($add['add_time'] + 60); $add['status'] = 0; $add['state'] = 0; $code = ''; $flag = true; while ($flag) { $code = '8' . rand(600000, 999999) . rand(100000, 999999) . rand(10000, 99999); $old = M('vip_dynamic_code')->where(array('merchantid' => $vip['merchantid'], 'state' => 0, 'status' => 0,'code'=>$code))->find(); if (empty($old)) { $flag = false; } } $add['code'] = $code; $id = M('vip_dynamic_code')->add($add); if ($id) { M('vip_dynamic_code')->where(array('vid'=>$vid,'id'=>array('neq',$id),'status'=>array('neq',0)))->save(array('state'=>1)); $res['status'] = 1; $res['code'] = $code; $res['time'] = round($add['failure_time']-time()); } else { $res['status'] = 0; $res['msg'] = '获取超时'; } } else { $res['status'] = 1; $res['code'] = $old['code']; $res['time'] = round($old['failure_time']-time()); } }else{ $res['status'] = 0; $res['msg'] = '登录超时'; } $this->ajaxReturn($res); } } }