| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798 |
- <?php
- /**
- * 邀请有礼
- */
- namespace hd\controllers;
- use bizHd\invite\services\InviteService;
- use common\components\stringUtil;
- use common\components\util;
- use Yii;
- use bizHd\invite\services\InviteAssetService;
- use bizHd\invite\services\InviteStatService;
- class InviteController extends BaseController
- {
-
- //邀请有礼
- public function actionList()
- {
- $get = Yii::$app->request->get();
- $status = isset($get['status']) ? $get['status'] : -1;
- $search = isset($get['search']) ? $get['search'] : '';
- $where = [];
- $where['sjId'] = $this->sjId;
- if ($status != -1) {
- $where['status'] = $status;
- }
- if (!empty($search)) {
- if (stringUtil::isMobile($search)) {
- $where['introMobile'] = $search;
- } else {
- $where['introUserName'] = ['like', $search];
- }
- }
- $list = InviteService::getInviteList($where);
- util::success($list);
- }
-
- //邀请有礼明细
- public function actionDetail()
- {
- $id = Yii::$app->request->get('id');
- $invite = InviteService::getById($id);
- InviteService::valid($invite, $this->sjId);
- $detail = InviteService::getDetail($id);
- util::success($detail);
- }
-
- //确认发奖
- public function actionGive()
- {
- $id = Yii::$app->request->get('id');
- $invite = InviteService::getById($id);
- InviteService::valid($invite, $this->sjId);
- InviteService::give($invite);
- util::complete();
- }
-
- //奖励设置详情
- public function actionSet()
- {
-
- }
-
- //奖励设置更新
- public function actionSetUpdate()
- {
-
- }
- //邀请有礼列表 ssh 2019.12.18
- public function actionMallList()
- {
- $where = [];
- $where['introUserId'] = $this->adminId;
- $list = InviteService::getInviteList($where);
- util::success($list);
- }
-
- //概况 ssh 2019.12.18
- public function actionProfile()
- {
- $stat = InviteStatService::getStat($this->adminId);
- $asset = InviteAssetService::getAsset($this->sjId);
- util::success(['stat' => $stat, 'asset' => $asset]);
- }
-
- //取新人奖励 ssh 2019.12.14
- public function actionGetNewGift()
- {
- $introUserId = Yii::$app->request->post('introUserId', 0);
- InviteService::getNewGift($this->user, $introUserId);
- util::complete('领取成功');
- }
-
- }
|