Commit 02fb39b7 authored by 黎博's avatar 黎博

优化羊小咩下单接口

parent f7252ae5
......@@ -2,8 +2,11 @@ package cn.qg.qaplatform.controller.yxm;
import cn.qg.qaplatform.config.SwitchDataSource;
import cn.qg.qaplatform.entity.kdsp.TSkuInfo;
import cn.qg.qaplatform.entity.vcc.Account;
import cn.qg.qaplatform.entity.xyqbuser.User;
import cn.qg.qaplatform.process.Yxm;
import cn.qg.qaplatform.service.kdsp.TSkuInfoService;
import cn.qg.qaplatform.service.vcc.AccountService;
import cn.qg.qaplatform.utils.Result;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
......@@ -26,6 +29,9 @@ public class YxmController {
@Autowired
TSkuInfoService tSkuInfoService;
@Autowired
AccountService accountService;
/**
* 获取sku列表
* @param namespace 环境
......@@ -43,6 +49,10 @@ public class YxmController {
String skuName,
@RequestParam(defaultValue = "1") Integer pageNum,
@RequestParam(defaultValue = "10") Integer pageSize) {
// namespace不能为空
if (!StringUtils.isEmpty(namespace)) {
return Result.buildErrorStateResult("namespace不能为空!", false);
}
SwitchDataSource.dataSourceSwitch(namespace, "kdsp");
QueryWrapper<TSkuInfo> queryWrapper = new QueryWrapper<>();
if (skuSource != null) {
......@@ -72,6 +82,16 @@ public class YxmController {
*/
@PostMapping("/order")
public Result yxmShopping(String namespace, String version, String phoneNo, String skuNo) {
SwitchDataSource.dataSourceSwitch(namespace, "vcc_talos");
QueryWrapper<Account> accountQueryWrapper = new QueryWrapper<>();
accountQueryWrapper.eq("phone_no", phoneNo);
Account account = accountService.getOne(accountQueryWrapper);
if (account == null) {
return Result.buildErrorStateResult("用户未开通享花卡,请先开通享花卡!", false);
}
if (account.getStatus() != 6) {
return Result.buildErrorStateResult("用户未开户成功,请先开户成功!", false);
}
try {
String token = Yxm.loginApp(namespace, version,phoneNo);
Integer addressId = Yxm.getAddressList(namespace, phoneNo, token);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment