子卡信息

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(); LJUser selectUserByUserId();
/**
*
* @return
*/
LJUser queryUserByUserId();
/** /**
* 查询所有会员信息 * 查询所有会员信息
* @return * @return

View File

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

View File

@ -1,10 +1,17 @@
package com.fuint.module.AlipayApi.controller; 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.AlipayApiException;
import com.alipay.api.response.AlipaySystemOauthTokenResponse; 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.BaseController;
import com.fuint.framework.web.ResponseObject; import com.fuint.framework.web.ResponseObject;
import com.fuint.module.AlipayApi.service.AlipayService1; 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.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated; import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.PostMapping;
@ -15,10 +22,13 @@ import org.springframework.web.bind.annotation.RestController;
import java.util.Map; import java.util.Map;
@RestController @RestController
@RequestMapping("/api/alipay") @RequestMapping("/clientApi/sign/alipayLogin")
public class AlipayController extends BaseController { public class AlipayController extends BaseController {
private Logger logger = LoggerFactory.getLogger(AlipayController.class);
@Autowired @Autowired
private AlipayService1 alipayService; private AlipayService1 alipayService;
@Autowired
private LJUserService userService;
/** /**
* 获取支付宝userId * 获取支付宝userId
@ -28,9 +38,30 @@ public class AlipayController extends BaseController {
@PostMapping("/getUserid") @PostMapping("/getUserid")
public ResponseObject getUserId(@Validated @RequestBody Map<String,String> map) throws AlipayApiException { public ResponseObject getUserId(@Validated @RequestBody Map<String,String> map) throws AlipayApiException {
String authCode = map.get("authCode"); 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); AlipaySystemOauthTokenResponse alipayProfile = alipayService.getAlipayProfile(authCode);
String userId = alipayProfile.getUserId(); 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(""); return getSuccessResult("");
} }
} }

View File

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

View File

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

View File

@ -2,7 +2,7 @@
module.exports = { module.exports = {
// baseUrl: 'https://vue.ruoyi.vip/prod-api', // baseUrl: 'https://vue.ruoyi.vip/prod-api',
// baseUrl: 'http://192.168.0.196:8081/', // 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', // baseUrl: 'http://192.168.1.5:8002/cdJdc',
imagesUrl: 'http://www.nuoyunr.com/lananRsc', imagesUrl: 'http://www.nuoyunr.com/lananRsc',

View File

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

View File

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