子卡信息

This commit is contained in:
cun-nan 2023-12-28 17:31:50 +08:00
parent cd24222c2a
commit 830e435b56
8 changed files with 86 additions and 10 deletions

View File

@ -28,6 +28,12 @@ public interface LJUserService extends IService<LJUser> {
*/
LJUser selectUserByUserId();
/**
*
* @return
*/
LJUser queryUserByUserId();
/**
* 查询所有会员信息
* @return

View File

@ -69,6 +69,11 @@ public class LJUserServiceImpl extends ServiceImpl<LJUserMapper, LJUser> impleme
return baseMapper.selectById(nowAccountInfo.getId());
}
@Override
public LJUser queryUserByUserId() {
return null;
}
/**
* 查询所有会员信息
* @return

View File

@ -1,10 +1,17 @@
package com.fuint.module.AlipayApi.controller;
import cn.hutool.core.util.ObjectUtil;
import com.alibaba.fastjson.JSONObject;
import com.alipay.api.AlipayApiException;
import com.alipay.api.response.AlipaySystemOauthTokenResponse;
import com.fuint.business.userManager.entity.LJUser;
import com.fuint.business.userManager.service.LJUserService;
import com.fuint.business.userManager.vo.LJUserVo;
import com.fuint.framework.web.BaseController;
import com.fuint.framework.web.ResponseObject;
import com.fuint.module.AlipayApi.service.AlipayService1;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.PostMapping;
@ -15,10 +22,13 @@ import org.springframework.web.bind.annotation.RestController;
import java.util.Map;
@RestController
@RequestMapping("/api/alipay")
@RequestMapping("/clientApi/sign/alipayLogin")
public class AlipayController extends BaseController {
private Logger logger = LoggerFactory.getLogger(AlipayController.class);
@Autowired
private AlipayService1 alipayService;
@Autowired
private LJUserService userService;
/**
* 获取支付宝userId
@ -28,9 +38,30 @@ public class AlipayController extends BaseController {
@PostMapping("/getUserid")
public ResponseObject getUserId(@Validated @RequestBody Map<String,String> map) throws AlipayApiException {
String authCode = map.get("authCode");
JSONObject paramsObj = new JSONObject(map.isEmpty());
logger.info("微信授权登录参数:{}", map);
JSONObject userInfo = paramsObj.getJSONObject("userInfo");
String storeId = ObjectUtil.isEmpty(userInfo.get("storeId"))? "" : userInfo.get("storeId").toString();
if ("".equals(storeId)) return getFailureResult(0, "微信登录失败");
// 获取支付宝userid
AlipaySystemOauthTokenResponse alipayProfile = alipayService.getAlipayProfile(authCode);
String userId = alipayProfile.getUserId();
// 根据手机号查询用户信息
LJUser user = userService.selectUserByMobile(userInfo.get("phone").toString());
if (ObjectUtil.isNotEmpty(user)){
// 添加用户的支付宝userid
user.setUserId(userId);
userService.updateById(user);
}else {
LJUserVo ljUser = new LJUserVo();
ljUser.setMobile(userInfo.get("phone").toString());
userService.insertUser(ljUser);
}
return getSuccessResult("");
}
}

View File

@ -451,6 +451,7 @@
<!-- </el-radio-group>-->
<el-radio v-model="payType" v-for="item in payList"
:key="item.dictValue" :value="item.dictValue"
v-if="item.dictValue!='APPLET_CODE'"
:label="item.dictValue"
@input="returnMethod"
border>{{ item.dictLabel }}</el-radio>

View File

@ -3,6 +3,8 @@
onLaunch: function() {
console.log('App Launch')
// #ifdef MP-WEIXIN
uni.setStorageSync("appltType","WECHAT")
console.log("微信")
//
uni.getUpdateManager().onCheckForUpdate(function(res) {
//
@ -36,6 +38,11 @@
}
});
// #endif
// #ifdef MP-ALIPAY
uni.setStorageSync("appltType","ALIPAY")
console.log("支付宝")
// #endif
},
onShow: function() {
console.log('App Show')

View File

@ -2,7 +2,7 @@
module.exports = {
// baseUrl: 'https://vue.ruoyi.vip/prod-api',
// baseUrl: 'http://192.168.0.196:8081/',
baseUrl: 'http://192.168.1.4:8080/',
baseUrl: 'http://192.168.0.121:8080/',
// baseUrl: 'http://192.168.1.5:8002/cdJdc',
imagesUrl: 'http://www.nuoyunr.com/lananRsc',

View File

@ -66,7 +66,8 @@
"requiredPrivateInfos" : [ "chooseLocation", "getLocation" ]
},
"mp-alipay" : {
"usingComponents" : true
"usingComponents" : true,
"appid" : "2021004130635045"
},
"mp-baidu" : {
"usingComponents" : true

View File

@ -9,7 +9,12 @@
<view class="top-box"></view>
<!-- 顶部区域 -->
<!-- #ifdef MP-WEIXIN -->
<button class="dl-box" open-type='getPhoneNumber' @getphonenumber="getPhone">手机号快捷登录</button>
<!-- #endif -->
<!-- #ifdef MP-ALIPAY -->
<button class="dl-box" open-type="getPhoneNumber" @getphonenumber="getUserLogin">手机号快捷登录</button>
<!-- #endif -->
<button class="kk-box" @click="goback">我再看看</button>
<view class="dbottom">
<view class="quanzi" v-if="qindex == false " @click="qindex =! qindex"></view>
@ -25,12 +30,14 @@
</template>
<script>
import request from '../../utils/request'
export default {
data() {
return {
title: '',
qindex: false,
baseUrl: this.$baseUrl,
appltType:uni.getStorageSync("appltType"),
}
},
onLoad() {
@ -40,7 +47,16 @@
components: {},
methods: {
// userid
getUserLogin1() {
getUserLogin(e) {
// if (this.qindex == false) {
// uni.showToast({
// icon: "none",
// title: "",
// duration: 2000
// })
// return;
// }
console.log(e)
let _this = this;
my.getAuthCode({
scopes: 'auth_base',
@ -48,9 +64,16 @@
const authCode = res.authCode;
console.log(res)
request({
url: "api/alipay/getUserid",
url: "clientApi/sign/alipayLogin/getUserid",
method: 'post',
data: {authCode:authCode},
data: {
authCode:authCode,
userInfo: {
storeId: 0,
staffId: "",
phone: '18457621459'
},
},
}).then((resp)=>{
console.log(resp)
// uni.setStorageSync("userId",resp.data)
@ -72,6 +95,7 @@
// })
// return;
// }
console.log(e)
uni.login({
provider: 'weixin',
success(res) {
@ -82,7 +106,7 @@
console.log('登录失败!' + res.errMsg)
}
console.log(e);
// console.log(e);
uni.checkSession({
success: () => {
uni.request({
@ -113,9 +137,9 @@
.data
.chainStoreId);
uni.navigateTo({
url: '/pages/index/index'
})
// uni.navigateTo({
// url: '/pages/index/index'
// })
}
console.log("swq", uni.getStorageSync(
'App-Token'));
@ -206,6 +230,7 @@
background: #2F72F7;
color: white;
border-radius: 50px;
margin: 0 auto;
}
.kk-box {