作者 唐旭辉

配置文件修改

[dev]
config_name = "test"
#----beego的默认配置 开始---
#端口号
httpport = 8080
#开启应用内监控
EnableAdmin = false
AdminPort = 8088
#---beego的默认配置 结束---
#---自定义配置 开始----
##数据库连接
# sqlconn ="${MYSQL_CONN||root:sutianxia2015@tcp(115.29.205.99:3306)/opportunity?charset=utf8&loc=Asia%2FShanghai}"
mysql_user = "${MYSQL_USER||root}"
mysql_password = "${MYSQL_PASSWORD||sutianxia2015}"
mysql_host = "${MYSQL_HOST||115.29.205.99}"
mysql_port = "${MYSQL_PORT||3306}"
mysql_db_name = "${MYSQL_DB_NAME||opportunity}"
##redis相关配置
redis_add = "${REDIS_HOST||127.0.0.1}"
redis_add_port = "${REDIS_PORT||6379}"
redis_auth = ""
##log相关配置
##out_put:"console","file"
log_output = "file"
log_filename = "${aliyun_logs_access||./log/ability.log}"
log_level = "${LOG_LEVEL||debug}"
##统一用户中心相关配置
ucenter_check_alt = "rsF0pL!6DwjBO735"
ucenter_base_url = "http://suplus-ucenter-test.fjmaimaimai.com"
ucenter_app_key = "39aefef9e22744a3b2d2d3791824ae7b"
ucenter_secret = "cykbjnfqgctn"
# 上传文件保存路径
file_save_path = "${aliyun_file_access||~/www/opp}"
file_host = "http://192.168.139.137:8080/"
file_host_path = "file/opp"
# 审批流程修改 消息发布
message_publish = "audit_change"
#---自定义配置 结束----
\ No newline at end of file
... ...
apiVersion: v1
kind: Service
metadata:
name: opp
name: mmm-oppmg
namespace: mmm-suplus-test
labels:
k8s-app: opp
k8s-app: mmm-oppmg
spec:
ports:
- name: "http"
port: 80
targetPort: 8082
- name: "http"
port: 80
targetPort: 8080
selector:
k8s-app: opp
k8s-app: mmm-oppmg
---
apiVersion: extensions/v1beta1
kind: Deployment
metadata:
name: opp
name: mmm-oppmg
namespace: mmm-suplus-test
labels:
k8s-app: opp
k8s-app: mmm-oppmg
spec:
replicas: 1
template:
metadata:
labels:
k8s-app: opp
k8s-app: mmm-oppmg
spec:
affinity:
nodeAffinity:
... ... @@ -43,54 +43,60 @@ spec:
- cn-hangzhou.i-bp1euf5u1ph9kbhtndhb
- cn-hangzhou.i-bp1hyp5oips9cdwxxgxy
containers:
- name: opp
image: 192.168.0.243:5000/mmm/opp:test
imagePullPolicy: Always
ports:
- containerPort: 8082
volumeMounts:
- mountPath: /opt/logs
name: accesslogs
env:
- name: ENTERPRISE_SERVICE_HOST
valueFrom:
configMapKeyRef:
name: suplus-config
key: service.enterprise
- name: MYSQL_HOST
valueFrom:
configMapKeyRef:
name: suplus-config
key: mysql.host
- name: MYSQL_PORT
valueFrom:
configMapKeyRef:
name: suplus-config
key: mysql.port
- name: MYSQL_USER
valueFrom:
configMapKeyRef:
name: suplus-config
key: mysql.user
- name: MYSQL_PASSWORD
valueFrom:
configMapKeyRef:
name: suplus-config
key: mysql.password
- name: MYSQL_DB_NAME
value: "opp_test"
- name: LOG_LEVEL
value: "debug"
- name: ERROR_BASE_CODE
value: "9"
- name: ERROR_BASE_CODE_MULTIPLE
value: "1000"
- name: RUN_MODE
value: "prod"
- name: aliyun_logs_suplus
value: "stdout"
- name: aliyun_logs_access
value: "/opt/logs/app.log"
- name: mmm-oppmg
image: 192.168.0.243:5000/mmm/mmm-oppmg:test
imagePullPolicy: Always
volumeMounts:
- mountPath: /opt/logs
name: accesslogs
- mountPath: /var/www/oppmg/file
name: mmmjihuitest-pvc1
ports:
- containerPort: 8080
env:
- name: MYSQL_HOST
valueFrom:
configMapKeyRef:
name: suplus-config
key: mysql.host
- name: MYSQL_PORT
valueFrom:
configMapKeyRef:
name: suplus-config
key: mysql.port
- name: REDIS_HOST
valueFrom:
configMapKeyRef:
name: suplus-config
key: redis.ip
- name: REDIS_PORT
valueFrom:
configMapKeyRef:
name: suplus-config
key: redis.port
- name: MYSQL_USER
valueFrom:
configMapKeyRef:
name: suplus-config
key: mysql.user
- name: MYSQL_PASSWORD
valueFrom:
configMapKeyRef:
name: suplus-config
key: mysql.password
- name: MYSQL_DB_NAME
value: "opportunity_test"
- name: RUN_MODE
value: "test"
- name: LOG_LEVEL
value: "debug"
- name: aliyun_logs_suplusfile
value: "stdout"
- name: aliyun_logs_access
value: " /opt/logs/app.log"
volumes:
- name: accesslogs
emptyDir: {}
\ No newline at end of file
- name: accesslogs
emptyDir: {}
- name: mmmjihuitest-pvc1
persistentVolumeClaim:
claimName: mmmjihuitest-pvc
... ...
... ... @@ -8,6 +8,7 @@ import (
"oppmg/common/log"
"oppmg/models"
"oppmg/protocol"
"oppmg/services/ucenter"
"oppmg/storage/redisdata"
"oppmg/utils"
"strings"
... ... @@ -206,23 +207,23 @@ func LoginAuthByUCenter(account, password string) (protocol.LoginAuthToken, erro
} else {
companyid = companys[0].Id
}
// var uclientReturn *ucenter.ResponseLogin
// uclientReturn, err = ucenter.RequestUCenterLogin(account, password)
// if err != nil {
// return logintoken, protocol.NewErrWithMessage("10021")
// }
// //更新用户数据
// _ = uclientReturn
// userdata.Accid = uclientReturn.Data.Accid
// userdata.Icon = uclientReturn.Data.Avatar
// userdata.ImToken = uclientReturn.Data.Imtoken
// userdata.NickName = uclientReturn.Data.NickName
// userdata.CsAccount = uclientReturn.Data.CustomerAccount
// userdata.LastLoginTime = time.Now()
// err = models.UpdateUserById(userdata, []string{"Accid", "Icon", "ImToken", "NickName", "CsAccount", "LastLoginTime"})
// if err != nil {
// log.Error("更新用户数据失败:%s", err)
// }
var uclientReturn *ucenter.ResponseLogin
uclientReturn, err = ucenter.RequestUCenterLogin(account, password)
if err != nil {
return logintoken, protocol.NewErrWithMessage("10021")
}
//更新用户数据
_ = uclientReturn
userdata.Accid = uclientReturn.Data.Accid
userdata.Icon = uclientReturn.Data.Avatar
userdata.ImToken = uclientReturn.Data.Imtoken
userdata.NickName = uclientReturn.Data.NickName
userdata.CsAccount = uclientReturn.Data.CustomerAccount
userdata.LastLoginTime = time.Now()
err = models.UpdateUserById(userdata, []string{"Accid", "Icon", "ImToken", "NickName", "CsAccount", "LastLoginTime"})
if err != nil {
log.Error("更新用户数据失败:%s", err)
}
logintoken, _ = GenerateAuthToken(userdata.Id, companyid)
return logintoken, err
}
... ...