增加实名认证数据表

pull/16/head
youngS 4 years ago
parent 5fd3df9095
commit fbb4d41934
  1. 91
      fir_client/src/components/FirAppInfosbaseinfo.vue
  2. 106
      fir_client/src/components/FirUserProfileBase.vue
  3. 213
      fir_client/src/components/FirUserProfileCertification.vue
  4. 5
      fir_client/src/router/index.js
  5. 84
      fir_client/src/utils/index.js
  6. 53
      fir_ser/api/migrations/0025_order_price.py
  7. 17
      fir_ser/api/migrations/0026_auto_20210329_1419.py
  8. 34
      fir_ser/api/migrations/0027_auto_20210329_1506.py
  9. 19
      fir_ser/api/migrations/0028_order_created_time.py
  10. 16
      fir_ser/api/migrations/0029_remove_order_date.py
  11. 27
      fir_ser/api/migrations/0030_auto_20210329_1755.py
  12. 51
      fir_ser/api/migrations/0031_auto_20210407_2021.py
  13. 19
      fir_ser/api/migrations/0032_certificationinfo_type.py
  14. 18
      fir_ser/api/migrations/0033_auto_20210407_2045.py
  15. 34
      fir_ser/api/models.py
  16. 44
      fir_ser/api/views/uploads.py

