Compare commits
No commits in common. "6644880fc89df7aaf61c92ebdc56b683634c22fb" and "9219289db101a37c6a6803493357a92823fc405f" have entirely different histories.
6644880fc8
...
9219289db1
2
go.mod
2
go.mod
@ -9,7 +9,6 @@ replace (
|
|||||||
//github.com/fonchain_enterprise/utils/objstorage => ../../tyfon-新/utils/objstorage
|
//github.com/fonchain_enterprise/utils/objstorage => ../../tyfon-新/utils/objstorage
|
||||||
github.com/fonchain/utils/voice => ../utils/voice
|
github.com/fonchain/utils/voice => ../utils/voice
|
||||||
github.com/fonchain_enterprise/utils/aes => ../utils/aes
|
github.com/fonchain_enterprise/utils/aes => ../utils/aes
|
||||||
github.com/fonchain_enterprise/utils/baidu => ../utils/baidu
|
|
||||||
github.com/fonchain_enterprise/utils/objstorage => ../utils/objstorage
|
github.com/fonchain_enterprise/utils/objstorage => ../utils/objstorage
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -110,7 +109,6 @@ require (
|
|||||||
github.com/envoyproxy/protoc-gen-validate v0.1.0
|
github.com/envoyproxy/protoc-gen-validate v0.1.0
|
||||||
github.com/fonchain/utils/security v0.0.0-00010101000000-000000000000
|
github.com/fonchain/utils/security v0.0.0-00010101000000-000000000000
|
||||||
github.com/fonchain/utils/voice v0.0.0-00010101000000-000000000000
|
github.com/fonchain/utils/voice v0.0.0-00010101000000-000000000000
|
||||||
github.com/fonchain_enterprise/utils/baidu v0.0.0-00010101000000-000000000000
|
|
||||||
github.com/fonchain_enterprise/utils/objstorage v0.0.0-00010101000000-000000000000
|
github.com/fonchain_enterprise/utils/objstorage v0.0.0-00010101000000-000000000000
|
||||||
github.com/gin-contrib/pprof v1.4.0
|
github.com/gin-contrib/pprof v1.4.0
|
||||||
github.com/go-redis/redis v6.15.9+incompatible
|
github.com/go-redis/redis v6.15.9+incompatible
|
||||||
|
|||||||
@ -8,11 +8,3 @@ type MsgLangQuery struct {
|
|||||||
Lang string `json:"lang" binding:"required"` //环境
|
Lang string `json:"lang" binding:"required"` //环境
|
||||||
Msg string `json:"msg" binding:"required"` //环境
|
Msg string `json:"msg" binding:"required"` //环境
|
||||||
}
|
}
|
||||||
type OcrRes struct {
|
|
||||||
RealName string `json:"realName"`
|
|
||||||
IDNum string `json:"iDNum"`
|
|
||||||
Path string `json:"path"`
|
|
||||||
Age int `json:"age"`
|
|
||||||
Birthday string `json:"birthday"`
|
|
||||||
Sex string `json:"sex"`
|
|
||||||
}
|
|
||||||
|
|||||||
@ -27,7 +27,6 @@ func BundleOrderRouter(r *gin.RouterGroup) {
|
|||||||
bundleOrderClientWebRoute.POST("bundle-order-list-download", bundle.OrderRecordsListDownload)
|
bundleOrderClientWebRoute.POST("bundle-order-list-download", bundle.OrderRecordsListDownload)
|
||||||
bundleOrderClientWebRoute.POST("reconciliation-list", bundle.GetReconciliationList)
|
bundleOrderClientWebRoute.POST("reconciliation-list", bundle.GetReconciliationList)
|
||||||
bundleOrderClientWebRoute.POST("reconciliation-list-download", bundle.GetReconciliationListDownload)
|
bundleOrderClientWebRoute.POST("reconciliation-list-download", bundle.GetReconciliationListDownload)
|
||||||
bundleOrderClientWebRoute.POST("query-order-snapshot-information", bundle.QueryTheOrderSnapshotInformation)
|
|
||||||
// 自动创建用户和订单
|
// 自动创建用户和订单
|
||||||
bundleOrderClientWebRoute.POST("auto-create-user-order", bundle.AutoCreateUserAndOrder)
|
bundleOrderClientWebRoute.POST("auto-create-user-order", bundle.AutoCreateUserAndOrder)
|
||||||
}
|
}
|
||||||
|
|||||||
@ -73,15 +73,13 @@ func NewRouter() *gin.Engine {
|
|||||||
acRoute.POST("real-name", account.RealName) //实名
|
acRoute.POST("real-name", account.RealName) //实名
|
||||||
acRoute.POST("info", account.UserInfo) //用户详情
|
acRoute.POST("info", account.UserInfo) //用户详情
|
||||||
acRoute.POST("update", account.UserUpdate) //用户更新
|
acRoute.POST("update", account.UserUpdate) //用户更新
|
||||||
acRoute.POST("ocr", account.CheckIdOcr) //
|
|
||||||
}
|
}
|
||||||
webAcRouter := privateGroup.Group("/user")
|
webAcRouter := privateGroup.Group("/user")
|
||||||
//webAcRouter.Use(middleware.CheckWebLogin(service.AccountProvider))
|
//webAcRouter.Use(middleware.CheckWebLogin(service.AccountProvider))
|
||||||
webAcRouter.Use(middleware.CheckWebLogin(service.AccountProvider))
|
webAcRouter.Use(middleware.CheckWebLogin(service.AccountProvider))
|
||||||
{
|
{
|
||||||
webAcRouter.POST("list", account.UserList) //用户列表
|
webAcRouter.POST("list", account.UserList) //用户列表
|
||||||
webAcRouter.POST("approval", account.UserApproval) //实名审核
|
webAcRouter.POST("approval", account.UserApproval) //实名审核
|
||||||
webAcRouter.POST("excel/download", account.UserExcelDownload) //excel下载
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
|
|||||||
@ -2,74 +2,16 @@ package account
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
"encoding/base64"
|
|
||||||
"errors"
|
|
||||||
"fmt"
|
"fmt"
|
||||||
account "fonchain-fiee/api/accountFiee"
|
account "fonchain-fiee/api/accountFiee"
|
||||||
"fonchain-fiee/pkg/e"
|
"fonchain-fiee/pkg/e"
|
||||||
"fonchain-fiee/pkg/model/login"
|
"fonchain-fiee/pkg/model/login"
|
||||||
"fonchain-fiee/pkg/model/query"
|
|
||||||
"fonchain-fiee/pkg/model/union"
|
"fonchain-fiee/pkg/model/union"
|
||||||
"fonchain-fiee/pkg/service"
|
"fonchain-fiee/pkg/service"
|
||||||
"fonchain-fiee/pkg/service/bundle"
|
|
||||||
"fonchain-fiee/pkg/utils"
|
|
||||||
"io/ioutil"
|
|
||||||
"net/http"
|
|
||||||
"time"
|
|
||||||
|
|
||||||
"github.com/fonchain_enterprise/utils/baidu"
|
|
||||||
|
|
||||||
"github.com/gin-gonic/gin"
|
"github.com/gin-gonic/gin"
|
||||||
"github.com/gin-gonic/gin/binding"
|
"github.com/gin-gonic/gin/binding"
|
||||||
)
|
)
|
||||||
|
|
||||||
func UserExcelDownload(c *gin.Context) {
|
|
||||||
var req account.UserListRequest
|
|
||||||
if err := c.ShouldBindBodyWith(&req, binding.JSON); err != nil {
|
|
||||||
service.Error(c, err)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
req.Domain = "app"
|
|
||||||
res, err := service.AccountFieeProvider.UserList(context.Background(), &req)
|
|
||||||
if err != nil {
|
|
||||||
service.Error(c, err)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
titleList := []string{
|
|
||||||
"用户编号", "姓名", "性别", "国籍", "手机号", "证件类型", "有效期至", "证件号码", "出生日期", "年龄", "现所在地", "注册时间", "审核时间", "审核状态", "不通过备注",
|
|
||||||
}
|
|
||||||
var dataList []interface{}
|
|
||||||
|
|
||||||
for _, i := range res.UserList {
|
|
||||||
DocumentType := bundle.GetDocumentTypeText(i.DocumentType)
|
|
||||||
Status := bundle.GetUserStatusText(i.Status)
|
|
||||||
data := []any{
|
|
||||||
i.SubNum,
|
|
||||||
i.Name,
|
|
||||||
i.Sex,
|
|
||||||
i.Nationality,
|
|
||||||
i.TelNum,
|
|
||||||
DocumentType,
|
|
||||||
i.Validity,
|
|
||||||
i.IdNumber,
|
|
||||||
i.DateOfBirth,
|
|
||||||
i.Age,
|
|
||||||
i.PlaceOfResidence,
|
|
||||||
i.RegistrationTime,
|
|
||||||
i.AuditTime,
|
|
||||||
Status,
|
|
||||||
i.NotPassRemarks,
|
|
||||||
}
|
|
||||||
dataList = append(dataList, &data)
|
|
||||||
}
|
|
||||||
content, err := utils.ToExcelByType(titleList, dataList, "slice", "")
|
|
||||||
if err != nil {
|
|
||||||
service.Error(c, err)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
utils.ResponseXls(c, content, "艺人管理")
|
|
||||||
return
|
|
||||||
}
|
|
||||||
func UserApproval(c *gin.Context) {
|
func UserApproval(c *gin.Context) {
|
||||||
var req account.CheckRealNameRequest
|
var req account.CheckRealNameRequest
|
||||||
if err := c.ShouldBindBodyWith(&req, binding.JSON); err != nil {
|
if err := c.ShouldBindBodyWith(&req, binding.JSON); err != nil {
|
||||||
@ -138,91 +80,6 @@ func UserUpdate(c *gin.Context) {
|
|||||||
service.Success(c, res)
|
service.Success(c, res)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
func CheckIdOcr(c *gin.Context) {
|
|
||||||
|
|
||||||
var req account.RealNameRequest
|
|
||||||
|
|
||||||
if err := c.ShouldBindBodyWith(&req, binding.JSON); err != nil {
|
|
||||||
service.Error(c, err)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
res, err := getFormIdCar(req.CertificatePicture)
|
|
||||||
if err != nil {
|
|
||||||
service.Error(c, err)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
service.Success(c, res)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 获取身份证OCR识别结果
|
|
||||||
* @param realIDImgA string - 身份证图片的URL地址
|
|
||||||
* @return res query.OcrRes - OCR识别结果结构体,包含身份证号、姓名、图片路径、年龄、生日、性别等信息
|
|
||||||
* @return err error - 错误信息,如果请求或处理过程中出现错误则返回错误
|
|
||||||
*/
|
|
||||||
func getFormIdCar(realIDImgA string) (res query.OcrRes, err error) {
|
|
||||||
// 发送HTTP GET请求获取图片
|
|
||||||
resObj, err := http.Get(realIDImgA)
|
|
||||||
if err != nil {
|
|
||||||
fmt.Println("网络请求错误:", err)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
// 确保在函数返回前关闭响应体
|
|
||||||
defer resObj.Body.Close()
|
|
||||||
|
|
||||||
// 读取图片数据
|
|
||||||
imageData, err := ioutil.ReadAll(resObj.Body)
|
|
||||||
if err != nil {
|
|
||||||
fmt.Println("读取图片数据错误:", err)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
// 将图片数据转换为base64编码
|
|
||||||
base64Data := base64.StdEncoding.EncodeToString(imageData)
|
|
||||||
fmt.Println(base64Data)
|
|
||||||
|
|
||||||
// 调用百度OCR接口识别身份证信息
|
|
||||||
result, err := baidu.OcrGetIdCard(base64Data, "front")
|
|
||||||
|
|
||||||
if err != nil {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
// 构造并返回OCR识别结果
|
|
||||||
res = query.OcrRes{
|
|
||||||
IDNum: result.IdCard, // 身份证号
|
|
||||||
RealName: result.Name, // 姓名
|
|
||||||
Path: result.Path, // 图片路径
|
|
||||||
Age: result.Age, // 年龄
|
|
||||||
Birthday: dd(result.Birthday), // 生日
|
|
||||||
Sex: result.Sex, // 性别
|
|
||||||
}
|
|
||||||
|
|
||||||
return res, nil
|
|
||||||
}
|
|
||||||
|
|
||||||
// dd 实在没时间好好写代码
|
|
||||||
func dd(dateStr string) string {
|
|
||||||
// 1. 解析字符串为time.Time类型
|
|
||||||
// 注意:Go的布局字符串必须使用参考时间"2006-01-02 15:04:05"的格式
|
|
||||||
t, err := time.Parse("20060102", dateStr)
|
|
||||||
if err != nil {
|
|
||||||
fmt.Printf("日期解析错误: %v\n", err)
|
|
||||||
return ""
|
|
||||||
}
|
|
||||||
|
|
||||||
// 2. 格式化为目标格式
|
|
||||||
formattedDate := t.Format("2006-01-02")
|
|
||||||
|
|
||||||
fmt.Println("原始日期:", dateStr)
|
|
||||||
fmt.Println("转换后日期:", formattedDate)
|
|
||||||
return formattedDate
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
// SendMsg 用户发送验证码
|
// SendMsg 用户发送验证码
|
||||||
func SendMsg(c *gin.Context) {
|
func SendMsg(c *gin.Context) {
|
||||||
@ -330,17 +187,6 @@ func RealName(c *gin.Context) {
|
|||||||
}
|
}
|
||||||
user := login.GetUserInfoFromC(c)
|
user := login.GetUserInfoFromC(c)
|
||||||
req.Id = user.ID
|
req.Id = user.ID
|
||||||
if req.DocumentType == 2 {
|
|
||||||
if len(req.IdNumber) != 18 {
|
|
||||||
service.Error(c, errors.New("身份证号格式错误"))
|
|
||||||
return
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
if req.IdNumber == "" {
|
|
||||||
service.Error(c, errors.New("证件号码不能为空"))
|
|
||||||
return
|
|
||||||
}
|
|
||||||
}
|
|
||||||
res, err := service.AccountFieeProvider.RealName(context.Background(), &req)
|
res, err := service.AccountFieeProvider.RealName(context.Background(), &req)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
service.Error(c, err)
|
service.Error(c, err)
|
||||||
|
|||||||
@ -722,38 +722,6 @@ func GetCurrencyTypeText(currencyType int32) string {
|
|||||||
return strconv.Itoa(int(currencyType))
|
return strconv.Itoa(int(currencyType))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
func GetUserStatusText(status int32) string {
|
|
||||||
switch status {
|
|
||||||
case 1:
|
|
||||||
return "未实名"
|
|
||||||
case 2:
|
|
||||||
return "审核中"
|
|
||||||
case 3:
|
|
||||||
return "审核失败"
|
|
||||||
case 4:
|
|
||||||
return "审核通过"
|
|
||||||
default:
|
|
||||||
return strconv.Itoa(int(status))
|
|
||||||
}
|
|
||||||
}
|
|
||||||
func GetDocumentTypeText(documentType int32) string {
|
|
||||||
switch documentType {
|
|
||||||
case 1:
|
|
||||||
return "护照"
|
|
||||||
case 2:
|
|
||||||
return "身份证"
|
|
||||||
case 3:
|
|
||||||
return "驾驶证"
|
|
||||||
case 4:
|
|
||||||
return "居住证"
|
|
||||||
case 5:
|
|
||||||
return "自拍照"
|
|
||||||
case 6:
|
|
||||||
return "社保卡"
|
|
||||||
default:
|
|
||||||
return ""
|
|
||||||
}
|
|
||||||
}
|
|
||||||
func OrderRecordsList(c *gin.Context) {
|
func OrderRecordsList(c *gin.Context) {
|
||||||
var req bundle.OrderRecordsRequest
|
var req bundle.OrderRecordsRequest
|
||||||
|
|
||||||
|
|||||||
@ -21,36 +21,6 @@ const (
|
|||||||
OnlyAddValueListByOrderNoFailed = "根据订单号查询增值套餐失败"
|
OnlyAddValueListByOrderNoFailed = "根据订单号查询增值套餐失败"
|
||||||
)
|
)
|
||||||
|
|
||||||
//官网报告
|
|
||||||
const (
|
|
||||||
ErrorCreateReportFailed = "创建官网报告失败"
|
|
||||||
ErrorDeleteReportFailed = "删除官网报告失败"
|
|
||||||
ErrorListReportFailed = "官网报告列表查询失败"
|
|
||||||
ErrorEditReportFailed = "编辑官网报告失败"
|
|
||||||
ErrorDisplayReportFailed = "显示官网报告失败"
|
|
||||||
)
|
|
||||||
|
|
||||||
//官网成员管理
|
|
||||||
const (
|
|
||||||
ErrorCreateMemberFailed = "创建官网成员失败"
|
|
||||||
ErrorDeleteMemberFailed = "删除官网成员失败"
|
|
||||||
ErrorListMemberFailed = "官网成员列表查询失败"
|
|
||||||
ErrorEditMemberFailed = "编辑官网成员失败"
|
|
||||||
ErrorDisplayMemberFailed = "显示官网成员失败"
|
|
||||||
ErrorEditBoardOfDirectorsFailed = "编辑董事会成员失败"
|
|
||||||
ErrorEditCommitteeAppointmentsFailed = "编辑委员会成员失败"
|
|
||||||
ErrorDisplayCommitteeAppointmentsFailed = "显示委员会成员失败"
|
|
||||||
ErrorEditManagementFailed = "编辑管理员失败"
|
|
||||||
ErrorDisplayManagementFailed = "显示管理员失败"
|
|
||||||
ErrorDisplayBoardOfDirectorsFailed = "显示董事会成员失败"
|
|
||||||
)
|
|
||||||
|
|
||||||
//官网邮箱通知
|
|
||||||
const (
|
|
||||||
ErrorEmailAlertSubmitFailed = "提交邮箱通知失败"
|
|
||||||
ErrorGetEmailInformationListFailed = "获取邮箱通知列表失败"
|
|
||||||
)
|
|
||||||
|
|
||||||
// 订单
|
// 订单
|
||||||
const (
|
const (
|
||||||
MissOrderNo = "缺少订单号"
|
MissOrderNo = "缺少订单号"
|
||||||
|
|||||||
@ -2,7 +2,6 @@ package bundle
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
"errors"
|
|
||||||
"fmt"
|
"fmt"
|
||||||
"fonchain-fiee/api/accountFiee"
|
"fonchain-fiee/api/accountFiee"
|
||||||
"fonchain-fiee/api/bundle"
|
"fonchain-fiee/api/bundle"
|
||||||
@ -549,21 +548,3 @@ func AutoCreateUserAndOrder(c *gin.Context) {
|
|||||||
return
|
return
|
||||||
|
|
||||||
}
|
}
|
||||||
func QueryTheOrderSnapshotInformation(c *gin.Context) {
|
|
||||||
var req bundle.QueryTheOrderSnapshotInformationReq
|
|
||||||
if err := c.ShouldBindBodyWith(&req, binding.JSON); err != nil {
|
|
||||||
service.Error(c, err)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
if req.OrderNo == "" {
|
|
||||||
service.Error(c, errors.New("订单号不能为空"))
|
|
||||||
return
|
|
||||||
}
|
|
||||||
res, err := service.BundleProvider.QueryTheOrderSnapshotInformation(context.Background(), &req)
|
|
||||||
if err != nil {
|
|
||||||
service.Error(c, err)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
service.Success(c, res)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user