SetMealController.php 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  1. <?php
  2. namespace shop\controllers;
  3. use biz\saas\services\SetMealService;
  4. use Yii;
  5. use common\components\util;
  6. class SetMealController extends BaseController
  7. {
  8. //套餐列表 shish 2019.12.8
  9. public function actionList()
  10. {
  11. $fest = SetMealService::getAllByCondition([], null, '*');
  12. util::success($fest);
  13. }
  14. //添加套餐 shish 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. //修改套餐 shish 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. //套餐详情 shish 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. //花店老板查看套餐详情 shish 2020.1.11
  38. public function actionGetDetail()
  39. {
  40. $id = Yii::$app->request->get('id', 1);
  41. $detail = SetMealService::getSetById($id);
  42. $detail['introduce'] = '适用于5人以下的花店,可以满足日常的经常、管理和营销需求。';
  43. $function = [
  44. ['name' => '小程序商城', 'has' => 1],
  45. ['name' => '节日涨价', 'has' => 1],
  46. ['name' => '客户管理', 'has' => 1],
  47. ['name' => '图库管理', 'has' => 1],
  48. ['name' => '收银工具', 'has' => 1],
  49. ['name' => '老带新', 'has' => 1],
  50. ['name' => '员工管理', 'has' => 1],
  51. ['name' => '门店管理', 'has' => 1],
  52. ['name' => '优惠券管理', 'has' => 1],
  53. ['name' => '订单管理', 'has' => 1],
  54. ['name' => '发货管理', 'has' => 1],
  55. ['name' => '人脸支付', 'has' => 0],
  56. ];
  57. $free = rand(0, 1);
  58. $data = ['detail' => $detail, 'function' => $function, 'free' => $free];
  59. util::success($data);
  60. }
  61. }