getRunTimeUid(); if (!Verify::unsignedInt($uid)) { self::ajax_fail_exit('无效用户id'); } $help_id = Request::g('help_id'); if (!Verify::unsignedInt($help_id)) { self::ajax_fail_exit('无效试用id'); } $source_user = Request::g('source_user'); if (!Verify::unsignedInt($source_user)) { self::ajax_fail_exit('无效用户id'); } if ($uid == $source_user) { self::ajax_fail_exit('不能给自己助力'); } $help_session = Request::g('help_session'); $state = $this->shareSession($help_id, $source_user, $help_session); if (!$state) { self::ajax_fail_exit('无效试用id'); } $events_id = Request::g('events_id'); if (!Verify::unsignedInt($events_id)) { self::ajax_fail_exit('无效试用id'); } $this->LotteryUserHelpLog = new LotteryUserHelpLog (); $this->LotteryUserHelp = new LotteryUserHelp (); $totals = $this->LotteryUserHelpLog->totals(array('help_id' => $help_id)); $this->LotteryUserHelp->modify(array('num' => $totals), array('id' => $help_id)); $condition = array ( 'help_id' => $help_id, 'events_id' => $events_id, 'uid' => $uid, ); $info = $this->LotteryUserHelpLog->fetchOne ( $condition); if ($info) { self::ajax_fail_exit('您只能助力一次'); # modify $this->LotteryUserHelpLog->modify($condition, array('id' => $info['id'])); } else { # add $id = $this->LotteryUserHelpLog->add($condition); } self::ajax_success_exit(); } public function display() { return $this->render (); } }