SetMealController.php 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. <?php
  2. namespace pt\controllers;
  3. use bizHd\saas\services\SetMealService;
  4. use Yii;
  5. use common\components\util;
  6. class SetMealController extends BaseController
  7. {
  8. //套餐列表 ssh 2019.12.8
  9. public function actionList()
  10. {
  11. $fest = SetMealService::getAllByCondition([], null, '*');
  12. util::success($fest);
  13. }
  14. //添加套餐 ssh 2019.12.21
  15. public function actionAdd()
  16. {
  17. $post = Yii::$app->request->post();
  18. $return = SetMealService::add($post);
  19. util::success($return);
  20. }
  21. //修改套餐 ssh 2019.12.21
  22. public function actionUpdate()
  23. {
  24. $post = Yii::$app->request->post();
  25. $id = $post['id'];
  26. unset($post['id']);
  27. SetMealService::updateById($id, $post);
  28. util::complete();
  29. }
  30. //套餐详情 ssh 2019.12.21
  31. public function actionDetail()
  32. {
  33. $id = Yii::$app->request->get('id');
  34. $fest = SetMealService::getById($id);
  35. util::success($fest);
  36. }
  37. //花店老板查看套餐详情 ssh 2020.1.11
  38. public function actionGetDetail()
  39. {
  40. $id = Yii::$app->request->get('id', 1);
  41. $detail = SetMealService::getSetById($id);
  42. $detail['introduce'] = '可以满足日常的经营、管理和营销需求。';
  43. $function = [
  44. ['name' => '微信商城', 'has' => 1],
  45. ['name' => '节日自动涨价', 'has' => 1],
  46. ['name' => '小程序商城', 'has' => 1],
  47. ['name' => '刷脸支付', 'has' => 0],
  48. ];
  49. $free = rand(0, 1);
  50. $data = ['detail' => $detail, 'function' => $function, 'free' => $free];
  51. util::success($data);
  52. }
  53. }