getRunTimeUid(); $userData = $objUserData -> get($uid); $this->setOutput('userData', $userData); # 获取用户最新收货地址 $objDLotteryUserExpress = new LotteryUserExpress(); $userExpress = $objDLotteryUserExpress -> getUserExpress($uid); $lottery_data_id = Request::g('lottery_data_id'); if (!Verify::unsignedInt($lottery_data_id)) { self::fail_exit('无效id'); } $objMlottery = new Lottery(); $lotteryData = $objMlottery-> getOneLotteryData($lottery_data_id); if(!isset($lotteryData['uid'])||$lotteryData['uid']!=$uid){ self::echo_404(); } $prize_id = $lotteryData['prize_id']; $prizeData = array(); $prizeData['prize_name'] = $lotteryData['run_time_data']['prize'][$prize_id]['prize_name']; $prizeData['img_url'] = $lotteryData['run_time_data']['prize'][$prize_id]['img_url']; $this->setOutput('title', '填写收货信息'); $this->setOutput('lotteryData', $lotteryData); $this->setOutput('prizeData', $prizeData); $this->setOutput('userExpress', $userExpress); $up = isset($_REQUEST['up'])?$_REQUEST['up']:null; $this->setOutput('upAction',$up ); $this->setOutput('notShowWeixinShare', true); $r = Request::g('r'); if ($r) { $r = base64_decode($r); $this->setOutput('refer', $r); } $this->tpl = 'express'; } /** * 事件ajax : 修改收货地址 */ public function doUpExpress() { $realname = Request::g('realname'); if (!$realname) { self::ajax_fail_exit('请填写姓名'); } $phone = Request::g('phone'); if (!$phone) { self::ajax_fail_exit('请填写有效手机号码'); } $address = Request::g('address'); if (!$address) { self::ajax_fail_exit('请填写收货地址'); } $sex = Request::g('sex'); if (!$sex) { $sex = 1; } # 获取用户信息 $objUserData = new UserInfo(); $uid = $this->getRunTimeUid(); $userData = $objUserData -> get($uid); $lottery_data_id = Request::g('lottery_data_id'); if (!Verify::unsignedInt($lottery_data_id)) { self::ajax_fail_exit('修改失败'); } $objMlottery = new Lottery(); $objDLotteryUserExpress = new LotteryUserExpress(); $lotteryData = $objMlottery-> getOneLotteryData($lottery_data_id); if(!isset($lotteryData['uid'])||$lotteryData['uid']!=$uid){ self::ajax_fail_exit('修改失败'); } $info = array( 'uid' => $uid, 'user_name' => $realname, 'phone' => $phone, 'address' => $address, 'sex' => $sex, ); $objDLotteryUserExpress -> add($info,AbstractDao::PARAM_CREATE_ACTION_REPLACE); unset($info['uid']); $objDLotteryData = new LotteryData(); $lotteryDataExpressInfo = array( 'express' => $info ); $objDLotteryData -> modify($lotteryDataExpressInfo,array('id' => $lottery_data_id)); self::ajax_success_exit('修改成功'); } /** * 事件ajax : 只修改收货地址 */ public function doUpExpressYes() { $realname = Request::g('realname'); if (!$realname) { self::ajax_fail_exit('请填写姓名'); } $phone = Request::g('phone'); if (!$phone) { self::ajax_fail_exit('请填写有效手机号码'); } $address = Request::g('address'); if (!$address) { self::ajax_fail_exit('请填写收货地址'); } $sex = Request::g('sex'); if (!$sex) { $sex = 1; } # 获取用户信息 $objUserData = new UserInfo(); $uid = $this->getRunTimeUid(); $userData = $objUserData -> get($uid); $objDLotteryUserExpress = new LotteryUserExpress(); $info = array( 'uid' => $uid, 'user_name' => $realname, 'phone' => $phone, 'address' => $address, 'sex' => $sex, ); $objDLotteryUserExpress -> add($info,AbstractDao::PARAM_CREATE_ACTION_REPLACE); unset($info['uid']); self::ajax_success_exit('修改成功'); } public function display() { return $this->render(); } }