123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183 |
- <?php
- namespace Cas\Controller;
- use Cas\Dao\LotteryData;
- use KIF\Dao\AbstractDao;
- use Cas\Module\Lottery;
- use KIF\Core\Request;
- use KIF\Verify;
- use Cas\Dao\LotteryUserExpress;
- use Cas\Dao\UserInfo;
- /**
- * 修改收获信息 (用户填写收货信息的页面)
- * lihuanchun
- * 着急写的:以后重新改
- *
- */
- class Express extends EventsController {
-
- /**
- * 页面:默认修改页
- */
- public function doDefault() {
- # 获取用户信息
- $objUserData = new UserInfo();
- $uid = $this->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();
- }
- }
|