Commit 7cfe5f2a by zhangjie

1. 通联用户ID的前缀修改到配置文件,以分离生产和测试环境用户

parent 985a229e
......@@ -4,26 +4,16 @@
<option name="autoReloadType" value="ALL" />
</component>
<component name="ChangeListManager">
<list default="true" id="d8ed78cd-bda7-467e-9bd3-d1cee57e3c79" name="变更" comment="">
<change afterPath="$PROJECT_DIR$/util/TimeConver.go" afterDir="false" />
<change beforePath="$PROJECT_DIR$/.idea/.gitignore" beforeDir="false" />
<change beforePath="$PROJECT_DIR$/.idea/inspectionProfiles/Project_Default.xml" beforeDir="false" />
<list default="true" id="d8ed78cd-bda7-467e-9bd3-d1cee57e3c79" name="变更" comment="1. 支付修改为通联支付">
<change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
<change beforePath="$PROJECT_DIR$/config.ini" beforeDir="false" afterPath="$PROJECT_DIR$/config.ini" afterDir="false" />
<change beforePath="$PROJECT_DIR$/customerServer.new" beforeDir="false" afterPath="$PROJECT_DIR$/customerServer.new" afterDir="false" />
<change beforePath="$PROJECT_DIR$/data_db_cache/dbcurd/d_update_record.go" beforeDir="false" afterPath="$PROJECT_DIR$/data_db_cache/dbcurd/d_update_record.go" afterDir="false" />
<change beforePath="$PROJECT_DIR$/docs/docs.go" beforeDir="false" afterPath="$PROJECT_DIR$/docs/docs.go" afterDir="false" />
<change beforePath="$PROJECT_DIR$/docs/swagger.json" beforeDir="false" afterPath="$PROJECT_DIR$/docs/swagger.json" afterDir="false" />
<change beforePath="$PROJECT_DIR$/docs/swagger.yaml" beforeDir="false" afterPath="$PROJECT_DIR$/docs/swagger.yaml" afterDir="false" />
<change beforePath="$PROJECT_DIR$/go.mod" beforeDir="false" afterPath="$PROJECT_DIR$/go.mod" afterDir="false" />
<change beforePath="$PROJECT_DIR$/go.sum" beforeDir="false" afterPath="$PROJECT_DIR$/go.sum" afterDir="false" />
<change beforePath="$PROJECT_DIR$/log/cDebug.log" beforeDir="false" />
<change beforePath="$PROJECT_DIR$/log/cInfo.log" beforeDir="false" />
<change beforePath="$PROJECT_DIR$/log/gErr.log" beforeDir="false" />
<change beforePath="$PROJECT_DIR$/log/gInfo.log" beforeDir="false" />
<change beforePath="$PROJECT_DIR$/log/gWarn.log" beforeDir="false" />
<change beforePath="$PROJECT_DIR$/log/sErr.log" beforeDir="false" />
<change beforePath="$PROJECT_DIR$/log/sInfo.log" beforeDir="false" />
<change beforePath="$PROJECT_DIR$/main.go" beforeDir="false" afterPath="$PROJECT_DIR$/main.go" afterDir="false" />
<change beforePath="$PROJECT_DIR$/data_db_cache/cache/cmap_areaServicePhonePayListSplit.go" beforeDir="false" afterPath="$PROJECT_DIR$/data_db_cache/cache/cmap_areaServicePhonePayListSplit.go" afterDir="false" />
<change beforePath="$PROJECT_DIR$/data_db_cache/cache/cmap_areaservice.go" beforeDir="false" afterPath="$PROJECT_DIR$/data_db_cache/cache/cmap_areaservice.go" afterDir="false" />
<change beforePath="$PROJECT_DIR$/log/gInfo.log" beforeDir="false" afterPath="$PROJECT_DIR$/log/gInfo.log" afterDir="false" />
<change beforePath="$PROJECT_DIR$/log/sInfo.log" beforeDir="false" afterPath="$PROJECT_DIR$/log/sInfo.log" afterDir="false" />
<change beforePath="$PROJECT_DIR$/thirdapi/allinpay/allinpay.go" beforeDir="false" afterPath="$PROJECT_DIR$/thirdapi/allinpay/allinpay.go" afterDir="false" />
<change beforePath="$PROJECT_DIR$/util/setting/setting.go" beforeDir="false" afterPath="$PROJECT_DIR$/util/setting/setting.go" afterDir="false" />
</list>
<option name="SHOW_DIALOG" value="false" />
<option name="HIGHLIGHT_CONFLICTS" value="true" />
......@@ -50,7 +40,7 @@
<property name="go.import.settings.migrated" value="true" />
<property name="go.modules.go.list.on.any.changes.was.set" value="true" />
<property name="go.sdk.automatically.set" value="true" />
<property name="last_opened_file_path" value="$PROJECT_DIR$/../dc_golang_server1_admin" />
<property name="last_opened_file_path" value="$PROJECT_DIR$" />
</component>
<component name="RecentsManager">
<key name="MoveFile.RECENT_KEYS">
......@@ -84,6 +74,10 @@
</option>
<option name="oldMeFiltersMigrated" value="true" />
</component>
<component name="VcsManagerConfiguration">
<MESSAGE value="1. 支付修改为通联支付" />
<option name="LAST_COMMIT_MESSAGE" value="1. 支付修改为通联支付" />
</component>
<component name="VgoProject">
<integration-enabled>true</integration-enabled>
</component>
......
[allin_pay]
#测试 K12B 正式 K12B-
AdminHead = K12B
#测试 K12U 正式 K12U-
CustomerHead = K12U
[sys_para]
#每个用户允许添加的亲情号数量
MaxFamilyNum = 2
......
No preview for this file type
......@@ -10,27 +10,27 @@ import (
"time"
)
func areaServicePhonePayListMapAddSplit(){ // 区域服务收款项列表添加分账列表
func areaServicePhonePayListMapAddSplit() { // 区域服务收款项列表添加分账列表
// 遍历 areaServicePhonePayListMap 中的 每一个areaServiceID的每一个[]model.CacheAreaServicePhonePayListStruct,去查询分账信息
fmt.Println(time.Now(),"cache: init areaServicePhonePayListMap SplitAmount begin")
fmt.Println(time.Now(), "cache: init areaServicePhonePayListMap SplitAmount begin")
areaServicePhonePayListMap.Range(func(key, value interface{}) bool {
if list, ok := value.([]model.CacheAreaServicePhonePayListStruct);ok{
for _,v := range list{
if list, ok := value.([]model.CacheAreaServicePhonePayListStruct); ok {
for _, v := range list {
v.SplitAmount = areaServicePhonePayListMapAddSplitByPayListID(v.ID) // todoN 可考虑校验分账之和是否等于amount,因设置时做了校验,现暂时不判断
}
} else {
areaServicePhonePayListMap.Delete(key)
fmt.Println("---------------error-error-error: value.([]model.CacheAreaServicePhonePayListStruct) != ok",key,value)
fmt.Println("---------------error-error-error: value.([]model.CacheAreaServicePhonePayListStruct) != ok", key, value)
}
return true
})
fmt.Println(time.Now(),"init areaServicePhonePayListMap SplitAmount end")
fmt.Println(time.Now(), "init areaServicePhonePayListMap SplitAmount end")
}
func areaServicePhonePayListMapAddSplitByPayListID(payListID uint32) (res []model.PhonePaySplitMoneyStruct) {
rows,err := dbcurd.PgDb.Query("SELECT admin_id,amount FROM b_phone_pay_split_money WHERE pay_list_id=$1",payListID) //
rows, err := dbcurd.PgDb.Query("SELECT admin_id,amount FROM b_pay_split_money WHERE pay_list_id=$1", payListID) //
if err != nil {
log.Panicln("areaServicePhonePayListMapAddSplit rows", err)
}
......@@ -42,14 +42,14 @@ func areaServicePhonePayListMapAddSplitByPayListID(payListID uint32) (res []mode
if err != nil {
log.Panicln("initAreaServicePhonePayListMap rows.Scan", err)
}
res = append(res,temp)
res = append(res, temp)
}
// 处理完毕后,需要判断一次遍历过程中是否有错误产生
if err = rows.Err(); err != nil {
logger.Log.Error("rows.Err()",
zap.Error(err),
zap.String("src", "initAreaServicePhonePayListMap"))
fmt.Println(time.Now(), "areaServicePhonePayListMapAddSplitByPayListID rows.Err()", err,payListID)
fmt.Println(time.Now(), "areaServicePhonePayListMapAddSplitByPayListID rows.Err()", err, payListID)
}
return
......
......@@ -17,7 +17,7 @@ func initAreaServiceMap() {
fmt.Println(time.Now(), "cache: initAreaServiceMap begin")
//rows, err := dbcurd.PgDb.Query("SELECT id,service_type,name,area_id,operator_id,status,pay_admin_id,service_phone FROM b_area_service WHERE status!=0 ORDER BY create_at DESC") //
rows, err := dbcurd.PgDb.Query("SELECT id,service_type,name,area_id,operator_id,status,pay_admin_id,service_phone,activate_fee,replace_fee FROM b_area_service" +
" LEFT JOIN b_phone_card_fee ON area_service_id=id WHERE status!=0 ORDER BY b_area_service.create_at") // 220208 增加开卡费和补卡费
" LEFT JOIN b_card_fee ON area_service_id=id WHERE status!=0 ORDER BY b_area_service.create_at") // 220208 增加开卡费和补卡费
if err != nil {
log.Panicln("initAreaServiceMap rows", err)
}
......
{"ts":"2022-02-17 17:59:35.710","msg":"read error","Src":"TCP-SERVER-connectionHandle","DevID":0,"Conn":"127.0.0.1:52696","error":"read tcp4 127.0.0.1:8010->127.0.0.1:52696: i/o timeout"}
{"ts":"2022-02-17 18:07:50.197","msg":"read error","Src":"TCP-SERVER-connectionHandle","DevID":0,"Conn":"127.0.0.1:52770","error":"EOF"}
{"ts":"2022-02-18 20:30:22.544","msg":"read error","Src":"TCP-SERVER-connectionHandle","DevID":0,"Conn":"127.0.0.1:57132","error":"EOF"}
{"ts":"2022-02-18 20:30:38.775","msg":"read error","Src":"TCP-SERVER-connectionHandle","DevID":0,"Conn":"127.0.0.1:50860","error":"EOF"}
{"ts":"2022-02-18 20:30:56.130","msg":"read error","Src":"TCP-SERVER-connectionHandle","DevID":0,"Conn":"127.0.0.1:54929","error":"EOF"}
......@@ -105,7 +105,7 @@ type WxMiniRequestPayment struct {
}
func Pay(req *ConsumeApplyStruct) *WxMiniRequestPayment { //
payerID := "K12U" + strconv.FormatUint(uint64(req.UserID), 10)
payerID := setting.AllinPayCustomerHead + strconv.FormatUint(uint64(req.UserID), 10)
if !creatPayMember(payerID) {
return nil //,"服务器忙,请重试"
}
......@@ -148,7 +148,7 @@ func Pay(req *ConsumeApplyStruct) *WxMiniRequestPayment { //
Source uint8 `json:"source"` // 访问终端类型 1 Mobile
}{
PayerId: payerID,
RecieverId: "K12B" + strconv.FormatUint(uint64(req.AreaServiceAllinPayID), 10),
RecieverId: setting.AllinPayAdminHead + strconv.FormatUint(uint64(req.AreaServiceAllinPayID), 10),
BizOrderNo: req.OrderNum,
Amount: req.Amount,
//Fee: uint32(float64(req.Amount)*feeRate/1000+0.5),
......@@ -176,13 +176,13 @@ func Pay(req *ConsumeApplyStruct) *WxMiniRequestPayment { //
Source: 1,
}
bizContent.SplitRule = make([]splitRuleStruct,len(req.SplitAmount))
bizContent.SplitRule = make([]splitRuleStruct, len(req.SplitAmount))
//var totalSplitAmount int32 // 分账给其他人的总金额
for i,v := range req.SplitAmount {
bizContent.SplitRule[i].BizUserId = "K12B" + strconv.FormatUint(uint64(v.AdminID),10)
for i, v := range req.SplitAmount {
bizContent.SplitRule[i].BizUserId = setting.AllinPayAdminHead + strconv.FormatUint(uint64(v.AdminID), 10)
bizContent.SplitRule[i].Amount = v.Amount
bizContent.SplitRule[i].Fee = uint32(float64(v.Amount)*feeRate/1000+0.5)
bizContent.SplitRule[i].Fee = uint32(float64(v.Amount)*feeRate/1000 + 0.5)
bizContent.Fee += bizContent.SplitRule[i].Fee
bizContent.SplitRule[i].Remark = v.Remark
//totalSplitAmount += v.Amount
......@@ -196,7 +196,7 @@ func Pay(req *ConsumeApplyStruct) *WxMiniRequestPayment { //
// return nil
//} else if req.Amount > totalSplitAmount { // 剩下的钱收款主体收
// bizContent.SplitRule = append(bizContent.SplitRule,splitRuleStruct{
// "K12B" + strconv.FormatUint(uint64(req.AreaServiceAllinPayID),10),
// setting.AllinPayAdminHead + strconv.FormatUint(uint64(req.AreaServiceAllinPayID),10),
// req.Amount - totalSplitAmount,
// uint32(float64(req.Amount - totalSplitAmount)*feeRate/1000+0.5),
// "",
......@@ -259,7 +259,7 @@ func PayCallback(c *gin.Context) {
return
}
reqData := verifySignAndGetValue(string(buf))
if reqData == nil{
if reqData == nil {
c.Status(404)
return
}
......@@ -356,7 +356,7 @@ func PayCallback(c *gin.Context) {
Acct string `json:"acct"` // 支付人 openid
Status string `json:"status"` // 订单是否成功 “OK”标识支付成功 “pending”表示进行中(中间状态) “error”表示支付失败 提现在成功和失败时都会通知商户;其他订单只在成功时会通知商户。
}
err = json.Unmarshal([]byte(reqData["bizContent"][0]),&orderData)
err = json.Unmarshal([]byte(reqData["bizContent"][0]), &orderData)
if err != nil {
logger.Log.Error("PayCallback json.Unmarshal([]byte(reqData[\"bizContent\"][0]),&orderData) err", zap.String("reqStr", string(buf)), zap.Reflect("reqData", reqData), zap.Error(err))
c.Status(404)
......@@ -381,35 +381,35 @@ func PayCallback(c *gin.Context) {
c.Status(404)
return
}
if len(orderBytes)!=21 {
if len(orderBytes) != 21 {
logger.Log.Error("PayCallback len(orderBytes)!=21", zap.String("reqStr", string(buf)), zap.Reflect("reqData", reqData))
c.Status(404)
return // 订单号都不对,看看要不要回复它,免得它一直发
}
//订单号生成规则:4B cardUserID,4B到期时间,4B 金额amount,8B 时间纳秒
cardUserID := uint32(orderBytes[0])<<24 + uint32(orderBytes[1])<<16 +uint32(orderBytes[2])<<8 + uint32(orderBytes[3])
expiryUnix := int64(orderBytes[4])<<24 + int64(orderBytes[5])<<16 +int64(orderBytes[6])<<8 + int64(orderBytes[7])
cardUserID := uint32(orderBytes[0])<<24 + uint32(orderBytes[1])<<16 + uint32(orderBytes[2])<<8 + uint32(orderBytes[3])
expiryUnix := int64(orderBytes[4])<<24 + int64(orderBytes[5])<<16 + int64(orderBytes[6])<<8 + int64(orderBytes[7])
// amount := uint32(orderBytes[8])<<24 + uint32(orderBytes[9])<<16 +uint32(orderBytes[10])<<8 + uint32(orderBytes[11])
if int(orderBytes[8])<<24 + int(orderBytes[9])<<16 +int(orderBytes[10])<<8 + int(orderBytes[11]) != orderData.Amount {
logger.Log.Error("PayCallback uint32(amount) != reqData.BizContent.Amount",zap.String("reqStr", string(buf)), zap.Reflect("reqData", reqData))
if int(orderBytes[8])<<24+int(orderBytes[9])<<16+int(orderBytes[10])<<8+int(orderBytes[11]) != orderData.Amount {
logger.Log.Error("PayCallback uint32(amount) != reqData.BizContent.Amount", zap.String("reqStr", string(buf)), zap.Reflect("reqData", reqData))
c.Status(404)
return// 订单金额不对,看看要不要回复它,免得它一直发
return // 订单金额不对,看看要不要回复它,免得它一直发
}
logger.LogHttpClient.Debug("PayCallback", zap.String("reqStr", string(buf)), zap.Reflect("reqData", reqData))
fee,err := strconv.ParseUint(orderData.ChannelFee,10,32)
fee, err := strconv.ParseUint(orderData.ChannelFee, 10, 32)
if err != nil {
logger.Log.Error("PayCallback ChannelFee err", zap.String("reqStr", string(buf)), zap.Reflect("reqData", reqData), zap.Error(err))
}
payTime,err := time.Parse("2006-01-02 15:04:05",orderData.PayDatetime)
payTime, err := time.Parse("2006-01-02 15:04:05", orderData.PayDatetime)
if err != nil {
logger.Log.Error("PayCallback payTime,err := time.Parse(\"2006-01-02 15:04:05\",orderData.PayDatetime) err", zap.String("reqStr", string(buf)), zap.Reflect("reqData", reqData), zap.Error(err))
payTime = time.Now()
}
expiry := time.Unix(expiryUnix,0)
expiry := time.Unix(expiryUnix, 0)
// 1. 更新库 用事务处理
if dbcurd.UpdateUPhonePayRecordPayAtAndUCardUserPhoneExpiryTransaction(&dbcurd.UpdateUPhonePayRecordStruct{
CardUserID: cardUserID,
......@@ -433,7 +433,7 @@ func PayCallback(c *gin.Context) {
// "message": "成功",
//})
} else {
logger.Log.Error("PayCallback dbcurd.UpdateUPhonePayRecordPayAtAndUCardUserPhoneExpiryTransaction false",zap.String("reqStr", string(buf)), zap.Reflect("reqData", reqData))
logger.Log.Error("PayCallback dbcurd.UpdateUPhonePayRecordPayAtAndUCardUserPhoneExpiryTransaction false", zap.String("reqStr", string(buf)), zap.Reflect("reqData", reqData))
c.Status(404)
}
}
......
......@@ -7,6 +7,9 @@ import (
)
var (
AllinPayAdminHead string
AllinPayCustomerHead string
MaxFamilyNum int
DbDSN string
......@@ -56,6 +59,9 @@ func Init() {
panic("配置文件读取错误")
}
AllinPayAdminHead = file.Section("allin_pay").Key("AdminHead").MustString("K12B")
AllinPayCustomerHead = file.Section("allin_pay").Key("CustomerHead").MustString("K12U")
MaxFamilyNum = file.Section("sys_para").Key("MaxFamilyNum").MustInt(2)
DbDSN = file.Section("database").Key("dbDSN").MustString("user=higher password=hj^&bhjb789j$^* dbname=jeff_study host=pgm-2ze3yp0bss39cxvh1o.pg.rds.aliyuncs.com port=1921 sslmode=disable")
......
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