mirror of
https://github.com/CoreUnion/CoreShop.git
synced 2026-10-16 21:08:47 +08:00
## 1.2.7(2022-01-1)
通用调整: 【调整】启用SqlSugar.Ioc及SqlSugarCore,弃用SqlSugarClient,保证线程安全及提高对象代码容错率。减少mysql下偶发性问题。 【优化】优化【后台生成小程序码】【后台生成预览页面设计小程序码】代码,并修复【七牛云】上传方式。#I4OHP9 【优化】修复treeTable的折叠列字符字符过长导致内容显示不全的问题。 【调整】应会员需求,开源社区版前端代码增加使用账号密码登录,取回账号密码的示例文档。详情预览【CoreCms.Net.Uni-App\CoreShop\pages\login】下文件。#I4O4H4 【优化】调整首页商品【goods】在根据栏目选择商品时候排序问题,调整为【sort desc,id desc】按照先自定义排序,后数据序列排序。取消【creattime desc】排序。#I4NW4F 【修复】修复首页设计使用【图片模块】导致图片浮动遮挡右下角按钮的问题。#I4NPZL 【优化】调整小程序消息通知设置,当未设置消息提醒时,不弹出错误项提示功能,保证订单下单时到支付订单页面不报错误提示。#I4N4UL。 ## 0.0.3 会员版/商业版: 【修复】修复下单界面【添加收货地址】按钮宽度及不居中的问题。 【优化】去除接口生成海报不需要的字体,只保留思源标准字体。 【修复】修复弹窗登录报【checkbox未嵌套的问题】,导致授权页有报错。#I4OYPR 【修复】移除【Microsoft.IdentityModel.Tokens】组件,防止更新组件导致对jwt token校验的影响。 【优化】移除【http.interceptor.js】遗留的前端请求拦截器。
This commit is contained in:
@@ -7,7 +7,6 @@
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Microsoft.AspNetCore.Authentication.JwtBearer" Version="5.0.11" />
|
||||
<PackageReference Include="Microsoft.Extensions.DependencyInjection.Abstractions" Version="5.0.0" />
|
||||
<PackageReference Include="Microsoft.IdentityModel.Tokens" Version="6.13.1" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
|
||||
@@ -17,6 +17,7 @@ using CoreCms.Net.Configuration;
|
||||
using CoreCms.Net.Loging;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
using SqlSugar;
|
||||
using SqlSugar.IOC;
|
||||
|
||||
namespace CoreCms.Net.Core.Config
|
||||
{
|
||||
@@ -25,70 +26,49 @@ namespace CoreCms.Net.Core.Config
|
||||
/// </summary>
|
||||
public static class SqlSugarSetup
|
||||
{
|
||||
|
||||
public static void AddSqlSugarSetup(this IServiceCollection services)
|
||||
{
|
||||
if (services == null) throw new ArgumentNullException(nameof(services));
|
||||
string connectionString = AppSettingsConstVars.DbSqlConnection;
|
||||
string dbTypeString = AppSettingsConstVars.DbDbType;
|
||||
|
||||
//获取数据类型
|
||||
var dbType = dbTypeString == DbType.MySql.ToString() ? DbType.MySql : DbType.SqlServer;
|
||||
//判断是否开启redis设置二级缓存方式
|
||||
ICacheService myCache = AppSettingsConstVars.RedisUseCache
|
||||
? (ICacheService)new SqlSugarRedisCache()
|
||||
: new SqlSugarMemoryCache();
|
||||
|
||||
var connectionConfig = new ConnectionConfig()
|
||||
//注入 ORM
|
||||
SugarIocServices.AddSqlSugar(new IocConfig()
|
||||
{
|
||||
ConnectionString = connectionString, //必填
|
||||
DbType = dbType, //必填
|
||||
IsAutoCloseConnection = false,
|
||||
InitKeyType = InitKeyType.Attribute,
|
||||
//数据库连接
|
||||
ConnectionString = AppSettingsConstVars.DbSqlConnection,
|
||||
//判断数据库类型
|
||||
DbType = AppSettingsConstVars.DbDbType == IocDbType.MySql.ToString() ? IocDbType.MySql : IocDbType.SqlServer,
|
||||
//是否开启自动关闭数据库连接-//不设成true要手动close
|
||||
IsAutoCloseConnection = true,
|
||||
});
|
||||
|
||||
ConfigureExternalServices = new ConfigureExternalServices()
|
||||
//设置参数
|
||||
services.ConfigurationSugar(db =>
|
||||
{
|
||||
db.CurrentConnectionConfig.InitKeyType = InitKeyType.Attribute;
|
||||
db.CurrentConnectionConfig.ConfigureExternalServices = new ConfigureExternalServices()
|
||||
{
|
||||
DataInfoCacheService = myCache
|
||||
},
|
||||
};
|
||||
//判断是否开启redis设置二级缓存方式
|
||||
DataInfoCacheService = AppSettingsConstVars.RedisUseCache ? (ICacheService)new SqlSugarRedisCache() : new SqlSugarMemoryCache()
|
||||
};
|
||||
|
||||
//执行SQL 错误事件,可监控sql(暂时屏蔽,需要可开启)
|
||||
//db.Aop.OnLogExecuting = (sql, p) =>
|
||||
//{
|
||||
// NLogUtil.WriteFileLog(NLog.LogLevel.Error, LogType.Other, "SqlSugar执行SQL错误事件打印Sql", sql);
|
||||
//};
|
||||
|
||||
services.AddScoped<ISqlSugarClient>(o =>
|
||||
//执行SQL 错误事件
|
||||
db.Aop.OnError = (exp) =>
|
||||
{
|
||||
NLogUtil.WriteFileLog(NLog.LogLevel.Error, LogType.Other, "SqlSugar", "执行SQL错误事件", exp);
|
||||
};
|
||||
|
||||
var db = new SqlSugarClient(connectionConfig); //默认SystemTable
|
||||
|
||||
//日志处理
|
||||
////SQL执行前 可以修改SQL
|
||||
//db.Aop.OnLogExecuting = (sql, pars) =>
|
||||
//{
|
||||
// //获取sql
|
||||
// Console.WriteLine(sql + "\r\n" + db.Utilities.SerializeObject(pars.ToDictionary(it => it.ParameterName, it => it.Value)));
|
||||
// Console.WriteLine();
|
||||
|
||||
// //通过TempItems这个变量来算出这个SQL执行时间(1)
|
||||
// if (db.TempItems == null) db.TempItems = new Dictionary<string, object>();
|
||||
// db.TempItems.Add("logTime", DateTime.Now);
|
||||
// //通过TempItems这个变量来算出这个SQL执行时间(2)
|
||||
// var startingTime = db.TempItems["logTime"];
|
||||
// db.TempItems.Remove("time");
|
||||
// var completedTime = DateTime.Now;
|
||||
|
||||
|
||||
//};
|
||||
//db.Aop.OnLogExecuted = (sql, pars) => //SQL执行完事件
|
||||
//{
|
||||
|
||||
//};
|
||||
//db.Aop.OnLogExecuting = (sql, pars) => //SQL执行前事件
|
||||
//{
|
||||
|
||||
//};
|
||||
db.Aop.OnError = (exp) =>//执行SQL 错误事件
|
||||
{
|
||||
NLogUtil.WriteFileLog(NLog.LogLevel.Error, LogType.Other, "SqlSugar", "执行SQL错误事件", exp);
|
||||
};
|
||||
return db;
|
||||
});
|
||||
//设置更多连接参数
|
||||
//db.CurrentConnectionConfig.XXXX=XXXX
|
||||
//db.CurrentConnectionConfig.MoreSetting=new MoreSetting(){}
|
||||
//读写分离等都在这儿设置
|
||||
});
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -25,6 +25,7 @@
|
||||
<PackageReference Include="Microsoft.Extensions.DependencyInjection.Abstractions" Version="5.0.0" />
|
||||
<PackageReference Include="Microsoft.OpenApi" Version="1.2.3" />
|
||||
<PackageReference Include="Qc.YilianyunSdk" Version="1.0.7" />
|
||||
<PackageReference Include="SqlSugar.IOC" Version="1.7.0" />
|
||||
<PackageReference Include="sqlSugarCore" Version="5.0.4.2" />
|
||||
<PackageReference Include="Swashbuckle.AspNetCore.Filters" Version="7.0.2" />
|
||||
</ItemGroup>
|
||||
|
||||
@@ -15,7 +15,7 @@ namespace CoreCms.Net.IRepository.UnitOfWork
|
||||
{
|
||||
public interface IUnitOfWork
|
||||
{
|
||||
SqlSugarClient GetDbClient();
|
||||
SqlSugarScope GetDbClient();
|
||||
|
||||
void BeginTran();
|
||||
|
||||
|
||||
@@ -22,7 +22,7 @@ namespace CoreCms.Net.Repository
|
||||
public abstract class BaseRepository<T> : IBaseRepository<T> where T : class, new()
|
||||
{
|
||||
//private readonly IUnitOfWork _unitOfWork;
|
||||
private readonly SqlSugarClient _dbBase;
|
||||
private readonly SqlSugarScope _dbBase;
|
||||
|
||||
protected BaseRepository(IUnitOfWork unitOfWork)
|
||||
{
|
||||
|
||||
@@ -7,6 +7,7 @@
|
||||
<ItemGroup>
|
||||
<PackageReference Include="DotLiquid" Version="2.2.548" />
|
||||
<PackageReference Include="Essensoft.Paylink.WeChatPay" Version="4.0.6" />
|
||||
<PackageReference Include="SqlSugar.IOC" Version="1.7.0" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
|
||||
@@ -919,8 +919,8 @@ namespace CoreCms.Net.Repository
|
||||
}
|
||||
else
|
||||
{
|
||||
var ids = DbClient.Queryable<CoreCmsGoods>().Where(p => p.isDel == false && p.isMarketable == true)
|
||||
.Select(p => p.id).ToArray();
|
||||
var ids = await DbClient.Queryable<CoreCmsGoods>().Where(p => p.isDel == false && p.isMarketable == true)
|
||||
.Select(p => p.id).ToArrayAsync();
|
||||
var dbIds = new List<int>();
|
||||
if (ids.Any())
|
||||
{
|
||||
|
||||
@@ -14,6 +14,7 @@ using CoreCms.Net.IRepository.UnitOfWork;
|
||||
using CoreCms.Net.Loging;
|
||||
using NLog;
|
||||
using SqlSugar;
|
||||
using SqlSugar.IOC;
|
||||
|
||||
namespace CoreCms.Net.Repository.UnitOfWork
|
||||
{
|
||||
@@ -21,19 +22,25 @@ namespace CoreCms.Net.Repository.UnitOfWork
|
||||
{
|
||||
private readonly ISqlSugarClient _sqlSugarClient;
|
||||
|
||||
public UnitOfWork(ISqlSugarClient sqlSugarClient)
|
||||
//public UnitOfWork(ISqlSugarClient sqlSugarClient)
|
||||
//{
|
||||
// _sqlSugarClient = sqlSugarClient;
|
||||
//}
|
||||
|
||||
|
||||
public UnitOfWork()
|
||||
{
|
||||
_sqlSugarClient = sqlSugarClient;
|
||||
_sqlSugarClient = DbScoped.SugarScope;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取DB,保证唯一性
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public SqlSugarClient GetDbClient()
|
||||
public SqlSugarScope GetDbClient()
|
||||
{
|
||||
// 必须要as,后边会用到切换数据库操作
|
||||
return _sqlSugarClient as SqlSugarClient;
|
||||
return _sqlSugarClient as SqlSugarScope;
|
||||
}
|
||||
|
||||
public void BeginTran()
|
||||
|
||||
@@ -421,7 +421,7 @@ namespace CoreCms.Net.Services
|
||||
}
|
||||
limit = limit > 0 ? limit : 10;
|
||||
|
||||
var goods = await _goodsServices.QueryListByClauseAsync(where, limit, p => p.createTime, OrderByType.Desc, false);
|
||||
var goods = await _goodsServices.QueryPageAsync(where, " sort desc,id desc ", 1, limit, true);
|
||||
if (goods != null && goods.Any())
|
||||
{
|
||||
JArray result = JArray.FromObject(goods);
|
||||
|
||||
@@ -137,7 +137,7 @@
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.coreshop-imgsingle { width: 100%; overflow: hidden; position: relative; margin: 20rpx 0rpx; padding: 0 15rpx;
|
||||
.ad-img { width: 100%; float: left; position: relative; z-index: 667; }
|
||||
.ad-img { width: 100%; float: left; }
|
||||
.ad-img:last-child { margin-bottom: 0; }
|
||||
.imgup-btn { position: absolute; z-index: 668; bottom: 80upx; left: 40upx;
|
||||
.coreshop-btn { line-height: 2; font-size: 28upx; padding: 0 50upx; border-radius: 50rpx; }
|
||||
|
||||
@@ -0,0 +1,203 @@
|
||||
<template>
|
||||
<view>
|
||||
<u-toast ref="uToast" /><u-no-network></u-no-network>
|
||||
<u-navbar title="找回密码"></u-navbar>
|
||||
<view class="content">
|
||||
<view class="reg-t"><image class="reg-logo" :src="logoImage" mode="aspectFill"></image></view>
|
||||
<view class="reg-m">
|
||||
<view class="reg-item">
|
||||
<input type="number" v-model="mobile" :maxlength="maxMobile" placeholder="请输入手机号码" focus placeholder-class="login-item-i-p fsz26" />
|
||||
</view>
|
||||
<view class="reg-item flc">
|
||||
<input class="reg-item-input" placeholder-class="login-item-i-p fsz26" type="text" v-model="code" placeholder="请输入验证码" />
|
||||
<view :class="sendCodeBtn" @click="sendCode" v-if="verification">发送验证码</view>
|
||||
<view class="coreshop-btn coreshop-btn-g" v-if="!verification">{{ timer }} 秒后重新获取</view>
|
||||
</view>
|
||||
<view class="reg-item">
|
||||
<input class="login-item-input" :password="true" placeholder-class="login-item-i-p fsz26" type="text" v-model="pwd" placeholder="请输入6-16位密码" />
|
||||
</view>
|
||||
<view class="reg-item">
|
||||
<input class="login-item-input" :password="true" placeholder-class="login-item-i-p fsz26" type="text" v-model="repwd" placeholder="请确认密码" />
|
||||
</view>
|
||||
</view>
|
||||
<view class="reg-b">
|
||||
<button :class="regButtonClass" @click="toReg()" hover-class="coreshop-btn-hover">确认</button>
|
||||
<!-- <view class="color-9 fsz24 agreement">
|
||||
注册即代表你同意 <text @click="goUserAgreementPage()" class="color-o">用户协议</text> 和 <text @click="goUserPrivacyPolicy()" class="color-o">隐私政策</text>
|
||||
</view> -->
|
||||
</view>
|
||||
<!-- <view class="registered-item">
|
||||
<view class="coreshop-btn coreshop-btn-g coreshop-btn-square registered" @click="toLogin">已有账号,立即登录</view>
|
||||
</view> -->
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { commonUse, articles } from '@/common/mixins/mixinsHelper.js';
|
||||
export default {
|
||||
mixins: [commonUse, articles],
|
||||
data() {
|
||||
return {
|
||||
maxMobile: 11,
|
||||
mobile: '', // 用户手机号
|
||||
code: '', // 短信验证码
|
||||
pwd: '', // 用户密码
|
||||
repwd: '', //确认密码
|
||||
verification: true, // 通过v-show控制显示获取还是倒计时
|
||||
timer: 60, // 定义初始时间为60s
|
||||
btnb: 'coreshop-btn coreshop-btn-c coreshop-btn-square coreshop-btn-all' //按钮背景
|
||||
};
|
||||
},
|
||||
onLoad(options) {
|
||||
let _this = this;
|
||||
_this.timer = parseInt(_this.$db.get('timer'));
|
||||
if (_this.timer != null && _this.timer > 0) {
|
||||
_this.countDown();
|
||||
_this.verification = false;
|
||||
}
|
||||
|
||||
if (options.invitecode) {
|
||||
this.$db.set('invitecode', options.invitecode);
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
// 验证手机号
|
||||
rightMobile() {
|
||||
let res = {};
|
||||
if (!this.mobile) {
|
||||
res.status = false;
|
||||
res.msg = '请输入手机号';
|
||||
} else if (!/^1[3456789]{1}\d{9}$/gi.test(this.mobile)) {
|
||||
res.status = false;
|
||||
res.msg = '手机号格式不正确';
|
||||
} else {
|
||||
res.status = true;
|
||||
}
|
||||
return res;
|
||||
},
|
||||
// 动态更改登录按钮bg
|
||||
regButtonClass() {
|
||||
return this.mobile && this.mobile.length === 11 && this.pwd && this.code ? this.btnb + ' coreshop-btn-b' : this.btnb;
|
||||
},
|
||||
// 动态修改发送验证码按钮
|
||||
sendCodeBtn() {
|
||||
let btn = 'coreshop-btn coreshop-btn-g';
|
||||
if (this.mobile.length === this.maxMobile && this.rightMobile.status) {
|
||||
return btn + ' coreshop-btn-b';
|
||||
} else {
|
||||
return btn;
|
||||
}
|
||||
},
|
||||
logoImage() {
|
||||
return this.$store.state.config.shopLogo;
|
||||
}
|
||||
},
|
||||
onShow() {
|
||||
let _this = this;
|
||||
let userToken = _this.$db.get('userToken');
|
||||
if (userToken && userToken != '') {
|
||||
this.$u.route({
|
||||
type: 'switchTab',
|
||||
url: '/pages/index/member/member'
|
||||
});
|
||||
return true;
|
||||
}
|
||||
_this.timer = parseInt(_this.$db.get('timer'));
|
||||
if (_this.timer != null && _this.timer > 0) {
|
||||
_this.countDown();
|
||||
_this.verification = false;
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
// 发送短信验证码
|
||||
sendCode() {
|
||||
if (!this.rightMobile.status) {
|
||||
this.$u.toast(this.rightMobile.msg);
|
||||
} else {
|
||||
uni.showToast({ title: '发送中...', icon: 'loading' })
|
||||
setTimeout(() => {
|
||||
uni.hideToast();
|
||||
this.$u.api.sms({ mobile: this.mobile, code: 'veri' }).then(res => {
|
||||
if (res.status) {
|
||||
this.timer = 60;
|
||||
this.verification = false;
|
||||
this.$refs.uToast.show({ title: res.msg, type: 'success', back: false });
|
||||
this.countDown(); // 执行验证码计时
|
||||
this.btnb = 'coreshop-btn coreshop-btn-square coreshop-btn-all coreshop-btn-b';
|
||||
} else {
|
||||
this.$u.toast(res.msg);
|
||||
}
|
||||
});
|
||||
}, 1000);
|
||||
}
|
||||
},
|
||||
// 验证码倒计时
|
||||
countDown() {
|
||||
let auth_timer = setInterval(() => {
|
||||
// 定时器设置每秒递减
|
||||
this.timer--; // 递减时间
|
||||
uni.setStorage({
|
||||
key: 'timer',
|
||||
data: this.timer,
|
||||
success: function () { }
|
||||
});
|
||||
if (this.timer <= 0) {
|
||||
this.verification = true; // 60s时间结束还原v-show状态并清除定时器
|
||||
clearInterval(auth_timer);
|
||||
}
|
||||
}, 1000);
|
||||
},
|
||||
toReg() {
|
||||
if (!this.rightMobile.status) {
|
||||
this.$u.toast(this.rightMobile.msg);
|
||||
} else if (!this.code) {
|
||||
this.$u.toast('请输入短信验证码');
|
||||
} else if (!this.pwd) {
|
||||
this.$u.toast('请输入6-16位密码');
|
||||
} else if (!this.repwd) {
|
||||
this.$u.toast('请确认密码');
|
||||
} else {
|
||||
let data = {
|
||||
mobile: this.mobile,
|
||||
code: this.code,
|
||||
newpwd: this.pwd,
|
||||
repwd: this.repwd
|
||||
};
|
||||
this.$u.api.userForgetpwd(data).then(res => {
|
||||
if (res.status) {
|
||||
this.$refs.uToast.show({
|
||||
title: res.msg, type: 'success', callback: function () {
|
||||
this.$u.route('/pages/login/loginByAccount/loginByAccount');
|
||||
}
|
||||
})
|
||||
} else {
|
||||
this.$u.toast(res.msg);
|
||||
}
|
||||
});
|
||||
}
|
||||
},
|
||||
toLogin() {
|
||||
this.$u.route('/pages/login/loginByAccount/loginByAccount');
|
||||
},
|
||||
}
|
||||
};
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
view { box-sizing: border-box; }
|
||||
.content { /* #ifdef H5 */ height: calc(100vh - 90upx); /* #endif */ /* #ifndef H5 */ height: 100vh; /* #endif */ background-color: #fff; padding: 0upx 100upx; }
|
||||
.reg-t { text-align: center; padding: 50upx 0; }
|
||||
.reg-logo { width: 180upx; height: 180upx; border-radius: 20upx; background-color: #f8f8f8; }
|
||||
.reg-m { margin-bottom: 100upx; }
|
||||
.reg-item { border-bottom: 2upx solid #d0d0d0; overflow: hidden; padding: 10upx; color: #333; margin-bottom: 30upx; }
|
||||
.coreshop-btn { border: none; width: 40%; text-align: right; }
|
||||
.coreshop-btn-b { background: none; color: #333 !important; }
|
||||
.reg-item-input { flex: 1; }
|
||||
.reg-b .coreshop-btn { color: #999; }
|
||||
.registered-item { overflow: hidden; width: 100%; }
|
||||
.registered { float: right; }
|
||||
.coreshop-btn-square { color: #333; height: 80upx; line-height: 80upx; padding: 0; font-size: $fz12; }
|
||||
.agreement { margin: 20rpx 0; text-align: center; }
|
||||
.color-o { margin: 0 10rpx; }
|
||||
</style>
|
||||
@@ -0,0 +1,309 @@
|
||||
<template>
|
||||
<view>
|
||||
<u-toast ref="uToast" /><u-no-network></u-no-network>
|
||||
<u-navbar title="账户登录"></u-navbar>
|
||||
<view class="content">
|
||||
<view class="login-t"><image class="login-logo" :src="logoImage" mode="aspectFill"></image></view>
|
||||
<view>
|
||||
<view class="login-m">
|
||||
<view class="login-item">
|
||||
<input type="number" v-model="mobile" :maxlength="maxMobile" placeholder="请输入手机号码" placeholder-class="login-item-i-p fsz26" />
|
||||
</view>
|
||||
<view class="login-item flc">
|
||||
<input class="login-item-input" :password="true" placeholder-class="login-item-i-p fsz26" type="text" v-model="pwd" placeholder="请输入密码" />
|
||||
</view>
|
||||
<view class="login-item" v-if="isCaptcha">
|
||||
<input class="login-item-input" placeholder-class="login-item-i-p fsz26" type="text" v-model="captcha" placeholder="输入验证码" />
|
||||
<img class="codeimg" :src="captchaUrl" alt="" />
|
||||
</view>
|
||||
<view class="goforgetpwd color-9 fsz24" @click="goForgetpwd()">忘记密码?</view>
|
||||
</view>
|
||||
<view class="login-b">
|
||||
<button :class="loginButtonClass" @click="loginHandler" hover-class="coreshop-btn-hover">登录</button>
|
||||
<view class="color-9 fsz24 agreement">
|
||||
登录即代表你同意
|
||||
<text @click="goUserAgreementPage()" class="color-o">用户协议</text>
|
||||
和
|
||||
<text @click="goUserPrivacyPolicy()" class="color-o">隐私政策</text>
|
||||
</view>
|
||||
<view class="login-other flc">
|
||||
<view class="fz12 item" @click="selectLoginType">验证码登录</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<!-- 微信浏览器里 -->
|
||||
<!-- #ifdef H5 -->
|
||||
<template v-if="weixinBrowser">
|
||||
<view class="fz12 g5">第三方账号登录:</view>
|
||||
<view class="flc third-block">
|
||||
<view class="third-item" v-for="(item, key, index) in thirdPartyLogins" :key="index" @click="handleThirdLogin(item)">
|
||||
<image class="third-item-img" :src="getThirdLoginImg(key)" mode="aspectFill"></image>
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
<!-- #endif -->
|
||||
<!-- #ifdef APP-PLUS || APP-PLUS-NVUE -->
|
||||
<view class="fz12 g5">第三方账号登录:</view>
|
||||
<view class="flc third-block" v-if="thirdPartyLogins.length > 0">
|
||||
<view class="third-item" v-for="(item, key, index) in thirdPartyLogins" :key="key" @click="handleThirdLoginApp(item)">
|
||||
<image class="third-item-img" src="/static/images/ic-wechat.png" mode="aspectFill" v-if="item == 'weixin'"></image>
|
||||
</view>
|
||||
</view>
|
||||
<!-- #endif -->
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { baseUrl } from '@/common/setting/constVarsHelper.js';
|
||||
import { commonUse, articles } from '@/common/mixins/mixinsHelper.js';
|
||||
export default {
|
||||
mixins: [commonUse, articles],
|
||||
data() {
|
||||
return {
|
||||
maxMobile: 11,
|
||||
mobile: '', // 手机号
|
||||
pwd: '', // 密码
|
||||
isCaptcha: false, // 是否需要验证码
|
||||
captcha: '', // 输入的验证码
|
||||
captchaUrl: '', // 验证码图片地址
|
||||
btnb: 'coreshop-btn coreshop-btn-square coreshop-btn-c coreshop-btn-all', // 按钮bg
|
||||
weixinBrowser: false, // 是否是微信浏览器
|
||||
thirdPartyLogins: [] // 第三方登录列表
|
||||
};
|
||||
},
|
||||
onLoad(options) {
|
||||
if (options.invitecode) {
|
||||
this.$db.set('invitecode', options.invitecode);
|
||||
}
|
||||
// 判断浏览器环境
|
||||
this.weixinBrowser = this.$common.isWeiXinBrowser();
|
||||
|
||||
if (this.weixinBrowser) {
|
||||
this.getAuths();
|
||||
}
|
||||
// #ifdef APP-PLUS || APP-PLUS-NVUE
|
||||
this.getAppAuths();
|
||||
// #endif
|
||||
},
|
||||
onShow() {
|
||||
//if (this.$db.get('userToken')) {
|
||||
// this.$u.route({
|
||||
// type: 'switchTab',
|
||||
// url: '/pages/index/default/default'
|
||||
// });
|
||||
//}
|
||||
},
|
||||
computed: {
|
||||
// 动态更改登录按钮bg
|
||||
loginButtonClass() {
|
||||
return this.mobile && this.mobile.length === 11 && this.pwd ? this.btnb + ' coreshop-btn-b' : this.btnb;
|
||||
},
|
||||
logoImage() {
|
||||
return this.$store.state.config.shopLogo;
|
||||
},
|
||||
getThirdLoginImg(key) {
|
||||
return key => {
|
||||
if (key == 'Wxofficial') {
|
||||
return '/static/images/ic-wechat.png';
|
||||
} else if (key == 'weixin') {
|
||||
return '/static/images/ic-wechat.png';
|
||||
}
|
||||
};
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
// 验证手机号
|
||||
rightMobile() {
|
||||
let res = {};
|
||||
if (!this.mobile) {
|
||||
res.status = false;
|
||||
res.msg = '请输入手机号';
|
||||
} else if (!/^1[3456789]{1}\d{9}$/gi.test(this.mobile)) {
|
||||
res.status = false;
|
||||
res.msg = '手机号格式不正确';
|
||||
} else if (!this.pwd) {
|
||||
res.status = false;
|
||||
res.msg = '请输入密码';
|
||||
} else {
|
||||
res.status = true;
|
||||
}
|
||||
return res;
|
||||
},
|
||||
// 登录处理
|
||||
loginHandler() {
|
||||
if (this.mobile && this.mobile.length === 11 && this.pwd) {
|
||||
if (!this.rightMobile().status) {
|
||||
this.$u.toast(this.rightMobile().msg);
|
||||
} else {
|
||||
this.toLogin();
|
||||
}
|
||||
}
|
||||
},
|
||||
// 获取验证码图片地址
|
||||
getCaptchaUrl() {
|
||||
this.captchaUrl = this.$config.apiBaseUrl + 'captcha.html';
|
||||
},
|
||||
// 去登录
|
||||
toLogin() {
|
||||
let _this = this;
|
||||
let data = {
|
||||
mobile: this.mobile,
|
||||
password: this.pwd
|
||||
};
|
||||
|
||||
if (this.isCaptcha) {
|
||||
data.captcha = this.captcha;
|
||||
}
|
||||
|
||||
// 获取邀请码
|
||||
let invicode = this.$db.get('invitecode');
|
||||
if (invicode) {
|
||||
data.invitecode = invicode;
|
||||
}
|
||||
|
||||
this.$u.api.login(data).then(res => {
|
||||
if (res.status) {
|
||||
this.$db.set('userToken', res.data);
|
||||
this.redirectHandler();
|
||||
} else {
|
||||
|
||||
_this.$refs.uToast.show({
|
||||
title: res.msg, type: 'error', back: true, callback: function () {
|
||||
// 需要输入验证码 或者 验证码错误刷新
|
||||
if (res.data === 10013 || res.data === 10012) {
|
||||
_this.isCaptcha = true;
|
||||
}
|
||||
// 登录需要验证码
|
||||
if (_this.isCaptcha) {
|
||||
_this.getCaptchaUrl();
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
});
|
||||
},
|
||||
// 重定向跳转 或者返回上一个页面
|
||||
redirectHandler() {
|
||||
this.$db.del('invitecode');
|
||||
this.toLoginSuccessHandleBack();
|
||||
},
|
||||
// 登录方式切换
|
||||
selectLoginType() {
|
||||
this.$u.route({ type: 'redirectTo', url: '/pages/login/loginBySMS/loginBySMS' });
|
||||
},
|
||||
// 获取第三方登录列表
|
||||
getAuths() {
|
||||
let data = {
|
||||
url: baseUrl + 'wap/pages/login/author/author'
|
||||
};
|
||||
this.$u.api.getTrustLogin(data).then(res => {
|
||||
if (res.status) {
|
||||
this.thirdPartyLogins = res.data;
|
||||
}
|
||||
});
|
||||
},
|
||||
// 第三方登录授权
|
||||
handleThirdLogin(url) {
|
||||
this.$u.route({ type: 'redirectTo', url: '' });
|
||||
let redirect = this.$store.state.redirectPage;
|
||||
this.$db.set('redirectPage', redirect);
|
||||
window.location.href = url;
|
||||
},
|
||||
//获取APP信任登录
|
||||
getAppAuths() {
|
||||
let _this = this;
|
||||
_this.thirdPartyLogins = [];
|
||||
uni.getProvider({
|
||||
service: 'oauth',
|
||||
success: function (res) {
|
||||
if (res.errMsg == 'getProvider:ok') {
|
||||
_this.thirdPartyLogins = res.provider;
|
||||
}
|
||||
}
|
||||
});
|
||||
},
|
||||
//app第三方登录
|
||||
handleThirdLoginApp(type) {
|
||||
uni.showLoading({
|
||||
title: '加载中'
|
||||
});
|
||||
let _this = this;
|
||||
uni.login({
|
||||
provider: type,
|
||||
success: function (loginRes) {
|
||||
// 获取用户信息
|
||||
uni.getUserInfo({
|
||||
provider: type,
|
||||
success: function (infoRes) {
|
||||
if (infoRes.errMsg == 'getUserInfo:ok') {
|
||||
var data = {
|
||||
user: infoRes.userInfo,
|
||||
type: type
|
||||
};
|
||||
var invitecode = _this.$db.get('invitecode');
|
||||
if (invitecode) {
|
||||
data.invitecode = invitecode;
|
||||
}
|
||||
_this.$u.api.appTrustLogin(data).then(res => {
|
||||
uni.hideLoading();
|
||||
if (res.status) {
|
||||
//判断是否返回了token,如果没有,就说明没有绑定账号,跳转到绑定页面
|
||||
if (typeof res.data.token == 'undefined') {
|
||||
_this.$u.route({ type: 'redirectTo', url: '/pages/login/loginBySMS/loginBySMS?sessionAuthId=' + res.data.sessionAuthId });
|
||||
} else {
|
||||
//登陆成功,设置token,并返回上一页
|
||||
_this.$db.set('userToken', res.data.token);
|
||||
uni.navigateBack({
|
||||
delta: 1
|
||||
});
|
||||
return false;
|
||||
}
|
||||
} else {
|
||||
_this.$u.toast('登录失败,请重试');
|
||||
}
|
||||
});
|
||||
} else {
|
||||
uni.hideLoading();
|
||||
_this.$u.toast('登录失败,请重试');
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
},
|
||||
goForgetpwd() {
|
||||
this.$u.route('/pages/login/forget/forget');
|
||||
}
|
||||
}
|
||||
};
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
view { box-sizing: border-box; }
|
||||
.content { /* #ifdef H5 */ height: calc(100vh - 90upx); /* #endif */ /* #ifndef H5 */ height: 100vh; /* #endif */ background-color: #fff; padding: 0upx 100upx; }
|
||||
.login-t { text-align: center; padding: 50upx 0; }
|
||||
.login-logo { width: 180upx; height: 180upx; border-radius: 20upx; background-color: #f8f8f8; }
|
||||
.login-m { margin-bottom: 100upx; }
|
||||
.login-item { border-bottom: 2upx solid #d0d0d0; overflow: hidden; padding: 10upx; font-size: 28upx; color: #333; margin-bottom: 30upx; display: flex; align-items: center; }
|
||||
.login-item-input { display: inline-block; flex: 1; box-sizing: border-box; }
|
||||
.codeimg { width: 210rpx; }
|
||||
.login-item .coreshop-btn { display: inline-block; font-size: 28upx; border: none; width: 40%; padding: 0; line-height: 1.7; float: right; }
|
||||
.login-b .coreshop-btn { color: #999; }
|
||||
.coreshop-btn-b { color: #fff !important; }
|
||||
.registered-item { overflow: hidden; width: 100%; }
|
||||
.registered { float: right; }
|
||||
.registered-item .coreshop-btn-square { color: #333; }
|
||||
.third-block { justify-content: center; padding-top: 40upx; }
|
||||
.third-item { width: 80upx; height: 80upx; background: $g2; border-radius: 50%; padding: 16upx; }
|
||||
.third-item img { display: block; width: 100%; height: 100%; }
|
||||
|
||||
.login-other { margin-bottom: 40upx; }
|
||||
.login-othe .item { padding: 20upx 0; }
|
||||
|
||||
|
||||
.agreement { margin: 20rpx 0; text-align: center; }
|
||||
.agreement .color-o { margin: 0 10rpx; }
|
||||
|
||||
.goforgetpwd { width: 100%; text-align: right; }
|
||||
</style>
|
||||
@@ -676,11 +676,8 @@
|
||||
success(ress) {
|
||||
if (res.errMsg == "requestSubscribeMessage:ok") {
|
||||
console.log(ress);
|
||||
} else {
|
||||
|
||||
}
|
||||
}, fail(ress) {
|
||||
_this.$u.toast(ress.errMsg);
|
||||
console.log(ress);
|
||||
}
|
||||
});
|
||||
|
||||
@@ -591,7 +591,7 @@ namespace CoreCms.Net.Web.Admin.Controllers
|
||||
//返回数据
|
||||
var jm = new AdminUiCallBack { code = 0 };
|
||||
|
||||
var _filesStorageOptions = await _coreCmsSettingServices.GetFilesStorageOptions();
|
||||
var filesStorageOptions = await _coreCmsSettingServices.GetFilesStorageOptions();
|
||||
|
||||
|
||||
var formModel = await _coreCmsFormServices.QueryByIdAsync(entity.id);
|
||||
@@ -615,100 +615,37 @@ namespace CoreCms.Net.Web.Admin.Controllers
|
||||
{
|
||||
var memStream = new MemoryStream(response.RawBytes);
|
||||
|
||||
var newFileName = DateTime.Now.ToString("yyyyMMddHHmmss_ffff", DateTimeFormatInfo.InvariantInfo) + ".jpg";
|
||||
var today = DateTime.Now.ToString("yyyyMMdd");
|
||||
|
||||
if (_filesStorageOptions.StorageType == GlobalEnumVars.FilesStorageOptionsType.LocalStorage.ToString())
|
||||
string url = string.Empty;
|
||||
if (filesStorageOptions.StorageType == GlobalEnumVars.FilesStorageOptionsType.LocalStorage.ToString())
|
||||
{
|
||||
var saveUrl = "/Upload/QrCode/" + today + "/";
|
||||
var dirPath = _webHostEnvironment.WebRootPath + saveUrl;
|
||||
string bucketBindDomain = AppSettingsConstVars.AppConfigAppUrl;
|
||||
url = _toolsServices.UpLoadBase64ForLocalStorage(filesStorageOptions, memStream);
|
||||
|
||||
if (!Directory.Exists(dirPath)) Directory.CreateDirectory(dirPath);
|
||||
var filePath = dirPath + newFileName;
|
||||
var fileUrl = saveUrl + newFileName;
|
||||
|
||||
//储存图片
|
||||
System.IO.File.Delete(filePath);
|
||||
await using (var fs = new FileStream(filePath, FileMode.CreateNew))
|
||||
{
|
||||
await memStream.CopyToAsync(fs).ConfigureAwait(false);
|
||||
await fs.FlushAsync().ConfigureAwait(false);
|
||||
}
|
||||
|
||||
jm.code = 0;
|
||||
jm.msg = "上传成功!";
|
||||
jm.data = new
|
||||
{
|
||||
fileUrl,
|
||||
src = bucketBindDomain + fileUrl
|
||||
};
|
||||
}
|
||||
else if (_filesStorageOptions.StorageType == GlobalEnumVars.FilesStorageOptionsType.AliYunOSS.ToString())
|
||||
else if (filesStorageOptions.StorageType == GlobalEnumVars.FilesStorageOptionsType.AliYunOSS.ToString())
|
||||
{
|
||||
//上传到阿里云
|
||||
|
||||
// 设置当前流的位置为流的开始
|
||||
memStream.Seek(0, SeekOrigin.Begin);
|
||||
|
||||
await using var fileStream = memStream;
|
||||
|
||||
var md5 = OssUtils.ComputeContentMd5(fileStream, memStream.Length);
|
||||
|
||||
var filePath = "Upload/QrCode/" + today + "/" + newFileName; //云文件保存路径
|
||||
//初始化阿里云配置--外网Endpoint、访问ID、访问password
|
||||
var aliyun = new OssClient(_filesStorageOptions.Endpoint, _filesStorageOptions.AccessKeyId, _filesStorageOptions.AccessKeySecret);
|
||||
//将文件md5值赋值给meat头信息,服务器验证文件MD5
|
||||
var objectMeta = new ObjectMetadata
|
||||
{
|
||||
ContentMd5 = md5
|
||||
};
|
||||
//文件上传--空间名、文件保存路径、文件流、meta头信息(文件md5) //返回meta头信息(文件md5)
|
||||
aliyun.PutObject(_filesStorageOptions.BucketName, filePath, fileStream, objectMeta);
|
||||
//返回给UEditor的插入编辑器的图片的src
|
||||
jm.code = 0;
|
||||
jm.msg = "上传成功";
|
||||
jm.data = new
|
||||
{
|
||||
fileUrl = _filesStorageOptions.BucketBindUrl + filePath,
|
||||
src = _filesStorageOptions.BucketBindUrl + filePath
|
||||
};
|
||||
url = await _toolsServices.UpLoadBase64ForAliYunOSS(filesStorageOptions, memStream);
|
||||
}
|
||||
else if (_filesStorageOptions.StorageType == GlobalEnumVars.FilesStorageOptionsType.QCloudOSS.ToString())
|
||||
else if (filesStorageOptions.StorageType == GlobalEnumVars.FilesStorageOptionsType.QCloudOSS.ToString())
|
||||
{
|
||||
//上传到腾讯云OSS
|
||||
//初始化 CosXmlConfig
|
||||
string appid = _filesStorageOptions.AccountId;//设置腾讯云账户的账户标识 APPID
|
||||
string region = _filesStorageOptions.CosRegion; //设置一个默认的存储桶地域
|
||||
CosXmlConfig config = new CosXmlConfig.Builder()
|
||||
//.SetAppid(appid)
|
||||
.IsHttps(true) //设置默认 HTTPS 请求
|
||||
.SetRegion(region) //设置一个默认的存储桶地域
|
||||
.SetDebugLog(true) //显示日志
|
||||
.Build(); //创建 CosXmlConfig 对象
|
||||
|
||||
long durationSecond = 600; //每次请求签名有效时长,单位为秒
|
||||
QCloudCredentialProvider qCloudCredentialProvider = new DefaultQCloudCredentialProvider(
|
||||
_filesStorageOptions.AccessKeyId, _filesStorageOptions.AccessKeySecret, durationSecond);
|
||||
|
||||
|
||||
var cosXml = new CosXmlServer(config, qCloudCredentialProvider);
|
||||
|
||||
byte[] bytes = memStream.ToArray();
|
||||
|
||||
var filePath = "Upload/QrCode/" + today + "/" + newFileName; //云文件保存路径
|
||||
COSXML.Model.Object.PutObjectRequest putObjectRequest = new COSXML.Model.Object.PutObjectRequest(_filesStorageOptions.TencentBucketName, filePath, bytes);
|
||||
|
||||
cosXml.PutObject(putObjectRequest);
|
||||
|
||||
jm.code = 0;
|
||||
jm.msg = "上传成功";
|
||||
jm.data = new
|
||||
{
|
||||
fileUrl = _filesStorageOptions.BucketBindUrl + filePath,
|
||||
src = _filesStorageOptions.BucketBindUrl + filePath
|
||||
};
|
||||
url = _toolsServices.UpLoadBase64ForQCloudOSS(filesStorageOptions, response.RawBytes);
|
||||
}
|
||||
else if (filesStorageOptions.StorageType == GlobalEnumVars.FilesStorageOptionsType.QiNiuKoDo.ToString())
|
||||
{
|
||||
//上传到七牛云kodo
|
||||
url = _toolsServices.UpLoadBase64ForQiNiuKoDo(filesStorageOptions, response.RawBytes);
|
||||
}
|
||||
|
||||
var bl = !string.IsNullOrEmpty(url);
|
||||
jm.code = bl ? 0 : 1;
|
||||
jm.msg = bl ? "上传成功!" : "上传失败";
|
||||
jm.data = new
|
||||
{
|
||||
fileUrl = url,
|
||||
src = url
|
||||
};
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -737,7 +674,7 @@ namespace CoreCms.Net.Web.Admin.Controllers
|
||||
//返回数据
|
||||
var jm = new AdminUiCallBack { code = 0 };
|
||||
|
||||
var _filesStorageOptions = await _coreCmsSettingServices.GetFilesStorageOptions();
|
||||
var filesStorageOptions = await _coreCmsSettingServices.GetFilesStorageOptions();
|
||||
|
||||
|
||||
var pageModel = await _pagesServices.QueryByClauseAsync(p => p.code == entity.id);
|
||||
@@ -761,100 +698,37 @@ namespace CoreCms.Net.Web.Admin.Controllers
|
||||
{
|
||||
var memStream = new MemoryStream(response.RawBytes);
|
||||
|
||||
var newFileName = DateTime.Now.ToString("yyyyMMddHHmmss_ffff", DateTimeFormatInfo.InvariantInfo) + ".jpg";
|
||||
var today = DateTime.Now.ToString("yyyyMMdd");
|
||||
|
||||
if (_filesStorageOptions.StorageType == GlobalEnumVars.FilesStorageOptionsType.LocalStorage.ToString())
|
||||
string url = string.Empty;
|
||||
if (filesStorageOptions.StorageType == GlobalEnumVars.FilesStorageOptionsType.LocalStorage.ToString())
|
||||
{
|
||||
var saveUrl = "/Upload/QrCode/" + today + "/";
|
||||
var dirPath = _webHostEnvironment.WebRootPath + saveUrl;
|
||||
string bucketBindDomain = AppSettingsConstVars.AppConfigAppUrl;
|
||||
url = _toolsServices.UpLoadBase64ForLocalStorage(filesStorageOptions, memStream);
|
||||
|
||||
if (!Directory.Exists(dirPath)) Directory.CreateDirectory(dirPath);
|
||||
var filePath = dirPath + newFileName;
|
||||
var fileUrl = saveUrl + newFileName;
|
||||
|
||||
//储存图片
|
||||
System.IO.File.Delete(filePath);
|
||||
await using (var fs = new FileStream(filePath, FileMode.CreateNew))
|
||||
{
|
||||
await memStream.CopyToAsync(fs).ConfigureAwait(false);
|
||||
await fs.FlushAsync().ConfigureAwait(false);
|
||||
}
|
||||
|
||||
jm.code = 0;
|
||||
jm.msg = "上传成功!";
|
||||
jm.data = new
|
||||
{
|
||||
fileUrl,
|
||||
src = bucketBindDomain + fileUrl
|
||||
};
|
||||
}
|
||||
else if (_filesStorageOptions.StorageType == GlobalEnumVars.FilesStorageOptionsType.AliYunOSS.ToString())
|
||||
else if (filesStorageOptions.StorageType == GlobalEnumVars.FilesStorageOptionsType.AliYunOSS.ToString())
|
||||
{
|
||||
//上传到阿里云
|
||||
|
||||
// 设置当前流的位置为流的开始
|
||||
memStream.Seek(0, SeekOrigin.Begin);
|
||||
|
||||
await using var fileStream = memStream;
|
||||
|
||||
var md5 = OssUtils.ComputeContentMd5(fileStream, memStream.Length);
|
||||
|
||||
var filePath = "Upload/QrCode/" + today + "/" + newFileName; //云文件保存路径
|
||||
//初始化阿里云配置--外网Endpoint、访问ID、访问password
|
||||
var aliyun = new OssClient(_filesStorageOptions.Endpoint, _filesStorageOptions.AccessKeyId, _filesStorageOptions.AccessKeySecret);
|
||||
//将文件md5值赋值给meat头信息,服务器验证文件MD5
|
||||
var objectMeta = new ObjectMetadata
|
||||
{
|
||||
ContentMd5 = md5
|
||||
};
|
||||
//文件上传--空间名、文件保存路径、文件流、meta头信息(文件md5) //返回meta头信息(文件md5)
|
||||
aliyun.PutObject(_filesStorageOptions.BucketName, filePath, fileStream, objectMeta);
|
||||
//返回给UEditor的插入编辑器的图片的src
|
||||
jm.code = 0;
|
||||
jm.msg = "上传成功";
|
||||
jm.data = new
|
||||
{
|
||||
fileUrl = _filesStorageOptions.BucketBindUrl + filePath,
|
||||
src = _filesStorageOptions.BucketBindUrl + filePath
|
||||
};
|
||||
url = await _toolsServices.UpLoadBase64ForAliYunOSS(filesStorageOptions, memStream);
|
||||
}
|
||||
else if (_filesStorageOptions.StorageType == GlobalEnumVars.FilesStorageOptionsType.QCloudOSS.ToString())
|
||||
else if (filesStorageOptions.StorageType == GlobalEnumVars.FilesStorageOptionsType.QCloudOSS.ToString())
|
||||
{
|
||||
//上传到腾讯云OSS
|
||||
//初始化 CosXmlConfig
|
||||
string appid = _filesStorageOptions.AccountId;//设置腾讯云账户的账户标识 APPID
|
||||
string region = _filesStorageOptions.CosRegion; //设置一个默认的存储桶地域
|
||||
CosXmlConfig config = new CosXmlConfig.Builder()
|
||||
//.SetAppid(appid)
|
||||
.IsHttps(true) //设置默认 HTTPS 请求
|
||||
.SetRegion(region) //设置一个默认的存储桶地域
|
||||
.SetDebugLog(true) //显示日志
|
||||
.Build(); //创建 CosXmlConfig 对象
|
||||
|
||||
long durationSecond = 600; //每次请求签名有效时长,单位为秒
|
||||
QCloudCredentialProvider qCloudCredentialProvider = new DefaultQCloudCredentialProvider(
|
||||
_filesStorageOptions.AccessKeyId, _filesStorageOptions.AccessKeySecret, durationSecond);
|
||||
|
||||
|
||||
var cosXml = new CosXmlServer(config, qCloudCredentialProvider);
|
||||
|
||||
byte[] bytes = memStream.ToArray();
|
||||
|
||||
var filePath = "Upload/QrCode/" + today + "/" + newFileName; //云文件保存路径
|
||||
COSXML.Model.Object.PutObjectRequest putObjectRequest = new COSXML.Model.Object.PutObjectRequest(_filesStorageOptions.TencentBucketName, filePath, bytes);
|
||||
|
||||
cosXml.PutObject(putObjectRequest);
|
||||
|
||||
jm.code = 0;
|
||||
jm.msg = "上传成功";
|
||||
jm.data = new
|
||||
{
|
||||
fileUrl = _filesStorageOptions.BucketBindUrl + filePath,
|
||||
src = _filesStorageOptions.BucketBindUrl + filePath
|
||||
};
|
||||
url = _toolsServices.UpLoadBase64ForQCloudOSS(filesStorageOptions, response.RawBytes);
|
||||
}
|
||||
else if (filesStorageOptions.StorageType == GlobalEnumVars.FilesStorageOptionsType.QiNiuKoDo.ToString())
|
||||
{
|
||||
//上传到七牛云kodo
|
||||
url = _toolsServices.UpLoadBase64ForQiNiuKoDo(filesStorageOptions, response.RawBytes);
|
||||
}
|
||||
|
||||
var bl = !string.IsNullOrEmpty(url);
|
||||
jm.code = bl ? 0 : 1;
|
||||
jm.msg = bl ? "上传成功!" : "上传失败";
|
||||
jm.data = new
|
||||
{
|
||||
fileUrl = url,
|
||||
src = url
|
||||
};
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@@ -1052,4 +1052,16 @@ xm-select .xm-body .xm-option.hide-icon.selected {
|
||||
.layadmin-side-shrink .layui-layout-admin .layui-logo {
|
||||
width: 60px;
|
||||
background-image: url(../images/common/logoMin.png);
|
||||
}
|
||||
.ew-tree-table .ew-tree-pack {
|
||||
cursor: pointer;
|
||||
line-height: 16px;
|
||||
display: inline;
|
||||
vertical-align: middle;
|
||||
}
|
||||
.ew-tree-table .ew-tree-pack > span {
|
||||
height: 16px;
|
||||
line-height: 16px;
|
||||
display: inline;
|
||||
vertical-align: middle;
|
||||
}
|
||||
@@ -358,4 +358,7 @@ xm-select .xm-label .xm-label-block, xm-select .xm-body .xm-option.hide-icon.sel
|
||||
.longLogo { height: 50px; width: 220px; display: none; }
|
||||
}
|
||||
|
||||
.layadmin-side-shrink .layui-layout-admin .layui-logo { width: 60px; background-image: url(../images/common/logoMin.png); }
|
||||
.layadmin-side-shrink .layui-layout-admin .layui-logo { width: 60px; background-image: url(../images/common/logoMin.png); }
|
||||
|
||||
.ew-tree-table .ew-tree-pack { cursor: pointer; line-height: 16px; display: inline; vertical-align: middle; }
|
||||
.ew-tree-table .ew-tree-pack > span { height: 16px; line-height: 16px; display: inline; vertical-align: middle; }
|
||||
File diff suppressed because one or more lines are too long
Reference in New Issue
Block a user