Browse Source

2.1.0 bug fix

胡轶钦 6 years ago
parent
commit
5d4079aafc

+ 1
- 1
models/channel/channel.go View File

@@ -46,7 +46,7 @@ func (m *ChannelDAO) GetChannels(caseid string, page int, pageSize int) ([]Chann
46 46
 	from ta_channel a 
47 47
 	inner join sys_case b on a.case_id = b.case_id 
48 48
 	where a.case_id in('` + strings.Replace(caseid, ",", "','", -1) + `') and  a.status > ` + strconv.Itoa(models.STATUS_DEL)
49
-	sql += ` order by a.create_date desc limit ` + strconv.Itoa(page-1) + `, ` + strconv.Itoa(pageSize)
49
+	sql += ` order by a.create_date desc limit ` + strconv.Itoa((page-1)*pageSize) + `, ` + strconv.Itoa(pageSize)
50 50
 	err := m.db.Sql(sql).Find(&channels)
51 51
 	return channels, err
52 52
 }

+ 2
- 2
models/customerremark/customerremark.go View File

@@ -47,7 +47,7 @@ FROM
47 47
 WHERE
48 48
 	a.sales_id = '` + salesId + `'
49 49
 	and a.customer_id = '` + customerId + `'
50
-	order by a.create_date desc limit ` + strconv.Itoa(page-1) + `, ` + strconv.Itoa(pageSize)
50
+	order by a.create_date desc limit ` + strconv.Itoa((page-1)*pageSize) + `, ` + strconv.Itoa(pageSize)
51 51
 	err := m.db.Sql(sql).Find(&remark)
52 52
 	return remark, err
53 53
 }
@@ -107,7 +107,7 @@ FROM
107 107
 	ta_customer_coupon
108 108
 	Where customer_id = '` + customerId + `'
109 109
 	and sales_id = '` + salesId + `'
110
-	order by receive_date desc limit ` + strconv.Itoa(page-1) + `, ` + strconv.Itoa(pageSize)
110
+	order by receive_date desc limit ` + strconv.Itoa((page-1)*pageSize) + `, ` + strconv.Itoa(pageSize)
111 111
 	err := m.db.Sql(sql).Find(&customerReceive)
112 112
 	return customerReceive, err
113 113
 

+ 3
- 3
models/flashbuy/flashbuy.go View File

@@ -63,7 +63,7 @@ FROM
63 63
 	if flashBuyStatus != "" {
64 64
 		sql += ` and a.flash_buy_status ='` + flashBuyStatus + `'`
65 65
 	}
66
-	sql += ` order by a.create_date desc limit ` + strconv.Itoa(page-1) + `, ` + strconv.Itoa(pageSize)
66
+	sql += ` order by a.create_date desc limit ` + strconv.Itoa((page-1)*pageSize) + `, ` + strconv.Itoa(pageSize)
67 67
 	err := m.db.Sql(sql).Find(&flashBuy)
68 68
 	return flashBuy, err
69 69
 }
@@ -171,7 +171,7 @@ WHERE
171 171
 	if phone != "" {
172 172
 		sql += ` and b.phone like '%` + phone + `%'`
173 173
 	}
174
-	sql += ` order by a.create_date desc  limit ` + strconv.Itoa(page-1) + `, ` + strconv.Itoa(pageSize)
174
+	sql += ` order by a.create_date desc  limit ` + strconv.Itoa((page-1)*pageSize) + `, ` + strconv.Itoa(pageSize)
175 175
 	err := m.db.Sql(sql).Find(&customerFlashBuy)
176 176
 	return customerFlashBuy, err
177 177
 
@@ -227,7 +227,7 @@ func (m *FlashbuyDAO) GetCustomerFlashBuyByCustomerId(customerId string, page, p
227 227
 	 inner join ta_flash_buy b 
228 228
 	 on a.flash_buy_id = b.flash_buy_id
229 229
 	 where a.customer_id = '` + customerId + `'`
230
-	sql += ` order by a.validate_start desc  limit ` + strconv.Itoa(page-1) + `, ` + strconv.Itoa(pageSize)
230
+	sql += ` order by a.validate_start desc  limit ` + strconv.Itoa((page-1)*pageSize) + `, ` + strconv.Itoa(pageSize)
231 231
 	err := m.db.Sql(sql).Find(&customerResult)
232 232
 	return customerResult, err
233 233
 

+ 7
- 0
models/system/user.go View File

@@ -179,7 +179,14 @@ func (m *UserDAO) AddUser(user model.SysUser) (*model.SysUser, error) {
179 179
 func (m *UserDAO) GenerateRecommendCode() string {
180 180
 	var temp1 int = rand.Intn(9) * 87
181 181
 	var temp2 int = rand.Intn(9)
182
+	var temp3 int = rand.Intn(9) * 7
182 183
 	var code string = strconv.Itoa(temp1) + strconv.Itoa(temp2)
184
+	if len(code) < 4 {
185
+		code += strconv.Itoa(temp3)
186
+	}
187
+	if len(code) > 4 {
188
+		code = code[0:4]
189
+	}
183 190
 	return code
184 191
 }
185 192
 func (m *UserDAO) IsCodeExist(code string) (int, error) {