LuckPrize.php 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. <?php
  2. // +----------------------------------------------------------------------
  3. // | CRMEB [ CRMEB赋能开发者,助力企业发展 ]
  4. // +----------------------------------------------------------------------
  5. // | Copyright (c) 2016~2020 https://www.crmeb.com All rights reserved.
  6. // +----------------------------------------------------------------------
  7. // | Licensed CRMEB并不是自由软件,未经许可不能去掉CRMEB相关版权
  8. // +----------------------------------------------------------------------
  9. // | Author: CRMEB Team <admin@crmeb.com>
  10. // +----------------------------------------------------------------------
  11. declare (strict_types=1);
  12. namespace app\controller\admin\v1\marketing\lottery;
  13. use app\controller\admin\AuthController;
  14. use app\services\activity\lottery\LuckPrizeServices;
  15. use think\facade\App;
  16. /**
  17. * 抽奖奖品
  18. * Class LuckPrize
  19. * @package app\controller\admin\v1\marketing\lottery
  20. */
  21. class LuckPrize extends AuthController
  22. {
  23. /**
  24. * LuckPrize constructor.
  25. * @param App $app
  26. * @param LuckPrizeServices $services
  27. */
  28. public function __construct(App $app, LuckPrizeServices $services)
  29. {
  30. parent::__construct($app);
  31. $this->services = $services;
  32. }
  33. public function edit($id)
  34. {
  35. $data = $this->request->postMore([
  36. ['type', 1],
  37. ['lottery_id', 0],
  38. ['name', ''],
  39. ['prompt', ''],
  40. ['image', ''],
  41. ['chance', 1],
  42. ['total', 1],
  43. ['couon_id', 0],
  44. ['product_id', 0],
  45. ['unique', ''],
  46. ['num', 1]
  47. ]);
  48. if (!$id) {
  49. return $this->fail('缺少参数id');
  50. }
  51. if (!$data['lottery_id']) {
  52. return $this->fail('缺少抽奖活动id');
  53. }
  54. return $this->success($this->services->edit((int)$id, $data) ? '编辑成功' : '编辑失败');
  55. }
  56. }