@ -57,7 +57,12 @@
style="width: 155px;height: 288px;margin-right: 20px;background-color: #d1eef9;float: left"
fit="scale-down"
@click="delscreen(screen.id)"
v-for="(screen) in currentapp.screenshots" :key="screen.id" :src="screen.url" alt=""/>
v-for="(screen) in currentapp.screenshots" :key="screen.id" :src="screen.url" alt="">
<div slot="error" class="image-slot" @click="delscreen(screen.id)"
style="text-align: center;margin-top: 80%">
<i class="el-icon-picture-outline"> 加载失败</i>
</div>
</el-image>
<div style="width: 155px;height: 288px;background-color: #d1eef9;float: left"
v-if="currentapp.screenshots && currentapp.screenshots.length < 5">
<el-upload
@ -84,8 +89,8 @@
</template>
<script>
import {apputils, getapppicurl, uploadimgs, getuploadurl, releaseapputils} from "../restful"
import {uploadaliyunoss, uploadlocalstorage, uploadqiniuoss} from "../utils";
import {apputils, getapppicurl, releaseapputils} from "../restful"
import {AvatarUploadUtils} from "../utils";
export default {
name: "FirAppInfosbaseinfo",
@ -96,7 +101,8 @@
uploadconf: {},
uploadprocess: 0,
dialogImageUrl: '',
dialogVisible: false
dialogVisible: false,
appinfos: {},
}
},
methods: {
@ -110,7 +116,7 @@
releaseapputils(data => {
if (data.code === 1000) {
this.$message.success('删除成功');
this.updateinfo();
this.getappinfo();
} else if (data.code === 1003) {
this.$router.push({name: 'FirApps'});
}
@ -128,51 +134,7 @@
});
});
},
updateimgs(certinfo) {
uploadimgs(data => {
if (data.code === 1000) {
this.$message.success('上传成功');
this.updateinfo();
} else {
this.$message.error('更新失败: ' + data.msg);
}
}, {'methods': 'PUT', 'data': {'certinfo': certinfo}});
},
uploadtostorage(file, certinfo) {
if (certinfo.storage === 1) {
// eslint-disable-next-line no-unused-vars,no-unreachable
uploadqiniuoss(file, certinfo, this, res => {
this.updateimgs(certinfo);
}, process => {
this.uploadprocess = process;
})
} else if (certinfo.storage === 2) {
// eslint-disable-next-line no-unused-vars
uploadaliyunoss(file, certinfo, this, res => {
this.updateimgs(certinfo);
}, process => {
this.uploadprocess = process;
});
} else {
//
if (certinfo.domain_name) {
certinfo.upload_url = getuploadurl(certinfo.domain_name)
} else {
certinfo.upload_url = getuploadurl();
}
// eslint-disable-next-line no-unused-vars,no-unreachable
uploadlocalstorage(file, certinfo, this, res => {
this.updateimgs(certinfo);
}, process => {
this.uploadprocess = process;
})
}
},
delApp() {
//APP
this.$confirm('确认删除 ' + this.currentapp.name + ' ?')
@ -202,9 +164,8 @@
.catch(err => {
this.willDeleteApp = false;
});
// alert('APP',this.delapp.name)
},
updateinfo() {
getappinfo() {
apputils(data => {
if (data.code === 1000) {
@ -249,26 +210,14 @@
return this.beforeAvatarUpload(file, 'screen')
},
beforeAvatarUpload(file, act) {
const isLt2M = file.size / 1024 / 1024 < 2;
if (file.type === 'image/jpeg' || file.type === 'image/png' || file.type === 'image/jpg') {
if (isLt2M) {
uploadimgs(data => {
if (data.code === 1000) {
let certinfo = data.data;
this.uploadtostorage(file, certinfo);
}
}, {
'methods': 'GET',
'data': {'app_id': this.currentapp.app_id, 'upload_key': file.name, 'ftype': act}
});
} else {
this.$message.error('上传应用图片大小不能超过 2MB!');
}
} else {
this.$message.error('上传应用图片只能是 JPG/PNG/JPEG 格式!');
}
return false;
// eslint-disable-next-line no-unused-vars
return AvatarUploadUtils(this, file, {
'app_id': this.currentapp.app_id,
'upload_key': file.name,
'ftype': act
}, res => {
this.getappinfo();
});
}
},
mounted() {

@ -39,15 +39,15 @@
</el-col>
<!-- <el-col :span="6" v-if="userinfo.storage_active">-->
<!-- <div class="col-4">-->
<!-- <a ref="storage" class="" @click="$router.push({name:'FirUserStorage'})">-->
<!-- <span><i class="el-icon-coin"></i></span>-->
<!-- 存储配置-->
<!-- </a>-->
<!-- </div>-->
<el-col :span="6">
<div class="col-4">
<a ref="storage" class="" @click="$router.push({name:'FirUserProfileCertification'})">
<span><i class="el-icon-coin"></i></span>
实名认证
</a>
</div>
<!-- </el-col>-->
</el-col>
</el-row>
@ -62,8 +62,8 @@
</template>
<script>
import {userinfos, getuserpicurl, uploadimgs, getuploadurl} from '../restful';
import {uploadaliyunoss, uploadlocalstorage, uploadqiniuoss} from "../utils";
import {userinfos, getuserpicurl} from '../restful';
import {AvatarUploadUtils} from "../utils";
export default {
name: "FirUserProfileBase",
@ -72,57 +72,10 @@
imageUrl: '',
userinfo: {},
uploadconf: {},
tspan: 9,
tspan: 6,
}
},
methods: {
updateimgs(certinfo) {
uploadimgs(data => {
if (data.code === 1000) {
// eslint-disable-next-line no-console
// console.log(data.data);
this.$message.success('上传成功');
this.updateUserInfo({"methods": 'GET'});
} else {
this.$message.error('更新失败: ' + data.msg);
}
}, {'methods': 'PUT', 'data': {'certinfo': certinfo}});
},
uploadtostorage(file, certinfo) {
if (certinfo.storage === 1) {
// eslint-disable-next-line no-unused-vars,no-unreachable
uploadqiniuoss(file, certinfo, this, res => {
this.updateimgs(certinfo);
}, process => {
this.uploadprocess = process;
})
} else if (certinfo.storage === 2) {
// eslint-disable-next-line no-unused-vars
uploadaliyunoss(file, certinfo, this, res => {
this.updateimgs(certinfo);
}, process => {
this.uploadprocess = process;
});
} else {
//
if (certinfo.domain_name) {
certinfo.upload_url = getuploadurl(certinfo.domain_name)
} else {
certinfo.upload_url = getuploadurl();
}
// eslint-disable-next-line no-unused-vars,no-unreachable
uploadlocalstorage(file, certinfo, this, res => {
this.updateimgs(certinfo);
}, process => {
this.uploadprocess = process;
})
}
},
updateUserInfo(datainfo) {
userinfos(data => {
if (data.code === 1000) {
@ -130,10 +83,6 @@
this.$store.dispatch("doUserinfo", data.data);
this.$store.dispatch('doucurrentapp', {});
this.imageUrl = data.data.head_img;
if (this.userinfo.storage_active) {
// this.tspan = 6
this.tspan = 9
}
if (datainfo.data) {
this.$message.success("更新成功")
}
@ -146,31 +95,14 @@
this.updateUserInfo({"methods": 'PUT', 'data': {"first_name": this.userinfo.first_name}});
},
beforeAvatarUpload(file) {
const isLt2M = file.size / 1024 / 1024 < 2;
if (file.type === 'image/jpeg' || file.type === 'image/png' || file.type === 'image/jpg') {
if (isLt2M) {
uploadimgs(data => {
if (data.code === 1000) {
// eslint-disable-next-line no-console
// console.log(data.data);
let certinfo = data.data;
this.uploadtostorage(file, certinfo);
}
}, {
'methods': 'GET',
'data': {'app_id': this.userinfo.uid, 'upload_key': file.name, 'ftype': 'head'}
});
return false;
} else {
this.$message.error('上传头像图片大小不能超过 2MB!');
}
} else {
this.$message.error('上传头像图片只能是 JPG/PNG/JPEG 格式!');
}
return false;
// eslint-disable-next-line no-unused-vars
return AvatarUploadUtils(this, file, {
'app_id': this.userinfo.uid,
'upload_key': file.name,
'ftype': 'head'
}, res => {
this.updateUserInfo({"methods": 'GET'});
});
},
setfunactive(item) {

@ -0,0 +1,213 @@
<template>
<div>
<el-form ref="form" :model="form">
<el-form-item>
<el-row>
<el-col :span="22">
<el-input v-model="form.oldpassword" autofocus="true" prefix-icon="el-icon-user"
placeholder="真实姓名" clearable></el-input>
</el-col>
</el-row>
</el-form-item>
<el-form-item>
<el-row>
<el-col :span="22">
<el-input v-model="form.newpassword" clearable prefix-icon="el-icon-s-order"
placeholder="身份证号"></el-input>
</el-col>
</el-row>
</el-form-item>
<el-form-item>
<el-row>
<el-col :span="22">
<el-input v-model="form.surepassword" clearable prefix-icon="el-icon-house"
placeholder="居住地"></el-input>
</el-col>
</el-row>
</el-form-item>
<el-form-item label="身份证" style="width: 100%">
<div class="appdownload">
<el-image
style="width: 155px;height: 188px;margin-right: 20px;background-color: #d1eef9;float: left"
fit="scale-down"
@click="delscreen(screen.id)"
v-for="(screen) in user_certification" :key="screen.id" :src="screen.url" alt=""/>
<div style="width: 155px;height: 188px;background-color: #d1eef9;float: left"
v-if="user_certification && user_certification.length < 2">
<el-upload
drag
action="#"
accept=".png , .jpg , .jpeg"
:before-upload="beforeAvatarUpload">
<i class="el-icon-upload"></i>
</el-upload>
</div>
</div>
</el-form-item>
<el-form-item>
<el-row>
<el-col :span="22">
<el-input v-model="form.mobile" ref="phone" clearable
prefix-icon="el-icon-mobile" placeholder="请输入手机号码" maxlength="11"></el-input>
</el-col>
</el-row>
</el-form-item>
<el-form-item style="height: 40px" v-if="cptch.cptch_image">
<el-row style="height: 40px" :gutter="10">
<el-col :span="11">
<el-input placeholder="请输入图片验证码" v-model="userinfo.authcode" maxlength="6"></el-input>
</el-col>
<el-col :span="8">
<el-image
style="margin:0px 4px;border-radius:4px;cursor:pointer;height: 40px"
:src="cptch.cptch_image"
fit="contain" @click="get_auth_code">
</el-image>
</el-col>
</el-row>
</el-form-item>
<el-form-item>
<el-row :gutter="10">
<el-col :span="16">
<el-input v-model="userinfo.auth_key" prefix-icon="el-icon-mobile" placeholder="请输入您收到的验证码"
maxlength="6"></el-input>
</el-col>
<el-col :span="6">
<el-button type="info" @click="getsmsemailcode('sms',userinfo.mobile)" plain
style="margin:0 4px;border-radius:4px;cursor:pointer;height: 40px;background-color: #ecf5ff;color: #dd6161">
获取验证码
</el-button>
</el-col>
</el-row>
</el-form-item>
<el-form-item>
<el-row>
<el-col :span="22">
<el-button type="danger" @click="updatepasswd">提交</el-button>
</el-col>
</el-row>
</el-form-item>
</el-form>
</div>
</template>
<script>
import {userinfos} from "../restful";
import {AvatarUploadUtils} from "../utils";
export default {
name: "FirUserProfileCertification",
data() {
return {
form: {
oldpassword: '',
newpassword: '',
surepassword: ''
},
cptch: {},
userinfo: {},
user_certification: [],
}
}, methods: {
beforeAvatarUpload(file) {
// eslint-disable-next-line no-unused-vars
return AvatarUploadUtils(this, file, {
'app_id': this.$store.state.userinfo.uid,
'upload_key': file.name,
'ftype': 'certification',
'ext': {'type': 1}
}, res => {
});
},
updatepasswd() {
if (this.form.newpassword === this.form.surepassword) {
userinfos(data => {
if (data.code === 1000) {
this.userinfo = data.data;
this.$message.success('密码修改成功');
} else {
this.$message.error('密码修改失败,' + data.msg);
}
}, {
"methods": 'PUT', 'data': {
"oldpassword": this.form.oldpassword,
"surepassword": this.form.surepassword
}
});
} else {
this.$message.error('密码不一致');
}
}
}, mounted() {
this.$store.dispatch('douserInfoIndex', 2);
}
}
</script>
<style scoped>
.el-form {
max-width: 360px;
margin: 0 auto;
}
.el-form-item .el-button {
max-width: 360px;
width: 100%;
height: 50px;
}
.appdownload /deep/ .el-upload-dragger {
background: #d1eef9;
width: 155px;
height: 188px;
}
.appdownload /deep/ .el-icon-upload {
margin-top: 45%;
}
.avatar-uploader .el-upload {
border: 1px dashed #d9d9d9;
border-radius: 6px;
cursor: pointer;
position: relative;
overflow: hidden;
}
.avatar-uploader .el-upload:hover {
border-color: #409EFF;
}
.avatar-uploader-icon {
font-size: 28px;
color: #8c939d;
width: 178px;
height: 178px;
line-height: 178px;
text-align: center;
}
.avatar {
width: 178px;
height: 178px;
display: block;
}
</style>

@ -113,6 +113,11 @@ const router = new VueRouter({
// component: FirUserProfileChangePwd
component: () => import("@/components/FirUserProfileChangePwd"),
}, {
path: 'certification',
name: 'FirUserProfileCertification',
component: () => import("@/components/FirUserProfileCertification"),
},
]
}

@ -171,7 +171,7 @@ export function uploadaliyunoss(file, certinfo, app, successcallback, processcal
}
import {loginFun, uploadstorage} from '../restful'
import {getuploadurl, loginFun, uploadimgs, uploadstorage} from '../restful'
export function uploadlocalstorage(file, certinfo, app, successcallback, processcallback) {
uploadstorage(certinfo, file, successcallback, processcallback)
@ -476,3 +476,85 @@ export function show_beautpic(father, canvas, nb = 666) {
createDots();
requestAnimationFrame(animateDots);
}
function updateimgs(fthis, certinfo, callabck) {
uploadimgs(data => {
if (data.code === 1000) {
fthis.$message.success('上传成功');
callabck()
} else {
fthis.$message.error('更新失败: ' + data.msg);
}
}, {'methods': 'PUT', 'data': {'certinfo': certinfo}});
}
function uploadtostorage(fthis, file, certinfo, callabck) {
if (certinfo.storage === 1) {
// eslint-disable-next-line no-unused-vars,no-unreachable
uploadqiniuoss(file, certinfo, this, res => {
updateimgs(fthis, certinfo, callabck);
}, process => {
fthis.uploadprocess = process;
})
} else if (certinfo.storage === 2) {
// eslint-disable-next-line no-unused-vars
uploadaliyunoss(file, certinfo, this, res => {
updateimgs(fthis, certinfo, callabck);
}, process => {
fthis.uploadprocess = process;
});
} else {
//本地
if (certinfo.domain_name) {
certinfo.upload_url = getuploadurl(certinfo.domain_name)
} else {
certinfo.upload_url = getuploadurl();
}
// eslint-disable-next-line no-unused-vars,no-unreachable
uploadlocalstorage(file, certinfo, this, res => {
updateimgs(fthis, certinfo, callabck);
}, process => {
fthis.uploadprocess = process;
})
}
}
/**
* @return {boolean}
*/
export function AvatarUploadUtils(fthis, file, params, callabck) {
const isLt2M = file.size / 1024 / 1024 < 2;
if (file.type === 'image/jpeg' || file.type === 'image/png' || file.type === 'image/jpg') {
if (isLt2M) {
uploadimgs(data => {
if (data.code === 1000) {
// eslint-disable-next-line no-console
// console.log(data.data);
let certinfo = data.data;
certinfo.ext = params.ext;
uploadtostorage(fthis, file, certinfo, callabck);
} else {
fthis.$message.error('参数有误');
}
}, {
'methods': 'GET',
'data': params
});
return false;
} else {
fthis.$message.error('上传头像图片大小不能超过 2MB!');
}
} else {
fthis.$message.error('上传头像图片只能是 JPG/PNG/JPEG 格式!');
}
return false;
}

@ -0,0 +1,53 @@
# Generated by Django 3.0.3 on 2021-03-29 14:10
from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('api', '0024_auto_20210324_1751'),
]
operations = [
migrations.CreateModel(
name='Price',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('name', models.CharField(max_length=128, unique=True, verbose_name='下载包唯一名称')),
('title', models.CharField(max_length=128, verbose_name='下载包名称')),
('description', models.CharField(max_length=128, verbose_name='下载包描述')),
('price', models.FloatField(verbose_name='下载包价格')),
('package_size', models.BigIntegerField(verbose_name='下载包次数')),
('download_count_gift', models.IntegerField(default=0, verbose_name='赠送下载次数')),
('is_enable', models.BooleanField(default=True, verbose_name='是否启用该价格')),
('updated_time', models.DateTimeField(auto_now=True, verbose_name='更新时间')),
],
options={
'verbose_name': '价格列表',
'verbose_name_plural': '价格列表',
'unique_together': {('price', 'package_size')},
},
),
migrations.CreateModel(
name='Order',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('payment_type', models.SmallIntegerField(choices=[(0, '微信'), (1, '支付宝'), (2, '优惠码'), (4, '银联')])),
('payment_number', models.CharField(blank=True, max_length=128, null=True, verbose_name='支付第3方订单号')),
('order_number', models.CharField(max_length=128, unique=True, verbose_name='订单号')),
('actual_amount', models.FloatField(verbose_name='实付金额')),
('status', models.SmallIntegerField(
choices=[(0, '交易成功'), (1, '待支付'), (2, '退费申请中'), (3, '已退费'), (4, '主动取消'), (5, '超时取消')],
verbose_name='状态')),
('order_type',
models.SmallIntegerField(choices=[(0, '用户下单'), (1, '后台充值')], default=0, verbose_name='订单类型')),
('date', models.DateTimeField(auto_now_add=True, verbose_name='订单生成时间')),
('pay_time', models.DateTimeField(blank=True, null=True, verbose_name='付款时间')),
('cancel_time', models.DateTimeField(blank=True, null=True, verbose_name='订单取消时间')),
(
'account', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL)),
],
),
]

@ -0,0 +1,17 @@
# Generated by Django 3.0.3 on 2021-03-29 14:19
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('api', '0025_order_price'),
]
operations = [
migrations.AlterField(
model_name='price',
name='price',
field=models.BigIntegerField(verbose_name='下载包价格'),
),
]

@ -0,0 +1,34 @@
# Generated by Django 3.0.3 on 2021-03-29 15:06
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('api', '0026_auto_20210329_1419'),
]
operations = [
migrations.AddField(
model_name='order',
name='actual_download_gift_times',
field=models.BigIntegerField(default=0, verbose_name='实际赠送的数量'),
preserve_default=False,
),
migrations.AddField(
model_name='order',
name='actual_download_times',
field=models.BigIntegerField(default=0, verbose_name='实际购买的数量'),
preserve_default=False,
),
migrations.AlterField(
model_name='order',
name='actual_amount',
field=models.BigIntegerField(verbose_name='实付金额,单位分'),
),
migrations.AlterField(
model_name='price',
name='price',
field=models.BigIntegerField(verbose_name='下载包价格,单位分'),
),
]

@ -0,0 +1,19 @@
# Generated by Django 3.0.3 on 2021-03-29 15:12
from django.db import migrations, models
import django.utils.timezone
class Migration(migrations.Migration):
dependencies = [
('api', '0027_auto_20210329_1506'),
]
operations = [
migrations.AddField(
model_name='order',
name='created_time',
field=models.DateTimeField(auto_now_add=True, default=django.utils.timezone.now, verbose_name='订单创建时间'),
preserve_default=False,
),
]

@ -0,0 +1,16 @@
# Generated by Django 3.0.3 on 2021-03-29 16:27
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('api', '0028_order_created_time'),
]
operations = [
migrations.RemoveField(
model_name='order',
name='date',
),
]

@ -0,0 +1,27 @@
# Generated by Django 3.0.3 on 2021-03-29 17:55
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('api', '0029_remove_order_date'),
]
operations = [
migrations.AddField(
model_name='order',
name='description',
field=models.TextField(blank=True, default='', null=True, verbose_name='备注'),
),
migrations.AlterField(
model_name='order',
name='actual_download_gift_times',
field=models.BigIntegerField(default=0, verbose_name='实际赠送的数量'),
),
migrations.AlterField(
model_name='order',
name='actual_download_times',
field=models.BigIntegerField(default=0, verbose_name='实际购买的数量'),
),
]

