a
This commit is contained in:
@@ -53,18 +53,20 @@ func PublishJob(ctx *jxcontext.Context, jobExt *model.JobExt) (errCode string, e
|
|||||||
finishedAt time.Time
|
finishedAt time.Time
|
||||||
DayTimeBegin, DayTimeEnd = jxutils.GetDayTime()
|
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 {
|
if data, err := json.Marshal(jobExt); err == nil {
|
||||||
json.Unmarshal(data, &job)
|
json.Unmarshal(data, &job)
|
||||||
}
|
}
|
||||||
finishedAt = utils.Str2Time(jobExt.FinishedAtStr)
|
finishedAt = utils.Str2Time(jobExt.FinishedAtStr)
|
||||||
job.FinishedAt = &finishedAt
|
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 == "" {
|
if job.UserID == "" {
|
||||||
return errCode, fmt.Errorf("参数有误!")
|
return errCode, fmt.Errorf("参数有误!")
|
||||||
}
|
}
|
||||||
@@ -646,7 +648,7 @@ func RechargeMtMembers(ctx *jxcontext.Context, phone int) (errCode string, err e
|
|||||||
return model.ErrCodeAccountBalanceNotEnough, fmt.Errorf("用户余额不足,请充值!")
|
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)
|
dao.Rollback(db)
|
||||||
return errCode, err
|
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 {
|
if err = GetRows(db, &stations, sql, sqlParams...); err == nil {
|
||||||
pagedInfo = &model.PagedInfo{
|
pagedInfo = &model.PagedInfo{
|
||||||
TotalCount: GetLastTotalRowCount(db),
|
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
|
return pagedInfo, err
|
||||||
|
|||||||
@@ -198,24 +198,25 @@ func (v *MtMember) TableIndex() [][]string {
|
|||||||
type StationInfo struct {
|
type StationInfo struct {
|
||||||
ModelIDCUL
|
ModelIDCUL
|
||||||
|
|
||||||
StationID string `orm:"column(station_id)" json:"stationID"`
|
StationID string `orm:"column(station_id)" json:"stationID"`
|
||||||
StationName string `json:"stationName"`
|
StationName string `json:"stationName"`
|
||||||
ProvinceName string `json:"provinceName"`
|
ProvinceName string `json:"provinceName"`
|
||||||
ProvinceID int `orm:"column(province_id)" json:"provinceID"`
|
ProvinceID int `orm:"column(province_id)" json:"provinceID"`
|
||||||
CityName string `json:"cityName"`
|
CityName string `json:"cityName"`
|
||||||
Latitude float64 `json:"latitude"`
|
Latitude float64 `json:"latitude"`
|
||||||
Longitude float64 `json:"longitude"`
|
Longitude float64 `json:"longitude"`
|
||||||
Location string `json:"location"`
|
Location string `json:"location"`
|
||||||
StarNum string `json:"starNum"`
|
StarNum string `json:"starNum"`
|
||||||
Phone string `json:"phone"`
|
Phone string `json:"phone"`
|
||||||
StationPic string `json:"stationPic"`
|
StationPic string `json:"stationPic"`
|
||||||
StationBannerPic string `json:"stationBannerPic"`
|
StationBannerPic string `json:"stationBannerPic"`
|
||||||
Prices string `orm:"type(text)" json:"prices"`
|
Prices string `orm:"type(text)" json:"prices"`
|
||||||
Adverts string `orm:"type(text)" json:"adverts"`
|
Adverts string `orm:"type(text)" json:"adverts"`
|
||||||
District string `json:"district"`
|
District string `json:"district"`
|
||||||
CityID int `orm:"column(city_id)" json:"cityID"`
|
CityID int `orm:"column(city_id)" json:"cityID"`
|
||||||
StationType int `json:"stationType"`
|
StationType int `json:"stationType"`
|
||||||
Distance float64 `json:"distance"`
|
Distance float64 `json:"distance"`
|
||||||
|
OilInfo []*OilInfo `orm:"-" json:"OilInfo"`
|
||||||
}
|
}
|
||||||
|
|
||||||
func (v *StationInfo) TableUnique() [][]string {
|
func (v *StationInfo) TableUnique() [][]string {
|
||||||
@@ -229,3 +230,13 @@ func (v *StationInfo) TableIndex() [][]string {
|
|||||||
[]string{"CityID", "ProvinceID"},
|
[]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 lat query float64 false "用户坐标"
|
||||||
// @Param lng query float64 false "用户坐标"
|
// @Param lng query float64 false "用户坐标"
|
||||||
// @Param oilCode query string 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 offset query int false "门店列表起始序号(以0开始,缺省为0)"
|
||||||
// @Param pageSize query int false "门店列表页大小(缺省为50,-1表示全部)"
|
// @Param pageSize query int false "门店列表页大小(缺省为50,-1表示全部)"
|
||||||
// @Success 200 {object} controllers.CallResult
|
// @Success 200 {object} controllers.CallResult
|
||||||
|
|||||||
Reference in New Issue
Block a user