Browse Source

fix:bug

token_replace
黄梓健 5 years ago
parent
commit
ec4931b98f
  1. 2
      controllers/client/live.go
  2. 2
      controllers/client/shake_red_envelope.go
  3. 4
      controllers/client/sign.go
  4. 6
      controllers/pc/auction.go
  5. 6
      controllers/pc/order_draw.go
  6. 4
      controllers/pc/reward.go
  7. 4
      controllers/pc/shake_red_envelope.go
  8. 2
      controllers/pc/sign.go
  9. 2
      main.go
  10. 2
      models/arch.go
  11. 6
      models/live_viewer.go
  12. 10
      private.json
  13. 15
      services/ws_send/send.go
  14. 7
      utils/define/config.go
  15. 92
      utils/define/define.go

2
controllers/client/live.go

@ -227,7 +227,7 @@ func (t *LiveCtl) GetLiveRedPack() {
t.Assert(exist, code.MSG_SHAKERB_RULE_NOT_EXIST, "红包规则不存在")
t.Assert(rule.Status == 1, code.MSG_SHAKERB_RULE_NOT_EXIST, "红包规则尚未生效")
activity := models.Activity{}
activity := &models.Activity{}
exist, err = models.Get(activity, rule.ActivityId)
t.CheckErr(err)
t.Assert(exist, code.MSG_ACTIVITY_NOT_EXIST, "互动不存在")

2
controllers/client/shake_red_envelope.go

@ -73,7 +73,7 @@ func (t *ShakeRedEnvelopeCtl) Shake() {
t.Assert(r.Float64()*100 <= rule.Probability, code.MSG_SHAKERB_RECORD_NOT_HIT, "您与红包擦肩而过") // 必须在红包概率以内才能获取
// 增加session 或者乐观锁
exist, err = record.GetByRuleId(ruleId, activity.RehearsalId, 0)
exist, err = record.GetByRuleId(ruleId, activity.RehearsalId, 0, activity.ArchId)
t.CheckErr(err)
t.Assert(exist, code.MSG_SHAKERB_RECORD_NOT_HIT, "红包已经派发完毕")

4
controllers/client/sign.go

@ -22,8 +22,8 @@ func (t *SignCtl) CheckSign() {
uid := t.MustGetUID()
_type := t.MustGetInt("type")
activity := models.Activity{}
exist, err := models.Get(&activity, activityId)
activity := &models.Activity{}
exist, err := models.Get(activity, activityId)
t.CheckErr(err)
t.Assert(exist, code.MSG_ACTIVITY_NOT_EXIST, "互动不存在")

6
controllers/pc/auction.go

@ -145,12 +145,12 @@ func (t *AuctionCtl) History() {
auctionId := t.MustGetInt64("auction_activity_id")
rehearsalId := t.MustGetInt64("rehearsal_id")
auction := new(models.NewAuctionActivity)
auction := &models.NewAuctionActivity{}
exist, err := models.Get(auction, auctionId)
t.CheckErr(err)
t.Assert(exist, code.MSG_AUCTION_NOT_EXIST, "竞拍不存在")
activity := models.Activity{}
activity := &models.Activity{}
exist, err = models.Get(activity, auction.ActivityId)
t.CheckErr(err)
t.Assert(exist, code.MSG_ACTIVITY_NOT_EXIST, "互动不存在")
@ -183,7 +183,7 @@ func (t *AuctionCtl) List() {
activityId := t.MustGetInt64("activity_id")
rehearsalId := t.MustGetInt64("rehearsal_id")
activity := models.Activity{}
activity := &models.Activity{}
exist, err := models.Get(activity, activityId)
t.CheckErr(err)
t.Assert(exist, code.MSG_ACTIVITY_NOT_EXIST, "互动不存在")

6
controllers/pc/order_draw.go

@ -357,12 +357,12 @@ func (t *OrderDrawCtl) ListOfWinners() {
t.CheckErr(err)
t.Assert(exist, code.MSG_ORDER_RULE_NOT_EXIST, "订单抽奖规则不存在")
lottery := models.OrderDrawActivity{}
lottery := &models.OrderDrawActivity{}
exist, err = models.Get(lottery, rule.OrderDrawActivityId)
t.CheckErr(err)
t.Assert(exist, code.MSG_ORDER_RULE_NOT_EXIST, "订单抽奖规则不存在")
activity := models.Activity{}
activity := &models.Activity{}
exist, err = models.Get(activity, lottery.ActivityId)
t.CheckErr(err)
t.Assert(exist, code.MSG_ACTIVITY_NOT_EXIST, "互动不存在")
@ -389,7 +389,7 @@ type OrdersResult struct {
func (t *OrderDrawCtl) Orders() {
activityId := t.MustGetInt64("activity_id")
activity := models.Activity{}
activity := &models.Activity{}
exist, err := models.Get(activity, activityId)
t.CheckErr(err)
t.Assert(exist, code.MSG_ACTIVITY_NOT_EXIST, "互动不存在")

4
controllers/pc/reward.go

@ -21,7 +21,7 @@ type RewardCtl struct {
func (t *RewardCtl) Latest() {
activityId := t.MustGetInt64("activity_id")
activity := models.Activity{}
activity := &models.Activity{}
exist, err := models.Get(activity, activityId)
t.CheckErr(err)
t.Assert(exist, code.MSG_ACTIVITY_NOT_EXIST, "互动不存在")
@ -55,7 +55,7 @@ func (t *RewardCtl) WaitReview() {
activityId := t.MustGetInt64("activity_id")
//rehearsalId := t.MustGetInt64("rehearsal_id")
activity := models.Activity{}
activity := &models.Activity{}
exist, err := models.Get(activity, activityId)
t.CheckErr(err)
t.Assert(exist, code.MSG_ACTIVITY_NOT_EXIST, "互动不存在")

4
controllers/pc/shake_red_envelope.go

@ -249,7 +249,7 @@ func (t *ShakeRedEnvelopeCtl) Winners() {
t.CheckErr(err)
t.Assert(exist, code.MSG_SHAKERB_RULE_NOT_EXIST, "红包活动不存在")
activity := models.Activity{}
activity := &models.Activity{}
exist, err = models.Get(activity, redEnvelope.ActivityId)
t.CheckErr(err)
t.Assert(exist, code.MSG_ACTIVITY_NOT_EXIST, "互动不存在")
@ -280,7 +280,7 @@ func (t *ShakeRedEnvelopeCtl) Count() {
t.CheckErr(err)
t.Assert(exist, code.MSG_SHAKERB_RULE_NOT_EXIST, "红包活动不存在")
activity := models.Activity{}
activity := &models.Activity{}
exist, err = models.Get(activity, redEnvelope.ActivityId)
t.CheckErr(err)
t.Assert(exist, code.MSG_ACTIVITY_NOT_EXIST, "互动不存在")

2
controllers/pc/sign.go

@ -76,7 +76,7 @@ type SignResult struct {
func (t *SignCtl) SignInfo() {
activityId := t.MustGetInt64("activity_id")
activity := new(models.Activity)
activity := &models.Activity{}
exist, err := models.Get(activity, activityId)
t.CheckErr(err)
t.Assert(exist, code.MSG_ACTIVITY_NOT_EXIST, "互动不存在")

2
main.go

@ -6,10 +6,12 @@ import (
"hudongzhuanjia/controllers/client"
"hudongzhuanjia/controllers/common"
"hudongzhuanjia/controllers/pc"
"hudongzhuanjia/utils/define"
//_ "net/http/pprof"
)
func main() {
define.SetDebug(true)
// pc
core.GetInstanceRouterManage().Registered(new(pc.WsCtl)) // 用户

2
models/arch.go

@ -23,5 +23,5 @@ func (t *Arch) TableName() string {
}
func (t *Arch) Count(activityId interface{}) (int64, error) {
return core.GetXormAuto().Where("is_delete=0 and activity_id=?", activityId).Get(t)
return core.GetXormAuto().Where("is_delete=0 and activity_id=?", activityId).Count(t)
}

6
models/live_viewer.go

@ -54,8 +54,10 @@ func (t *LiveViewer) Record(uid, aid, lid int64) error {
func GetLiveViewerByLiveConfigIds(ids interface{}) ([]*LiveViewer, error) {
viewers := make([]*LiveViewer, 0)
err := core.GetXormAuto().Table(&LiveViewer{}).Alias("l").Join("left", Alias(&Activity{}, "a"),
"a.id=l.activity_id and l.arch_id=a.arch_id").Where("is_delete=0").In("live_config_id", ids).
err := core.GetXormAuto().Table(&LiveViewer{}).Alias("l").
Join("left", Alias(&Activity{}, "a"),
"a.id=l.activity_id and l.arch_id=a.arch_id").
Where("l.is_delete=0").In("l.live_config_id", ids).
Find(&viewers)
return viewers, err
}

10
private.json

@ -1,10 +1,10 @@
{
"db": {
"host": "gz-cdb-onvbcfqn.sql.tencentcdb.com",
"port": "61232",
"user": "root",
"password": "Pox2210XXa@",
"name": "hudongzhuanjia",
"host": "ouxuanhudongtest.t.3pr.com.cn",
"port": "3306",
"user": "ouxuanhudongtest",
"password": "wXrzerxEBGTYs28M",
"name": "ouxuanhudongtest",
"prefix": "ox_",
"max_open_conn": 500
}

15
services/ws_send/send.go

@ -2,14 +2,13 @@ package ws_send_service
import (
"github.com/kirinlabs/HttpRequest"
"hudongzhuanjia/utils/define"
)
var SendUrl = "https://api.ouxuanhudong.com:20182/PcClient/Connect/MessageCtl/Receive"
// https://api.hudongzhuanjia.com:20182/PcClient/Connect/MessageCtl/Receive
// func init() {
// SendUrl = "http://127.0.0.1:20182/PcClient/Handle/MessageCtl/receive"
// define.SendUrl = "http://127.0.0.1:20182/PcClient/Handle/MessageCtl/receive"
// }
type Message struct {
@ -29,7 +28,7 @@ func SendUpperWall(roomId string, tag string, dest int64, data map[string]interf
RoomId: roomId,
Data: data,
}
HttpRequest.Debug(true).JSON().Post(SendUrl, HttpRequest.Json(&m))
HttpRequest.Debug(true).JSON().Post(define.SendUrl, HttpRequest.Json(&m))
}
func SendShakeRedEnvelope(roomId string, tag string, dest int64, data map[string]interface{}) {
@ -40,7 +39,7 @@ func SendShakeRedEnvelope(roomId string, tag string, dest int64, data map[string
RoomId: roomId,
Data: data,
}
HttpRequest.Debug(true).JSON().Post(SendUrl, HttpRequest.Json(&m))
HttpRequest.Debug(true).JSON().Post(define.SendUrl, HttpRequest.Json(&m))
}
func SendBarrage(roomId string, tag string, dest int64, data map[string]interface{}) {
@ -51,7 +50,7 @@ func SendBarrage(roomId string, tag string, dest int64, data map[string]interfac
RoomId: roomId,
Data: data,
}
HttpRequest.Debug(true).JSON().Post(SendUrl, HttpRequest.Json(&m))
HttpRequest.Debug(true).JSON().Post(define.SendUrl, HttpRequest.Json(&m))
}
func SendSign(roomId string, tag string, dest int64, data map[string]interface{}) {
@ -62,7 +61,7 @@ func SendSign(roomId string, tag string, dest int64, data map[string]interface{}
RoomId: roomId,
Data: data,
}
HttpRequest.Debug(true).JSON().Post(SendUrl, HttpRequest.Json(&m))
HttpRequest.Debug(true).JSON().Post(define.SendUrl, HttpRequest.Json(&m))
}
func SendAuction(roomId string, tag string, dest int64, data map[string]interface{}) {
@ -73,7 +72,7 @@ func SendAuction(roomId string, tag string, dest int64, data map[string]interfac
Dest: dest,
Data: data,
}
HttpRequest.Debug(true).JSON().Post(SendUrl, HttpRequest.Json(&m))
HttpRequest.Debug(true).JSON().Post(define.SendUrl, HttpRequest.Json(&m))
}
// 可以设置通用的ws链接进行通信

7
utils/define/config.go

@ -17,10 +17,9 @@ func SetDebug(modes ...bool) {
}
var (
SendUrl = "https://api.ouxuanhudong.com:20182/PcClient/Connect/MessageCtl/Receive"
RoomPrefix = ""
HOST = "https://api.ouxuanhudong.com"
H5Host = "https://h5.ouxuanhudong.com/web"
SendUrl = "https://api.ouxuanhudong.com:20182/PcClient/Connect/MessageCtl/Receive"
HOST = "https://api.ouxuanhudong.com"
H5Host = "https://h5.ouxuanhudong.com/web"
)
const (

92
utils/define/define.go

@ -57,26 +57,26 @@ const (
TOKEN = "token"
)
const (
WSSENDURL = "https://api.ouxuanhudong.com:20182/PcClient/Handle/MessageCtl/Receive"
HOST = "https://api.ouxuanhudong.com"
H5Host = "https://h5.ouxuanhudong.com/web"
)
const (
H5Index = "index.html"
H5SignIn = "SignIn.html"
H5ShakeRb = "shakeRb.html"
H5TugOfWar = "tugOfWar.html"
H5UpperWall = "UpperWall.html"
H5Barrage = "barrage.html"
H5Order = "order.html"
H5Reward = "reward.html"
H5BScreen = "bScreen.html"
H5Auction = "auction.html"
H5Vote = "vote.html"
H5Calorie = "calorie.html"
)
//const (
// WSSENDURL = "https://api.ouxuanhudong.com:20182/PcClient/Handle/MessageCtl/Receive"
// HOST = "https://api.ouxuanhudong.com"
// H5Host = "https://h5.ouxuanhudong.com/web"
//)
//const (
// H5Index = "index.html"
// H5SignIn = "SignIn.html"
// H5ShakeRb = "shakeRb.html"
// H5TugOfWar = "tugOfWar.html"
// H5UpperWall = "UpperWall.html"
// H5Barrage = "barrage.html"
// H5Order = "order.html"
// H5Reward = "reward.html"
// H5BScreen = "bScreen.html"
// H5Auction = "auction.html"
// H5Vote = "vote.html"
// H5Calorie = "calorie.html"
//)
const (
TYPE_H5USER = "h5user"
@ -85,34 +85,34 @@ const (
)
// 固定长度
var DefaultOrderNo = 10000000000
//var DefaultOrderNo = 10000000000
// 微信常量
const (
// 欧轩互动 -> 普通商户
ApiKey = `2c82c64ceec6ba89ffc9f593c671a12f`
WxAppId = `wx7b0bcf476552c5e9`
Secret = `f6aabdd40ea25272f4442603a7dc8028`
AppId = `wx7b0bcf476552c5e9`
MchId = `1394404502`
SubMchId = ``
// 欧轩 -> 服务商
//ApiKey = `6e281c8b5430c674034594cab789334F`
//AppId = `wx662a1633304bfd42`
//WxAppId = `wx662a1633304bfd42`
//Secret = `7e4ecfe06ad1e075c210059d5b0162a3`
//MchId = `1441266702`
//SubMchId = `1394404502`
//SubMchId = `1594049151`
// 认证服务号:欧轩(用于申请微信服务商)
// AppID:wx662a1633304bfd42
// 密钥:7e4ecfe06ad1e075c210059d5b0162a3
WxHost = `https://api.mch.weixin.qq.com`
WxBack = `https://api2.mch.weixin.qq.com`
ClientIp = `123.207.246.51`
)
//const (
// // 欧轩互动 -> 普通商户
// ApiKey = `2c82c64ceec6ba89ffc9f593c671a12f`
// WxAppId = `wx7b0bcf476552c5e9`
// Secret = `f6aabdd40ea25272f4442603a7dc8028`
// AppId = `wx7b0bcf476552c5e9`
// MchId = `1394404502`
// SubMchId = ``
//
// // 欧轩 -> 服务商
// //ApiKey = `6e281c8b5430c674034594cab789334F`
// //AppId = `wx662a1633304bfd42`
// //WxAppId = `wx662a1633304bfd42`
// //Secret = `7e4ecfe06ad1e075c210059d5b0162a3`
// //MchId = `1441266702`
// //SubMchId = `1394404502`
// //SubMchId = `1594049151`
// // 认证服务号:欧轩(用于申请微信服务商)
// // AppID:wx662a1633304bfd42
// // 密钥:7e4ecfe06ad1e075c210059d5b0162a3
//
// WxHost = `https://api.mch.weixin.qq.com`
// WxBack = `https://api2.mch.weixin.qq.com`
// ClientIp = `123.207.246.51`
//)
const (
CODE_SUCCESS = "SUCCESS" // 成功

Loading…
Cancel
Save