25개 이상의 토픽을 선택하실 수 없습니다. Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

55 lines
1.6 KiB

  1. <?php
  2. /**
  3. *
  4. * ============================================================================
  5. * * 版权所有 蜘蛛出行 * *
  6. * 网站地址: http://www.zhizhuchuxing.com
  7. * ----------------------------------------------------------------------------
  8. * 这不是一个自由软件!您只能在不用于商业目的的前提下对程序代码进行修改和
  9. * 使用;不允许对程序代码以任何形式任何目的的再发布。
  10. * ============================================================================
  11. * Author By: 倪宗锋
  12. * PhpStorm RedPackController.php
  13. * Create By 2016/12/5 11:56 $
  14. */
  15. namespace Activity\Controller;
  16. use Activity\Service\RedPackService;
  17. use Util\Controller\MvcController;
  18. class RedPackController extends MvcController
  19. {
  20. private $service = null;
  21. public function getService($act_id = 1)
  22. {
  23. if ($this->service == null) {
  24. $this->service = new RedPackService($act_id);
  25. }
  26. return $this->service;
  27. }
  28. /**
  29. * Function Description:发送红包
  30. * Function Name: sendRedPackAction
  31. *
  32. * @return string
  33. *
  34. * @author 倪宗锋
  35. */
  36. public function sendRedPackAction()
  37. {
  38. $params = $_GET;
  39. $act_id = empty($params['act_id']) ? 1 : $params['act_id'];
  40. //参数校验
  41. $checkSign = $this->getService($act_id)->checkParams($params);
  42. if ($checkSign['flag'] == false) {
  43. return json_encode($checkSign);
  44. }
  45. $openid = $params['openid'];
  46. $sendRedPack = $this->getService($act_id)->sendRedPack($openid);//发送红包
  47. return json_encode($sendRedPack);
  48. }
  49. }