| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071 |
- <?php
- namespace app\adminapi\controller\v1\product;
- use app\adminapi\controller\AuthController;
- use app\services\product\product\StoreProductGiftGroupService;
- use think\facade\App;
- /**
- * 商品参数
- * @author wuhaotian
- * @email 442384644@qq.com
- * @date 2024/12/17
- */
- class StoreProductGiftGroup extends AuthController
- {
- /**
- * @param App $app
- * @param StoreProductGiftGroupService $services
- */
- public function __construct(App $app, StoreProductGiftGroupService $services)
- {
- parent::__construct($app);
- $this->services = $services;
- }
- /**
- * 获取礼包商品列表(最外层礼包名列表)
- * @return \think\Response
- * @throws \think\db\exception\DataNotFoundException
- * @throws \think\db\exception\DbException
- * @throws \think\db\exception\ModelNotFoundException
- * @author wuhaotian
- * @email 442384644@qq.com
- * @date 2024/12/17
- */
- public function getGiftProductList()
- {
- $where = $this->request->getMore([
- ['name', '']
- ]);
- return app('json')->success($this->services->getGiftProductList($where));
- }
- /**
- * 获取推荐关系列表
- * - 只传product_id:显示该商品中最上层的推荐人(只存在于pid中,而没有在uid里的用户)
- * - 同时传product_id和uid:显示该用户的小组成员(fake_pid为该uid的用户)
- * @return \think\Response
- */
- public function getRecommendationRelationList()
- {
- $where = $this->request->getMore([
- ['product_id', 0],
- ['uid', 0]
- ]);
- return app('json')->success($this->services->getRecommendationRelationList($where));
- }
- /**
- * 获取指定商品的所有推荐关系用户
- * @return \think\Response
- */
- public function getRecommendationUsers()
- {
- $product_id = $this->request->get('product_id', 0);
- if (!$product_id) return app('json')->fail('请选择商品');
- $users = $this->services->getRecommendationUsers($product_id);
- return app('json')->success($users);
- }
- }
|