隐私号
This commit is contained in:
@@ -4635,7 +4635,7 @@ func BackUpStoreSkuBind(ctx *jxcontext.Context, isAsync, isContinueWhenError boo
|
||||
snapshotAt = utils.Time2Date(time.Now())
|
||||
)
|
||||
storeSkuBindHis := &model.StoreSkuBindHistory{
|
||||
SnapshotAt: snapshotAt.AddDate(0, 0, -3),
|
||||
SnapshotAt: snapshotAt.AddDate(0, 0, -2),
|
||||
}
|
||||
dao.DeleteEntity(db, storeSkuBindHis, "SnapshotAt")
|
||||
storeList, err := dao.GetStoreList(db, nil, nil, nil, nil, nil, "")
|
||||
|
||||
@@ -4,6 +4,7 @@ import (
|
||||
"bytes"
|
||||
"context"
|
||||
"fmt"
|
||||
"git.rosy.net.cn/jx-callback/business/jxutils/secretNumber"
|
||||
"net"
|
||||
"regexp"
|
||||
"strconv"
|
||||
@@ -1985,7 +1986,7 @@ func UploadJdsImage(ctx *jxcontext.Context) (err error) {
|
||||
// }
|
||||
// go connHandler(conn, "1e000f02000151323032313036313530303030313"+utils.Int2Str(i)+"00000033")
|
||||
//}
|
||||
cms.RefreshStoreIsOnline(jxcontext.AdminCtx)
|
||||
secretNumber.QuerySubsId("17188399428")
|
||||
return err
|
||||
}
|
||||
|
||||
|
||||
91
business/jxutils/secretNumber/secretNum.go
Normal file
91
business/jxutils/secretNumber/secretNum.go
Normal file
@@ -0,0 +1,91 @@
|
||||
package secretNumber
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"git.rosy.net.cn/baseapi/utils"
|
||||
"git.rosy.net.cn/jx-callback/business/jxutils/jxcontext"
|
||||
"git.rosy.net.cn/jx-callback/business/model"
|
||||
"git.rosy.net.cn/jx-callback/business/model/dao"
|
||||
"git.rosy.net.cn/jx-callback/globals/api"
|
||||
"github.com/alibabacloud-go/dyplsapi-20170525/client"
|
||||
"github.com/alibabacloud-go/tea/tea"
|
||||
)
|
||||
|
||||
//查询线上可购号码余量
|
||||
func QuerySecretNoRemain(city string) (b bool, err error) {
|
||||
result, err := api.SecretNumClient.QuerySecretNoRemain(&client.QuerySecretNoRemainRequest{
|
||||
SpecId: tea.Int64(1), //1:虚商号码,即170或171。
|
||||
City: tea.String(city), //城市名
|
||||
})
|
||||
if err != nil {
|
||||
return false, err
|
||||
}
|
||||
if *result.Body.Code != "OK" {
|
||||
err = fmt.Errorf(*result.Body.Message)
|
||||
return false, err
|
||||
}
|
||||
if *result.Body.SecretRemainDTO.Amount > 0 {
|
||||
return true, nil
|
||||
}
|
||||
return false, err
|
||||
}
|
||||
|
||||
//购买号码
|
||||
func BuySecretNo(ctx *jxcontext.Context, poolKey, city string) (err error) {
|
||||
result, err := api.SecretNumClient.BuySecretNo(&client.BuySecretNoRequest{
|
||||
PoolKey: tea.String(poolKey),
|
||||
SpecId: tea.Int64(1),
|
||||
City: tea.String(city),
|
||||
})
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
if *result.Body.Code != "OK" {
|
||||
err = fmt.Errorf(*result.Body.Message)
|
||||
return err
|
||||
}
|
||||
if secretNo := *result.Body.SecretBuyInfoDTO.SecretNo; secretNo != "" {
|
||||
secretNumber := &model.SecretNumber{
|
||||
City: city,
|
||||
Number: secretNo,
|
||||
PoolKey: poolKey,
|
||||
}
|
||||
dao.WrapAddIDCULDEntity(secretNumber, ctx.GetUserName())
|
||||
err = dao.CreateEntity(dao.GetDB(), secretNumber)
|
||||
}
|
||||
return err
|
||||
}
|
||||
|
||||
//绑定号码
|
||||
func BindAxb(ctx *jxcontext.Context, secretNumber, numberA, numberB, expiration string) (err error) {
|
||||
result, err := api.SecretNumClient.BindAxb(&client.BindAxbRequest{
|
||||
PhoneNoA: tea.String(numberA),
|
||||
PhoneNoB: tea.String(numberB),
|
||||
PhoneNoX: tea.String(secretNumber),
|
||||
Expiration: tea.String(expiration),
|
||||
})
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
if *result.Body.Code != "OK" {
|
||||
err = fmt.Errorf(*result.Body.Message)
|
||||
return err
|
||||
}
|
||||
return err
|
||||
}
|
||||
|
||||
//查询绑定唯一标识SubsId
|
||||
func QuerySubsId(secretNumber string) (err error) {
|
||||
result, err := api.SecretNumClient.QuerySubsId(&client.QuerySubsIdRequest{
|
||||
PhoneNoX: tea.String(secretNumber),
|
||||
})
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
if *result.Body.Code != "OK" {
|
||||
err = fmt.Errorf(*result.Body.Message)
|
||||
return err
|
||||
}
|
||||
fmt.Println(utils.Format4Output(result.Body, true))
|
||||
return err
|
||||
}
|
||||
16
business/model/secret_number.go
Normal file
16
business/model/secret_number.go
Normal file
@@ -0,0 +1,16 @@
|
||||
package model
|
||||
|
||||
type SecretNumber struct {
|
||||
ModelIDCULD
|
||||
|
||||
PoolKey string `json:"poolKey"`
|
||||
Number string `json:"number"` //隐私号
|
||||
City string `json:"city"` //归属地
|
||||
Comment string `json:"comment"` //备注
|
||||
}
|
||||
|
||||
func (*SecretNumber) TableUnique() [][]string {
|
||||
return [][]string{
|
||||
[]string{"PoolKey", "Number"},
|
||||
}
|
||||
}
|
||||
@@ -812,11 +812,12 @@ func (*StoreAudit) TableIndex() [][]string {
|
||||
type Brand struct {
|
||||
ModelIDCULD
|
||||
|
||||
Name string `orm:"size(255)" json:"name"` //品牌名
|
||||
Logo string `orm:"size(255)" json:"logo"` //品牌logo
|
||||
BrandType int `json:"brandType"` //品牌类型
|
||||
IsOpen int `json:"isOpen"` //主要三方配送用,是否配送,默认0表示打开,1表示关
|
||||
IsPrint int `json:"isPrint"` //是否打印小票中的标题,默认0表示打,1表示不打
|
||||
Name string `orm:"size(255)" json:"name"` //品牌名
|
||||
Logo string `orm:"size(255)" json:"logo"` //品牌logo
|
||||
BrandType int `json:"brandType"` //品牌类型
|
||||
IsOpen int `json:"isOpen"` //主要三方配送用,是否配送
|
||||
IsPrint int `json:"isPrint"` //是否打印小票中的标题,默认0表示打,1表示不打
|
||||
SecretNumberPoolKey string `json:"secretNumberPoolKey"` //隐私号池ID,一个品牌对应一个池子
|
||||
}
|
||||
|
||||
func (*Brand) TableUnique() [][]string {
|
||||
|
||||
43
globals/api/aliapi.go
Normal file
43
globals/api/aliapi.go
Normal file
@@ -0,0 +1,43 @@
|
||||
package api
|
||||
|
||||
import (
|
||||
"github.com/alibabacloud-go/darabonba-openapi/client"
|
||||
dyplsapiclient "github.com/alibabacloud-go/dyplsapi-20170525/client"
|
||||
dyvmsapiclient "github.com/alibabacloud-go/dyvmsapi-20170525-2.0.2/client"
|
||||
"github.com/alibabacloud-go/tea/tea"
|
||||
beego "github.com/astaxie/beego/server/web"
|
||||
)
|
||||
|
||||
var (
|
||||
aliKey = tea.String(beego.AppConfig.DefaultString("aliKey", ""))
|
||||
aliSecret = tea.String(beego.AppConfig.DefaultString("aliSecret", ""))
|
||||
)
|
||||
|
||||
var (
|
||||
VoiceClient, _ = CreateClientVoice(aliKey, aliSecret, "dyvmsapi.aliyuncs.com") //语音服务
|
||||
SecretNumClient, _ = CreateClientSecretNum(aliKey, aliSecret, "dyplsapi.aliyuncs.com") //号码隐私
|
||||
)
|
||||
|
||||
func CreateClientVoice(accessKeyId *string, accessKeySecret *string, url string) (_result *dyvmsapiclient.Client, _err error) {
|
||||
config := &client.Config{}
|
||||
// 您的AccessKey ID
|
||||
config.AccessKeyId = accessKeyId
|
||||
// 您的AccessKey Secret
|
||||
config.AccessKeySecret = accessKeySecret
|
||||
config.Endpoint = tea.String(url)
|
||||
_result = &dyvmsapiclient.Client{}
|
||||
_result, _err = dyvmsapiclient.NewClient(config)
|
||||
return _result, _err
|
||||
}
|
||||
|
||||
func CreateClientSecretNum(accessKeyId *string, accessKeySecret *string, url string) (_result *dyplsapiclient.Client, _err error) {
|
||||
config := &client.Config{}
|
||||
// 您的AccessKey ID
|
||||
config.AccessKeyId = accessKeyId
|
||||
// 您的AccessKey Secret
|
||||
config.AccessKeySecret = accessKeySecret
|
||||
config.Endpoint = tea.String(url)
|
||||
_result = &dyplsapiclient.Client{}
|
||||
_result, _err = dyplsapiclient.NewClient(config)
|
||||
return _result, _err
|
||||
}
|
||||
@@ -3,7 +3,6 @@ package api
|
||||
import (
|
||||
"git.rosy.net.cn/baseapi/platformapi/jxprintapi"
|
||||
"git.rosy.net.cn/baseapi/platformapi/qywxapi"
|
||||
"github.com/alibabacloud-go/tea/tea"
|
||||
"time"
|
||||
|
||||
"git.rosy.net.cn/baseapi/platformapi/fnpsapi"
|
||||
@@ -19,10 +18,6 @@ import (
|
||||
|
||||
"git.rosy.net.cn/baseapi/platformapi/tonglianpayapi"
|
||||
|
||||
aliyunsmsclient "github.com/KenmyZhang/aliyun-communicate"
|
||||
"github.com/alibabacloud-go/darabonba-openapi/client"
|
||||
dyvmsapiclient "github.com/alibabacloud-go/dyvmsapi-20170525-2.0.2/client"
|
||||
|
||||
"git.rosy.net.cn/baseapi/platformapi"
|
||||
"git.rosy.net.cn/baseapi/platformapi/alipayapi"
|
||||
"git.rosy.net.cn/baseapi/platformapi/autonavi"
|
||||
@@ -45,6 +40,7 @@ import (
|
||||
"git.rosy.net.cn/jx-callback/business/jxutils/cache"
|
||||
"git.rosy.net.cn/jx-callback/business/jxutils/cache/redis"
|
||||
"git.rosy.net.cn/jx-callback/globals"
|
||||
aliyunsmsclient "github.com/KenmyZhang/aliyun-communicate"
|
||||
|
||||
beego "github.com/astaxie/beego/server/web"
|
||||
"github.com/qiniu/api.v7/auth/qbox"
|
||||
@@ -108,9 +104,8 @@ var (
|
||||
|
||||
PushAPI *unipushapi.API
|
||||
|
||||
Cacher cache.ICacher
|
||||
SMSClient *aliyunsmsclient.SmsClient
|
||||
VoiceClient *dyvmsapiclient.Client
|
||||
Cacher cache.ICacher
|
||||
SMSClient *aliyunsmsclient.SmsClient
|
||||
)
|
||||
|
||||
func init() {
|
||||
@@ -288,19 +283,6 @@ func Init() {
|
||||
JxPrintAPI = jxprintapi.New(beego.AppConfig.DefaultString("jxPrintAppID", ""), beego.AppConfig.DefaultString("jxPrintAppKey", ""))
|
||||
|
||||
SMSClient = aliyunsmsclient.New("http://dysmsapi.aliyuncs.com/")
|
||||
VoiceClient, _ = CreateClient(tea.String(beego.AppConfig.DefaultString("aliKey", "")), tea.String(beego.AppConfig.DefaultString("aliSecret", "")))
|
||||
|
||||
QywxAPI = qywxapi.New(beego.AppConfig.DefaultString("qywxID", ""), beego.AppConfig.DefaultString("qywxSecret", ""), "")
|
||||
}
|
||||
|
||||
func CreateClient(accessKeyId *string, accessKeySecret *string) (_result *dyvmsapiclient.Client, _err error) {
|
||||
config := &client.Config{}
|
||||
// 您的AccessKey ID
|
||||
config.AccessKeyId = accessKeyId
|
||||
// 您的AccessKey Secret
|
||||
config.AccessKeySecret = accessKeySecret
|
||||
config.Endpoint = tea.String("dyvmsapi.aliyuncs.com")
|
||||
_result = &dyvmsapiclient.Client{}
|
||||
_result, _err = dyvmsapiclient.NewClient(config)
|
||||
return _result, _err
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user