This commit is contained in:
邹宗楠
2022-10-24 21:45:35 +08:00
parent 42eda07e55
commit 475044fd4b
2 changed files with 4 additions and 3 deletions

View File

@@ -280,7 +280,9 @@ func AddVendorOrgCode(ctx *jxcontext.Context, vendorOrgCode *model.VendorOrgCode
return err
}
if len(list) > 0 {
return fmt.Errorf("库里有这个账号了,[%v]", vendorOrgCode.VendorOrgCode)
vendorOrgCode.ID = list[0].ID
_, err = dao.UpdateEntity(db, vendorOrgCode, "token", "updated_at", "app_key", "app_secret")
return err
}
var userName string

View File

@@ -16,7 +16,6 @@ import (
"io/ioutil"
"net/http"
"strings"
"time"
)
type TiktokShopController struct {
@@ -123,7 +122,6 @@ func (c *TiktokShopController) TokenMsg() {
globals.SugarLogger.Debugf("result=====%s", utils.Format4Output(result, false))
result.ExpiresIn += time.Now().Unix()
data, err := json.Marshal(result)
if err != nil {
c.Data["json"] = tiktok_api.CallbackResponse{Code: tiktok_api.CallbackFailCode, Msg: tiktok_api.CallbackFail}
@@ -145,6 +143,7 @@ func (c *TiktokShopController) TokenMsg() {
AppSecret: "heihei", // web.AppConfig.DefaultString("tiktokShopAppSecret", "c397aa9f-3927-47c4-8cfe-4d84e02602e0")
}
if err := common.AddVendorOrgCode(nil, param); err != nil {
globals.SugarLogger.Debugf("AddVendorOrgCode=====err%s", err)
c.Data["json"] = tiktok_api.CallbackResponse{Code: tiktok_api.CallbackFailCode, Msg: tiktok_api.CallbackFail}
c.ServeJSON()
return