BUG
jiangqs
2023-04-24 aa2eae024f8f251c8e2b9eace5351dea7e315ed7
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
package com.hrt.system.controller.miniapp;
 
import com.hrt.common.core.domain.R;
import com.hrt.common.security.utils.SecurityUtils;
import com.hrt.system.domain.dto.AppBaseGetDto;
import com.hrt.system.domain.dto.AppGoodsInfoGetDto;
import com.hrt.system.domain.poji.member.Member;
import com.hrt.system.domain.vo.AppGoodsInfoVo;
import com.hrt.system.domain.vo.AppShopInfoVo;
import com.hrt.system.service.goods.GoodsService;
import com.hrt.system.service.member.MemberService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;
 
/**
 * @author jqs34
 * @ClassName AppGoodsController
 * @description: TODO
 * @date 2023年04月20日
 * @version: 1.0
 */
@Api(value = "小程序商品相关接口", tags = "小程序商品相关接口", description = "小程序商品相关接口")
@RestController
@RequestMapping("/app/home")
public class AppGoodsController {
 
    @Autowired
    private GoodsService goodsService;
 
    @Autowired
    private MemberService memberService;
 
    @RequestMapping(value = "/getGoodsInfo", method = RequestMethod.POST)
    @ApiOperation(value = "获取商品详情")
    public R<AppGoodsInfoVo> getGoodsInfo(@RequestBody AppGoodsInfoGetDto appGoodsInfoGetDto) {
        Long userId = SecurityUtils.getUserId();
        if(userId!=null){
            Member member = memberService.getById(userId);
            if(member!=null&&member.getRealtionShopId()!=null){
                appGoodsInfoGetDto.setShopId(member.getRealtionShopId());
            }
        }
        AppGoodsInfoVo appGoodsInfoVo = goodsService.getGoodsInfo(appGoodsInfoGetDto);
        return R.ok(appGoodsInfoVo);
    }
 
 
 
}