diff --git a/.gitignore b/.gitignore index 5fa28e2..30a103e 100644 --- a/.gitignore +++ b/.gitignore @@ -21,4 +21,3 @@ go_build_main_go .log -services/pay/bindata.go \ No newline at end of file diff --git a/controllers/author.go b/controllers/author.go index 8c8e508..47ca32a 100644 --- a/controllers/author.go +++ b/controllers/author.go @@ -47,6 +47,9 @@ func (t *AuthorCtl) MustGetActivityId() int64 { } func (t *AuthorCtl) MustGetCustomerId() int64 { + if t.claims.CustomerId == 0 { + return t.MustGetInt64("customer_id") + } return t.claims.CustomerId } diff --git a/controllers/client/barrage.go b/controllers/client/barrage.go index fdd89e9..7c88632 100644 --- a/controllers/client/barrage.go +++ b/controllers/client/barrage.go @@ -4,6 +4,7 @@ import ( "fmt" "github.com/ouxuanserver/osmanthuswine/src/core" "hudongzhuanjia/controllers" + "hudongzhuanjia/libs/filter" "hudongzhuanjia/models" ws_send_service "hudongzhuanjia/services/ws_send" "hudongzhuanjia/utils/code" @@ -24,9 +25,10 @@ func (t *BarrageCtl) Send() { content := t.MustGet("content") //检查内容是否包含敏感 - if models.IsSensitive(content) { - t.ERROR("内容包含敏感字", code.MSG_ERR) - } + //if models.IsSensitive(content) { + // t.ERROR("内容包含敏感字", code.MSG_ERR) + //} + content = filter.Replace(content) //查询该活动的所属客户 activity := new(models.Activity) diff --git a/controllers/client/bully_screen.go b/controllers/client/bully_screen.go index 37ea1f8..9973dee 100644 --- a/controllers/client/bully_screen.go +++ b/controllers/client/bully_screen.go @@ -2,6 +2,7 @@ package client import ( "hudongzhuanjia/controllers" + "hudongzhuanjia/libs/filter" "hudongzhuanjia/models" bully_screen_service "hudongzhuanjia/services/bully_screen" "hudongzhuanjia/services/pay" @@ -33,9 +34,10 @@ func (t *BullyScreenCtl) PaScreen() { t.CheckRunning(activity.Status) //检查内容是否包含敏感 - if models.IsSensitive(content) { - t.ERROR("内容包含敏感字", code.MSG_ERR) - } + //if models.IsSensitive(content) { + // t.ERROR("内容包含敏感字", code.MSG_ERR) + //} + content = filter.Replace(content) //查询该活动的的霸屏服务id bullyScreenServer := new(models.BullyScreenServer) diff --git a/controllers/client/live.go b/controllers/client/live.go index d4bc38a..61ff763 100644 --- a/controllers/client/live.go +++ b/controllers/client/live.go @@ -2,8 +2,13 @@ package client import ( "hudongzhuanjia/controllers" + "hudongzhuanjia/libs/filter" "hudongzhuanjia/models" + pay_service "hudongzhuanjia/services/pay" + red_envelope_service "hudongzhuanjia/services/red_envelope" "hudongzhuanjia/utils/code" + "strings" + "time" ) type LiveCtl struct { @@ -65,3 +70,76 @@ func (t *LiveCtl) LoopQuery() { "watch": live.WatchNum, }) } + +// 发送红包 +func (t *LiveCtl) SendLiveRedPack() { + userId := t.MustGetUID() // 用户 uid + activityId := t.MustGetInt64("activity_id") // activity_id + num := t.MustGetInt("num") // 红包数量 + amount := t.MustGetDouble("amount") // 金额 + prompt := t.MustGet("prompt") // 提示 + + user := models.User{} + exist, err := models.GetById(&user, userId) + t.CheckErr(err) + t.Assert(exist, code.MSG_USER_NOT_EXIST, "用户不存在") + + ip := strings.Split(t.Request.OriginRequest.RemoteAddr, ":") + res, err := pay_service.Order("欧轩互动-直播红包", ip[0], user.Openid, int(amount*100), 3, userId, activityId) + t.CheckErr(err) + + info := models.LiveRedPackInfo{} + info.UserOrderId = res["user_order_id"].(int64) + info.Amount = amount + info.UserId = userId + info.ActivityId = activityId + info.Prompt = prompt + info.IsDelete = false + info.UpdatedAt = time.Now() + info.CreatedAt = time.Now() + _, err = info.Add() + t.CheckErr(err) + + redPacks := red_envelope_service.GenRedPack(int(amount*100), num) + for _, v := range redPacks { + redPack := new(models.LiveRedPack) + redPack.LiveRedPackInfoId = info.Id + redPack.ActivityId = activityId + redPack.Receiver = 0 + redPack.Amount = float64(v) / 100 + redPack.CreatedAt = time.Now() + redPack.UpdatedAt = time.Now() + _, err = redPack.Add() + t.CheckErr(err) + } + info.Prompt = filter.Replace(info.Prompt) + t.JSON(info) +} + +func (t *LiveCtl) QueryRedPack() { + +} + +// 领取红包 +func (t *LiveCtl) GetRedPack() { + liveRedPackInfoId := t.MustGetInt64("live_red_pack_info_id") + userId := t.MustGetUID() + + redPack := new(models.LiveRedPack) + exist, err := redPack.GetByInfoId(liveRedPackInfoId) + t.CheckErr(err) + if !exist { + // 通知其他的人 + t.ERROR("红包被领完了", code.MSG_LIVE_RED_PACK_NOT_EXIST) + return + } + + // 乐观锁 ==> 防止并发 + row, err := redPack.Receive(userId) + t.CheckErr(err) + if row != 1 { + t.ERROR("红包被领完了", code.MSG_LIVE_RED_PACK_NOT_EXIST) + return + } + t.JSON(redPack) +} diff --git a/controllers/client/reward.go b/controllers/client/reward.go index e9e539c..2d15ce3 100644 --- a/controllers/client/reward.go +++ b/controllers/client/reward.go @@ -2,6 +2,7 @@ package client import ( "hudongzhuanjia/controllers" + "hudongzhuanjia/libs/filter" "hudongzhuanjia/models" pay_service "hudongzhuanjia/services/pay" "hudongzhuanjia/utils" @@ -27,9 +28,10 @@ func (t *RewardCtl) Reward() { t.ERROR("打赏金额不能小于0", code.MSG_ERR_Param) } //检查内容是否包含敏感 - if models.IsSensitive(content) { - t.ERROR("内容包含敏感字", code.MSG_ERR) - } + //if models.IsSensitive(content) { + // t.ERROR("内容包含敏感字", code.MSG_ERR) + //} + content = filter.Replace(content) activity := new(models.Activity) exist, err := models.GetById(activity, activityId) diff --git a/controllers/common/wechat_oauth.go b/controllers/common/wechat_oauth.go index 94c86fc..e71162e 100644 --- a/controllers/common/wechat_oauth.go +++ b/controllers/common/wechat_oauth.go @@ -5,6 +5,7 @@ import ( "encoding/xml" "fmt" "hudongzhuanjia/controllers" + "hudongzhuanjia/libs/filter" "hudongzhuanjia/logger" "hudongzhuanjia/services/pay" "os" @@ -34,11 +35,13 @@ func (t *WeChatOauthCtl) Oauth() { } func (t *WeChatOauthCtl) Checkin() { + content, _ := t.Get("content") path, _ := os.Getwd() t.JSON(map[string]interface{}{ "success": "你好, tommy黄梓健", "version": Now, "wd": path, + "content": filter.Replace(content), }) } diff --git a/go.mod b/go.mod index 197f424..667101f 100644 --- a/go.mod +++ b/go.mod @@ -13,6 +13,7 @@ require ( github.com/gorilla/websocket v1.4.0 github.com/iGoogle-ink/gopay v1.5.1 // indirect github.com/iGoogle-ink/gopay/v2 v2.0.5 + github.com/importcjj/sensitive v0.0.0-20200106142752-42d1c505be7b github.com/kirinlabs/HttpRequest v0.1.5 github.com/ouxuanserver/osmanthuswine v0.0.0-20190916032555-480efadf4941 github.com/panjf2000/ants v4.0.2+incompatible diff --git a/go.sum b/go.sum index 52cc230..67cb719 100644 --- a/go.sum +++ b/go.sum @@ -144,6 +144,8 @@ github.com/iGoogle-ink/gopay v1.5.1 h1:uAKvQows+O7P8tPsdxXMwe/YqqeEIEswrdVDwF8bF github.com/iGoogle-ink/gopay v1.5.1/go.mod h1:/A7M5Ts6OUEaQD+88stwhPtFV1AxOCL+CAtjreZlGGQ= github.com/iGoogle-ink/gopay/v2 v2.0.5 h1:jjiHTzkbXEOLC87hs3cAfAGC6+CqWzz/hQ/2x3w1lIU= github.com/iGoogle-ink/gopay/v2 v2.0.5/go.mod h1:plZK1Q8XAw19RkO4MLMYEWWmIhshVK9FtLOrS1ooNwg= +github.com/importcjj/sensitive v0.0.0-20200106142752-42d1c505be7b h1:9hudrgWUhyfR4FRMOfL9KB1uYw48DUdHkkgr9ODOw7Y= +github.com/importcjj/sensitive v0.0.0-20200106142752-42d1c505be7b/go.mod h1:zLVdX6Ed2SvCbEamKmve16U0E03UkdJo4ls1TBfmc8Q= github.com/jackc/fake v0.0.0-20150926172116-812a484cc733 h1:vr3AYkKovP8uR8AvSGGUK1IDqRa5lAAvEkZG1LKaCRc= github.com/jackc/fake v0.0.0-20150926172116-812a484cc733/go.mod h1:WrMFNQdiFJ80sQsxDoMokWK1W5TQtxBFNpzWTD84ibQ= github.com/jackc/pgx v3.3.0+incompatible h1:Wa90/+qsITBAPkAZjiByeIGHFcj3Ztu+VzrrIpHjL90= diff --git a/keywords b/keywords new file mode 100644 index 0000000..d893d9b --- /dev/null +++ b/keywords @@ -0,0 +1,631 @@ +你妈逼 +爱液 +按摩棒 +拔出来 +爆草 +包二奶 +暴干 +暴奸 +暴乳 +爆乳 +暴淫 +被操 +被插 +被干 +逼奸 +仓井空 +插暴 +操逼 +操黑 +操烂 +肏你 +肏死 +操死 +操我 +厕奴 +插比 +插b +插逼 +插进 +插你 +插我 +插阴 +潮吹 +潮喷 +成人电影 +成人论坛 +成人色情 +成人网站 +成人文学 +成人小说 +艳情小说 +成人游戏 +吃精 +抽插 +春药 +大波 +大力抽送 +大乳 +荡妇 +荡女 +盗撮 +发浪 +放尿 +肥逼 +粉穴 +风月大陆 +干死你 +干穴 +肛交 +肛门 +龟头 +裹本 +国产av +好嫩 +豪乳 +黑逼 +后庭 +后穴 +虎骑 +换妻俱乐部 +黄片 +几吧 +鸡吧 +鸡巴 +鸡奸 +妓女 +奸情 +叫床 +脚交 +精液 +就去日 +巨屌 +菊花洞 +菊门 +巨奶 +巨乳 +菊穴 +开苞 +口爆 +口活 +口交 +口射 +口淫 +裤袜 +狂操 +狂插 +浪逼 +浪妇 +浪叫 +浪女 +狼友 +聊性 +凌辱 +漏乳 +露b +乱交 +乱伦 +轮暴 +轮操 +轮奸 +裸陪 +买春 +美逼 +美少妇 +美乳 +美腿 +美穴 +美幼 +秘唇 +迷奸 +密穴 +蜜穴 +蜜液 +摸奶 +摸胸 +母奸 +奈美 +奶子 +男奴 +内射 +嫩逼 +嫩女 +嫩穴 +捏弄 +女优 +炮友 +砲友 +喷精 +屁眼 +前凸后翘 +强jian +强暴 +强奸处女 +情趣用品 +情色 +拳交 +全裸 +群交 +人妻 +人兽 +日逼 +日烂 +肉棒 +肉逼 +肉唇 +肉洞 +肉缝 +肉棍 +肉茎 +肉具 +揉乳 +肉穴 +肉欲 +乳爆 +乳房 +乳沟 +乳交 +乳头 +骚逼 +骚比 +骚女 +骚水 +骚穴 +色逼 +色界 +色猫 +色盟 +色情网站 +色区 +色色 +色诱 +色欲 +色b +少年阿宾 +射爽 +射颜 +食精 +释欲 +兽奸 +兽交 +手淫 +兽欲 +熟妇 +熟母 +熟女 +爽片 +双臀 +死逼 +丝袜 +丝诱 +松岛枫 +酥痒 +汤加丽 +套弄 +体奸 +体位 +舔脚 +舔阴 +调教 +偷欢 +推油 +脱内裤 +文做 +舞女 +无修正 +吸精 +夏川纯 +相奸 +小逼 +校鸡 +小穴 +小xue +性感妖娆 +性感诱惑 +性虎 +性饥渴 +性技巧 +性交 +性奴 +性虐 +性息 +性欲 +胸推 +穴口 +穴图 +亚情 +颜射 +阳具 +杨思敏 +要射了 +夜勤病栋 +一本道 +一夜欢 +一夜情 +一ye情 +阴部 +淫虫 +阴唇 +淫荡 +阴道 +淫电影 +阴阜 +淫妇 +淫河 +阴核 +阴户 +淫贱 +淫叫 +淫教师 +阴茎 +阴精 +淫浪 +淫媚 +淫糜 +淫魔 +淫母 +淫女 +淫虐 +淫妻 +淫情 +淫色 +淫声浪语 +淫兽学园 +淫书 +淫术炼金士 +淫水 +淫娃 +淫威 +淫亵 +淫样 +淫液 +淫照 +阴b +应召 +幼交 +欲火 +欲女 +玉乳 +玉穴 +援交 +原味内衣 +援助交际 +招鸡 +招妓 +抓胸 +自慰 +作爱 +a片 +fuck +gay片 +g点 +h动画 +h动漫 +失身粉 +淫荡自慰器 +习近平 +平近习 +xjp +习太子 +习明泽 +老习 +温家宝 +温加宝 +温x +温jia宝 +温宝宝 +温加饱 +温加保 +张培莉 +温云松 +温如春 +温jb +胡温 +胡x +胡jt +胡boss +胡总 +胡王八 +hujintao +胡jintao +胡j涛 +胡惊涛 +胡景涛 +胡紧掏 +湖紧掏 +胡紧套 +锦涛 +hjt +胡派 +胡主席 +刘永清 +胡海峰 +胡海清 +江泽民 +民泽江 +江胡 +江哥 +江主席 +江书记 +江浙闽 +江沢民 +江浙民 +择民 +则民 +茳泽民 +zemin +ze民 +老江 +老j +江core +江x +江派 +江zm +jzm +江戏子 +江蛤蟆 +江某某 +江贼 +江猪 +江氏集团 +江绵恒 +江绵康 +王冶坪 +江泽慧 +邓小平 +平小邓 +xiao平 +邓xp +邓晓平 +邓朴方 +邓榕 +邓质方 +毛泽东 +猫泽东 +猫则东 +猫贼洞 +毛zd +毛zx +z东 +ze东 +泽d +zedong +毛太祖 +毛相 +主席画像 +改革历程 +朱镕基 +朱容基 +朱镕鸡 +朱容鸡 +朱云来 +李鹏 +李peng +里鹏 +李月月鸟 +李小鹏 +李小琳 +华主席 +华国 +国锋 +国峰 +锋同志 +白春礼 +薄熙来 +薄一波 +蔡赴朝 +蔡武 +曹刚川 +常万全 +陈炳德 +陈德铭 +陈建国 +陈良宇 +陈绍基 +陈同海 +陈至立 +戴秉国 +丁一平 +董建华 +杜德印 +杜世成 +傅锐 +郭伯雄 +郭金龙 +贺国强 +胡春华 +耀邦 +华建敏 +黄华华 +黄丽满 +黄兴国 +回良玉 +贾庆林 +贾廷安 +靖志远 +李长春 +李春城 +李建国 +李克强 +李岚清 +李沛瑶 +李荣融 +李瑞环 +李铁映 +李先念 +李学举 +李源潮 +栗智 +梁光烈 +廖锡龙 +林树森 +林炎志 +林左鸣 +令计划 +柳斌杰 +刘奇葆 +刘少奇 +刘延东 +刘云山 +刘志军 +龙新民 +路甬祥 +罗箭 +吕祖善 +马飚 +马恺 +孟建柱 +欧广源 +强卫 +沈跃跃 +宋平顺 +粟戎生 +苏树林 +孙家正 +铁凝 +屠光绍 +王东明 +汪东兴 +王鸿举 +王沪宁 +王乐泉 +王洛林 +王岐山 +王胜俊 +王太华 +王学军 +王兆国 +王振华 +吴邦国 +吴定富 +吴官正 +无官正 +吴胜利 +吴仪 +奚国华 +习仲勋 +徐才厚 +许其亮 +徐绍史 +杨洁篪 +叶剑英 +由喜贵 +于幼军 +俞正声 +袁纯清 +曾培炎 +曾庆红 +曾宪梓 +曾荫权 +张德江 +张定发 +张高丽 +张立昌 +张荣坤 +张志国 +赵洪祝 +紫阳 +周生贤 +周永康 +朱海仑 +中南海 +大陆当局 +中国当局 +北京当局 +共产党 +党产共 +共贪党 +阿共 +产党共 +公产党 +工产党 +共c党 +共x党 +共铲 +供产 +共惨 +供铲党 +供铲谠 +供铲裆 +共残党 +共残主义 +共产主义的幽灵 +拱铲 +老共 +中共 +中珙 +中gong +gc党 +贡挡 +gong党 +g产 +狗产蛋 +共残裆 +恶党 +邪党 +共产专制 +共产王朝 +裆中央 +土共 +土g +共狗 +g匪 +共匪 +仇共 +政府 +症腐 +政腐 +政付 +正府 +政俯 +政f +zhengfu +政zhi +挡中央 +档中央 +中央领导 +中国zf +中央zf +国wu院 +中华帝国 +gong和 +大陆官方 +北京政权 +江泽民 +胡锦涛 +温家宝 +习近平 +习仲勋 +贺国强 +贺子珍 +周永康 +李长春 +李德生 +王岐山 +姚依林 +回良玉 +李源潮 +李干成 +戴秉国 +黄镇 +刘延东 +刘瑞龙 +俞正声 +黄敬 +薄熙 +薄一波 +周小川 +周建南 +温云松 +徐明 +江泽慧 +江绵恒 +江绵康 +李小鹏 +李鹏 +李小琳 +朱云来 +朱容基 +法轮功 +李洪志 +新疆骚乱 \ No newline at end of file diff --git a/libs/filter/filter.go b/libs/filter/filter.go new file mode 100644 index 0000000..902548e --- /dev/null +++ b/libs/filter/filter.go @@ -0,0 +1,26 @@ +package filter + +import ( + "github.com/importcjj/sensitive" + "os" + "path/filepath" +) + +var filter *sensitive.Filter + +func init() { + initFilter() +} + +func initFilter() { + wd, _ := os.Getwd() + filter = sensitive.New() + filter.LoadWordDict(filepath.Join(wd, "keywords")) +} + +func Replace(content string) string { + if filter == nil { + initFilter() + } + return filter.Replace(content, '*') +} diff --git a/libs/im/im.go b/libs/im/im.go index c533082..632a7b2 100644 --- a/libs/im/im.go +++ b/libs/im/im.go @@ -13,29 +13,43 @@ var ( //SdkAppid = 1400345581 //SdkAppKey = "e3d095ce8253fe18109d6c1ad068907978cac0a428fbad181d8958631b78e930" - SdkAppKey = "9683fc9d2e50857f33c7ef5431942458f2dbc7042ba526f87042092afb646331" - SdkAppid = 1400337419 - TxImHost = "https://console.tim.qq.com" + SdkAppKey = "9683fc9d2e50857f33c7ef5431942458f2dbc7042ba526f87042092afb646331" + SdkAppid = 1400337419 + TxImHostV4 = "https://console.tim.qq.com/v4" ) -type AccountImportResult struct { +type NoticeType int + +const NoticeLiveRedPackStart NoticeType = 256 // 通知直播用户红包开始了 +const NoticeLiveRedPackEnd NoticeType = 257 // 通知直播用户红包结束了 +const NoticeShakeRedPackStart NoticeType = 258 // 通知摇红包开始了 +const NoticeShakeRedPackEnd NoticeType = 259 // 通知摇红包结束了 + +type CommonResult struct { ActionStatus string `json:"ActionStatus"` ErrorCode int `json:"ErrorCode"` ErrorInfo string `json:"ErrorInfo"` } + type AccountImportParam struct { Identifier string `json:"Identifier"` Nick string `json:"Nick"` FaceUrl string `json:"FaceUrl"` } +func GenSig(identifier string) (string, error) { + return tencentyun.GenSig(SdkAppid, SdkAppKey, identifier, 86400000) +} + func AccountImport(identifier, nickname, faceurl string) (string, error) { - sign, err := tencentyun.GenSig(SdkAppid, SdkAppKey, "admin", 86400*180) + //sign, err := tencentyun.GenSig(SdkAppid, SdkAppKey, "admin", 86400*180) + sig, err := GenSig("admin") if err != nil { return "", err } random := utils.RandomStr(32) - u := fmt.Sprintf("%s/v4/im_open_login_svc/account_import?sdkappid=%d&identifier=admin&usersig=%s&random=%s&contenttype=json", TxImHost, SdkAppid, sign, random) + u := fmt.Sprintf("%s/im_open_login_svc/account_import?sdkappid=%d&identifier=admin&usersig=%s&random=%s&contenttype=json", + TxImHostV4, SdkAppid, sig, random) bs, _ := json.Marshal(&AccountImportParam{ Identifier: identifier, Nick: nickname, @@ -45,7 +59,7 @@ func AccountImport(identifier, nickname, faceurl string) (string, error) { if err != nil { return "", err } - res := AccountImportResult{} + res := CommonResult{} err = resp.Json(&res) if err != nil { return "", err @@ -54,5 +68,50 @@ func AccountImport(identifier, nickname, faceurl string) (string, error) { return "", errors.New(res.ErrorInfo) } - return tencentyun.GenSig(SdkAppid, SdkAppKey, identifier, 86400000) + //return tencentyun.GenSig(SdkAppid, SdkAppKey, identifier, 86400000) + return GenSig(identifier) +} + +// 群通知 +type SendGroupSystemNotificationParam struct { + GroupId string `json:"GroupId"` + Content string `json:"Content"` + ToMembersAccount []string `json:"ToMembers_Account,omitempty"` +} + +func SendGroupSystemNotification(groupId string, noticeType NoticeType, notice string, members ...string) error { + sig, err := GenSig("admin") + if err != nil { + return err + } + random := utils.RandomStr(32) + u := fmt.Sprintf("%s/group_open_http_svc/send_group_system_notification?sdkappid=%d&identifier=admin&usersig=%s&random=%s&contenttype=json", + TxImHostV4, SdkAppid, sig, random) + + var m = make(map[string]interface{}) + m["type"] = noticeType + m["notice"] = notice + content, err := json.Marshal(&m) + if err != nil { + return err + } + + bs, err := json.Marshal(&SendGroupSystemNotificationParam{ + GroupId: groupId, + Content: string(content), + ToMembersAccount: members, + }) + if err != nil { + return err + } + resp, err := HttpRequest.NewRequest().Debug(true).JSON().Post(u, string(bs)) + res := CommonResult{} + err = resp.Json(&res) + if err != nil { + return err + } + if res.ErrorCode != 0 { + return errors.New(res.ErrorInfo) + } + return nil } diff --git a/libs/im/im_test.go b/libs/im/im_test.go index f582ff7..83a0708 100644 --- a/libs/im/im_test.go +++ b/libs/im/im_test.go @@ -9,3 +9,9 @@ func TestAccountImport(t *testing.T) { sig, err := AccountImport("test1", "tommy", "http://a.cphotos.bdimg.com/timg?image&quality=100&size=b4000_4000&sec=1585813714&di=c76777c95455780deffa04d28b25cb70&src=http://b-ssl.duitang.com/uploads/item/201412/28/20141228171331_L5T2n.jpeg") fmt.Println(sig, err) } + +func TestSendGroupSystemNotification(t *testing.T) { + err := SendGroupSystemNotification("@TGS#aZWTFELGU", 256, "你好吗") + fmt.Println(err) + +} diff --git a/libs/wx/pay.go b/libs/wx/pay.go index 4d628d8..8079ab9 100644 --- a/libs/wx/pay.go +++ b/libs/wx/pay.go @@ -10,15 +10,6 @@ import ( "net/http" ) -func SwitchHost(host string) { - UnifiedOrderURL = fmt.Sprintf("%s/pay/unifiedorder", host) - QueryOrderURL = fmt.Sprintf("%s/pay/orderquery", host) - CloseOrderURL = fmt.Sprintf("%s/pay/closeorder", host) - RefundURL = fmt.Sprintf("%s/pay/refund", host) - RefundQueryURL = fmt.Sprintf("%s/pay/refundquery", host) - TransfersURL = fmt.Sprintf("%s/mmpaymkttransfers/promotion/transfers", host) -} - type cdata string func (c cdata) MarshalXML(e *xml.Encoder, start xml.StartElement) error { @@ -60,20 +51,6 @@ type Client struct { secureClient *http.Client } -//func NewClient() *Client { -// tlsConfig, err := getTLSConfig() -// if err != nil { -// panic(err) // 出现错误 -// } -// tr := &http.Transport{TLSClientConfig: tlsConfig} -// client := &http.Client{Transport: tr} -// return &Client{ -// AppId: Appid, -// MchId: Mchid, -// secureClient: client, -// } -//} - func (w *Client) Post(url string, xmlRes []byte) (*http.Response, error) { return w.secureClient.Post(url, "application/xml", bytes.NewBuffer(xmlRes)) } diff --git a/models/init_models.go b/models/init_models.go index 8c19b1d..50bcfdb 100644 --- a/models/init_models.go +++ b/models/init_models.go @@ -86,6 +86,8 @@ func init() { new(RealSignHistory), new(LiveViewer), new(LiveConfig), + new(LiveRedPackInfo), + new(LiveRedPack), ) fmt.Printf("error=======>%v\n\n", err) } diff --git a/models/live_red_pack.go b/models/live_red_pack.go new file mode 100644 index 0000000..079d2ed --- /dev/null +++ b/models/live_red_pack.go @@ -0,0 +1,38 @@ +package models + +import ( + "github.com/ouxuanserver/osmanthuswine/src/core" + "time" +) + +const LiveRedPackTN = TableNamePrefix + "live_red_pack" + +type LiveRedPack struct { + Id int64 `json:"id" xorm:"not null pk autoincr INT(11)"` + IsDelete bool `json:"-" xorm:"not null default 0 comment('是否删除') TINYINT(1)"` + CreatedAt time.Time `json:"created_at" xorm:"not null created comment('创建时间') DATETIME"` + UpdatedAt time.Time `json:"updated_at" xorm:"not null updated default CURRENT_TIMESTAMP comment('更新时间') TIMESTAMP"` + + LiveRedPackInfoId int64 `json:"live_red_pack_info_id" xorm:"not null default 0 comment('红包信息id') INT(11)"` + ActivityId int64 `json:"activity_id" xorm:"not null default 0 comment('互动id') INT(11)"` + Receiver int64 `json:"receiver" xorm:"not null default 0 comment('[0未领取/非0领取用户id]') INT(11)"` + Amount float64 `json:"amount" xorm:"not null default 0.0 comment('红包金额') DECIMAL(18,2)"` + Version int `json:"version" xorm:"not null version comment('乐观锁') INT(11)"` +} + +func (t LiveRedPack) TableName() string { + return LiveRedPackTN +} + +func (t *LiveRedPack) Add() (int64, error) { + return core.GetXormAuto().InsertOne(t) +} + +func (t *LiveRedPack) GetByInfoId(infoId int64) (bool, error) { + return core.GetXormAuto().Where("live_red_package_info_id=? and is_delete=0", infoId).Get(t) +} + +func (t *LiveRedPack) Receive(userId int64) (int64, error) { + t.Receiver = userId + return core.GetXormAuto().Where("id=?", t.Id).Cols("user_id").Update(t) +} diff --git a/models/live_red_pack_info.go b/models/live_red_pack_info.go new file mode 100644 index 0000000..5ab1e5d --- /dev/null +++ b/models/live_red_pack_info.go @@ -0,0 +1,29 @@ +package models + +import ( + "github.com/ouxuanserver/osmanthuswine/src/core" + "time" +) + +const LiveRedPackInfoTN = TableNamePrefix + "live_red_pack_info" + +type LiveRedPackInfo struct { + Id int64 `json:"live_red_pack_info_id" xorm:"not null pk autoincr INT(11)"` + IsDelete bool `json:"-" xorm:"not null default 0 comment('是否删除') TINYINT(1)"` + CreatedAt time.Time `json:"created_at" xorm:"not null created comment('创建时间') DATETIME"` + UpdatedAt time.Time `json:"updated_at" xorm:"not null updated default CURRENT_TIMESTAMP comment('更新时间') TIMESTAMP"` + + UserOrderId int64 `json:"user_order_id" xorm:"not null default 0 comment('用户微信订单id') INT(11)"` + UserId int64 `json:"user_id" xorm:"not null default 0 comment('用户id') INT(11)"` + ActivityId int64 `json:"activity_id" xorm:"not null default 0 comment('互动id') INT(11)"` + Prompt string `json:"prompt" xorm:"not null default 0 comment('祝福语') VARCHAR(255)"` + Amount float64 `json:"amount" xorm:"not null default 0.0 comment('红包金额') DECIMAL(18,2)"` +} + +func (t *LiveRedPackInfo) TableName() string { + return LiveRedPackInfoTN +} + +func (t *LiveRedPackInfo) Add() (int64, error) { + return core.GetXormAuto().InsertOne(t) +} diff --git a/models/user_order.go b/models/user_order.go index 2d6652d..02d8b46 100644 --- a/models/user_order.go +++ b/models/user_order.go @@ -10,7 +10,7 @@ const UserOrderTableName = TableNamePrefix + "user_order" type UserOrder struct { Id int64 `json:"id" xorm:"not null pk autoincr INT(11)"` DeviceInfo string `json:"device_info" xorm:"not null default('') comment('设备号') VARCHAR(32)"` - GoodType int `json:"good_type" xorm:"not null default(0) comment('1霸屏2打赏')"` + GoodType int `json:"good_type" xorm:"not null default(0) comment('1霸屏2打赏3直播红包')"` Desc string `json:"desc" xorm:"not null default('') comment('') VARCHAR(128)"` OutTradeNo string `json:"out_trade_no" xorm:"not null default('') comment('商户订单号') VARCHAR(32)"` FeeType string `json:"fee_type" xorm:"not null default('CNY') comment('货币种类') VARCHAR(16)"` diff --git a/services/pay/bindata.go b/services/pay/bindata.go new file mode 100644 index 0000000..ba46170 --- /dev/null +++ b/services/pay/bindata.go @@ -0,0 +1,315 @@ +// Code generated for package main by go-bindata DO NOT EDIT. (@generated) +// sources: +// cacert/apiclient_cert.p12 +// cacert/apiclient_cert.pem +// cacert/apiclient_key.pem +// cacert/rootca.pem +package pay_service + +import ( + "bytes" + "compress/gzip" + "fmt" + "io" + "io/ioutil" + "os" + "path/filepath" + "strings" + "time" +) + +func bindataRead(data []byte, name string) ([]byte, error) { + gz, err := gzip.NewReader(bytes.NewBuffer(data)) + if err != nil { + return nil, fmt.Errorf("Read %q: %v", name, err) + } + + var buf bytes.Buffer + _, err = io.Copy(&buf, gz) + clErr := gz.Close() + + if err != nil { + return nil, fmt.Errorf("Read %q: %v", name, err) + } + if clErr != nil { + return nil, err + } + + return buf.Bytes(), nil +} + +type asset struct { + bytes []byte + info os.FileInfo +} + +type bindataFileInfo struct { + name string + size int64 + mode os.FileMode + modTime time.Time +} + +// Name return file name +func (fi bindataFileInfo) Name() string { + return fi.name +} + +// Size return file size +func (fi bindataFileInfo) Size() int64 { + return fi.size +} + +// Mode return file mode +func (fi bindataFileInfo) Mode() os.FileMode { + return fi.mode +} + +// Mode return file modify time +func (fi bindataFileInfo) ModTime() time.Time { + return fi.modTime +} + +// IsDir return file whether a directory +func (fi bindataFileInfo) IsDir() bool { + return fi.mode&os.ModeDir != 0 +} + +// Sys return file is sys mode +func (fi bindataFileInfo) Sys() interface{} { + return nil +} + +var _cacertApiclient_certP12 = []byte("\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\x54\xd4\x69\x38\xd4\x0b\xc3\x06\xf0\xff\x8c\x99\x49\x33\xf6\xad\x2c\x89\x8e\xec\xc3\x20\xc6\x5a\x09\x43\x85\xd2\xb1\x93\x31\xf6\x75\xec\x53\xb6\x89\x69\x2c\x73\x22\x83\x49\xb2\x3c\xf6\x35\x33\xf6\xad\xc2\x20\x43\x54\x0a\x21\x5b\x59\x4a\x96\xb1\x53\xea\xc8\x7b\x3d\xd7\xf5\xbe\xef\xf3\x9c\x8f\xf7\x75\xdf\xf7\xd7\x1f\x8a\x04\xcf\x01\x83\x38\x50\x24\xb8\x07\xec\xa4\x62\xa2\x59\xe2\x77\x6e\xd0\x09\x50\x21\x09\x6e\x03\x21\xc1\xad\x50\x24\xb8\x05\x8a\x04\x19\xfe\x4f\x05\x2b\x24\x41\x98\x28\x12\xe4\x05\x18\x04\xa0\x48\x90\xe6\xff\x3a\xa1\x24\x60\xf0\xff\x0d\x5c\x20\x18\x8a\x07\xc2\xd9\xa7\xfc\xb3\xe3\x7d\xe0\x34\x1a\x0c\xe6\x04\xe2\x48\x90\x64\xad\x28\xee\x95\xd1\x34\xf9\x7d\x21\x17\xe1\xf3\x84\x42\x05\x0d\x83\x0d\xed\x8b\x46\xba\x0f\x18\xb1\xa7\xaf\x73\x2f\xaf\x11\x45\xc7\x3e\xde\xcd\xec\x76\xc0\xaa\xc7\x09\x53\x4d\x29\x54\xe6\xa5\xc8\xc9\xc6\x12\xff\xb5\x3b\xb1\x36\x3f\x26\x75\xfb\x9c\xd4\xc1\xb2\xf7\xbb\xfd\x71\x9f\x05\x5c\x4a\xde\x3d\xa9\x47\xe3\x4f\x0f\x73\xa3\x4f\xb6\x57\x0c\xc5\x4f\x5e\x51\x9d\xbc\xb5\x8f\xbf\x02\x50\x1a\x8c\x25\xd4\x84\xb1\x1c\x75\x56\x76\x5b\x9d\x53\xea\x86\x6e\xdc\x50\x4a\x66\x13\x2c\x3a\xbf\xa7\xec\x50\x2d\xf5\x16\xef\x11\x3d\xff\x80\x26\xc2\x6c\xd9\x4f\x34\x2f\xb5\xc6\x08\x77\x9b\x1f\xf0\xf3\xef\xa1\xbc\x3b\xaa\x89\xa3\x8a\x18\xa0\x77\x35\x88\x27\xe8\x7b\x61\xb3\x36\xd5\x24\xc5\xf1\x31\x52\x81\xdd\x7d\x61\x86\x4a\x39\xa5\x9d\xfc\xbd\xec\x35\xdb\xf3\xe5\x24\x5d\x3a\xa3\x6e\xd8\x33\x3f\xa0\x53\xe7\xcb\xbf\x26\xea\x69\x72\x6d\x55\x40\x6c\x8b\x61\x8a\x9b\xa5\x6e\xf1\x43\x93\x19\xfd\x41\xce\x78\x9d\x4b\x6b\xbb\x9a\xf4\x9f\x61\xad\xad\xe2\x01\x9a\x9f\xd7\xbe\xde\xb9\x4a\xdf\x6d\x6a\xc2\x19\x5d\xb7\x38\x63\x70\x69\x77\x29\x80\x5d\xb0\x33\x65\x10\x25\x0e\x34\x4f\x89\xd8\xa4\x0d\xbf\xcd\xde\x0e\x4f\xc6\x4e\xc8\xb8\x82\xcf\x24\xe7\xc0\xaf\xad\xb8\xca\x6b\xcb\x1e\xb2\xa2\x55\x86\x28\x2a\x1e\x4e\x11\x0f\x05\x7c\xb0\xc4\x6c\x57\xea\x9b\xe4\x1c\x7b\xa3\xee\x4b\x95\x24\x30\x24\xfe\x8a\x7b\x85\x4f\xd5\xaa\xdf\x08\x35\x5f\xe0\x19\x6e\xa3\x64\xd8\xd2\xd4\x62\x0f\x59\xb8\xb3\x3a\xf5\x3c\xcc\xcc\x1c\xfb\xa0\x72\xbb\x6f\x45\x5c\xf2\x8c\x34\xf3\x33\xbc\x50\xef\xbb\xf8\x2f\x65\xa8\xcd\x73\x89\xf3\x27\xac\x45\x91\x78\xdb\xa2\x87\xca\x67\x46\x62\x40\x2f\xaf\xbb\x19\xa5\x1c\x5a\x6b\x70\xa5\x62\xc8\x73\x94\xa6\xa5\x16\x6d\x59\xeb\x21\x0e\x62\x79\xcc\xe5\x8b\xd4\xfb\x75\xf9\xab\x5e\xf3\x05\x13\xb5\xfc\xc1\x58\x0d\xbe\x84\xdf\x9a\xf6\xc4\xe4\xe8\x7d\x16\xcd\x9d\xa4\x76\x8a\x73\x7a\xe2\x5d\xa6\x53\x18\x93\xbe\x73\x99\xc0\x75\xfb\xc2\xeb\x68\xb5\xf5\xf2\xb4\x60\x59\x68\xd7\xb4\x26\x79\x4f\x43\x63\xf4\x8b\x89\x05\xbd\x78\x81\xe8\xf7\x04\xb3\x57\x88\x68\xa2\x59\x3e\x30\x39\x48\xe7\x2d\x56\xee\x20\xd7\x71\xd1\x22\x05\xaf\xbd\x7a\xf4\x41\x55\xca\x3b\x08\x51\xb1\x65\xb9\x90\x7b\xec\x46\x57\xbd\x69\x7d\xe3\x56\xbb\x55\xa8\xd2\xde\x33\xc1\xc7\xc4\xef\x65\x8f\x3f\xcf\x74\x56\xa7\xd2\x4a\x66\xcc\x05\x6b\xdf\x6c\x4b\xce\xc9\x98\x31\x9a\xb3\xa3\xd6\x8b\x37\x84\xd2\xd6\x3c\x7d\xe9\x0a\xc2\x9f\xee\x09\xbb\x30\x28\x09\x9d\x25\x52\xd1\x4a\x19\x91\x17\xac\x8f\xe8\x8e\x66\x62\xae\x1f\xac\x06\xfb\x6a\xab\xfc\x0c\x6b\x54\x9a\xcd\x47\x03\x5f\xe4\x2b\x7c\xa4\x24\x94\x0d\x7e\xe5\x44\xb6\x94\x45\x8f\xf3\x19\x05\x23\xe7\xdf\x54\x58\x0c\xd7\xef\x66\x17\xdd\x4f\x90\xb8\x4b\x3a\xb1\xa0\x03\x51\x41\xb6\x5e\xa8\x49\xc9\xe2\x79\xa3\x6f\xba\xe5\xfa\x3a\x4a\xcd\x48\xaf\x45\x01\x18\xb1\x5c\xc8\xb2\xed\xb8\xb6\x29\x27\xad\xd5\x5c\x4c\x8c\x32\x47\x80\x8f\x9b\x46\x78\x78\x6e\x6f\xbb\xf5\x1f\xa4\x9a\x3b\xaa\x72\x6d\x50\xa8\x95\x89\x23\x42\xe1\x25\xe1\xb8\xbc\x72\xd1\xf2\x89\x81\x8a\x4d\x38\x55\xb7\x1f\x6a\x9c\xb4\x8b\x99\x30\xfd\x2b\xa6\x6a\x60\x5c\x15\xdc\x2a\x53\x67\x86\x15\x06\xa3\xdc\x4d\xf7\x53\xfd\x76\x31\x4e\x7f\xb7\x65\xc6\xb6\x17\xa9\xab\x32\x6c\xe4\x33\x31\xc0\x17\xd6\xa3\xd9\xf9\xc3\x9e\x81\xc0\x7f\x8d\x8a\xd1\x44\x17\x3c\x55\xd8\x5e\x15\xe9\xe5\x55\x63\x2b\x06\x37\x1a\x7e\xff\xfd\x21\xcf\x47\xf4\xe1\xf0\x72\x4d\x48\x8f\xdb\xe6\x4c\x6b\x42\xf9\x4a\x63\xdf\xe2\x90\xa1\x3f\x26\xa4\xd7\xbc\x0b\xcf\x58\x45\x7c\x9b\xff\x80\x9c\xa9\x14\xe8\xca\xe9\xec\x9f\x57\xfa\x01\xb5\x34\x26\x5f\x5d\xa0\x99\xb4\x1b\x4f\xd7\x4b\x16\x4f\x5e\x4f\x03\x55\xa0\x9b\x2d\xa5\x63\x92\xd2\xc6\x9c\x46\xcf\x24\x09\x4d\xd0\xe7\x92\x48\xa3\xca\x9a\x5e\x05\x8b\x0a\x18\x2f\x03\x5b\xa2\x07\x62\x7c\x8d\x1d\x19\x7f\x35\x83\x50\x5d\x70\xcf\xd3\xca\xef\xd7\x43\x6c\x5e\x86\xde\xe2\x31\x65\x5d\x86\x6c\xeb\x4f\x6d\x82\x58\x4b\x74\x5a\x8f\x6f\xf1\xc9\xc0\x66\x18\x83\x01\xdd\x8b\xbe\xce\x84\x3c\x95\x4f\x6c\x04\x13\x3f\xe9\x51\xca\x0c\x4f\x3e\xdb\x6b\xae\xea\xdd\x36\xb1\xa3\xcf\x16\x1f\x17\x4f\xbc\xb5\xf7\x51\xe3\x2b\xde\xdf\xbe\xac\x23\xa0\xc9\xcc\x0b\x29\xed\x63\x2a\xb4\xae\x8d\xf0\x98\xc0\xeb\x46\xb9\x03\x9f\xc0\xb3\x93\x54\x67\x07\x21\x41\x5e\xf9\x69\xcc\x4f\xee\xb0\x66\x9d\x2f\x86\x6d\xf4\x16\x82\xe4\x9f\x9f\x5b\x54\x47\xbd\x58\x43\xf6\xab\x0e\x2c\x5e\x23\x1e\x0f\x7e\xae\x02\xb7\xa9\x41\x21\x98\x3b\x7b\x73\x62\xdb\x03\x6d\xb5\x74\x2a\xf4\x15\x3c\x83\x95\x42\xad\x1a\x9e\x8b\x26\xb3\x60\xa1\xcd\x41\x2e\x24\x7b\x6a\xae\xd1\x4e\xcf\xb2\xb1\xd4\x85\x2a\xbc\x9a\x22\x97\xfc\x91\xac\xef\xa7\xeb\xb1\x71\x51\xd3\x2c\x94\xdd\x28\xac\xa5\x41\xd6\x4d\x34\xb8\xfa\xd0\x4c\xf9\x1c\x72\x2b\xbf\x0b\xea\x0f\x56\x87\x55\x71\xb0\xc4\x3e\x11\x4f\xf4\xae\x0d\xf7\x8a\x9e\xd5\xd3\xe9\x5c\x6e\x1c\x41\x60\x30\xf2\x99\xf7\xc4\x76\x57\xb4\x4f\xff\x35\xf4\x92\xe3\x38\x0d\x45\x82\x12\xfe\xa1\x1d\xd4\x1b\x42\x82\xba\xa3\x48\x50\x2c\x8a\x04\x75\x82\x21\xfe\x8f\x31\x38\x08\x5c\x48\x82\x6c\xa0\x48\x90\xd5\x7f\xe8\xc6\xf1\x6f\xdd\x54\xe2\xb2\x30\xb3\x21\x79\x06\xff\xd6\x0d\x42\x82\x0c\x80\x1a\x68\xca\xb6\x3a\xe8\xed\x0d\x8d\x07\xd9\xe9\x64\xe4\x02\xfe\xa9\xd0\x49\xcd\xf2\x0e\x77\x7d\x40\x95\x56\x5c\xd2\x3f\x8d\xce\x65\xa5\x5f\x9e\x8f\x39\x57\xec\x3c\x14\x32\xe0\x57\xfb\x4d\xaf\xce\x71\x86\x64\xd8\xbd\x46\x65\xfd\x8a\xe7\xb7\xd1\x5d\x9e\x6d\x8e\x55\xf9\xa9\x9f\xeb\x7d\x53\x4a\xd7\x5a\x46\xca\x91\xfb\x8f\x7c\xeb\x32\xc9\x25\x52\x3a\x5e\x52\xe8\x69\x89\xe3\xb2\xc9\x7a\x9e\xb8\xc8\xd0\xea\x64\xa6\xbd\xb3\xe8\x58\x57\xd9\xdd\xa9\x71\x06\x79\xbf\x1d\xff\xb4\x9d\x47\xe5\x8c\xaf\xb2\x35\x7f\x7a\x51\x06\x51\xeb\x91\x7b\x7f\xf9\xf8\xd8\x66\x35\xd0\x25\xd5\xf5\x35\xe3\x8a\x16\xf5\x2d\x44\x7f\x54\xd1\xa2\x0c\x5c\xa9\xe4\x9d\x41\x7f\xb6\x1d\x80\xb7\x83\x1e\xbc\x1a\x1c\xdb\xca\xeb\x4b\x0d\x69\xf6\xd7\x38\x5b\x4b\xb8\x73\x64\xa5\xae\x3a\x7b\x9e\xe8\x34\x99\x9e\xf0\x10\x91\x14\xcf\x33\xb9\xbc\xf0\x54\x77\xce\xd6\x54\x3d\x3c\xf9\x21\x62\x6e\x04\x34\x2b\x46\x7c\x65\x95\x79\xb5\xc5\xd9\xfb\x16\x2e\x1c\x46\x4c\xf9\xf0\x6b\x79\x92\xc1\xe3\x31\xff\x0e\xe7\xf9\x4b\xbe\xc4\x36\xc6\x6e\x4b\xe9\x6e\x74\xc0\xf8\x86\x62\xd2\x4b\x7d\x09\xad\x73\x35\x93\xde\x2a\xa5\x94\x47\xb4\x3b\xe4\x0d\x4e\x16\xfe\xe5\x3c\xa3\xc7\x86\x28\xa6\x42\xa8\xca\xaa\xd0\xa9\xa6\x49\x5d\xd1\xd4\x35\x9f\x8b\xc5\x29\xd8\xd9\xd4\x59\x8a\xa9\xe6\x83\x7e\xaf\xfd\x71\x13\x9f\xbc\xee\x6d\x82\x7e\x7c\x85\x55\x8c\x35\x78\xde\x90\x7d\xee\x15\x8f\x97\x33\x52\x51\xe5\xed\xa5\xbc\x65\xfa\xb4\x73\x06\xa2\x1f\x2d\xa9\xfa\x2e\xc7\x3e\xe7\xc4\x9f\xe6\xab\xeb\xc1\xc8\xec\x27\x2e\x72\xa1\xb7\xaa\x6b\xe7\xcb\x8e\x7b\xcb\x64\xa3\xf2\xa7\xce\x3b\x1d\x4f\xe9\xce\xca\x8c\x3e\xf1\xc5\xba\xbc\x8f\x3f\x64\x04\x75\x40\xf3\xe4\x14\x6e\x8e\x33\x83\x5c\x9d\xb5\x4a\xc9\x7b\x63\x3b\x25\x17\xbd\xba\xaf\x37\xad\x3c\x2e\x81\x12\x82\x10\x09\x11\x69\x91\x59\x56\xd2\xe4\x55\x93\x4b\x49\xbd\x1a\x6a\xf3\x6d\x67\xc7\x66\xec\xfa\x82\xd4\xd9\x4c\xd7\xf3\x4a\x94\xac\x77\x6e\xef\xbc\xe6\x0a\x57\xb2\x47\xf2\x38\xb5\x71\xf2\xfa\xc1\x84\xc1\x3e\x9e\x0b\x44\xd4\xc1\x41\xb4\xfd\xc0\xf2\xf3\xd5\xc8\x17\x91\xe5\x22\x55\xc7\x8b\x58\x59\x1d\x2b\xed\x53\x8c\x9b\x88\xa7\x31\x91\x33\x63\xa1\x6a\x73\xfc\xdb\x4c\x97\x4a\x9d\x5c\xdf\x1c\x0e\xd1\xc7\xe7\xbe\x48\xc0\xf5\xb9\x57\x5a\xf4\x96\x96\xa2\x6f\x77\xff\xb0\x75\x7b\xf9\x13\x57\xe4\x57\x7e\x34\x74\x8c\x16\x70\x89\x67\x78\x47\x7a\xb4\xd3\xba\x7c\xbe\xe1\x3e\x95\xef\x96\x25\x9e\x6c\xb4\xaf\x41\x89\x7e\xc3\x5b\x68\x61\xb1\x82\x1e\xad\x7a\x12\xdc\x7b\xc1\x9d\x3a\xf0\x6f\x65\x77\xb9\x0d\xa9\x5a\xa9\xe4\x94\x30\x41\xa3\xe8\xc1\x37\xdf\xb9\x4e\xd8\x2b\x74\x3b\xcc\x2a\x07\x27\x26\x57\x45\x22\xec\xc8\x45\x6a\x75\x27\x44\x0f\x7a\x1b\x13\x79\x85\x3d\x58\xc2\xeb\x45\xe8\x81\xae\x8a\xd6\xe7\x9d\x43\x98\xbc\xed\xb6\xe9\xc5\xdf\xa1\x82\xeb\xcb\x94\xfc\x53\xf5\x16\x9f\x93\xd6\x41\xea\xd1\xdf\x0f\x3b\xbd\x6c\x08\xe9\x70\x85\xbf\x8e\x6a\x77\x2e\xd3\xe7\x17\xff\x9e\x0b\x34\x6b\xaa\x43\x8a\x77\x3d\xb3\x4a\x16\x6e\xac\x37\x82\x97\x68\x0a\xf0\xc9\x1e\x75\xe4\xb3\xbb\xcd\x1d\x78\xb1\x72\xcf\x33\x2a\x22\x7e\xe1\x61\xc5\xf9\xa4\xf1\x5f\x2f\x2e\x4e\x88\x19\xb0\x38\x3a\x0c\x36\xfb\x8c\x63\x4f\xc7\x6d\x2b\x7f\x18\xfd\x5c\xb8\x1f\x40\x29\x51\x0a\xdf\x4e\x1b\x09\x19\xff\x43\x77\xcf\x78\x3d\x99\x46\xd3\xee\x4c\xf0\x0d\x57\xaf\x9e\xcb\x43\x9f\x3f\x86\x6f\xbe\xe2\x80\x4e\x2a\x50\xc4\xae\x72\xe1\x1a\x92\x2d\xb8\x46\xc6\xee\x36\xfa\x44\x57\x39\xc9\x7e\x62\x17\x8c\xc0\x0c\x3a\x64\xb8\x5b\xe4\x2e\xc7\xe3\x9a\xf8\xc8\xec\x93\xaf\xc7\xfa\x2b\x65\xe3\x0f\x87\x12\xd8\xdd\x9b\xed\xdf\xfc\xf5\x59\xca\x4b\x77\xb2\x40\x5c\xe2\x8e\xa2\xd2\x58\xe5\xad\x72\xf5\xb3\xa7\xd2\x5c\x1b\x5e\x5b\xcd\x4b\xd4\x38\x30\x78\x25\xb9\xc9\x12\xdd\x94\x1f\x2d\xf3\x9e\x59\x71\x2b\x8b\x1b\xbb\xd7\xea\x5d\x64\x8c\x53\xd0\x6a\x98\x1f\x77\x14\x8d\xd0\x8f\x02\xdf\x86\xa0\x8b\x7c\x56\x78\x8d\x4a\x4f\xff\xfe\xa1\xe2\xc3\xff\xe4\xb5\x4b\x50\x4d\x57\x8d\x06\x5f\x44\x58\xc8\x6b\xe6\xf5\x33\xe7\xda\xed\xf4\x98\x77\x1d\xde\x77\x54\xbd\x70\xf9\x53\x46\xf6\xc1\xc6\xed\xdf\x18\xb3\x08\x5d\xf4\xfd\x59\xf2\xbc\x10\xd2\x90\xe9\xd1\x2f\xd0\xe9\xc2\x97\xc3\x1b\x2d\x72\x8f\x97\xde\x51\xe5\x5e\xcb\xbe\xdd\x66\x6a\x32\xe3\x92\xd0\xc6\x43\x49\xb5\xbc\x61\xb7\x2f\xd2\xd4\x1a\xd1\x58\xdd\xfb\xa4\x7c\xf9\xa2\xc1\x57\x9f\x90\x5e\xb3\x7b\x03\x66\xac\x01\xeb\xd3\x4b\x72\x9c\x4c\x6d\xdc\xb0\x2f\x81\x94\x68\x66\x5e\x1f\x96\x13\xe7\x33\x22\x49\x55\x5d\x91\x83\xf9\xae\x17\x42\x8f\xd9\x9d\xb9\x8e\x1f\x09\x73\x4b\x37\xed\x6e\x11\x0e\x69\xeb\x22\x8f\x78\x95\x4b\x7b\xc3\xb7\x6a\xe1\x7d\x17\x22\xa6\xe7\x30\x5f\x7e\xf6\x93\x5c\x03\xdf\x07\x2c\x6d\xf1\x49\xd0\x22\x34\x4f\x7f\xd1\x41\x36\x3e\xbe\x56\x9a\x0b\x4a\x5d\x7c\x97\x82\x40\xb7\xf3\xfd\x2e\x3f\xde\xad\x64\x45\x74\xbb\x39\x6c\xb8\x85\x4c\xa5\xd0\x18\x14\xe3\x9e\x1b\xeb\xb1\xcc\xab\x50\xf6\xc1\x66\x6d\xe0\x01\xff\xb6\xb6\x56\x40\x5d\x40\x2d\x97\x70\x3b\x1a\xe4\xe0\x6e\xe0\x15\xc4\xbd\xfc\x31\xca\xe8\xa0\xa2\xc8\x2f\xe3\xe5\xb9\x3d\xae\x86\x02\xed\x53\x07\xc3\x1c\x0d\x51\xbd\xef\x13\xcc\x04\x31\xcf\x3a\xa9\x3d\x63\xea\x3d\x22\x86\x52\x60\x37\xc6\xd1\xa6\xe3\xe1\xd8\x53\x09\xc2\x35\x65\xe6\xf1\x9b\x51\x35\x47\xd4\x1f\xff\xaf\xe3\x49\x61\x35\x11\x88\x90\xa0\xc0\xc1\x8d\x3c\xa5\x40\xf9\xde\x9d\xbe\x8c\x94\x67\x6d\x12\xb9\x20\xbe\x38\x94\xc6\x7f\x46\x42\x6a\xb2\x92\x32\x80\x35\xe0\x09\xe0\x81\x60\x00\x07\x44\x02\x52\x80\x11\xe0\x09\x84\x02\xe1\x80\x2f\xe0\x05\xf8\x02\xee\x00\x0e\x08\x07\x3c\x51\x48\x94\x34\xea\x24\x0c\xaa\xc4\xc3\x01\x16\x83\x02\x10\xa1\x6c\xdb\x1d\xf7\xd0\xa7\xe2\x0f\x28\x7d\x61\x85\x6f\x72\x5c\x44\xd4\x03\x62\x30\x10\xce\x82\x52\xbc\xe2\x74\xee\x13\xec\xff\x04\x00\x00\xff\xff\x96\xd7\xd8\x93\x9e\x0a\x00\x00") + +func cacertApiclient_certP12Bytes() ([]byte, error) { + return bindataRead( + _cacertApiclient_certP12, + "cacert/apiclient_cert.p12", + ) +} + +func cacertApiclient_certP12() (*asset, error) { + bytes, err := cacertApiclient_certP12Bytes() + if err != nil { + return nil, err + } + + info := bindataFileInfo{name: "cacert/apiclient_cert.p12", size: 2718, mode: os.FileMode(438), modTime: time.Unix(1565839462, 0)} + a := &asset{bytes: bytes, info: info} + return a, nil +} + +var _cacertApiclient_certPem = []byte("\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\x64\x94\x4b\xcf\xb2\x30\x1e\xc5\xf7\x7c\x8a\xd9\x9b\x89\x28\xa2\xb8\x78\x17\x85\x16\xe4\xd2\x6a\xb9\xaa\x3b\x40\x28\x72\x57\x90\x22\x9f\x7e\xf2\x3e\xcf\x64\x92\x99\xe9\xf2\x77\x9a\xe6\xf4\xe4\xff\x3f\xff\xfc\x7b\x54\x64\x98\xe4\x1f\x1a\x72\x7d\x53\x37\x35\xe0\xa3\x1f\x2a\x60\xd3\x84\x0a\xd4\x34\x30\x3e\x19\xe0\xa6\x0a\x98\x19\x5c\xb9\x74\x27\x12\x43\x45\xf5\xca\xb5\xa2\x7a\xd9\xf6\x98\x8d\x18\xcd\x63\x09\x38\xa4\x37\xcb\xee\xee\x66\x31\xa5\x04\x50\xe4\x08\x2a\x05\xfc\x5a\x22\x07\x83\xca\x00\x9b\x00\xa9\x05\xd6\xa8\xb8\x9b\xd1\x02\x5c\x95\x91\x50\x05\x9d\xaf\xd5\x6e\x9d\xb4\x6a\x91\x79\x72\x99\x6c\xc5\xf9\xe4\x83\xe4\x57\x1b\x7c\x41\xd7\xff\x4b\x64\x54\x44\x8c\x6e\xc3\xcf\xc3\x08\xbf\xd8\x1d\xb8\x41\x6f\x30\xa4\x14\xa2\xd9\x0a\xee\x91\xcc\x6f\xd7\xea\x73\xdb\x1e\x47\x53\xb7\xa6\x44\xa2\x4c\xa0\x22\xe2\xa7\x22\x25\xd8\xaf\xf8\x19\xa2\x0d\x86\xf8\x8b\x97\x80\x47\x7f\x59\x49\xff\xb2\xe5\x3f\xac\xd4\x54\xe6\x23\x1f\xab\xe8\xc7\x2d\xe0\xdc\x16\xb0\x8f\x65\x02\x29\x27\x30\xe0\xb8\x44\x09\x56\x7f\xbf\xa2\x31\xee\xc9\xc9\xfe\x23\x3b\xab\x42\xbe\x47\x86\xdc\x3d\x25\xf9\x70\x3e\xc8\x87\x4f\x8e\x3d\x91\xdb\xfc\xc7\x99\x23\x40\xcd\xaf\x3f\xc9\xba\x1e\xe5\x43\xf3\xb6\xf3\x6e\x8a\xdb\x76\xba\x9f\xda\x8f\xbc\xb4\xbd\x7c\x6a\x9e\x1d\x6c\x5a\xb3\xed\x9b\x3b\xac\x8b\x78\xa9\xcb\x03\x9b\xb5\x05\x58\xbf\x19\xdc\xb0\x00\x2a\x72\xc6\x2e\xe2\xf0\xf7\xc5\x13\x04\x85\x1f\x1b\xe1\x27\x6a\x8a\x3a\x29\x35\x0d\x78\xe6\xff\x26\xaf\xaa\x14\x40\xc6\xd0\x05\x40\x4d\x13\x00\xed\x34\xc6\x90\x0a\x70\xb1\x3e\x50\x29\x48\x0e\x46\x9a\x31\xd4\xed\x83\x9e\x76\x7d\xa3\x98\xce\x1e\xdc\x4c\x2b\xee\xfc\xc1\x51\x5d\xc5\xf0\xd2\xce\x8f\xa2\x09\x48\x79\x67\xef\xc2\x3c\x10\x9a\x4d\xe0\xc2\xac\xec\x06\x2e\x46\xe4\x25\xee\x58\x54\x2d\x46\xc5\x27\xd2\xe6\xfe\x70\x1a\x4f\xae\xb9\x2e\x49\xb7\xd4\x5d\x85\x7a\x73\xe4\xa3\x4b\xdd\xcf\xd6\xcf\x5a\x10\xd9\x9f\xfd\xcb\xae\x84\x4b\xd9\xbc\x2f\xd9\xbc\x3f\x6e\x72\xc2\xd4\x58\x1e\x8d\x38\xda\x99\xd5\x56\xe1\x7b\x82\x3e\x45\x2c\xd7\x91\x0a\xcb\xd4\xa9\xc1\xc6\xcc\x36\x62\x91\x0f\xb5\xb9\x53\x26\xf4\xe8\x69\xeb\xa7\x4f\x2a\x64\x2b\x7d\x7f\xb0\x24\x5d\xae\x5f\x73\x3d\x4b\xed\x21\x73\x90\x5c\x46\x73\x93\xbc\x8e\xab\xb3\xe9\x9e\x62\x16\x25\x6b\x2b\xfd\xca\xe8\xac\x7a\x73\x51\xf4\x53\x72\x6c\x43\x67\x6a\xcd\x3b\x73\xc0\x43\xd8\x8e\x30\xcb\x65\x35\x9e\xfc\x54\x7c\xad\xa5\x24\x75\xe2\x4b\xd7\xe4\xf2\x00\xed\xf5\xc5\xeb\x1f\xa6\x16\x6f\xc7\xcc\x4a\xdf\xef\xd7\x79\x1a\x96\x1b\x23\xf5\x72\xed\x77\x1e\x4b\xbd\x2f\x66\xbd\x25\xc8\x22\x34\x32\xb4\x5d\x94\xfa\xb3\xba\xe3\xb4\x5a\x97\xd7\x7d\x9b\xf8\xde\xdd\xea\x67\xb0\x15\x35\xc0\x11\x00\xf1\x59\x65\xbe\xba\xfe\xf7\xb8\x3f\x10\xa7\x1a\x06\x80\x6b\xfc\x06\x85\xd0\x15\x2f\x2a\xa0\x10\x30\x9f\x63\x23\xf8\xb9\x70\xe2\x6e\x86\x75\xce\xa3\x97\x7a\xeb\xf4\xd8\x08\x8d\x42\x7c\x9c\xc0\xde\xf9\x1e\xeb\x47\x43\x0a\xa7\xa9\xc5\xb4\x0d\x17\xa7\x21\x93\x90\xfc\xdd\x81\xe7\x91\x3f\x22\x6b\x88\x23\x3c\xc5\x57\xf7\xfb\xb8\x92\x32\x6d\xf8\x9a\x8a\xe8\x88\x03\x0b\x11\x68\x7e\x31\x0a\x36\x18\xb9\x1a\x5d\x80\x48\x4b\xb0\xa5\x01\x5d\xce\x7e\xba\x11\x08\xac\x76\x04\xde\x21\x86\x3a\xc4\x62\xb0\x73\x03\x0b\xe1\x12\x10\x95\x55\xaf\xa2\x7a\x1a\x47\x2e\xaa\x80\x0e\x3a\x00\x67\x0d\x50\x04\x9e\x8d\xa4\xf4\xac\x32\xd3\x7a\x9c\xcb\xcc\x91\x84\x92\x2c\xf3\x36\x6c\x9a\x53\x9d\x5b\xa7\x74\x8b\x53\x6d\xc5\x5e\x5b\x59\xb9\x44\x98\xaf\x55\x53\xfe\x9a\xca\xb5\x39\xf9\x8a\xbd\x73\xbc\x55\x8f\xd9\x75\x7f\x64\x5d\xdd\x50\x23\x25\xf3\x73\x87\xde\xc2\xb0\x5f\x5b\x27\x10\xf6\x2e\x86\xb2\xb6\xdf\x34\x21\xe6\xdb\xf0\x5a\x0e\x9b\xe7\xcd\xe6\x8c\x29\x56\x60\xa9\x7e\x5f\x29\xcb\x2e\x38\x0e\xf6\x81\x2d\x7a\x63\x28\xa3\xb7\xfb\x94\x84\x46\xb9\x7e\x17\xde\x34\xd9\xf8\xf7\x1b\xaf\x96\xf7\x30\x3a\xc6\xa6\xc7\x9b\xb7\x2f\xfa\x96\x89\xf1\xe0\xed\xf4\x34\x0d\xe3\x5b\x9e\xbb\x46\x0e\xc5\x5a\xab\xe9\xad\xbc\x59\x1d\x29\x3b\x57\x42\x92\xee\x7d\x26\x49\x88\x0b\x31\x5f\x42\xf3\xa8\x76\x07\x55\x57\x56\xae\x24\x61\x78\x3c\x96\x20\xeb\x8b\x33\xff\x4e\x75\xe3\xc9\x75\xae\x73\x4c\xdc\x37\xa8\x6b\xb1\x4c\xaa\x74\xf2\xc8\x62\x5c\x72\x3a\xda\x2b\x53\x11\xba\x6b\x55\x7e\xcc\xf4\x99\x1c\xec\x39\x24\x9f\xe9\xc0\xd8\x26\xfe\x5a\x9b\xa1\x5f\xaf\x8a\xa4\xff\x42\x7d\xeb\x66\xc3\xf1\x8c\x82\xc6\x88\x9f\xa4\x48\xde\x68\x3d\x24\x3c\x95\x32\xb8\x52\x80\x0d\x84\xd5\xf5\xbd\x6f\xd9\x9f\x3f\xc2\x4f\xc7\x22\x02\xff\xbf\x77\xff\x15\x00\x00\xff\xff\xef\x33\x6f\x42\x94\x05\x00\x00") + +func cacertApiclient_certPemBytes() ([]byte, error) { + return bindataRead( + _cacertApiclient_certPem, + "cacert/apiclient_cert.pem", + ) +} + +func cacertApiclient_certPem() (*asset, error) { + bytes, err := cacertApiclient_certPemBytes() + if err != nil { + return nil, err + } + + info := bindataFileInfo{name: "cacert/apiclient_cert.pem", size: 1428, mode: os.FileMode(438), modTime: time.Unix(1565839462, 0)} + a := &asset{bytes: bytes, info: info} + return a, nil +} + +var _cacertApiclient_keyPem = []byte("\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\x64\xd5\x37\xb2\x83\x4a\x02\x85\xe1\x9c\x55\xbc\x9c\x9a\x12\x56\x48\xc1\x0b\x1a\x6f\x44\xe3\x6d\x06\x08\x27\x40\x98\x16\x76\xf5\x53\x73\xd3\x39\xe1\x89\xfe\xec\xfb\xcf\xff\xc6\x4b\x8a\x06\xff\xb1\x5d\x2d\x04\xbe\xf4\x8f\x21\x25\x7f\x2f\x66\x6a\x9a\xb4\xed\x1a\x0f\x44\x00\xf9\xba\x9b\x9b\xae\x55\x9e\x3b\xc1\x03\x47\x92\x01\xf0\x04\xde\xe8\xf6\xba\xf6\x7a\x50\x4b\x00\x8c\x1a\x0f\x1c\x51\xab\x70\x02\x92\x0a\x7e\x7c\xd5\x91\xc7\x0c\xab\x37\x02\xc3\x48\x37\x41\xc0\x6b\x45\x10\xa2\x59\xe2\x84\x3d\xa8\xf8\xee\x6b\x48\x64\xbf\xec\x90\xbe\x0b\xab\x1c\x93\xfa\x2f\x94\x1c\x7a\xbc\xbf\x4c\x28\x7f\xb2\x9f\xa5\xc9\x93\x79\x4c\x26\xf6\xba\x52\x9a\xe0\x78\xce\x25\x3c\x9b\xb9\x32\x93\xcd\x74\xde\xf0\x5e\xc5\x2b\x08\xa4\xfc\xd7\xd1\xd3\x2e\xb7\xcb\x3a\xb7\x93\xc8\xb0\xf3\x45\xa3\x72\x7b\xc7\x57\x02\xa2\x35\x77\x87\x7e\x15\x74\x0c\x6e\xa6\xf5\x71\x5f\x63\xb4\xa6\x61\xed\x30\xb4\xc0\x3a\xd0\x53\x7f\x6f\x2d\xe6\x74\xcf\xb2\x5f\x87\x9a\x05\x3a\x41\x6b\x9d\xba\x35\xe5\x7a\xbe\x8f\x32\xcd\x50\x5a\xbc\x59\x9c\x6e\x0f\x2b\x21\x31\x94\x0e\xf7\xad\xfa\xb4\x92\x4b\x8d\xf2\x70\x3b\x63\x73\x75\xc5\x3a\x40\x49\x92\xe5\xd4\x2d\x25\x3d\x8e\x3d\x95\x44\xd8\xd5\xf7\xe2\xd0\x5f\xdc\x89\x16\x82\x86\xc6\xf6\xa4\x68\x81\xfa\xdc\xf5\x2f\x86\xe7\xe0\xdc\x2e\x62\x8e\x3d\x30\xfc\x96\xb8\x8d\x8d\xfb\xfd\xb3\x70\x26\xa5\x89\x69\x41\xde\x4b\x69\x54\x25\xf4\xd1\x0c\xaf\x7c\x83\xe3\xdb\x40\x74\xd3\xf3\x6d\xf0\x55\xdd\x66\x48\x7c\xa2\x08\x8c\x18\xbc\xac\x70\xe0\x0f\xd4\x26\x0f\x80\x24\xd4\xb5\xc4\x03\x5d\x80\x2b\xea\xbf\x67\x5d\xba\x2b\x79\xae\x3f\xd9\x16\xc0\xd1\xd1\x27\xbb\x41\x1f\xbd\xd1\x4f\x88\xb6\xa2\xab\x64\xee\xd7\x77\x98\x5f\x8e\x9d\x11\x25\x5f\xbe\xf6\x4a\xa6\xcb\x93\x6a\x15\x63\xa8\xf3\x0e\x9d\xe5\xee\xae\xac\xb3\x3f\xc8\x17\x30\xc0\x46\x47\xb0\xd3\xb5\xa6\x26\x87\xc1\xb8\xd5\x53\x8d\x04\x78\x3c\x6f\x73\x80\x59\xa6\x35\x81\xc9\x23\x33\x4e\x7e\xa9\xee\xd7\xa3\xfb\x66\x66\x69\x52\xf2\xaa\x47\x52\xa8\xe3\x5a\x06\x80\xa8\x9e\x9e\x4f\xc7\x15\x4a\xe2\x66\x17\x23\xa5\x0c\xa3\x68\x70\x7b\x24\x91\x7e\xd2\x61\xa8\x77\xb6\x36\xc1\xe9\x26\x10\xeb\xe7\xa4\xe8\x9f\x22\x3d\x10\x93\xbf\xdf\x3f\xb6\x1c\xd3\x78\x64\x78\x40\xb7\x74\xb8\x9d\xe9\x6d\x9a\x9b\xa1\x1a\x9a\x22\xe7\x5c\xcd\x00\xb7\x36\xee\xce\xb6\xc1\xac\xd0\x85\x7d\xe4\xc4\xfe\x67\x74\x6a\x6f\x61\x24\xb7\x93\x1f\xd5\xd2\x32\x4b\xf0\xbc\x93\x31\x65\xb3\x95\x22\x4c\x45\xb6\x44\xe3\x83\x8b\x78\x19\xaf\x98\x88\x63\xa8\x47\x3e\xd5\x3a\x81\x42\x19\x4b\x99\x1f\x37\x4d\x72\xcc\xd5\xdd\x30\x2d\xe1\x4d\xd0\x53\xc9\xdf\x42\x0a\x90\xe9\xbd\x4c\x6c\x83\x63\x93\x55\xf6\x3d\x35\x7c\x75\x42\x9d\x48\xe0\x1e\x1a\x5c\x69\xdd\x99\x4b\x6a\xce\xb0\x2f\x4f\xac\xbb\xc9\x11\xed\x0f\x8c\xec\xb1\x8d\x7f\x9e\x6d\xbf\xe9\x52\x4c\xc9\x45\x11\xc4\x25\x93\x46\x82\xb4\xcd\x4a\x6c\xd3\x3c\x1b\x6e\x19\x85\xf8\xb2\xe2\x63\x35\x64\x64\x18\xb6\x81\xd3\x9d\xe9\x0f\x4b\x9b\x50\x70\xef\x76\x68\x2d\x23\x3c\x21\x35\x83\xc9\x3b\x71\xcb\x0d\xa1\xfd\x20\xee\x4c\xbb\xed\xd4\xe7\x36\xd6\x8a\x50\x87\xce\xaf\x73\xf2\x4d\xf9\x46\x9e\x33\x6c\x64\xf4\xf0\x0d\x70\x76\x3f\x0c\xf5\x2e\xd4\xd3\xf8\x70\xcf\x42\xa3\x0e\xb4\x75\x79\x57\x7d\xee\xd5\x76\x2f\xd1\x5f\x32\x75\x3b\x65\x3e\xd4\xe9\x57\x6b\xa6\x5b\xd0\x84\xfa\xc1\xb5\xb4\x2e\x93\xda\x46\xd7\xca\x48\x41\x0c\x88\x11\x6f\x6c\x13\xcb\x8b\xf2\x14\x19\xfb\x9a\x28\xc2\x6c\x82\x59\x25\xf5\x5e\xf9\xee\xb9\xaa\x4e\xc8\xa7\x09\xbb\xd8\xf1\xd7\x25\x34\xd6\xa9\x89\x5f\x83\x38\xf7\xaa\xe4\x15\xa2\xb5\x2c\x0a\x9b\x4b\x45\x15\xf9\x91\xcb\xb2\x72\x52\xcd\xc6\x11\xcc\x3b\xcf\xdd\xcc\xf2\x85\x52\x02\x5f\x73\x7b\x43\xed\x2d\x1f\x6b\xb4\xe3\x50\xf5\x87\x82\x3c\x83\x68\x21\x92\xe0\x63\x9f\xc2\xe2\x7c\xb8\x1f\xb6\x5d\xdf\xf0\xcd\x0c\x5b\x54\x17\x7f\xc9\x63\xa5\xde\x3f\x49\xd4\xc5\x73\x32\xc3\xd6\xd6\xbe\x44\x7e\x21\xae\x37\x2d\xfc\xdd\x3b\xd7\x43\xa5\x0e\x12\xfd\x98\x02\x05\xcb\xab\x28\xe4\x42\xc6\x92\x24\x6f\x86\xc7\x57\x5e\x8f\x83\x8a\xae\x87\x11\xe6\x89\x26\x8f\x2e\x43\x05\x1a\x58\x4e\xcd\xe4\x5e\x34\x81\x4e\xdf\xbf\x93\x8f\x44\xea\xa0\xb6\x44\xea\xd8\x5f\x4d\x37\x3f\x1d\x1a\xee\x0e\x83\x95\x4b\x4f\xc1\x60\xa7\x70\x8b\xe8\x0a\x3a\x30\x47\x43\xcc\x02\xf6\xc6\xd9\x5e\x3e\x11\x42\x15\x6c\xb8\xf6\xc9\x4a\x33\xe5\xed\x6f\x8b\x73\xf2\xc9\xec\xfa\x4b\xce\x17\x63\x58\x25\xa1\x4e\x40\x81\x95\xd7\x3e\x2d\xfe\x99\x71\x6c\x4a\xb4\xe2\x77\x50\xb9\x33\xac\xc0\xfa\x49\xbd\x60\x9b\xd7\x98\xae\xab\xb8\xb6\x59\x1c\x66\xca\xe1\x58\x9c\xd1\xe4\x85\xce\xf1\x4f\x0d\x40\x7a\x37\x2c\x28\x23\x8c\xbd\x11\xee\x5c\x19\x19\xac\xf2\xe5\xdd\xc0\x84\x40\x06\x3a\xc6\x76\xac\xaa\x29\xda\xd1\x79\x56\x38\xc5\xeb\x33\x6f\xf6\x7a\x78\x75\x49\x79\xbd\x44\x19\x35\x7a\x2b\x9c\x4f\x9f\xce\xf6\x93\xc1\xba\x1c\x55\x2f\xaa\x91\x02\xb9\xbc\x4b\xe5\x47\xbd\x88\x69\xfc\x38\xdd\xc3\x6c\x86\xcc\x74\x23\x93\x4b\x96\x73\xe5\x6d\x8d\xde\x0d\xbe\x76\x04\x26\x88\xd8\x79\xa6\x45\x3f\xf5\x1e\x87\x18\xa7\x0e\xb6\xcd\x0b\xef\x95\xcf\x7e\x7c\x57\xaa\x80\xbb\x3b\x63\xf7\xd9\x93\x7c\x22\xee\x89\xa4\x9b\x54\xab\xf0\x34\x0f\xf9\x4d\xd2\xe0\x3a\x8f\xa9\xba\x64\x46\xe8\x28\x8d\xb7\x5e\xf0\x4d\x91\x9c\xd6\x21\x0c\x7c\xb6\x6e\x5a\x69\xeb\xb7\x9a\x8c\xfb\x34\x07\x36\xbe\x89\xdf\x99\x8b\x95\x36\xe1\xa5\xa0\xae\x96\x40\x5e\x9f\xa4\xb4\x59\xd5\xcf\x87\x6c\xa4\xed\xf8\xf8\x64\x3b\x3a\x90\x89\xdb\x7b\x29\x93\x12\x6b\x5e\x1d\xa8\xba\x82\x7b\xf0\x48\xff\x5a\x4b\x9c\xf7\xfc\xf4\x86\x90\xd1\x9c\x7f\xff\xc5\xfe\xec\x91\xa0\xf8\xff\x1e\xfd\x37\x00\x00\xff\xff\x8f\x2c\x57\x2c\xac\x06\x00\x00") + +func cacertApiclient_keyPemBytes() ([]byte, error) { + return bindataRead( + _cacertApiclient_keyPem, + "cacert/apiclient_key.pem", + ) +} + +func cacertApiclient_keyPem() (*asset, error) { + bytes, err := cacertApiclient_keyPemBytes() + if err != nil { + return nil, err + } + + info := bindataFileInfo{name: "cacert/apiclient_key.pem", size: 1708, mode: os.FileMode(438), modTime: time.Unix(1565839462, 0)} + a := &asset{bytes: bytes, info: info} + return a, nil +} + +var _cacertRootcaPem = []byte("\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\xa4\x94\x4d\xcf\xb2\x38\x17\xc7\xf7\x24\x7c\x87\x67\x6f\x9e\x08\x5e\xbe\x2e\x4f\x4b\xc1\xaa\x05\x8b\xbc\xef\x90\x97\x22\x88\x5c\xea\xad\x45\x3e\xfd\x44\xaf\xc9\x24\x73\xcf\xec\xa6\xcb\x5f\x9b\x9e\x93\xff\xf9\xe5\xfc\xff\x7d\x10\xb1\xa8\xfd\x3f\x4c\x5c\x8f\x9a\x14\x83\x47\x3e\x54\x55\x18\xa5\x06\x35\x30\x86\xae\x15\x20\x29\x02\x41\x89\x9d\x2f\xb4\x61\x00\x1b\x89\xe6\x5a\x35\x27\x6b\x25\x35\x04\xdc\x37\xc1\x40\x0e\xe3\x77\x89\x79\x6c\x04\x9c\x5b\x44\x6e\x02\x55\xf1\x07\xc2\x19\x4c\x2d\xd0\x7d\x82\x2b\xb6\x76\x23\x53\x4f\xc3\xa4\x2a\x0c\xf2\x8b\xe1\xfb\x0f\xef\x59\xf3\x17\xc7\xc8\x4b\x42\x5b\xcf\x5a\x5f\xf0\x49\xf0\x52\x95\xdc\x3a\xb7\x69\x68\x57\xb9\xe5\x0b\x1e\x05\x5a\x6a\xad\x5e\x69\xe4\xce\x18\x9a\x46\x86\xd7\x4c\x99\x21\x5e\xac\x26\x13\xdb\x20\x3a\x0b\xba\xc8\xf0\xc8\xdf\x98\xaa\xb0\xa0\x93\x5e\x4d\x76\x0c\x9a\x4f\x3d\x54\x31\x1c\x04\xac\x27\x06\x38\x48\xd8\x01\x82\xce\x43\x5a\xd0\xe7\xe1\xb9\x8d\x23\xd1\xef\x3c\xb8\xfd\xf0\xbb\xb7\x21\x41\xaf\x2a\x7f\xde\x08\x7f\x12\xd4\x79\xb4\x39\x53\x62\x9f\xb3\x8b\xfb\x9d\xb4\xe7\x3a\x8e\xdc\x33\x25\xa6\x9e\x5b\xd5\x33\x6b\xcf\x5a\xe1\x61\x74\xf9\x2d\x1f\x55\x01\x4e\x4c\x00\x07\xd5\x1c\xa4\x88\x1b\x2c\x62\x02\x32\x98\xf4\xa1\x95\xd1\xf8\x31\x17\xed\x49\x2b\xb1\x35\x71\x4d\xeb\x14\xe3\x6a\x31\x9a\x08\xf7\x49\xa6\xee\x89\x66\x7b\xb7\x64\xf3\x52\x55\x50\x81\xa7\x50\x22\xc7\x76\x86\xd3\xe9\xdb\x27\xc9\x76\xe8\x53\xdd\x2e\xd1\x71\xbf\x4b\xa6\x78\xcc\xc5\xd6\x19\xff\xd2\x10\x2e\x86\x0a\x90\xbb\x1f\xef\x9f\xd2\xb0\x75\xe3\x71\xbe\xdf\xa6\xee\x08\x54\x25\xdb\x34\x41\x30\x63\xe1\x92\x8f\xa2\xf4\x56\xe2\x14\xb3\x6c\x20\x7a\xc2\xb6\xbd\xbb\xae\x1f\xcf\xed\xea\xf8\x88\xb5\x60\xd1\xe7\xe7\xd2\xb7\x77\xb5\x0f\xcb\xf9\xc9\x29\xc6\xe6\xfe\x4b\xf4\x8b\x06\xab\x0a\x48\x02\x90\x3a\x18\x78\x23\x85\x20\x26\x5b\xc3\x3b\xd1\x7c\x2d\xdd\x6f\x66\x65\x32\x49\x51\xdd\x59\x56\x13\x0d\x28\xff\xdd\x85\xb7\x09\xaa\xf2\x5f\x5c\x78\x9b\xa0\x2a\xff\xea\x02\xd7\x24\x96\x9f\x5a\x06\x91\xae\xe1\x37\xb2\x67\xa8\xfb\xf4\x46\x80\x7b\x0c\x59\xc8\x18\xa8\x64\x9e\x90\xaa\xe2\x18\xf4\xc5\xbc\x58\x63\x9e\xdf\x87\x35\xec\xde\xb3\x5e\xf3\x25\x41\xc0\x30\xf0\x58\xae\xdf\x3f\xb9\x5a\x8d\x90\x90\x66\x07\xfe\xc1\x49\xba\xd1\xe1\x79\xb8\x7f\x47\x91\xbb\x12\xb5\xaa\x50\x84\xf6\x6c\x76\xe2\x97\x15\x97\x6b\xfe\x79\xed\x20\x14\x13\x93\xd4\x6d\xba\x6f\x6e\xda\x6d\x1b\xe8\x5a\x19\xd3\x17\x70\x6f\x70\xe2\x66\x33\xf6\x19\xc8\x9f\x7e\x24\x37\xdf\x39\x30\x04\xe5\x52\x5a\x22\xde\x6c\xbb\x84\x56\xcf\x64\x85\x34\x02\x08\x34\x89\xfb\xbb\x19\xd4\xec\xc1\x2c\x66\x80\x38\x02\x03\xcd\xc2\x87\xab\x75\xa0\xc7\x2f\x83\x13\x84\xb8\x0f\xaa\x02\x53\x0b\x81\x59\x3b\xdb\xe2\xb6\x5c\xad\xe6\xfa\x20\xb6\x33\x73\x11\x9a\xda\xf1\x52\x4f\x37\x11\xdb\x78\xc4\x86\x6d\x7a\x38\x5e\x46\x93\xa6\x75\x0a\x7f\x13\xb9\x6d\x3b\x6e\x48\x3e\xab\xab\x70\x1e\xab\xca\xe2\x5a\x8f\xc3\x7b\xed\x05\xc7\x4d\x9b\x05\x65\x21\xf1\xfa\xb6\x3f\x5c\x2f\x54\x6b\x10\xa2\x09\x2e\xc6\xc3\xa3\x9c\xd3\xd0\xbf\x05\x97\x64\x65\xc3\x64\xb8\xb7\xe1\x8e\x76\xf9\x30\x79\x98\xeb\xbc\x52\x15\xfd\xd9\x5d\x93\x53\x21\x8c\xf2\x7a\xc9\xf4\xe1\x9a\xed\x2d\x9f\x86\x01\x89\xc6\xb7\xe5\xe2\x75\xee\xae\xe9\x76\x5d\x14\xab\xd9\x42\x1b\xdd\xd1\x57\x36\x55\x95\xcf\x62\x21\xb6\xf1\x8f\x65\xf3\x47\x00\x00\x00\xff\xff\x94\xef\x0a\xc2\x88\x04\x00\x00") + +func cacertRootcaPemBytes() ([]byte, error) { + return bindataRead( + _cacertRootcaPem, + "cacert/rootca.pem", + ) +} + +func cacertRootcaPem() (*asset, error) { + bytes, err := cacertRootcaPemBytes() + if err != nil { + return nil, err + } + + info := bindataFileInfo{name: "cacert/rootca.pem", size: 1160, mode: os.FileMode(438), modTime: time.Unix(1523923200, 0)} + a := &asset{bytes: bytes, info: info} + return a, nil +} + +// Asset loads and returns the asset for the given name. +// It returns an error if the asset could not be found or +// could not be loaded. +func Asset(name string) ([]byte, error) { + cannonicalName := strings.Replace(name, "\\", "/", -1) + if f, ok := _bindata[cannonicalName]; ok { + a, err := f() + if err != nil { + return nil, fmt.Errorf("Asset %s can't read by error: %v", name, err) + } + return a.bytes, nil + } + return nil, fmt.Errorf("Asset %s not found", name) +} + +// MustAsset is like Asset but panics when Asset would return an error. +// It simplifies safe initialization of global variables. +func MustAsset(name string) []byte { + a, err := Asset(name) + if err != nil { + panic("asset: Asset(" + name + "): " + err.Error()) + } + + return a +} + +// AssetInfo loads and returns the asset info for the given name. +// It returns an error if the asset could not be found or +// could not be loaded. +func AssetInfo(name string) (os.FileInfo, error) { + cannonicalName := strings.Replace(name, "\\", "/", -1) + if f, ok := _bindata[cannonicalName]; ok { + a, err := f() + if err != nil { + return nil, fmt.Errorf("AssetInfo %s can't read by error: %v", name, err) + } + return a.info, nil + } + return nil, fmt.Errorf("AssetInfo %s not found", name) +} + +// AssetNames returns the names of the assets. +func AssetNames() []string { + names := make([]string, 0, len(_bindata)) + for name := range _bindata { + names = append(names, name) + } + return names +} + +// _bindata is a table, holding each asset generator, mapped to its name. +var _bindata = map[string]func() (*asset, error){ + "cacert/apiclient_cert.p12": cacertApiclient_certP12, + "cacert/apiclient_cert.pem": cacertApiclient_certPem, + "cacert/apiclient_key.pem": cacertApiclient_keyPem, + "cacert/rootca.pem": cacertRootcaPem, +} + +// AssetDir returns the file names below a certain +// directory embedded in the file by go-bindata. +// For example if you run go-bindata on data/... and data contains the +// following hierarchy: +// data/ +// foo.txt +// img/ +// a.png +// b.png +// then AssetDir("data") would return []string{"foo.txt", "img"} +// AssetDir("data/img") would return []string{"a.png", "b.png"} +// AssetDir("foo.txt") and AssetDir("notexist") would return an error +// AssetDir("") will return []string{"data"}. +func AssetDir(name string) ([]string, error) { + node := _bintree + if len(name) != 0 { + cannonicalName := strings.Replace(name, "\\", "/", -1) + pathList := strings.Split(cannonicalName, "/") + for _, p := range pathList { + node = node.Children[p] + if node == nil { + return nil, fmt.Errorf("Asset %s not found", name) + } + } + } + if node.Func != nil { + return nil, fmt.Errorf("Asset %s not found", name) + } + rv := make([]string, 0, len(node.Children)) + for childName := range node.Children { + rv = append(rv, childName) + } + return rv, nil +} + +type bintree struct { + Func func() (*asset, error) + Children map[string]*bintree +} + +var _bintree = &bintree{nil, map[string]*bintree{ + "cacert": &bintree{nil, map[string]*bintree{ + "apiclient_cert.p12": &bintree{cacertApiclient_certP12, map[string]*bintree{}}, + "apiclient_cert.pem": &bintree{cacertApiclient_certPem, map[string]*bintree{}}, + "apiclient_key.pem": &bintree{cacertApiclient_keyPem, map[string]*bintree{}}, + "rootca.pem": &bintree{cacertRootcaPem, map[string]*bintree{}}, + }}, +}} + +// RestoreAsset restores an asset under the given directory +func RestoreAsset(dir, name string) error { + data, err := Asset(name) + if err != nil { + return err + } + info, err := AssetInfo(name) + if err != nil { + return err + } + err = os.MkdirAll(_filePath(dir, filepath.Dir(name)), os.FileMode(0755)) + if err != nil { + return err + } + err = ioutil.WriteFile(_filePath(dir, name), data, info.Mode()) + if err != nil { + return err + } + err = os.Chtimes(_filePath(dir, name), info.ModTime(), info.ModTime()) + if err != nil { + return err + } + return nil +} + +// RestoreAssets restores an asset under the given directory recursively +func RestoreAssets(dir, name string) error { + children, err := AssetDir(name) + // File + if err != nil { + return RestoreAsset(dir, name) + } + // Dir + for _, child := range children { + err = RestoreAssets(dir, filepath.Join(name, child)) + if err != nil { + return err + } + } + return nil +} + +func _filePath(dir, name string) string { + cannonicalName := strings.Replace(name, "\\", "/", -1) + return filepath.Join(append([]string{dir}, strings.Split(cannonicalName, "/")...)...) +} diff --git a/services/pay/order.go b/services/pay/order.go index d528725..11e14d9 100644 --- a/services/pay/order.go +++ b/services/pay/order.go @@ -14,7 +14,7 @@ import ( "time" ) -const CALLBACK_ORDER_URL = "https://api.ouxuanhudong.com/PcClient/common/WeChatOauthCtl/callbackOrder" +const CallbackOrderUrl = "https://api.ouxuanhudong.com/PcClient/common/WeChatOauthCtl/callbackOrder" func Order(content, ip, openid string, fee, goodType int, userId, activityId int64) (map[string]interface{}, error) { client := wechat.NewClient(wx.Appid, wx.Mchid, wx.ApiKey, true) @@ -35,7 +35,7 @@ func Order(content, ip, openid string, fee, goodType int, userId, activityId int body.Set("out_trade_no", outTradeNo) body.Set("total_fee", fee) body.Set("spbill_create_ip", ip) - body.Set("notify_url", CALLBACK_ORDER_URL) + body.Set("notify_url", CallbackOrderUrl) body.Set("trade_type", wechat.TradeType_JsApi) body.Set("device_info", "WEB") body.Set("sign_type", wechat.SignType_MD5) diff --git a/services/red_envelope/red_envelop.go b/services/red_envelope/red_envelop.go index 8dcaf12..80661bf 100644 --- a/services/red_envelope/red_envelop.go +++ b/services/red_envelope/red_envelop.go @@ -49,6 +49,35 @@ const ( MaxRedPackAmount = 499 ) +func GenRedPack(amount, num int) []int { + r := rand.New(rand.NewSource(time.Now().UnixNano())) + sumMoney := 0 + redPacks := make([]int, num) + for i := 0; i < num; i++ { + money := r.Int()*2*(amount-sumMoney)/num - i + if money <= MinRedPackAmount { + money = MinRedPackAmount + } else if money >= MaxRedPackAmount { + money = MaxRedPackAmount + } + + // 剩余红包的限制 + rate := (amount - sumMoney - money) / (num - i) + if rate <= MinRedPackAmount { + money = MinRedPackAmount + } else if rate >= MaxRedPackAmount { + money = MaxRedPackAmount + } + + if num-i == 1 { // 最后一个 + money = amount - sumMoney + } + sumMoney += money + redPacks = append(redPacks, money) + } + return redPacks +} + // 提前生成红包 func GenRedEnvelope(aid, rid int64, rule *models.ShakeRedEnvelopeRule) error { // 判断红包是否存在 @@ -65,12 +94,29 @@ func GenRedEnvelope(aid, rid int64, rule *models.ShakeRedEnvelopeRule) error { r := rand.New(rand.NewSource(time.Now().UnixNano())) if rule.Model == define.SHAKERB_RULE_RANDOM { // 随机红包 + //redPacks := GenRedPack(int(rule.RandSum*100), int(rule.RedEnvelopeNum)) + //for _, redpack := range redPacks { + // record := new(models.ShakeRedEnvelopeRecord) + // record.ActivityId = aid + // record.RehearsalId = rid + // record.ShakeRedEnvelopeActivityId = rule.ShakeRedEnvelopeActivityId + // record.ShakeRedEnvelopeRuleId = rule.Id + // record.Amount = float64(redpack) / 100 + // record.IsDraw = -1 + // record.IsDelete = false + // record.CreatedAt = time.Now() + // record.UpdatedAt = time.Now() + // if _, err := core.GetXormAuto().InsertOne(record); err != nil { + // return err + // } + //} + // 检测红包是否存在 sumMoney := 0.0 for i := 0; i < int(rule.RedEnvelopeNum); i++ { money := r.Float64() * 2 * (rule.RandSum - sumMoney) / float64(int(rule.RedEnvelopeNum)-i) amount := utils.Float64CusDecimal(money, 2) - if amount < MinRedPackAmount { // 随机的金额可能小于1块钱 + if amount <= MinRedPackAmount { // 随机的金额可能小于1块钱 amount = MinRedPackAmount } else if amount >= MaxRedPackAmount { amount = MaxRedPackAmount diff --git a/utils/code/code.go b/utils/code/code.go index 4de7c95..430d3bf 100644 --- a/utils/code/code.go +++ b/utils/code/code.go @@ -12,6 +12,8 @@ const ( MSG_CUSTOMER_NOT_EXIST = 700 MSG_AREASTORE_NOT_EXIST = 800 MSG_ENTRYPEOPLE_NOT_EXIST = 900 + MSG_LIVE_ACTIVITY_NOT_EXIST = 950 // 直播活动不存在 + MSG_LIVE_RED_PACK_NOT_EXIST = 951 // 直播红包不存在 MSG_ACTIVITY_NOT_EXIST = 1000 // 互动不存在 MSG_MODULE_NOT_EXIST = 1001 // 模块活动不存在 MSG_MODULE_STATUS_END = 1002 // 该模块活动已结束 @@ -42,6 +44,5 @@ const ( MSG_SHAKERB_RECORD_NOT_EXIST = 8001 // 摇红包不存在 MSG_SHAKERB_RULE_NOT_EXIST = 8002 // 红包规则不存在 MSG_AUCTION_NOT_EXIST = 9000 // 竞拍不存在 - MSG_AUCTION_PLAYER_NOT_EXIST = 9001 // 竞拍人不存在 MSG_CALORIE_NOT_EXIST = 10001 // 卡路里轮次不存在 )