|
@@ -8,6 +8,12 @@ use KIF\Core\Request;
|
|
|
use Cas\Module\Lottery;
|
|
|
use Cas\Dao\UserInfo;
|
|
|
use Cas\Dao\LotteryUserFeedback;
|
|
|
+use Cas\Dao\ArticleLikeCounter;
|
|
|
+use Cas\Dao\LotteryUserHelp;
|
|
|
+use Cas\Module\LotteryLog;
|
|
|
+use Cas\Dao\LotteryUserExpress;
|
|
|
+
|
|
|
+
|
|
|
/**
|
|
|
*
|
|
|
* 用户资料设置
|
|
@@ -19,6 +25,219 @@ class Member extends EventsController {
|
|
|
|
|
|
}
|
|
|
|
|
|
+ /**
|
|
|
+ * 我的首页
|
|
|
+ */
|
|
|
+ public function doMy() {
|
|
|
+
|
|
|
+ # 获取当前用户的信息
|
|
|
+ $objUserData = new UserInfo();
|
|
|
+ $uid = $this->getRunTimeUid();
|
|
|
+ $userData = $objUserData -> get($uid);
|
|
|
+ $this->setOutput('userData', $userData);
|
|
|
+ $thisTime = time();
|
|
|
+
|
|
|
+ # 获取登录地址
|
|
|
+ $url = Request::g('url');
|
|
|
+ $thisUrl = Request::schemeDomain().'/member/my';
|
|
|
+ $loginUrl = $this -> getLoginUrl($thisUrl);
|
|
|
+ $this->setOutput('loginUrl', $loginUrl);
|
|
|
+
|
|
|
+ # 判断是否需要登录
|
|
|
+ $ckLogin = $this->ckLogin();
|
|
|
+ $this->setOutput('ckLogin', $ckLogin);
|
|
|
+
|
|
|
+
|
|
|
+ # 获取我的助力值
|
|
|
+ $condition = array (
|
|
|
+ 'events_id' => $events_id,
|
|
|
+ 'uid' => $uid,
|
|
|
+ );
|
|
|
+ $objLotteryUserHelp = new LotteryUserHelp();
|
|
|
+ $info = $objLotteryUserHelp->fetchAll ( $condition, 10000, 'id desc' );
|
|
|
+ $num = 0;
|
|
|
+ if ($info) {
|
|
|
+ foreach ($info as $k => $v) {
|
|
|
+ $num += $v['num'];
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ $this->tpl = 'my';
|
|
|
+ $this->setOutput('thisTime', $thisTime);
|
|
|
+ $this->setOutput('title', '我的');
|
|
|
+ $this->setOutput('num', $num);
|
|
|
+ $this->setOutput('action', 'gift');
|
|
|
+ $this->setOutput('display', 1);
|
|
|
+ $this->setOutput('notShowWeixinShare', true);
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 资料设置
|
|
|
+ */
|
|
|
+ public function doSet() {
|
|
|
+
|
|
|
+ # 获取当前用户的信息
|
|
|
+ $objUserData = new UserInfo();
|
|
|
+ $uid = $this->getRunTimeUid();
|
|
|
+ $userData = $objUserData -> get($uid);
|
|
|
+ $this->setOutput('userData', $userData);
|
|
|
+ $thisTime = time();
|
|
|
+
|
|
|
+ # 获取登录地址
|
|
|
+ $url = Request::g('url');
|
|
|
+ $thisUrl = Request::schemeDomain().'/member/set';
|
|
|
+ $loginUrl = $this -> getLoginUrl($thisUrl);
|
|
|
+ $this->setOutput('loginUrl', $loginUrl);
|
|
|
+
|
|
|
+ # 判断是否需要登录
|
|
|
+ $ckLogin = $this->ckLogin();
|
|
|
+ $this->setOutput('ckLogin', $ckLogin);
|
|
|
+
|
|
|
+ # 获取用户最新收货地址
|
|
|
+ $objDLotteryUserExpress = new LotteryUserExpress();
|
|
|
+
|
|
|
+ $userExpress = $objDLotteryUserExpress -> getUserExpress($uid);
|
|
|
+
|
|
|
+
|
|
|
+ # 获取我的资料
|
|
|
+
|
|
|
+ $this->tpl = 'my_set';
|
|
|
+ $this->setOutput('thisTime', $thisTime);
|
|
|
+ $this->setOutput('title', '我的资料');
|
|
|
+ $this->setOutput('my', $userExpress);
|
|
|
+ $this->setOutput('action', 'gift');
|
|
|
+ $this->setOutput('display', 1);
|
|
|
+ $this->setOutput('notShowWeixinShare', true);
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 我参与的活动
|
|
|
+ */
|
|
|
+ public function doAct() {
|
|
|
+
|
|
|
+ # 获取当前用户的信息
|
|
|
+ $objUserData = new UserInfo();
|
|
|
+ $uid = $this->getRunTimeUid();
|
|
|
+ $userData = $objUserData -> get($uid);
|
|
|
+ $this->setOutput('userData', $userData);
|
|
|
+ $thisTime = time();
|
|
|
+
|
|
|
+ # 获取登录地址
|
|
|
+ $url = Request::g('url');
|
|
|
+ $thisUrl = Request::schemeDomain().'/member/act';
|
|
|
+ $loginUrl = $this -> getLoginUrl($thisUrl);
|
|
|
+ $this->setOutput('loginUrl', $loginUrl);
|
|
|
+
|
|
|
+ # 判断是否需要登录
|
|
|
+ $ckLogin = $this->ckLogin();
|
|
|
+ $this->setOutput('ckLogin', $ckLogin);
|
|
|
+
|
|
|
+ $plat_form_id = $this->getPlatFormId();
|
|
|
+ $objLottery = new Lottery();
|
|
|
+ # 根据uid,得到参与的活动
|
|
|
+ $condition = array('uid' => $uid);
|
|
|
+ $totals = $objLottery -> getLotteryDataListNum($condition);
|
|
|
+ $offset = 0;
|
|
|
+ $size = 10;
|
|
|
+
|
|
|
+ $data = $objLottery->getLotteryDataList($condition, "{$offset},{$size}", 'create_time desc');
|
|
|
+ $events_ids = array();
|
|
|
+
|
|
|
+ foreach($data as $key=> $d) {
|
|
|
+ $events_ids[$d['run_time_data']['events']['id']] = $d['run_time_data']['events']['id'];
|
|
|
+ }
|
|
|
+
|
|
|
+ $objDLotteryEvents = new LotteryEvents();
|
|
|
+ $eventsData = $objDLotteryEvents -> gets($events_ids);
|
|
|
+
|
|
|
+ # 剩余天数
|
|
|
+ $TIME = time();
|
|
|
+ $objArticleLikeCounter = new ArticleLikeCounter();
|
|
|
+ foreach ($eventsData as $tmpKey => $tmpData) {
|
|
|
+ $rday = ($tmpData['end_time'] - $TIME) / (24 * 60 * 60);
|
|
|
+ $eventsData[$tmpKey]['rday'] = ceil($rday);
|
|
|
+ # 参与人数
|
|
|
+ $objMLotteryLog = new LotteryLog ( null, $tmpData['id'] );
|
|
|
+ $eventsData[$tmpKey]['user_total'] = $objMLotteryLog->getUserParticipateLogNumGroupByUid ();
|
|
|
+
|
|
|
+ if ($tmpData['type'] == 9) {
|
|
|
+ # 阅读人数
|
|
|
+ $eventsData[$tmpKey]['click_num'] = $tmpData['click_num'] + ($tmpData['article_pass_base_num']?$tmpData['click_num'] + $tmpData['article_pass_base_num']:0);
|
|
|
+ # 点赞人数
|
|
|
+ $eventsData[$tmpKey]['likes'] = $objArticleLikeCounter->getLikes($tmpData['id']);
|
|
|
+ $eventsData[$tmpKey]['likes'] = $eventsData[$tmpKey]['likes'] + $tmpData['article_praise'];
|
|
|
+ } else {
|
|
|
+ if (isset($tmpData['base_num']) && $tmpData['base_num']) {
|
|
|
+ $eventsData[$tmpKey]['user_total'] += $tmpData['base_num'];
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ $this->setOutput('eventsData', $eventsData);
|
|
|
+ $this->setOutput('title', '我参与的活动');
|
|
|
+ $this->setOutput('totals', ceil($totals / $size));
|
|
|
+ $this->tpl = 'my_act';
|
|
|
+ $this->setOutput('action', 'gift');
|
|
|
+ $this->setOutput('plat_form_id', $plat_form_id);
|
|
|
+ $this->setOutput('display', 1);
|
|
|
+ $this->setOutput('notShowWeixinShare', true);
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 事件:ajax翻页
|
|
|
+ */
|
|
|
+ public function doActAjax() {
|
|
|
+ $page = Request::varGetInt('page', 1);
|
|
|
+ $thisTime = time();
|
|
|
+ $objLottery = new Lottery();
|
|
|
+
|
|
|
+ $uid = $this->getRunTimeUid();
|
|
|
+ $condition = array('uid' => $uid);
|
|
|
+
|
|
|
+ $totals = $objLottery -> getLotteryDataListNum($condition);
|
|
|
+ $size = 10;
|
|
|
+ $offset = ($page - 1) * $size;
|
|
|
+ $limit = "{$offset},{$size}";
|
|
|
+ $data = $objLottery->getLotteryDataList($condition, "{$offset},{$size}", 'create_time desc');
|
|
|
+
|
|
|
+ $newData = array();
|
|
|
+ $events_ids = array();
|
|
|
+
|
|
|
+ $events_ids = array();
|
|
|
+
|
|
|
+ foreach($data as $key=> $d) {
|
|
|
+ $events_ids[$d['run_time_data']['events']['id']] = $d['run_time_data']['events']['id'];
|
|
|
+ }
|
|
|
+
|
|
|
+ $objDLotteryEvents = new LotteryEvents();
|
|
|
+ $eventsData = $objDLotteryEvents -> gets($events_ids);
|
|
|
+
|
|
|
+ # 剩余天数
|
|
|
+ $TIME = time();
|
|
|
+ $objArticleLikeCounter = new ArticleLikeCounter();
|
|
|
+ foreach ($eventsData as $tmpKey => $tmpData) {
|
|
|
+ $rday = ($tmpData['end_time'] - $TIME) / (24 * 60 * 60);
|
|
|
+ $eventsData[$tmpKey]['rday'] = ceil($rday);
|
|
|
+ # 参与人数
|
|
|
+ $objMLotteryLog = new LotteryLog ( null, $tmpData['id'] );
|
|
|
+ $eventsData[$tmpKey]['user_total'] = $objMLotteryLog->getUserParticipateLogNumGroupByUid ();
|
|
|
+
|
|
|
+ if ($tmpData['type'] == 9) {
|
|
|
+ # 阅读人数
|
|
|
+ $eventsData[$tmpKey]['click_num'] = $tmpData['click_num'] + ($tmpData['article_pass_base_num']?$tmpData['click_num'] + $tmpData['article_pass_base_num']:0);
|
|
|
+ # 点赞人数
|
|
|
+ $eventsData[$tmpKey]['likes'] = $objArticleLikeCounter->getLikes($tmpData['id']);
|
|
|
+ $eventsData[$tmpKey]['likes'] = $eventsData[$tmpKey]['likes'] + $tmpData['article_praise'];
|
|
|
+ } else {
|
|
|
+ if (isset($tmpData['base_num']) && $tmpData['base_num']) {
|
|
|
+ $eventsData[$tmpKey]['user_total'] += $tmpData['base_num'];
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ $this->setOutput('eventsData', $eventsData);
|
|
|
+ $this->tpl = 'ajax_my_act';
|
|
|
+ $this->ajax_success_exit($this->render(true));
|
|
|
+ }
|
|
|
|
|
|
|
|
|
/**
|
|
@@ -36,6 +255,16 @@ class Member extends EventsController {
|
|
|
$uid = $this->getRunTimeUid();
|
|
|
$userData = $objUserData -> get($uid);
|
|
|
$this->setOutput('userData', $userData);
|
|
|
+
|
|
|
+ # 获取登录地址
|
|
|
+ $url = Request::g('url');
|
|
|
+ $thisUrl = Request::schemeDomain().'/member/gifts';
|
|
|
+ $loginUrl = $this -> getLoginUrl($thisUrl);
|
|
|
+ $this->setOutput('loginUrl', $loginUrl);
|
|
|
+
|
|
|
+ # 判断是否需要登录
|
|
|
+ $ckLogin = $this->ckLogin();
|
|
|
+ $this->setOutput('ckLogin', $ckLogin);
|
|
|
|
|
|
$condition = array('audit' => 2, 'uid' => $uid,'scratch_receive' => LotteryData::EVENT_SCRATCH_RECEIVE_TRUE);
|
|
|
$totals = $objLottery -> getLotteryDataListNum($condition);
|