Commit 3f19d047 authored by haoyanbin's avatar haoyanbin

1

parent 38559bff
......@@ -30,5 +30,5 @@ COPY --from=builder /go/src/gin-vue-admin/resource ./resource
# 运行打包好的二进制
RUN pwd \
&& ls
EXPOSE 8052
EXPOSE 12001
ENTRYPOINT ["/go/src/gin-vue-admin/server"]
\ No newline at end of file
......@@ -38,6 +38,8 @@ func ExportMsgExcel(c *gin.Context) {
_, list, _ := service.GetCustomerUserList(req)
codeList := service.GetVcodeList(req.MocId)
fileName := "用户短链列表" + time.Now().Format("20060102")
f := excelize.NewFile()
// Create a new sheet.
......@@ -53,8 +55,13 @@ func ExportMsgExcel(c *gin.Context) {
f.SetCellValue(fileName, "H1", "短链")
for k, v := range list {
url := "" + "?user_id=" + strconv.Itoa(v.Id) + "&moc_id=" + strconv.Itoa(req.MocId)
url := ""
code, ok := codeList[v.Id]
if ok == true {
url = global.GVA_CONFIG.Common.Url + "/" + code
} else {
url = global.GVA_CONFIG.Common.Url + "/" + service.GetVcode(v.Id, req.MocId)
}
a := strconv.Itoa(k + 2)
f.SetCellValue(fileName, "A"+a, v.Id)
......
package mobile
import (
"gin-vue-admin/model/request"
"gin-vue-admin/model/response"
"gin-vue-admin/service"
"github.com/gin-gonic/gin"
)
func GetIdByCode(c *gin.Context) {
var req request.GetIdByCodeReq
_ = c.ShouldBindJSON(&req)
reply := service.GetIdByCode(req.Code)
response.OkWithDetailed(reply, "获取成功", c)
}
func SetCode(c *gin.Context) {
var req request.GetCustomerUserListReq
_ = c.ShouldBindJSON(&req)
req.PageSize = 1200
_, list, _ := service.GetCustomerUserList(req)
codeList := service.GetVcodeList(req.MocId)
for _, v := range list {
_, ok := codeList[v.Id]
if ok == false {
service.GetVcode(v.Id, req.MocId)
}
}
response.OkWithDetailed("", "获取成功", c)
}
......@@ -116,7 +116,7 @@ encrypt:
key: "75SIQyfvwHDU0GbO"
common:
type: "2"
url: ""
url: "https://tdt.pet-dbc.cn/"
sms:
smsname: "dbc"
......
......@@ -2,4 +2,5 @@ package config
type Common struct {
Type string `mapstructure:"type" json:"type" yaml:"type"` // 存储区域
Url string `mapstructure:"url" json:"url" yaml:"url"` // 存储区域
}
package request
type GetIdByCodeReq struct {
Code string `json:"code"`
}
type SetCodeReq struct {
Code string `json:"code"`
}
package model
type Vcode struct {
UserId int `gorm:"type:int(255)" json:"user_id"`
MocId int `gorm:"type:int(255)" json:"moc_id"`
Code string `gorm:"type:string(255)" json:"code"`
}
......@@ -5,6 +5,13 @@ aliyun-oss:
bucket-name: "dbc-static"
bucket-url: "https://dbc-static.oss-cn-beijing.aliyuncs.com"
directory: "dbc-medical"
aliyun-oss-image:
endpoint: "http://oss-cn-beijing.aliyuncs.com"
access-key-id: "LTAI5tRZJzrwgvftsRHKeoYv"
access-key-secret: "NwAhBTU62e8Z7q1G9r0PyHsqcGMEnX"
bucket-name: "dbc-dcm"
bucket-url: "https://oss.pet-dbc.vip"
directory: "custom_image"
autocode:
transfer-restart: true
root: /Users/haoyanbin/go/src
......@@ -45,9 +52,9 @@ local:
mysql:
path: rm-2zenl1z0v6209a4jrbo.mysql.rds.aliyuncs.com
config: charset=utf8mb4&parseTime=True&loc=Local
db-name: dbc_medical_record
username: root_medical
password: dbc_medical888888!
db-name: dt_analysis
username: root_shop
password: DBC_shopqwe
max-idle-conns: 0
max-open-conns: 0
log-mode: false
......@@ -66,15 +73,16 @@ qiniu:
access-key: ""
secret-key: ""
use-cdn-domains: false
#127.0.0.1:6379 172.17.36.64:6379
redis:
addr: 39.97.179.15:6382
addr: 39.96.85.45:6382
password: saas123456
db: 4
pool_size: 200
max_retries: 3
system:
env: public
addr: 8052
addr: 12001
db-type: mysql
oss-type: aliyun-oss
use-multipoint: false
......@@ -104,46 +112,11 @@ zap:
stacktrace-key: stacktrace
log-in-console: true
# https://tmall.pet-dbc.cn
dcyp:
host: "https://mall.pet-dbc.cn"
dbys:
host: "http://39.96.85.45:8081"
ai:
# host: "https://ai.pet-dbc.cn"
host: "http://39.105.63.250:3391"
hostnew: "http://39.105.63.250:8899"
hostfrac: "http://39.105.63.250:8888"
token: "eyJhbGciOiJIUzUxMiIsImlhdCI6MTY1ODEzMDc3MywiZXhwIjoxNjYwNzIyNzczfQ.eyJ1c2VybmFtZSI6ImFkbWluX3hpdW1pbmcifQ.PguJYgqslyN1IdK7NEvoNuJFZxbIJDFa9W2OibWubL5bwp2wUZNmyty-V5g0W6v2OkyjZ1YC0sFRZZOJ46kWrA"
new:
host: "https://image.pet-dbc.cn/api"
phone: "17710551102"
password: "123456"
im:
host: "http://39.97.239.70:11002"
search:
host: "http://39.107.139.233:11004"
encrypt:
key: "75SIQyfvwHDU0GbO"
outside:
# https://healthy.tk.cn/apply/reviewInformation
taikang-host: "http://ecuat.tk.cn/ccs_regist/apply/reviewInformation"
taikang-img: "http://ecuat.tk.cn/ccs_regist/image/downLoadPetImageByUrl"
common:
type: "1"
#e签宝配置
eqb:
project-id: "4438758767"
project-secret: "cc7fb6e1278990edf87f3e4f0f9c3a51"
api-host: "https://smlo.tsign.cn/opentreaty-service/"
auth-api-host: "http://smlrealname.tsign.cn:8080/"
access-token-url: "https://smlopenapi.esign.cn/v1/oauth2/access_token"
sign-flows-url: "https://smlopenapi.esign.cn/v1/signflows/"
organ-auth-url: "http://smlrealname.tsign.cn:8080/realname/rest/external/organ/orgAuth"
info-auth-url: "http://smlrealname.tsign.cn:8080/realname/rest/external/organ/infoAuth-special"
type: "2"
url: "https://dt.pet-dbc.cn/"
sms:
smsname: "dbc"
......@@ -153,7 +126,7 @@ sms:
ip: "114.255.71.158:8061"
url: "https://tsms.pet-dbc.cn/v1/send"
wx:
wx: # wx0e311bf538eec0a1 51e0e550569535352be0d0e3fbd21946 ! wxb8fe0ea4e5de5a24 24f0e0148693725a02102ec1eaccdb57
appid: "wxb8fe0ea4e5de5a24"
appsecret: "e2a8ec3ef42d107ccb28a69fa5c6bc08"
apikey: "dibaocheng20190410dibaocheng2019"
......@@ -166,15 +139,11 @@ bkwx:
#支付配置
pay:
pay-call-back: "https://medical.pet-dbc.cn/vip/callBack"
unified-order: "https://pay.pet-dbc.cn/v1/pay/unified_order"
pay-call-back: "https://tmedical.pet-dbc.cn/vip/callBack"
unified-order: "https://tpay.pet-dbc.cn/v1/pay/unified_order"
# doctor pay
doctor_pay:
url: "https://medical.pet-dbc.cn/v1/pay/purchase_notice"
lis_ocr:
url: "https://open.pet-dbc.cn/ocr"
doctor_db:
account: "dbc_saas:dbc_saas888888@tcp(rm-2zepcf8kag0aol0q48o.mysql.rds.aliyuncs.com:3306)/hos_database?charset=utf8"
common: "dbc_saas:dbc_saas888888@tcp(rm-2zepcf8kag0aol0q48o.mysql.rds.aliyuncs.com:3306)/saas_common?charset=utf8"
ipaddr:
url: "https://ipaddquery.market.alicloudapi.com/ip/address-query"
appkey: "203818254"
appsecret: "Po6a0U5awkWFeXCBmfYyezJdhI7p7Xib"
appcode: "6d1da9eb15b540688a505c1814e0c25f"
\ No newline at end of file
......@@ -10,20 +10,19 @@ import (
func InitMobileUserLoginRouter(Router *gin.RouterGroup) {
UserRouter := Router.Group("mobile")
{
UserRouter.POST("login", mobile.Login) // 用户注册账号
UserRouter.POST("login", mobile.Login)
UserRouter.POST("register", mobile.Register) // 用户注册账号
UserRouter.POST("getOpenid", mobile.GetOpenid) // 用户注册账号
UserRouter.POST("sendCode", mobile.SendCode) // 用户注册账号
UserRouter.POST("checkCode", mobile.CheckCode) // 用户注册账号
UserRouter.POST("msgData", mobile.MsgData) // 用户注册账号
UserRouter.POST("getOpenid", mobile.GetOpenid)
UserRouter.POST("sendCode", mobile.SendCode)
UserRouter.POST("checkCode", mobile.CheckCode)
UserRouter.POST("msgData", mobile.MsgData)
UserRouter.POST("getIdByCode", mobile.GetIdByCode)
UserRouter.POST("setCode", mobile.SetCode)
}
}
func InitMobileUserPublicRouter(Router *gin.RouterGroup) {
UserRouter := Router.Group("mobile").Use(middleware.OperationRecord())
{
//UserRouter.POST("login", mobile.Login) // 用户注册账号
//UserRouter.POST("getOpenid", mobile.GetOpenid) // 用户注册账号
//UserRouter.POST("getReportListByCollection", mobile.GetReportListByCollection)
UserRouter.POST("getRegoinList", mobile.GetRegoinList)
UserRouter.POST("updateUser", mobile.UpdateUser)
UserRouter.POST("upload", v1.UploadFile)
......
......@@ -22,7 +22,7 @@ func GetCustomerUserList(req request.GetCustomerUserListReq) (error, []request.G
table := " customer_user"
field := " user_name, region, city, zone, address, contacts, contacts_mobile" +
field := " id, user_name, region, city, zone, address, contacts, contacts_mobile" +
", worker_position, worker_name, worker_mobile, user_source, user_type, create_time "
conditions := ""
......
package service
import (
"fmt"
"gin-vue-admin/global"
"gin-vue-admin/model"
"gin-vue-admin/utils"
)
func GetVcode(userId, mocId int) string {
code := ""
sqlStr := "SELECT code FROM vcode WHERE user_id = ? and moc_id = ? "
global.GVA_DB.Raw(sqlStr, userId, mocId).Find(&code)
if global.GVA_DB.Error != nil {
fmt.Println(global.GVA_DB.Error)
return code
}
if code != "" {
return code
}
code = createCode()
IpaddrData := model.Vcode{
UserId: userId,
MocId: mocId,
Code: code,
}
global.GVA_DB.Table("vcode").Create(&IpaddrData)
return code
}
func createCode() string {
code := utils.GetRandStr()
cid := 0
sqlStr := "SELECT count(code) as cid FROM vcode WHERE code = ? "
global.GVA_DB.Raw(sqlStr, code).Find(&cid)
if global.GVA_DB.Error != nil {
fmt.Println(global.GVA_DB.Error)
return code
}
if cid == 0 {
return code
}
return createCode()
}
func GetIdByCode(code string) model.Vcode {
data := new(model.Vcode)
sqlStr := "SELECT user_id, moc_id, code FROM vcode WHERE code = ? "
global.GVA_DB.Raw(sqlStr, code).Find(&data)
if global.GVA_DB.Error != nil {
fmt.Println(global.GVA_DB.Error)
return model.Vcode{}
}
return *data
}
func GetVcodeList(mocId int) map[int]string {
data := make([]model.Vcode, 0)
sqlStr := "SELECT code, user_id FROM vcode WHERE moc_id = ? "
global.GVA_DB.Raw(sqlStr, mocId).Find(&data)
if global.GVA_DB.Error != nil {
fmt.Println(global.GVA_DB.Error)
return map[int]string{}
}
reply := make(map[int]string, 0)
for _, v := range data {
reply[v.UserId] = v.Code
}
return reply
}
package utils
import (
"encoding/hex"
"fmt"
"gin-vue-admin/model"
"math/rand"
......@@ -134,6 +135,12 @@ func GetPointsOrderNo(num int) string {
return "P" + timeStr + sup(orderNo, 9)
}
func GetRandStr() string {
result := make([]byte, 3)
rand.Read(result)
return hex.EncodeToString(result)
}
func GetRandNum(num int) string {
code := ""
rand.Seed(time.Now().UnixNano())
......
......@@ -54,7 +54,7 @@ func SendMobileCode(action, mobile, code string) string {
h.Write([]byte("dthydthy12345" + nowtime))
sign := hex.EncodeToString(h.Sum(nil))
content := "【顶图】您的验证码为:" + code
content := "【顶图DR】您的验证码为:" + code
postData := make(map[string]string)
postData["action"] = action
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment