InviteController.php 2.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798
  1. <?php
  2. /**
  3. * 邀请有礼
  4. */
  5. namespace hd\controllers;
  6. use bizHd\invite\services\InviteService;
  7. use common\components\stringUtil;
  8. use common\components\util;
  9. use Yii;
  10. use bizHd\invite\services\InviteAssetService;
  11. use bizHd\invite\services\InviteStatService;
  12. class InviteController extends BaseController
  13. {
  14. //邀请有礼
  15. public function actionList()
  16. {
  17. $get = Yii::$app->request->get();
  18. $status = isset($get['status']) ? $get['status'] : -1;
  19. $search = isset($get['search']) ? $get['search'] : '';
  20. $where = [];
  21. $where['sjId'] = $this->sjId;
  22. if ($status != -1) {
  23. $where['status'] = $status;
  24. }
  25. if (!empty($search)) {
  26. if (stringUtil::isMobile($search)) {
  27. $where['introMobile'] = $search;
  28. } else {
  29. $where['introUserName'] = ['like', $search];
  30. }
  31. }
  32. $list = InviteService::getInviteList($where);
  33. util::success($list);
  34. }
  35. //邀请有礼明细
  36. public function actionDetail()
  37. {
  38. $id = Yii::$app->request->get('id');
  39. $invite = InviteService::getById($id);
  40. InviteService::valid($invite, $this->sjId);
  41. $detail = InviteService::getDetail($id);
  42. util::success($detail);
  43. }
  44. //确认发奖
  45. public function actionGive()
  46. {
  47. $id = Yii::$app->request->get('id');
  48. $invite = InviteService::getById($id);
  49. InviteService::valid($invite, $this->sjId);
  50. InviteService::give($invite);
  51. util::complete();
  52. }
  53. //奖励设置详情
  54. public function actionSet()
  55. {
  56. }
  57. //奖励设置更新
  58. public function actionSetUpdate()
  59. {
  60. }
  61. //邀请有礼列表 ssh 2019.12.18
  62. public function actionMallList()
  63. {
  64. $where = [];
  65. $where['introUserId'] = $this->adminId;
  66. $list = InviteService::getInviteList($where);
  67. util::success($list);
  68. }
  69. //概况 ssh 2019.12.18
  70. public function actionProfile()
  71. {
  72. $stat = InviteStatService::getStat($this->adminId);
  73. $asset = InviteAssetService::getAsset($this->sjId);
  74. util::success(['stat' => $stat, 'asset' => $asset]);
  75. }
  76. //取新人奖励 ssh 2019.12.14
  77. public function actionGetNewGift()
  78. {
  79. $introUserId = Yii::$app->request->post('introUserId', 0);
  80. InviteService::getNewGift($this->user, $introUserId);
  81. util::complete('领取成功');
  82. }
  83. }