@ -0,0 +1,51 @@
# Generated by Django 3.0.3 on 2021-04-07 20:21
from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('api', '0030_auto_20210329_1755'),
]
operations = [
migrations.CreateModel(
name='UserCertificationInfo',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('name', models.CharField(max_length=128, verbose_name='真实姓名')),
('card', models.CharField(max_length=128, verbose_name='身份证号码')),
('addr', models.CharField(max_length=128, verbose_name='居住地')),
('mobile', models.BigIntegerField(unique=True, verbose_name='手机号码')),
('status', models.SmallIntegerField(choices=[(0, '审核中'), (1, '审核成功'), (2, '审核失败')], default=0,
verbose_name='审核状态')),
('created_time', models.DateTimeField(auto_now_add=True, verbose_name='创建时间')),
('user_id', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL,
verbose_name='用户ID')),
],
options={
'verbose_name': '用户认证信息',
'verbose_name_plural': '用户认证信息',
},
),
migrations.CreateModel(
name='CertificationInfo',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('certification_url', models.CharField(blank=True, max_length=128, verbose_name='认证URL')),
('created_time', models.DateTimeField(auto_now_add=True, verbose_name='创建时间')),
('user_id', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL,
verbose_name='用户ID')),
],
options={
'verbose_name': '身份证截图',
'verbose_name_plural': '身份证截图',
},
),
migrations.AddIndex(
model_name='usercertificationinfo',
index=models.Index(fields=['card'], name='api_usercer_card_246743_idx'),
),
]

