Browse Source

Merge branch 'develop' of 192.168.3.17:zhanghongbo/qfw into develop

wangchuanjin 9 năm trước cách đây
mục cha
commit
ff3ff49400

+ 8 - 0
common/src/qfw/util/common.go

@@ -367,3 +367,11 @@ func BsonIdToSId(uid interface{}) string {
 		return fmt.Sprintf("%x", string(uid.(bson.ObjectId)))
 	}
 }
+
+func GetSubDay(t1 int64) int {
+	tt1 := time.Unix(t1, 0)
+	tt2 := time.Now()
+	nt1 := time.Date(tt1.Year(), tt1.Month(), tt1.Day(), 0, 0, 0, 0, time.Local)
+	nt2 := time.Date(tt2.Year(), tt2.Month(), tt2.Day(), 0, 0, 0, 0, time.Local)
+	return int((nt1.Unix() - nt2.Unix()) / 86400)
+}

+ 12 - 2
common/src/qfw/util/elastic/elasticutil_test.go

@@ -7,6 +7,7 @@ import (
 	"log"
 	"qfw/util/mongodb"
 	"testing"
+	"time"
 )
 
 func Test_Find1(t *testing.T) {
@@ -181,8 +182,17 @@ func Test_date(t *testing.T) {
 	//"1448267541"
 	//s := time.Now().UnixNano()
 	//log.Println(s, time.Now().Unix(), fmt.Sprintf("%d", s)[4:12], 999999/60/60)
-	var n uint64 = 1
-	log.Println(n<<62, int(n<<62))
+	t1 := time.Now().Unix()
+	t2 := t1 + 10000
+
+	tt1 := time.Unix(t1, 0)
+	tt2 := time.Unix(t2, 0)
+
+	nt1 := time.Date(tt1.Year(), tt1.Month(), tt1.Day(), 0, 0, 0, 0, time.Local)
+	nt2 := time.Date(tt2.Year(), tt2.Month(), tt2.Day(), 0, 0, 0, 0, time.Local)
+
+	log.Println((nt2.Unix() - nt1.Unix()) / 86400)
+
 }
 
 func Test_Getpage(t *testing.T) {

+ 27 - 13
core/src/qfw/manage/auditing.go

@@ -21,6 +21,7 @@ import (
 	. "qfw/util/msg"
 	"qfw/util/redis"
 	qrpc "qfw/util/rpc"
+	"runtime"
 	"strconv"
 	"strings"
 	"time"
@@ -419,6 +420,17 @@ func (s *SystemManage) Auditcontent(_id string) error {
 
 //审核用户认证信息
 func (s *SystemManage) Updateaudit() error {
+	defer func() {
+		if err := recover(); err != nil {
+			for skip := 1; ; skip++ {
+				_, file, line, ok := runtime.Caller(skip)
+				if !ok {
+					break
+				}
+				go log.Printf("%v,%v\n", file, line)
+			}
+		}
+	}()
 	s.DisableHttpCache()
 	if s.Is("GET") {
 		return s.Render("/manage/systemsetting.html")
@@ -744,20 +756,22 @@ func (s *SystemManage) Updateaudit() error {
 			if (*f)["s_m_openid"] != nil {
 				openid = (*f)["s_m_openid"].(string)
 				go func() {
-					if i_freeze == 2 || i_freeze == 1 { //管理员通知
-						if i_freeze == 2 {
-							s_remark = fmt.Sprintf(util.GetPropertie("freeze.freezeRemark", coreconfig.MessageConfig).(string), freezeremark)
-							s_result = util.GetPropertie("freeze.freezeTitle", coreconfig.MessageConfig).(string)
-							s.Session().UpdateByCustomField("id", s_submitid, "i_freeze", 2)
-						} else {
-							s_remark = util.GetPropertie("freeze.unFreezeRemark", coreconfig.MessageConfig).(string)
-							s_result = util.GetPropertie("freeze.unFreezeTitle", coreconfig.MessageConfig).(string)
+					util.Try(func() {
+						if i_freeze == 2 || i_freeze == 1 { //管理员通知
+							if i_freeze == 2 {
+								s_remark = fmt.Sprintf(util.GetPropertie("freeze.freezeRemark", coreconfig.MessageConfig).(string), freezeremark)
+								s_result = util.GetPropertie("freeze.freezeTitle", coreconfig.MessageConfig).(string)
+								s.Session().UpdateByCustomField("id", s_submitid, "i_freeze", 2)
+							} else {
+								s_remark = util.GetPropertie("freeze.unFreezeRemark", coreconfig.MessageConfig).(string)
+								s_result = util.GetPropertie("freeze.unFreezeTitle", coreconfig.MessageConfig).(string)
+							}
+							coreutil.SendManagerNotifyMsg(&qrpc.NotifyMsg{Openid: openid, Title: s_result, Detail: util.GetPropertie("freeze.manager", coreconfig.MessageConfig).(string), Remark: s_remark})
+						} else { //认证通知
+							s_detail = util.GetPropertie("indentify.success.wxdetail", coreconfig.MessageConfig).(string)
+							coreutil.SendIdentifyTplMsg(&qrpc.NotifyMsg{Openid: openid, Remark: s_remark, Detail: s_detail, Result: s_result})
 						}
-						coreutil.SendManagerNotifyMsg(&qrpc.NotifyMsg{Openid: openid, Title: s_result, Detail: util.GetPropertie("freeze.manager", coreconfig.MessageConfig).(string), Remark: s_remark})
-					} else { //认证通知
-						s_detail = util.GetPropertie("ptcindentify.success.wxdetail", coreconfig.MessageConfig).(string)
-						coreutil.SendIdentifyTplMsg(&qrpc.NotifyMsg{Openid: openid, Remark: s_remark, Detail: s_detail, Result: s_result})
-					}
+					}, func(e interface{}) {})
 				}()
 			}
 			go func() {

+ 3 - 6
core/src/qfw/mobile/wxmenu.go

@@ -64,15 +64,12 @@ func (m *Mobile) Wxrssset() error {
 					if vobj, ok := v.(map[string]interface{}); ok {
 						if vobj["l_enddate"] != nil && vobj["i_status"] != nil {
 							if util.IntAll(vobj["i_status"]) == 1 {
-								sub := vobj["l_enddate"].(int64) - time.Now().Unix()
+								sub := util.GetSubDay(vobj["l_enddate"].(int64))
 								if sub >= 0 {
-									if sub%86400 == 0 {
-										vobj["days"] = sub / 86400
-									} else {
-										vobj["days"] = sub/86400 + 1
-									}
+									vobj["days"] = sub
 								} else {
 									vobj["days"] = 0
+									//是否要扣
 								}
 							}
 						}

+ 1 - 4
core/src/qfw/swordfish/swordfishmanage.go

@@ -49,10 +49,7 @@ func (s *SwordFish) RssSet() error {
 			}
 		}
 	}
-	_, list := getSwordFish(time.Now().Unix(), userId, nil, 10)
-	if len(*list) < 1 {
-		list = mongodb.Find("bidding", nil, `{"comeintime":-1}`, `{"title":1,"href":1,"publishtime":1}`, false, 0, 10)
-	}
+	list := mongodb.Find("bidding", nil, `{"comeintime":-1}`, `{"title":1,"href":1,"publishtime":1}`, false, 0, 10)
 	s.T["msgset"] = msgset
 	s.T["list"] = *list
 	return s.Render("/swordfish/rssset.html", &s.T)

+ 1 - 1
core/src/qfw/yellowpage/yellowpagemanager.go

@@ -277,7 +277,7 @@ func (yp *Yellowpage) GetRelation() error {
 		r := relation.(map[string]interface{})
 		var links *[]map[string]interface{}
 		if d, err := json.Marshal(r["links"]); err == nil && json.Unmarshal(d, &links) == nil && len(*links) > 0 {
-			if credit.AIsHasDo(credit.A_CKGXW, util.IntAll(yp.GetSession("credit_a"))) {
+			if !credit.AIsHasDo(credit.A_CKGXW, util.IntAll(yp.GetSession("credit_a"))) {
 				credit.UpuserCreditSession(yp.GetSession("userId").(string), credit.A_CKGXW, "A", nil, yp.Action)
 			}
 		}

+ 2 - 1
core/src/timetask.json

@@ -1 +1,2 @@
-{"comment":{"c_rate":720,"commentrate":900},"market":{"demand":{"attr":["i_hits","i_bids","i_status"],"timepoint":"2016-01-22 13:40:43"},"service":{"attr":["i_hits","i_sales","i_comments","i_score","i_appcounts"],"timepoint":"2016-01-22 13:40:43"}},"marketisstart":true,"marketrate":300}
+{"comment":{"c_rate":720,"commentrate":900},"market":{"demand":{"attr":["i_hits","i_bids","i_status"],"timepoint":"2016-01-22 15:44:25"},"service":{"attr":["i_hits","i_sales","i_comments","i_score","i_appcounts"],"timepoint":"2016-01-22 15:44:25"}},"marketisstart":true,"marketrate":300}
+

+ 1 - 1
core/src/web/staticres/wxswordfish/main.js

@@ -251,7 +251,7 @@ function showSnopshot(module,type,on){
 		//显示天数
 		try{
 			var days=eval("msgset."+module+".days")	
-			if(days){
+			if(typeof days=="number"){
 				var tiptxt="本栏目推送服务期还剩<d style='color:red'>"+days+"</d>天"
 				if(winWidth<341){
 					tiptxt="服务期还剩<d style='color:red'>"+days+"</d>天"

+ 1 - 1
core/src/web/templates/member/credit/mycredit.html

@@ -87,7 +87,7 @@
 								<td width="30%" align="center"><b>操作</b></td>
 							</tr>
 							<tr class="rowone">
-								<td width="60%" style="text-indent: 7em;">* 新用户注册,得50积分</td>
+								<td width="60%" style="text-indent: 7em;">* 新用户注册,得2000积分</td>
 								<td width="10%" align="center"><span class="ok-sign bootstrap-glyphicon glyphicon-ok-sign"></span> 已完成</td>
 								<td width="30%" style="padding:110px"></td>
 							</tr>

+ 1 - 1
credit/src/config.json

@@ -48,7 +48,7 @@
         "swordfish_closeTitle": "剑鱼服务暂停提醒",
         "swordfish_close": "您的剑鱼服务已经到期,已经暂停,请及时续费。",
         "swordfish_payTitle": "剑鱼服务订单提醒",
-        "swordfish_pay": "您已成功续订剑鱼,扣除%d,剩余积分%d,剑鱼时长延期到%s",
+        "swordfish_pay": "您已成功续订剑鱼,扣除%d积分,剩余%d积分,剑鱼服务时长到:%s",
         "give": "转赠提醒",
         "give_pay": "转赠扣除提醒",
         "recharge": "充值成功提醒",

+ 5 - 4
credit/src/main.go

@@ -202,8 +202,8 @@ func TimerSwordFishFromUser() {
 					} {
 						query := coll.Find(&map[string]interface{}{
 							"o_msgset." + typeName + ".l_enddate": map[string]interface{}{
-								"$gte": next64 - 60000,
-								"$lte": next64 + int64(swordfish_tipBeforeDays[0]*24*3600) + 60000,
+								"$gte": next64 - 80000,
+								"$lte": next64 + int64(swordfish_tipBeforeDays[0]*24*3600) + 80000,
 							},
 							"o_msgset." + typeName + ".i_status":       1,
 							"o_msgset." + typeName + ".i_switchstatus": 1,
@@ -214,14 +214,15 @@ func TimerSwordFishFromUser() {
 							util.Try(func() {
 								tmpCode := tmp["o_msgset"].(map[string]interface{})[typeName].(map[string]interface{})
 								endDate := tmpCode["l_enddate"].(int64)
-								sub64 := (endDate - next64) / 86400
+								sub64 := util.GetSubDay(endDate) //(endDate - next64) / 86400
+								log.Println("======---====", sub64)
 								if sub64 <= 0 {
 									//自动扣费
 									doSubCreditByUser(util.BsonIdToSId(tmp["_id"]), tmp["s_m_openid"].(string), typeName, code, &next, tmp)
 								} else {
 									//提示
 									for _, v := range swordfish_tipBeforeDays {
-										if int64(v) == sub64 {
+										if v == sub64 {
 											creditrpc.SendMsgWebAndWx(swordfish_dueTitle, fmt.Sprintf(swordfish_due, v), util.BsonIdToSId(tmp["_id"]), tmp["s_m_openid"].(string))
 										}
 									}

+ 1 - 1
credit/src/qfw/creditrpc/creditrpc.go

@@ -310,7 +310,7 @@ func SendMsgWebAndWx(title, content, userId, umid string) {
 		ReceiveId: userId,
 	}
 	go m.SaveMsg()
-	go SendManagerNotifyMsg(&qrpc.NotifyMsg{Openid: umid, Title: title, Detail: "管理员", Remark: content})
+	go SendManagerNotifyMsg(&qrpc.NotifyMsg{Openid: umid, Title: title, Detail: "剑鱼君", Remark: content})
 
 }
 

+ 1 - 1
push/src/qfw/push/dopush/dopush.go

@@ -208,7 +208,7 @@ func SendWeixin(k *push.MemberInterest, TITLE, ShortTitle, str, stype string, no
 		wxDate = time.Now().Local().Add(time.Duration(-n2) * time.Second).Add(time.Duration(-n1*24) * time.Hour).Format(util.Date_Full_Layout)
 	}
 
-	wxstr := "\n点击下方“详情”查看详细信息。\n以上" + ShortTitle + "信息,是剑鱼根据关键字“" + strings.Join(k.Interest, ";") + "”奋力查找并推送,如不合您心意,请猛戳企明星菜单“会员服务—剑鱼”进行修改。"
+	wxstr := "\n点击下方“详情”查看详细信息。\n以上" + ShortTitle + "信息,是剑鱼根据关键字“" + strings.Join(k.Interest, ";") + "”奋力查找并推送,如不合您心意,请猛戳企明星菜单“剑鱼”进行修改。"
 	push.SendWinXin(&qrpc.NotifyMsg{
 		Openid:  k.Openid,
 		Title:   push.PushConfig[stype+"Title"].(string),