|
@@ -32,6 +32,13 @@ class LotteryController extends HomeBaseController
|
|
|
//抽奖页
|
|
|
public function index()
|
|
|
{
|
|
|
+ //验证
|
|
|
+ $user_id = cmf_get_current_user_id();
|
|
|
+ $user = UserModel::get($user_id);
|
|
|
+ if ($user['is_marry'] == 2 || $user['sex'] == 1) {
|
|
|
+ $this->redirect('/');
|
|
|
+ }
|
|
|
+
|
|
|
$prize = LotteryPrizeModel::all();
|
|
|
$ids = [];
|
|
|
$restaraunts = [];
|
|
@@ -70,7 +77,7 @@ class LotteryController extends HomeBaseController
|
|
|
|
|
|
$lottery = LotteryLogModel::where('user_id', $user_id)->find();
|
|
|
if (!empty($lottery)) {
|
|
|
- $this->error('一个人只能抽一次奖');
|
|
|
+ $this->error('一个人只能抽一次奖',url('log'));
|
|
|
}
|
|
|
|
|
|
//奖品列表
|
|
@@ -96,6 +103,26 @@ class LotteryController extends HomeBaseController
|
|
|
$this->success('恭喜你,获得' . $prize['name'],'',['id' => $rid]);
|
|
|
}
|
|
|
|
|
|
+ /**
|
|
|
+ * 中奖记录
|
|
|
+ */
|
|
|
+ public function log()
|
|
|
+ {
|
|
|
+ //奖品
|
|
|
+ $user_id = cmf_get_current_user_id();
|
|
|
+ $lottery = LotteryLogModel::with('lottery')->where('user_id',$user_id)->find();
|
|
|
+ if (empty($lottery) || $lottery['status'] == 1) {
|
|
|
+ $this->redirect('/');
|
|
|
+ }
|
|
|
+ $lottery['lottery']['image'] = cmf_get_image_url($lottery['lottery']['image']);
|
|
|
+ $this->assign('lottery',$lottery);
|
|
|
+
|
|
|
+ return $this->fetch();
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 获取奖品
|
|
|
+ */
|
|
|
private function _get_rand($proArr)
|
|
|
{
|
|
|
$result = '';
|