@ -0,0 +1,19 @@
# Generated by Django 3.0.3 on 2021-04-07 20:44
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('api', '0031_auto_20210407_2021'),
]
operations = [
migrations.AddField(
model_name='certificationinfo',
name='type',
field=models.SmallIntegerField(choices=[(0, '国徽面照片'), (1, '人像面照片'), (2, '手持身份证照片')], default=0,
verbose_name='图像类型'),
preserve_default=False,
),
]

@ -0,0 +1,18 @@
# Generated by Django 3.0.3 on 2021-04-07 20:45
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('api', '0032_certificationinfo_type'),
]
operations = [
migrations.AlterField(
model_name='certificationinfo',
name='type',
field=models.SmallIntegerField(choices=[(0, '未知'), (1, '国徽面照片'), (2, '人像面照片'), (3, '手持身份证照片')], default=0,
verbose_name='图像类型'),
),
]

@ -394,3 +394,37 @@ class Price(models.Model):
def __str__(self):
return "%s-%s-%s-%s" % (self.name, self.price, self.package_size, self.download_count_gift)
class UserCertificationInfo(models.Model):
user_id = models.ForeignKey(to="UserInfo", verbose_name="用户ID", on_delete=models.CASCADE)
name = models.CharField(max_length=128, null=False, verbose_name="真实姓名")
card = models.CharField(max_length=128, null=False, verbose_name="身份证号码")
addr = models.CharField(max_length=128, null=False, verbose_name="居住地")
mobile = models.BigIntegerField(verbose_name="手机号码", unique=True, null=False)
status_choices = ((0, '审核中'), (1, '审核成功'), (2, '审核失败'))
status = models.SmallIntegerField(choices=status_choices, default=0, verbose_name="审核状态")
created_time = models.DateTimeField(auto_now_add=True, verbose_name="创建时间")
class Meta:
verbose_name = '用户认证信息'
verbose_name_plural = "用户认证信息"
indexes = [models.Index(fields=['card'])]
def __str__(self):
return "%s-%s" % (self.user_id, self.name)
class CertificationInfo(models.Model):
user_id = models.ForeignKey(to="UserInfo", verbose_name="用户ID", on_delete=models.CASCADE)
certification_url = models.CharField(max_length=128, blank=True, verbose_name="认证URL")
type_choices = ((0, '未知'), (1, '国徽面照片'), (2, '人像面照片'), (3, '手持身份证照片'))
type = models.SmallIntegerField(choices=type_choices, default=0, verbose_name="图像类型")
created_time = models.DateTimeField(auto_now_add=True, verbose_name="创建时间")
class Meta:
verbose_name = '身份证截图'
verbose_name_plural = "身份证截图"
def __str__(self):
return "%s-%s" % (self.user_id, self.certification_url)

