|
@@ -143,6 +143,9 @@ func (d *DataExport) SieveData() error {
|
|
|
if d.GetSession("s_m_openid") != nil {
|
|
|
sieveCondition["s_openid"] = d.GetSession("s_m_openid").(string)
|
|
|
}
|
|
|
+ if d.GetSession("userId") != nil {
|
|
|
+ sieveCondition["s_userid"] = d.GetSession("userId").(string)
|
|
|
+ }
|
|
|
_id := mongodb.Save(public.ExportTable, sieveCondition)
|
|
|
if _id != "" {
|
|
|
d.T["success"] = true
|
|
@@ -163,11 +166,11 @@ func (d *DataExport) ToMyOrder() error {
|
|
|
func (d *DataExport) QueryOrder() error {
|
|
|
typ := d.GetString("type") //0-全部 1-待支付 2-已支付
|
|
|
query := map[string]interface{}{}
|
|
|
- if openid := d.GetSession("s_m_openid"); openid != nil {
|
|
|
- query["user_openid"] = openid.(string)
|
|
|
- log.Println("QueryOrder -- openid====================", openid)
|
|
|
+ if userId := d.GetSession("userId"); userId != nil {
|
|
|
+ query["user_id"] = userId.(string)
|
|
|
+ log.Println("QueryOrder -- userId====================", userId)
|
|
|
} else {
|
|
|
- log.Println("QueryOrder -- session openid does not exist")
|
|
|
+ log.Println("QueryOrder -- session userId does not exist")
|
|
|
return nil
|
|
|
}
|
|
|
if typ != "0" && typ != "" {
|
|
@@ -210,7 +213,7 @@ func (d *DataExport) QueryOrder() error {
|
|
|
v["order_money"] = float64(orderMoney.(int64)) / 100
|
|
|
}
|
|
|
if v["id"] != nil && orderMoney != nil && v["order_code"] != nil {
|
|
|
- v["token"] = public.GetWaitPayToken(v["id"].(int64), int(orderMoney.(int64)), v["order_code"].(string), query["user_openid"].(string))
|
|
|
+ v["token"] = public.GetWaitPayToken(v["id"].(int64), int(orderMoney.(int64)), v["order_code"].(string), query["user_id"].(string))
|
|
|
}
|
|
|
}
|
|
|
}
|
|
@@ -227,10 +230,11 @@ func (d *DataExport) QueryOrder() error {
|
|
|
根据 id+openid 删除
|
|
|
*/
|
|
|
func (d *DataExport) DeleteOrder() error {
|
|
|
- if openid := d.GetSession("s_m_openid"); openid != nil {
|
|
|
+ if userId := d.GetSession("userId"); userId != nil {
|
|
|
+ // if openid := d.GetSession("s_m_openid"); openid != nil {
|
|
|
queryMap := map[string]interface{}{
|
|
|
- "id": d.GetString("id"),
|
|
|
- "user_openid": openid.(string),
|
|
|
+ "id": d.GetString("id"),
|
|
|
+ "user_id": userId.(string),
|
|
|
}
|
|
|
boo := public.Mysql.Update(tableName_order, queryMap, map[string]interface{}{"order_status": -1})
|
|
|
d.ServeJson(map[string]interface{}{"success": boo})
|
|
@@ -239,20 +243,21 @@ func (d *DataExport) DeleteOrder() error {
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
-根据 订单编号+openid 查询
|
|
|
+根据 订单编号+userId 查询
|
|
|
*/
|
|
|
func (d *DataExport) ToOrderDetail(orderCode string) error {
|
|
|
- myOpenid := ""
|
|
|
- if openid := d.GetSession("s_m_openid"); openid != nil {
|
|
|
- myOpenid = openid.(string)
|
|
|
+ myUserId := ""
|
|
|
+ if userId := d.GetSession("userId"); userId != nil {
|
|
|
+ // if openid := d.GetSession("s_m_openid"); openid != nil {
|
|
|
+ myUserId = userId.(string)
|
|
|
} else {
|
|
|
return nil
|
|
|
}
|
|
|
orderDetail := map[string]interface{}{}
|
|
|
filter := public.SieveCondition{}
|
|
|
queryMap := map[string]interface{}{
|
|
|
- "order_code": orderCode,
|
|
|
- "user_openid": myOpenid,
|
|
|
+ "order_code": orderCode,
|
|
|
+ "user_id": myUserId,
|
|
|
}
|
|
|
if orderCode != "" {
|
|
|
orderDetail = *public.Mysql.FindOne(tableName_order, queryMap, "", "")
|
|
@@ -376,7 +381,8 @@ func (d *DataExport) ApplyInvoice() error {
|
|
|
//---------------------------生成订单预览----------------------------------
|
|
|
func (d *DataExport) SuperSearchExport() error {
|
|
|
openid := util.ObjToString(d.GetSession("s_m_openid"))
|
|
|
- if openid == "" {
|
|
|
+ userId := util.ObjToString(d.GetSession("userId"))
|
|
|
+ if userId == "" {
|
|
|
return errors.New("未登录")
|
|
|
}
|
|
|
//接收超级搜索页面参数
|
|
@@ -446,6 +452,7 @@ func (d *DataExport) SuperSearchExport() error {
|
|
|
"comeintime": now.Unix(),
|
|
|
"s_openid": openid,
|
|
|
"comeinfrom": "supersearchPage",
|
|
|
+ "s_userid": userId,
|
|
|
}
|
|
|
|
|
|
//存入数据库
|
|
@@ -457,7 +464,8 @@ func (d *DataExport) SuperSearchExport() error {
|
|
|
func (d *DataExport) ToCreateOrderPage(_id string) error {
|
|
|
id := util.SE.Decode4Hex(_id)
|
|
|
openid := util.ObjToString(d.GetSession("s_m_openid"))
|
|
|
- if openid == "" {
|
|
|
+ userId := util.ObjToString(d.GetSession("userId"))
|
|
|
+ if userId == "" {
|
|
|
return errors.New("未登录")
|
|
|
}
|
|
|
msgCount := public.GetDataExportSearchCountUseId(id)
|
|
@@ -486,14 +494,14 @@ func (d *DataExport) ToCreateOrderPage(_id string) error {
|
|
|
d.T["timeSpaceing"] = timeSpaceing
|
|
|
} else {
|
|
|
mail_phone := public.Mysql.FindOne("dataexport_order", map[string]interface{}{
|
|
|
- "user_openid": openid,
|
|
|
+ "user_id": userId,
|
|
|
}, "user_mail,user_phone", "create_time desc")
|
|
|
if mail_phone != nil {
|
|
|
email = (*mail_phone)["user_mail"]
|
|
|
resPhone = (*mail_phone)["user_phone"]
|
|
|
}
|
|
|
if email == nil || email == "" {
|
|
|
- userData, _ := mongodb.FindOneByField("user", `{"s_m_openid":"`+openid+`"}`, `{"o_jy":1}`)
|
|
|
+ userData, _ := mongodb.FindById("user", userId, `{"o_jy":1}`)
|
|
|
o_jy := util.ObjToMap((*userData)["o_jy"])
|
|
|
email = (*o_jy)["s_email"]
|
|
|
}
|
|
@@ -508,6 +516,7 @@ func (d *DataExport) ToCreateOrderPage(_id string) error {
|
|
|
if phone != nil && phone != "" {
|
|
|
d.T["phone"] = phone
|
|
|
} else {
|
|
|
+ //剑鱼助手手机号登录
|
|
|
if isPhone(openid) {
|
|
|
phone = openid
|
|
|
} else {
|
|
@@ -528,7 +537,7 @@ func (d *DataExport) ToCreateOrderPage(_id string) error {
|
|
|
d.T["unitPrice_normal_final"] = (public.ExConf.UnitPrice_normal * 100) * (public.ExConf.Discount * 100) / 10000
|
|
|
d.T["unitPrice_senior_final"] = (public.ExConf.UnitPrice_senior * 100) * (public.ExConf.Discount * 100) / 10000
|
|
|
d.T["orderMinPrice"] = public.ExConf.OrderMinPrice
|
|
|
- incurKey := fmt.Sprintf("PreviewData_%s_%d", d.GetSession("s_m_openid"), time.Now().Day())
|
|
|
+ incurKey := fmt.Sprintf("PreviewData_%s_%d", d.GetSession("userId"), time.Now().Day())
|
|
|
d.T["PreviewData"] = util.IntAll(redis.Get("other", incurKey))
|
|
|
// go func() {
|
|
|
// orderdata := public.Mysql.FindOne("dataexport_order", map[string]interface{}{
|
|
@@ -543,12 +552,13 @@ func (d *DataExport) ToCreateOrderPage(_id string) error {
|
|
|
}
|
|
|
|
|
|
func (d *DataExport) PreviewData(_id string) error {
|
|
|
- openid := util.ObjToString(d.GetSession("s_m_openid"))
|
|
|
- if openid == "" {
|
|
|
+ userId := util.ObjToString(d.GetSession("userId"))
|
|
|
+ // openid := util.ObjToString(d.GetSession("s_m_openid"))
|
|
|
+ if userId == "" {
|
|
|
return errors.New("未登录")
|
|
|
}
|
|
|
//数据预览每天限制50次
|
|
|
- incurKey := fmt.Sprintf("PreviewData_%s_%d", d.GetSession("s_m_openid"), time.Now().Day())
|
|
|
+ incurKey := fmt.Sprintf("PreviewData_%s_%d", d.GetSession("userId"), time.Now().Day())
|
|
|
times := util.IntAll(redis.Get("other", incurKey))
|
|
|
if times >= 50 {
|
|
|
return errors.New("超出预览次数")
|
|
@@ -634,10 +644,11 @@ func (d *DataExport) SendMailVerify() {
|
|
|
var email_used = true
|
|
|
if email != d.GetSession("DataExportVerifyEmail") {
|
|
|
d.DelSession("CreatEVerifyTime")
|
|
|
- openid := util.ObjToString(d.GetSession("s_m_openid"))
|
|
|
+ // openid := util.ObjToString(d.GetSession("s_m_openid"))
|
|
|
+ userId := util.ObjToString(d.GetSession("userId"))
|
|
|
emails := public.Mysql.FindOne("dataexport_order", map[string]interface{}{
|
|
|
- "user_mail": email,
|
|
|
- "user_openid": openid,
|
|
|
+ "user_mail": email,
|
|
|
+ "user_id": userId,
|
|
|
}, "user_mail", "")
|
|
|
if emails != nil && util.ObjToString((*emails)["user_mail"]) != "" {
|
|
|
email_used = false
|
|
@@ -651,7 +662,7 @@ func (d *DataExport) SendMailVerify() {
|
|
|
if email_used {
|
|
|
lastSendDEVerify := util.Int64All(d.GetSession("CreatEVerifyTime"))
|
|
|
timeSpaceing := lastSendDEVerify - time.Now().Unix() + 60*5
|
|
|
- incurKey := fmt.Sprintf("SendEmail_%s_%d", d.GetSession("s_m_openid"), time.Now().Day())
|
|
|
+ incurKey := fmt.Sprintf("SendEmail_%s_%d", d.GetSession("userId"), time.Now().Day())
|
|
|
//log.Println(incurKey)
|
|
|
if lastSendDEVerify == 0 || timeSpaceing < 0 {
|
|
|
//每日限制10次
|
|
@@ -735,12 +746,13 @@ func isEmail(value string) bool {
|
|
|
}
|
|
|
func (d *DataExport) Paysuccess() error {
|
|
|
code := d.GetString("code")
|
|
|
- openid, _ := d.GetSession("s_m_openid").(string)
|
|
|
+ // openid, _ := d.GetSession("s_m_openid").(string)
|
|
|
+ userId, _ := d.GetSession("userId").(string)
|
|
|
data := map[string]interface{}{}
|
|
|
- if code != "" && openid != "" {
|
|
|
+ if code != "" && userId != "" {
|
|
|
data_ := public.Mysql.FindOne("dataexport_order", map[string]interface{}{
|
|
|
"order_code": code,
|
|
|
- "user_openid": openid,
|
|
|
+ "user_id": userId,
|
|
|
"order_status": 1,
|
|
|
}, "pay_way,user_mail,pay_time,pay_money,order_money", "")
|
|
|
|