mirror of
https://github.com/kongyuebin1/dongfeng-pay.git
synced 2025-09-16 09:53:48 +08:00
重构了boss系统,添加了逻辑
This commit is contained in:
86
boss/models/merchant/merchant_deploy_info.go
Normal file
86
boss/models/merchant/merchant_deploy_info.go
Normal file
@@ -0,0 +1,86 @@
|
||||
/***************************************************
|
||||
** @Desc : This file for ...
|
||||
** @Time : 2019/10/7 11:52
|
||||
** @Author : yuebin
|
||||
** @File : merchant_deploy_info
|
||||
** @Last Modified by : yuebin
|
||||
** @Last Modified time: 2019/10/7 11:52
|
||||
** @Software: GoLand
|
||||
****************************************************/
|
||||
package merchant
|
||||
|
||||
import (
|
||||
"github.com/beego/beego/v2/client/orm"
|
||||
"github.com/beego/beego/v2/core/logs"
|
||||
)
|
||||
|
||||
type MerchantDeployInfo struct {
|
||||
Id int
|
||||
Status string
|
||||
MerchantUid string
|
||||
PayType string
|
||||
SingleRoadUid string
|
||||
SingleRoadName string
|
||||
SingleRoadPlatformRate float64
|
||||
SingleRoadAgentRate float64
|
||||
RollRoadCode string
|
||||
RollRoadName string
|
||||
RollRoadPlatformRate float64
|
||||
RollRoadAgentRate float64
|
||||
IsLoan string
|
||||
LoanRate float64
|
||||
LoanDays int
|
||||
UnfreezeHour int
|
||||
WaitUnfreezeAmount float64
|
||||
LoanAmount float64
|
||||
UpdateTime string
|
||||
CreateTime string
|
||||
}
|
||||
|
||||
const MERCHANT_DEPLOY_INFO = "merchant_deploy_info"
|
||||
|
||||
func InsertMerchantDeployInfo(merchantDeployInfo MerchantDeployInfo) bool {
|
||||
o := orm.NewOrm()
|
||||
_, err := o.Insert(&merchantDeployInfo)
|
||||
if err != nil {
|
||||
logs.Error("insert merchant deploy info fail: ", err)
|
||||
return false
|
||||
}
|
||||
return true
|
||||
}
|
||||
|
||||
func IsExistByUidAndPayType(uid, payType string) bool {
|
||||
o := orm.NewOrm()
|
||||
isEixst := o.QueryTable(MERCHANT_DEPLOY_INFO).Filter("merchant_uid", uid).Filter("pay_type", payType).Exist()
|
||||
return isEixst
|
||||
}
|
||||
|
||||
func GetMerchantDeployByUidAndPayType(uid, payType string) MerchantDeployInfo {
|
||||
o := orm.NewOrm()
|
||||
var merchantDeployInfo MerchantDeployInfo
|
||||
_, err := o.QueryTable(MERCHANT_DEPLOY_INFO).Filter("merchant_uid", uid).Filter("pay_type", payType).Limit(1).All(&merchantDeployInfo)
|
||||
if err != nil {
|
||||
logs.Error("get merchant deploy by uid and paytype fail:", err)
|
||||
}
|
||||
return merchantDeployInfo
|
||||
}
|
||||
|
||||
func DeleteMerchantDeployByUidAndPayType(uid, payType string) bool {
|
||||
o := orm.NewOrm()
|
||||
_, err := o.QueryTable(MERCHANT_DEPLOY_INFO).Filter("merchant_uid", uid).Filter("pay_type", payType).Delete()
|
||||
if err != nil {
|
||||
logs.Error("delete merchant deploy by uid and payType fail: ", err)
|
||||
return false
|
||||
}
|
||||
return true
|
||||
}
|
||||
|
||||
func UpdateMerchantDeploy(merchantDeploy MerchantDeployInfo) bool {
|
||||
o := orm.NewOrm()
|
||||
_, err := o.Update(&merchantDeploy)
|
||||
if err != nil {
|
||||
logs.Error("update merchant deploy fail: ", err)
|
||||
return false
|
||||
}
|
||||
return true
|
||||
}
|
186
boss/models/merchant/merchant_info.go
Normal file
186
boss/models/merchant/merchant_info.go
Normal file
@@ -0,0 +1,186 @@
|
||||
/***************************************************
|
||||
** @Desc : This file for ...
|
||||
** @Time : 2019/9/28 16:47
|
||||
** @Author : yuebin
|
||||
** @File : merchant_info
|
||||
** @Last Modified by : yuebin
|
||||
** @Last Modified time: 2019/9/28 16:47
|
||||
** @Software: GoLand
|
||||
****************************************************/
|
||||
package merchant
|
||||
|
||||
import (
|
||||
"github.com/beego/beego/v2/client/orm"
|
||||
"github.com/beego/beego/v2/core/logs"
|
||||
)
|
||||
|
||||
type MerchantInfo struct {
|
||||
Id int
|
||||
Status string
|
||||
BelongAgentUid string
|
||||
BelongAgentName string
|
||||
MerchantName string
|
||||
MerchantUid string
|
||||
MerchantKey string
|
||||
MerchantSecret string
|
||||
LoginPassword string
|
||||
LoginAccount string
|
||||
AutoSettle string
|
||||
AutoPayFor string
|
||||
WhiteIps string
|
||||
Remark string
|
||||
SinglePayForRoadUid string
|
||||
SinglePayForRoadName string
|
||||
RollPayForRoadCode string
|
||||
RollPayForRoadName string
|
||||
PayforFee float64
|
||||
UpdateTime string
|
||||
CreateTime string
|
||||
}
|
||||
|
||||
const MERCHANT_INFO = "merchant_info"
|
||||
|
||||
func IsExistByMerchantName(merchantName string) bool {
|
||||
o := orm.NewOrm()
|
||||
exist := o.QueryTable(MERCHANT_INFO).Filter("merchant_name", merchantName).Exist()
|
||||
|
||||
return exist
|
||||
}
|
||||
|
||||
func IsExistByMerchantUid(uid string) bool {
|
||||
o := orm.NewOrm()
|
||||
exist := o.QueryTable(MERCHANT_INFO).Filter("merchant_uid", uid).Exist()
|
||||
|
||||
return exist
|
||||
}
|
||||
|
||||
func IsExistMerchantByAgentUid(uid string) bool {
|
||||
o := orm.NewOrm()
|
||||
exist := o.QueryTable(MERCHANT_INFO).Filter("belong_agent_uid", uid).Exist()
|
||||
|
||||
return exist
|
||||
}
|
||||
|
||||
func IsExistByMerchantPhone(phone string) bool {
|
||||
o := orm.NewOrm()
|
||||
exist := o.QueryTable(MERCHANT_INFO).Filter("LoginAccount", phone).Exist()
|
||||
|
||||
return exist
|
||||
}
|
||||
|
||||
func InsertMerchantInfo(merchantInfo MerchantInfo) bool {
|
||||
o := orm.NewOrm()
|
||||
_, err := o.Insert(&merchantInfo)
|
||||
if err != nil {
|
||||
logs.Error("insert merchant fail: ", err)
|
||||
return false
|
||||
}
|
||||
return true
|
||||
}
|
||||
|
||||
func GetMerchantLenByMap(params map[string]string) int {
|
||||
o := orm.NewOrm()
|
||||
qs := o.QueryTable(MERCHANT_INFO)
|
||||
for k, v := range params {
|
||||
if len(v) > 0 {
|
||||
qs = qs.Filter(k, v)
|
||||
}
|
||||
}
|
||||
cnt, err := qs.Count()
|
||||
if err != nil {
|
||||
logs.Error("get merchant len by map fail: ", err)
|
||||
}
|
||||
return int(cnt)
|
||||
}
|
||||
|
||||
func GetMerchantListByMap(params map[string]string, displayCount, offset int) []MerchantInfo {
|
||||
o := orm.NewOrm()
|
||||
qs := o.QueryTable(MERCHANT_INFO)
|
||||
for k, v := range params {
|
||||
if len(v) > 0 {
|
||||
qs = qs.Filter(k, v)
|
||||
}
|
||||
}
|
||||
var merchantList []MerchantInfo
|
||||
_, err := qs.Limit(displayCount, offset).OrderBy("-update_time").All(&merchantList)
|
||||
if err != nil {
|
||||
logs.Error("get merchant list by map fail: ", err)
|
||||
}
|
||||
return merchantList
|
||||
}
|
||||
|
||||
func GetAllMerchant() []MerchantInfo {
|
||||
o := orm.NewOrm()
|
||||
var merchantList []MerchantInfo
|
||||
|
||||
_, err := o.QueryTable(MERCHANT_INFO).Limit(-1).All(&merchantList)
|
||||
if err != nil {
|
||||
logs.Error("get all merchant fail:", err)
|
||||
}
|
||||
|
||||
return merchantList
|
||||
}
|
||||
|
||||
func GetMerchantByParams(params map[string]string, displayCount, offset int) []MerchantInfo {
|
||||
o := orm.NewOrm()
|
||||
var merchantList []MerchantInfo
|
||||
qs := o.QueryTable(MERCHANT_INFO)
|
||||
for k, v := range params {
|
||||
if len(v) > 0 {
|
||||
qs = qs.Filter(k, v)
|
||||
}
|
||||
}
|
||||
|
||||
qs.Limit(displayCount, offset).All(&merchantList)
|
||||
|
||||
return merchantList
|
||||
}
|
||||
|
||||
func GetMerchantLenByParams(params map[string]string) int {
|
||||
o := orm.NewOrm()
|
||||
qs := o.QueryTable(MERCHANT_INFO)
|
||||
for k, v := range params {
|
||||
if len(v) > 0 {
|
||||
qs = qs.Filter(k, v)
|
||||
}
|
||||
}
|
||||
|
||||
cnt, err := qs.Limit(-1).Count()
|
||||
|
||||
if err != nil {
|
||||
logs.Error("get merchant len by params fail: ", err)
|
||||
}
|
||||
return int(cnt)
|
||||
}
|
||||
|
||||
func GetMerchantByUid(merchantUid string) MerchantInfo {
|
||||
o := orm.NewOrm()
|
||||
var merchantInfo MerchantInfo
|
||||
_, err := o.QueryTable(MERCHANT_INFO).Filter("merchant_uid", merchantUid).Limit(1).All(&merchantInfo)
|
||||
if err != nil {
|
||||
logs.Error("get merchant info fail: ", err)
|
||||
}
|
||||
return merchantInfo
|
||||
}
|
||||
|
||||
func UpdateMerchant(merchantInfo MerchantInfo) bool {
|
||||
o := orm.NewOrm()
|
||||
_, err := o.Update(&merchantInfo)
|
||||
|
||||
if err != nil {
|
||||
logs.Error("update merchant fail: ", err)
|
||||
return false
|
||||
}
|
||||
|
||||
return true
|
||||
}
|
||||
|
||||
func DeleteMerchantByUid(merchantUid string) bool {
|
||||
o := orm.NewOrm()
|
||||
_, err := o.QueryTable(MERCHANT_INFO).Filter("merchant_uid", merchantUid).Delete()
|
||||
if err != nil {
|
||||
logs.Error("delete merchant fail: ", err)
|
||||
return false
|
||||
}
|
||||
return true
|
||||
}
|
56
boss/models/merchant/merchant_load_info.go
Normal file
56
boss/models/merchant/merchant_load_info.go
Normal file
@@ -0,0 +1,56 @@
|
||||
/***************************************************
|
||||
** @Desc : This file for ...
|
||||
** @Time : 2019/11/22 13:07
|
||||
** @Author : yuebin
|
||||
** @File : merchant_load_info
|
||||
** @Last Modified by : yuebin
|
||||
** @Last Modified time: 2019/11/22 13:07
|
||||
** @Software: GoLand
|
||||
****************************************************/
|
||||
package merchant
|
||||
|
||||
import (
|
||||
"github.com/beego/beego/v2/client/orm"
|
||||
"github.com/beego/beego/v2/core/logs"
|
||||
)
|
||||
|
||||
type MerchantLoadInfo struct {
|
||||
Id int
|
||||
Status string
|
||||
MerchantUid string
|
||||
RoadUid string
|
||||
LoadDate string
|
||||
LoadAmount float64
|
||||
UpdateTime string
|
||||
CreateTime string
|
||||
}
|
||||
|
||||
const MERCHANT_LOAD_INFO = "merchant_load_info"
|
||||
|
||||
func GetMerchantLoadInfoByMap(params map[string]string) []MerchantLoadInfo {
|
||||
o := orm.NewOrm()
|
||||
qs := o.QueryTable(MERCHANT_LOAD_INFO)
|
||||
for k, v := range params {
|
||||
if len(v) > 0 {
|
||||
qs = qs.Filter(k, v)
|
||||
}
|
||||
}
|
||||
var merchantLoadList []MerchantLoadInfo
|
||||
_, err := qs.Limit(-11).All(&merchantLoadList)
|
||||
if err != nil {
|
||||
logs.Error("get merchant load info fail: ", err)
|
||||
}
|
||||
return merchantLoadList
|
||||
}
|
||||
|
||||
func IsExistMerchantLoadByParams(params map[string]string) bool {
|
||||
o := orm.NewOrm()
|
||||
qs := o.QueryTable(MERCHANT_LOAD_INFO)
|
||||
for k, v := range params {
|
||||
if len(v) > 0 {
|
||||
qs = qs.Filter(k, v)
|
||||
}
|
||||
}
|
||||
|
||||
return qs.Exist()
|
||||
}
|
Reference in New Issue
Block a user