@ -160,7 +160,7 @@ class UploadView(APIView):
if ftype == 'app' or ftype == 'screen':
app_obj = Apps.objects.filter(app_id=app_id, user_id=request.user).first()
elif ftype and ftype == 'head':
elif ftype and ftype in ['head', 'certification']:
if request.user.uid != app_id:
res.code = 1007
res.msg = '该用户不存在'
@ -176,7 +176,7 @@ class UploadView(APIView):
res.code = 1006
res.msg = '类型不允许'
else:
upload_key = make_from_user_uuid(request.user) + '.' + app_type
upload_key = make_from_user_uuid(request.user) + '.' + app_type + settings.FILE_UPLOAD_TMP_KEY
upload_token = storage.get_upload_token(upload_key)
storage_type = storage.get_storage_type()
res.data = {
@ -231,7 +231,7 @@ class UploadView(APIView):
# res.code = 1006
# res.msg = '该应用不存在'
# return Response(res.dict)
elif ftype and ftype == 'head':
elif ftype and ftype in ['head', 'certification']:
if request.user.uid != app_id:
res.code = 1007
res.msg = '该用户不存在'
@ -296,15 +296,23 @@ class UploadView(APIView):
logger.info("user %s update img %s info" % (request.user, app_id))
ftype = certinfo.get('ftype', None)
storage = Storage(request.user)
upload_key = certinfo.get("upload_key", None)
if ftype and upload_key:
storage = Storage(request.user)
new_upload_key = upload_key.strip(settings.FILE_UPLOAD_TMP_KEY)
else:
res.msg = '参数有误'
res.code = 1008
return Response(res.dict)
if ftype and app_id and ftype == 'app':
app_obj = Apps.objects.filter(app_id=app_id, user_id=request.user).first()
if app_obj:
release_obj = AppReleaseInfo.objects.filter(app_id=app_obj, is_master=True).first()
if release_obj:
old_file_key = release_obj.icon_url
release_obj.icon_url = certinfo.get("upload_key")
release_obj.icon_url = new_upload_key
release_obj.save()
storage.rename_file(upload_key, new_upload_key)
del_cache_response_by_short(app_id)
storage.delete_file(old_file_key)
return Response(res.dict)
@ -313,23 +321,35 @@ class UploadView(APIView):
if app_obj:
scount = AppScreenShot.objects.filter(app_id=app_obj).count()
if scount >= 5:
storage.delete_file(certinfo.get("upload_key"))
storage.delete_file(upload_key)
res.msg = '最多支持五张截图'
res.code = 1009
return Response(res.dict)
AppScreenShot.objects.create(app_id=app_obj, screenshot_url=certinfo.get("upload_key"))
AppScreenShot.objects.create(app_id=app_obj, screenshot_url=new_upload_key)
storage.rename_file(upload_key, new_upload_key)
del_cache_response_by_short(app_id)
return Response(res.dict)
elif ftype and app_id and ftype == 'head':
elif ftype and app_id and ftype in ['head', 'certification']:
if request.user.uid != app_id:
res.code = 1007
res.msg = '该用户不存在'
return Response(res.dict)
old_file_key = request.user.head_img
UserInfo.objects.filter(pk=request.user.id).update(head_img=certinfo.get("upload_key"))
if old_file_key != "" or old_file_key != 'head_img.jpeg':
storage.delete_file(old_file_key)
if ftype == 'head':
old_file_key = request.user.head_img
UserInfo.objects.filter(pk=request.user.id).update(head_img=new_upload_key)
if old_file_key != "" or old_file_key != 'head_img.jpeg':
storage.delete_file(old_file_key)
storage.rename_file(upload_key, new_upload_key)
elif ftype == 'certification':
ext = certinfo.get('ext', None)
if ext:
ptype = ext.get('type', None)
if ptype is not None:
pass
pass
else:
pass
return Response(res.dict)
else:

Loading…
Cancel
Save