refactor: fmt

master
howell 4 years ago
parent a0fdfa95b3
commit 9de70d4e8d

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

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

@ -244,7 +244,7 @@ func CreatePreviewShoppingTrolleyOrder(c *gin.Context) {
}
if IsAddrDelivery { // 如果是发货地区,计算每个商品的
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
}
_, 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
if err := dbc.DB.First(&detail, "order_id = ?", virtualID).Error;
err != nil && err != gorm.ErrRecordNotFound {
if err := dbc.DB.First(&detail, "order_id = ?", virtualID).Error; err != nil && err != gorm.ErrRecordNotFound {
return err, ""
}

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

@ -184,7 +184,6 @@ func H5Callback(c *gin.Context) {
return
}
if result.IsPayNotify() {
h5PaySuccess(c, result)
} else {
@ -240,4 +239,4 @@ func h5PaySuccess(c *gin.Context, result PayCallbackNotification) {
c.Set("status", "SyncOrder")
c.Set("id", orderInfo.ID)
c.String(200, "success")
}
}

@ -1 +1 @@
package alipay
package alipay

@ -1 +1 @@
package unionpay
package unionpay

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

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

@ -219,4 +219,4 @@ func (c *notificationMap) UnmarshalXML(d *xml.Decoder, start xml.StartElement) e
}
}
}
}
}

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

@ -151,7 +151,7 @@ func WaterMarkOut(imgPath string, ttf string, w io.Writer, contentList []Content
defer open.Close()
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 {
item.Width = 810
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)
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)
fmt.Println(offsetX, offsetY)

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

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

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

@ -40,7 +40,7 @@ func OrderProfit(od order.Information, tx *gorm.DB) error {
spID := od.SharerID
if s1.Level == 1 {
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
}
spID = sp1.ID

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

@ -48,4 +48,4 @@ func (o *Operate) DestroyWithCode(c *gin.Context) {
return
}
back.Suc(c, "操作成功", nil)
}
}

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

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

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

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

@ -20,7 +20,7 @@ func (t MyTime) MarshalJSON() ([]byte, 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{})
return err
}

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

@ -513,7 +513,7 @@ func Refund(tx *gorm.DB, asGoods after.RecookAfterSalesGoodsModel, orderInfo man
}).Error; err != nil {
return err
}
//这里插入日志
Log1 := after.RecookAfterSalesLogsModel{
AsID: asGoods.Id,

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

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

@ -165,4 +165,4 @@ func (a AFTAddrLogic) All() (result []province, err error) {
Where("parent_id = 0").Find(&result).Error
return
}
}

@ -24,4 +24,4 @@ func (*CompanyCreditCodeModel) TableName() string {
func (m *CompanyCreditCodeModel) FindByCompanyID(by uint) (result CompanyCreditCodeModel) {
m.GetDb().Table(m.TableName()).First(&result)
return
}
}

@ -25,4 +25,4 @@ func (r *GysEnterpriseSectorModel) TableName() string {
func (r *GysEnterpriseSectorModel) FindByEnterpriseIDAndType(enterpriseID uint, sectorType int) (result GysEnterpriseSectorModel) {
dbc.DB.First(&result, "enterprise_id = ? and `type` = ?", enterpriseID, sectorType)
return
}
}

@ -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)
var cover goods2.GysGoodsMainPhotoTempModel
for index, v := range result{
for index, v := range result {
dbc.DB.Table(cover.TableName()).First(&result[index].MainPhoto,
"goods_id = ? AND is_master = 1", v.SourceID)
}

@ -38,4 +38,4 @@ func (o *ExpressModel) GetJSTExpressCode(name string) string {
func (o *ExpressModel) FindByLcID(by string) (result ExpressModel) {
o.GetDb().Table(o.TableName()).First(&result, "lc_id = ?", by)
return
}
}

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

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

@ -53,4 +53,4 @@ func (r *RecookOrderGoodsDetailLogsModel) ListCount(query interface{}, args ...i
return
}
//
//

@ -11,11 +11,11 @@ func routerTask(taskRouter *gin.RouterGroup) {
goodsController := &task.Goods{}
taskRouter.GET("goods/associate", goodsController.Update) // 关联更新
taskRouter.GET("goods/sync", goodsController.Sync) // jcook商品更新
taskRouter.GET("goods/fix", goodsController.Fix) // jcook图片修复
taskRouter.GET("goods/publish", goodsController.Publish) // 更新商品上下级状态
taskRouter.GET("goods/sync", goodsController.Sync) // jcook商品更新
taskRouter.GET("goods/fix", goodsController.Fix) // jcook图片修复
taskRouter.GET("goods/publish", goodsController.Publish) // 更新商品上下级状态
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) // 微博数据同步

@ -29,4 +29,4 @@ func SHA256Str(src string) string {
h := sha256.New()
h.Write([]byte(src)) // 需要加密的字符串为
return hex.EncodeToString(h.Sum(nil))
}
}

Loading…
Cancel
Save