refactor: fmt

master
howell 4 years ago
parent a0fdfa95b3
commit 9de70d4e8d

@ -191,7 +191,6 @@ const (
ConfigJCookMqHost = "jcook.com.cn" ConfigJCookMqHost = "jcook.com.cn"
ConfigJCookMqPort = "5672" ConfigJCookMqPort = "5672"
ConfigShaMaAppKey = "64f70e023a32e058a565650d74d44a7d" ConfigShaMaAppKey = "64f70e023a32e058a565650d74d44a7d"
ConfigShaMaAppSecret = "ca5f6cc561672968fab36c825fc78385" ConfigShaMaAppSecret = "ca5f6cc561672968fab36c825fc78385"
ConfigShaMaAppChannelID = 1010273 ConfigShaMaAppChannelID = 1010273

@ -40,9 +40,9 @@ func QueryDiamondList(c *gin.Context) {
var list []user.DiamondRegister var list []user.DiamondRegister
dbc.DB.Where(where).Limit(limit).Offset((page.Page) * limit).Find(&list) dbc.DB.Where(where).Limit(limit).Offset((page.Page) * limit).Find(&list)
dbc.DB.Table("recook_diamond_register").Where(where).Count(&count) dbc.DB.Table("recook_diamond_register").Where(where).Count(&count)
for key,_info := range list{ for key, _info := range list {
userInfo := user.Information{} userInfo := user.Information{}
dbc.DB.Where("id = ?",_info.IntroUserId).First(&userInfo) dbc.DB.Where("id = ?", _info.IntroUserId).First(&userInfo)
list[key].IntroUserInfo = userInfo list[key].IntroUserInfo = userInfo
} }
back.Suc(c, "", &BaseResponse{ back.Suc(c, "", &BaseResponse{

@ -244,7 +244,7 @@ func CreatePreviewShoppingTrolleyOrder(c *gin.Context) {
} }
if IsAddrDelivery { // 如果是发货地区,计算每个商品的 if IsAddrDelivery { // 如果是发货地区,计算每个商品的
for _, v := range preOrderGoodsList { // 如果该地区不发货,不用计算运费了 for _, v := range preOrderGoodsList { // 如果该地区不发货,不用计算运费了
if v.VendorID == 1800 || v.VendorID == 2000 || v.VendorID == 3000{ if v.VendorID == 1800 || v.VendorID == 2000 || v.VendorID == 3000 {
continue continue
} }
_, expressFee, _ := computeExpressFeeWithPreviewGoods(v.Quantity, v, defaultAddr.Province, defaultAddr.City) _, expressFee, _ := computeExpressFeeWithPreviewGoods(v.Quantity, v, defaultAddr.Province, defaultAddr.City)

@ -57,8 +57,7 @@ func createOrder(virtualID uint, ip string, userID uint) (error, string) {
} }
var detail pay.AliPayDetail var detail pay.AliPayDetail
if err := dbc.DB.First(&detail, "order_id = ?", virtualID).Error; if err := dbc.DB.First(&detail, "order_id = ?", virtualID).Error; err != nil && err != gorm.ErrRecordNotFound {
err != nil && err != gorm.ErrRecordNotFound {
return err, "" return err, ""
} }

@ -77,8 +77,7 @@ func createH5Order(orderID uint, ip string, userID uint) (error, string) {
tx.Commit() tx.Commit()
return nil, detail.CreateOrderSign return nil, detail.CreateOrderSign
} else { } else {
if url, tradeNo, err := genUrl(od[0].Title, userID, orderID, amount); if url, tradeNo, err := genUrl(od[0].Title, userID, orderID, amount); err != nil {
err != nil {
return errors.New("失败"), "" return errors.New("失败"), ""
} else { } else {
tx := dbc.DB.Begin() tx := dbc.DB.Begin()
@ -133,13 +132,11 @@ func CreateH5Alipay(c *gin.Context) {
} }
} }
if err = public.UpdateNormalPay(p.OrderID); err != nil { if err = public.UpdateNormalPay(p.OrderID); err != nil {
back.Err(c, err.Error()) back.Err(c, err.Error())
return return
} }
now := time.Now().Unix() now := time.Now().Unix()
var orderInfo order.Information var orderInfo order.Information
@ -186,8 +183,7 @@ func CreateH5Alipay(c *gin.Context) {
} }
} else { } else {
if url, tradeNo, err := genUrl(orderInfo.Title, p.UserID, orderInfo.ID, orderInfo.ActualTotalAmount); if url, tradeNo, err := genUrl(orderInfo.Title, p.UserID, orderInfo.ID, orderInfo.ActualTotalAmount); err != nil {
err != nil {
back.Fail(c, "失败") back.Fail(c, "失败")
} else { } else {
err = dbc.DB.Model(&orderInfo).Updates(order.Information{ err = dbc.DB.Model(&orderInfo).Updates(order.Information{

@ -184,7 +184,6 @@ func H5Callback(c *gin.Context) {
return return
} }
if result.IsPayNotify() { if result.IsPayNotify() {
h5PaySuccess(c, result) h5PaySuccess(c, result)
} else { } else {

@ -1,2 +1 @@
package recookpay package recookpay

@ -34,7 +34,6 @@ func (r *RefundReqInfo) IsOk() bool {
return r.RefundStatus == "SUCCESS" return r.RefundStatus == "SUCCESS"
} }
func RefundCallback(c *gin.Context) { func RefundCallback(c *gin.Context) {
FAIL := gin.H{ FAIL := gin.H{
"return_code": "FAIL", "return_code": "FAIL",

@ -113,8 +113,7 @@ func createOrder(orderID uint, ip string, userID uint) (error, *AppCreateOrderRe
} }
var u user.Information var u user.Information
if err := dbc.DB.Select("wx_mini_open_id").First(&u, "id = ?", userID).Error; if err := dbc.DB.Select("wx_mini_open_id").First(&u, "id = ?", userID).Error; err != nil && err != gorm.ErrRecordNotFound {
err != nil && err != gorm.ErrRecordNotFound {
return err, nil return err, nil
} }

@ -352,4 +352,3 @@ func UserDestroy(c *gin.Context) {
back.Suc(c, "操作成功", nil) back.Suc(c, "操作成功", nil)
return return
} }

@ -151,7 +151,7 @@ func WaterMarkOut(imgPath string, ttf string, w io.Writer, contentList []Content
defer open.Close() defer open.Close()
tmpImg, _, _ := image.Decode(open) tmpImg, _, _ := image.Decode(open)
condition := tmpImg.Bounds().Max.X > tmpImg.Bounds().Max.Y * 3 condition := tmpImg.Bounds().Max.X > tmpImg.Bounds().Max.Y*3
if condition { if condition {
item.Width = 810 item.Width = 810
item.Height = 0 item.Height = 0
@ -159,7 +159,7 @@ func WaterMarkOut(imgPath string, ttf string, w io.Writer, contentList []Content
tmpImg = resize.Resize(item.Width, item.Height, tmpImg, resize.Lanczos3) tmpImg = resize.Resize(item.Width, item.Height, tmpImg, resize.Lanczos3)
offsetX := item.X - tmpImg.Bounds().Max.X offsetX := item.X - tmpImg.Bounds().Max.X
offsetY := item.Y - 270 + (270 - tmpImg.Bounds().Max.Y) / 2 offsetY := item.Y - 270 + (270-tmpImg.Bounds().Max.Y)/2
offset := image.Pt(offsetX, offsetY) offset := image.Pt(offsetX, offsetY)
fmt.Println(offsetX, offsetY) fmt.Println(offsetX, offsetY)

@ -90,7 +90,7 @@ func ParsePage(data []byte) (res []weibo.ReunionSystem, err error) {
} }
} }
do.Wait() do.Wait()
if err = mysql.Db.Create(res).Error; err != nil{ if err = mysql.Db.Create(res).Error; err != nil {
fmt.Println(err.Error()) fmt.Println(err.Error())
} }

@ -20,7 +20,7 @@ type DiamondRegister struct {
AuditManangerId uint `gorm:"column:audit_manager_id" json:"audit_manager_id"` AuditManangerId uint `gorm:"column:audit_manager_id" json:"audit_manager_id"`
AuditTime formatime.Second `gorm:"column:audit_time" json:"audit_time"` AuditTime formatime.Second `gorm:"column:audit_time" json:"audit_time"`
CreatedAt formatime.Second `gorm:"column:created_at" json:"createdAt"` CreatedAt formatime.Second `gorm:"column:created_at" json:"createdAt"`
IntroUserInfo Information `gorm:"-"` IntroUserInfo Information `gorm:"-"`
} }
const ( const (

@ -14,7 +14,7 @@ type rabbitMq struct {
} }
var ( var (
Conn *rabbitMq Conn *rabbitMq
Conn1 *rabbitMq Conn1 *rabbitMq
) )
@ -32,7 +32,7 @@ func SetUpMq() {
Conn = &rabbitMq{conn} Conn = &rabbitMq{conn}
} }
func SetUpShaMa(){ func SetUpShaMa() {
uri1 := fmt.Sprintf("amqp://%s:%s@%s:%s", uri1 := fmt.Sprintf("amqp://%s:%s@%s:%s",
configs.ConfigShaMaMqUser, configs.ConfigShaMaMqUser,
configs.ConfigShaMaMqPwd, configs.ConfigShaMaMqPwd,

@ -40,7 +40,7 @@ func OrderProfit(od order.Information, tx *gorm.DB) error {
spID := od.SharerID spID := od.SharerID
if s1.Level == 1 { if s1.Level == 1 {
var sp1 user.Information var sp1 user.Information
if err := tx.First(&sp1, "id = ?", s1.ParentID).Error; err != nil{ if err := tx.First(&sp1, "id = ?", s1.ParentID).Error; err != nil {
return err return err
} }
spID = sp1.ID spID = sp1.ID

@ -126,5 +126,3 @@ func (k *KingKongController) ViewIconKingName(c *gin.Context) {
mysql2.Db.Model(&list).Find(&list) mysql2.Db.Model(&list).Find(&list)
back.Suc(c, "", list) back.Suc(c, "", list)
} }

@ -75,7 +75,6 @@ func (o *Company) ReNew(c *gin.Context) {
return return
} }
// ReSign 重签. // ReSign 重签.
func (o *Company) ReSign(c *gin.Context) { func (o *Company) ReSign(c *gin.Context) {
req := gys.UpdateReSignReq{} req := gys.UpdateReSignReq{}

@ -3,16 +3,16 @@ package gys
import "github.com/gin-gonic/gin" import "github.com/gin-gonic/gin"
type ListReq struct { type ListReq struct {
Settled uint `json:"settled"` Settled uint `json:"settled"`
Name string `json:"name"` Name string `json:"name"`
ContractNo string `json:"contractNo"` ContractNo string `json:"contractNo"`
Code string `json:"code"` Code string `json:"code"`
Operator string `json:"operator"` Operator string `json:"operator"`
ApplyStartTime string `json:"applyStartTime"` ApplyStartTime string `json:"applyStartTime"`
ApplyEndTime string `json:"applyEndTime"` ApplyEndTime string `json:"applyEndTime"`
ReviewStartTime string `json:"reviewStartTime"` ReviewStartTime string `json:"reviewStartTime"`
ReviewEndTime string `json:"reviewEndTime"` ReviewEndTime string `json:"reviewEndTime"`
ContractStartTime string `json:"contractTime"` ContractStartTime string `json:"contractTime"`
} }
func (e *Enterprise) List(c *gin.Context) { func (e *Enterprise) List(c *gin.Context) {

@ -15,7 +15,7 @@ func (q *Qualification) Detail(c *gin.Context) {
back.Unauthorized(c) back.Unauthorized(c)
return return
} }
if r, e := qualification.QLogic.Detail(id); e != nil{ if r, e := qualification.QLogic.Detail(id); e != nil {
back.Fail(c, e.Error()) back.Fail(c, e.Error())
return return
} else { } else {

@ -335,7 +335,6 @@ func (g *Goods) OpenSearch(c *gin.Context) {
} }
fmt.Println("request len:", len(requestBody)) fmt.Println("request len:", len(requestBody))
// 发送请求的方法调用. // 发送请求的方法调用.
r1, rr := client.Request( r1, rr := client.Request(
tea.String("POST"), tea.String("POST"),
@ -345,7 +344,7 @@ func (g *Goods) OpenSearch(c *gin.Context) {
requestBody, requestBody,
runTime) runTime)
page += 1 page += 1
if rr != nil{ if rr != nil {
fmt.Println(rr.Error()) fmt.Println(rr.Error())
continue continue
} }

@ -20,7 +20,7 @@ func (t MyTime) MarshalJSON() ([]byte, error) {
} }
func (t *MyTime) UnmarshalJSON(data []byte) (err error) { func (t *MyTime) UnmarshalJSON(data []byte) (err error) {
if len(data) < 3 || strings.ToLower(string(data)) == "null"{ if len(data) < 3 || strings.ToLower(string(data)) == "null" {
*t = MyTime(time.Time{}) *t = MyTime(time.Time{})
return err return err
} }

@ -5,7 +5,6 @@ import (
"strings" "strings"
) )
type TagAttr struct { type TagAttr struct {
Name string Name string
Style string Style string

@ -39,4 +39,3 @@ func Refund(tx *gorm.DB, asGoods *after.RecookAfterSalesGoodsModel) error {
return pay.SyncRefundSuccessCallback(tx, asGoods) return pay.SyncRefundSuccessCallback(tx, asGoods)
} }

@ -29,7 +29,7 @@ func Refund(asGoods *after.RecookAfterSalesGoodsModel) error {
} }
tradeNo := asGoods.TradeNo + "T" + strconv.Itoa(int(asGoods.Id)) tradeNo := asGoods.TradeNo + "T" + strconv.Itoa(int(asGoods.Id))
_, err = unionpay.UnionPay.Refund(tradeNo, query["queryId"], asGoods.RefundAmount) _, err = unionpay.UnionPay.Refund(tradeNo, query["queryId"], asGoods.RefundAmount)
if err != nil{ if err != nil {
log.Println(err) log.Println(err)
} }
return err return err

@ -65,7 +65,7 @@ func NewGlTBase(query *gorm.DB, page bean.Page) (result []*ListTempBase, total i
query.Group("source_id").Limit(page.GetLimit()).Offset(page.GetStart()).Find(&result) query.Group("source_id").Limit(page.GetLimit()).Offset(page.GetStart()).Find(&result)
var cover goods2.GysGoodsMainPhotoTempModel var cover goods2.GysGoodsMainPhotoTempModel
for index, v := range result{ for index, v := range result {
dbc.DB.Table(cover.TableName()).First(&result[index].MainPhoto, dbc.DB.Table(cover.TableName()).First(&result[index].MainPhoto,
"goods_id = ? AND is_master = 1", v.SourceID) "goods_id = ? AND is_master = 1", v.SourceID)
} }

@ -14,7 +14,7 @@ const (
RecookCoinHistoryRecommendCoin = user.RecommendTypeForCoinHistory // 每月结算收益 RecookCoinHistoryRecommendCoin = user.RecommendTypeForCoinHistory // 每月结算收益
RecookCoinHistoryRewardCoin = user.RewardTypeForCoinHistory // 每月结算收益 RecookCoinHistoryRewardCoin = user.RewardTypeForCoinHistory // 每月结算收益
RefundTypeForCoinHistory1 = 7 //瑞比退回 RefundTypeForCoinHistory1 = 7 //瑞比退回
) )
type RecookCoinHistoryModel struct { type RecookCoinHistoryModel struct {

@ -11,9 +11,9 @@ type RecookGoodsDetailPhotoModel struct {
GoodsID uint `gorm:"column:goods_id" json:"goodsId"` GoodsID uint `gorm:"column:goods_id" json:"goodsId"`
Url string `gorm:"column:url" json:"url"` Url string `gorm:"column:url" json:"url"`
Name string `gorm:"column:name" json:"name"` Name string `gorm:"column:name" json:"name"`
OrderNo int `gorm:"column:order_no" json:"orderNo"` OrderNo int `gorm:"column:order_no" json:"orderNo"`
Width int `gorm:"column:width" json:"width"` Width int `gorm:"column:width" json:"width"`
Height int `gorm:"column:height" json:"height"` Height int `gorm:"column:height" json:"height"`
} }
// TableName sets the insert table name for this struct type // TableName sets the insert table name for this struct type

@ -11,11 +11,11 @@ func routerTask(taskRouter *gin.RouterGroup) {
goodsController := &task.Goods{} goodsController := &task.Goods{}
taskRouter.GET("goods/associate", goodsController.Update) // 关联更新 taskRouter.GET("goods/associate", goodsController.Update) // 关联更新
taskRouter.GET("goods/sync", goodsController.Sync) // jcook商品更新 taskRouter.GET("goods/sync", goodsController.Sync) // jcook商品更新
taskRouter.GET("goods/fix", goodsController.Fix) // jcook图片修复 taskRouter.GET("goods/fix", goodsController.Fix) // jcook图片修复
taskRouter.GET("goods/publish", goodsController.Publish) // 更新商品上下级状态 taskRouter.GET("goods/publish", goodsController.Publish) // 更新商品上下级状态
taskRouter.GET("goods/openSearch", goodsController.OpenSearch) // 更新openSearch taskRouter.GET("goods/openSearch", goodsController.OpenSearch) // 更新openSearch
taskRouter.GET("goods/attr", goodsController.AttrSync) // jcook规格修复 taskRouter.GET("goods/attr", goodsController.AttrSync) // jcook规格修复
taskRouter.GET("weibo/sync", goodsController.WeiboSync) // 微博数据同步 taskRouter.GET("weibo/sync", goodsController.WeiboSync) // 微博数据同步

Loading…
Cancel
Save