a
This commit is contained in:
@@ -53,18 +53,20 @@ func PublishJob(ctx *jxcontext.Context, jobExt *model.JobExt) (errCode string, e
|
||||
finishedAt time.Time
|
||||
DayTimeBegin, DayTimeEnd = jxutils.GetDayTime()
|
||||
)
|
||||
// 需根据任务类型做一些参数判断,比如门店商品链接,地址
|
||||
switch job.JobCategoryID {
|
||||
case model.JobCategoryIDwmtg:
|
||||
|
||||
default:
|
||||
return errCode, fmt.Errorf("暂不支持的任务类型! %v", job.JobCategoryID)
|
||||
}
|
||||
if data, err := json.Marshal(jobExt); err == nil {
|
||||
json.Unmarshal(data, &job)
|
||||
}
|
||||
finishedAt = utils.Str2Time(jobExt.FinishedAtStr)
|
||||
job.FinishedAt = &finishedAt
|
||||
// 需根据任务类型做一些参数判断,比如门店商品链接,地址
|
||||
switch job.JobCategoryID {
|
||||
case model.JobCategoryIDwmtg:
|
||||
if job.StoreURL == "" || job.Address == "" {
|
||||
return errCode, fmt.Errorf("外卖推广任务请输入门店信息!")
|
||||
}
|
||||
default:
|
||||
return errCode, fmt.Errorf("暂不支持的任务类型! %v", job.JobCategoryID)
|
||||
}
|
||||
if job.UserID == "" {
|
||||
return errCode, fmt.Errorf("参数有误!")
|
||||
}
|
||||
@@ -646,7 +648,7 @@ func RechargeMtMembers(ctx *jxcontext.Context, phone int) (errCode string, err e
|
||||
return model.ErrCodeAccountBalanceNotEnough, fmt.Errorf("用户余额不足,请充值!")
|
||||
}
|
||||
//账户支出
|
||||
if err = financial.AddExpendUpdateAccount(db, userBill, model.BillTypeSpJob, 1000); err != nil {
|
||||
if err = financial.AddExpendUpdateAccount(db, userBill, model.BillTypeSpJob, 1100); err != nil {
|
||||
dao.Rollback(db)
|
||||
return errCode, err
|
||||
}
|
||||
|
||||
@@ -476,7 +476,43 @@ func GetStationInfoList(db *DaoDB, stationName string, cityCode int, lat, lng fl
|
||||
if err = GetRows(db, &stations, sql, sqlParams...); err == nil {
|
||||
pagedInfo = &model.PagedInfo{
|
||||
TotalCount: GetLastTotalRowCount(db),
|
||||
Data: stations,
|
||||
// Data: stations,
|
||||
}
|
||||
for _, v := range stations {
|
||||
utils.Map2StructByJson(v.Prices, &v.OilInfo, false)
|
||||
}
|
||||
if oilCode != "" {
|
||||
for i := 0; i < len(stations); i++ {
|
||||
for j := 0; j < len(stations)-i-1; j++ {
|
||||
var (
|
||||
index int
|
||||
index2 int
|
||||
)
|
||||
for k, v := range stations[j].OilInfo {
|
||||
if v.OilCode == oilCode {
|
||||
index = k
|
||||
}
|
||||
}
|
||||
for k, v := range stations[j+1].OilInfo {
|
||||
if v.OilCode == oilCode {
|
||||
index2 = k
|
||||
}
|
||||
}
|
||||
if sortType == 3 {
|
||||
if utils.Str2Float64(stations[j].OilInfo[index].StationPrice) < utils.Str2Float64(stations[j+1].OilInfo[index2].StationPrice) {
|
||||
temp := stations[j]
|
||||
stations[j] = stations[j+1]
|
||||
stations[j+1] = temp
|
||||
}
|
||||
} else if sortType == -3 {
|
||||
if utils.Str2Float64(stations[j].OilInfo[index].StationPrice) > utils.Str2Float64(stations[j+1].OilInfo[index2].StationPrice) {
|
||||
temp := stations[j]
|
||||
stations[j] = stations[j+1]
|
||||
stations[j+1] = temp
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return pagedInfo, err
|
||||
|
||||
@@ -198,24 +198,25 @@ func (v *MtMember) TableIndex() [][]string {
|
||||
type StationInfo struct {
|
||||
ModelIDCUL
|
||||
|
||||
StationID string `orm:"column(station_id)" json:"stationID"`
|
||||
StationName string `json:"stationName"`
|
||||
ProvinceName string `json:"provinceName"`
|
||||
ProvinceID int `orm:"column(province_id)" json:"provinceID"`
|
||||
CityName string `json:"cityName"`
|
||||
Latitude float64 `json:"latitude"`
|
||||
Longitude float64 `json:"longitude"`
|
||||
Location string `json:"location"`
|
||||
StarNum string `json:"starNum"`
|
||||
Phone string `json:"phone"`
|
||||
StationPic string `json:"stationPic"`
|
||||
StationBannerPic string `json:"stationBannerPic"`
|
||||
Prices string `orm:"type(text)" json:"prices"`
|
||||
Adverts string `orm:"type(text)" json:"adverts"`
|
||||
District string `json:"district"`
|
||||
CityID int `orm:"column(city_id)" json:"cityID"`
|
||||
StationType int `json:"stationType"`
|
||||
Distance float64 `json:"distance"`
|
||||
StationID string `orm:"column(station_id)" json:"stationID"`
|
||||
StationName string `json:"stationName"`
|
||||
ProvinceName string `json:"provinceName"`
|
||||
ProvinceID int `orm:"column(province_id)" json:"provinceID"`
|
||||
CityName string `json:"cityName"`
|
||||
Latitude float64 `json:"latitude"`
|
||||
Longitude float64 `json:"longitude"`
|
||||
Location string `json:"location"`
|
||||
StarNum string `json:"starNum"`
|
||||
Phone string `json:"phone"`
|
||||
StationPic string `json:"stationPic"`
|
||||
StationBannerPic string `json:"stationBannerPic"`
|
||||
Prices string `orm:"type(text)" json:"prices"`
|
||||
Adverts string `orm:"type(text)" json:"adverts"`
|
||||
District string `json:"district"`
|
||||
CityID int `orm:"column(city_id)" json:"cityID"`
|
||||
StationType int `json:"stationType"`
|
||||
Distance float64 `json:"distance"`
|
||||
OilInfo []*OilInfo `orm:"-" json:"OilInfo"`
|
||||
}
|
||||
|
||||
func (v *StationInfo) TableUnique() [][]string {
|
||||
@@ -229,3 +230,13 @@ func (v *StationInfo) TableIndex() [][]string {
|
||||
[]string{"CityID", "ProvinceID"},
|
||||
}
|
||||
}
|
||||
|
||||
type OilInfo struct {
|
||||
OilID string `json:"oilId"`
|
||||
StationPrice string `json:"stationPrice"`
|
||||
OilType string `json:"oilType"`
|
||||
DiscountPrice string `json:"discountPrice"`
|
||||
CountryPrice string `json:"countryPrice"`
|
||||
OilgunCodes []string `json:"oilgunCodes"`
|
||||
OilCode string `json:"oilCode"`
|
||||
}
|
||||
|
||||
@@ -333,7 +333,7 @@ func (c *JobController) CheckJdDeliveryWeight() {
|
||||
// @Param lat query float64 false "用户坐标"
|
||||
// @Param lng query float64 false "用户坐标"
|
||||
// @Param oilCode query string false "油号"
|
||||
// @Param sortType query int false "排序, 1为距离,2为评分"
|
||||
// @Param sortType query int false "排序, 1为距离,2为评分,3为油价"
|
||||
// @Param offset query int false "门店列表起始序号(以0开始,缺省为0)"
|
||||
// @Param pageSize query int false "门店列表页大小(缺省为50,-1表示全部)"
|
||||
// @Success 200 {object} controllers.CallResult
|
||||
|
||||
Reference in New Issue
Block a user