| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899 |
- <?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);
- }
- /**
- * 获取我的礼包商品列表(当前管理员)
- * @return \think\Response
- */
- public function getMyGiftProductList()
- {
- $where = $this->request->getMore([
- ['name', '']
- ]);
- $uid = $this->adminId; // 自动获取当前登录管理员的uid
- $where['uid'] = $uid; // 添加uid过滤条件
- return app('json')->success($this->services->getGiftProductList($where));
- }
- /**
- * 获取我的推荐关系列表(当前管理员)
- * @return \think\Response
- */
- public function getMyRecommendationRelationList()
- {
- $where = $this->request->getMore([
- ['product_id', 0]
- ]);
- $uid = $this->adminId; // 自动获取当前登录管理员的uid
- $where['uid'] = $uid;
- return app('json')->success($this->services->getRecommendationRelationList($where));
- }
- }
|