|
@@ -6,7 +6,6 @@ import (
|
|
|
"github.com/go-xweb/httpsession"
|
|
|
"jfw/modules/common/src/qfw/util/dataexport"
|
|
|
"jfw/modules/common/src/qfw/util/jy"
|
|
|
- "jfw/public"
|
|
|
qutil "qfw/util"
|
|
|
"strings"
|
|
|
"util"
|
|
@@ -39,14 +38,15 @@ func (this *dataExportPackStruct) GetPackPriceById(packId string) (int, error) {
|
|
|
|
|
|
//查询账户和企业数据包情况
|
|
|
func (this *dataExportPackStruct) GetAccountMsg(sess *httpsession.Session, userId string) (map[string]interface{}, error) {
|
|
|
+ userId = "610b7ca691acedc3a76a269d" //测试用户id
|
|
|
//每日限量包
|
|
|
packDetail := map[string]interface{}{}
|
|
|
vipStatus := jy.GetBigVipUserBaseMsg(userId, util.Mysql, util.MQFW)
|
|
|
if vipStatus.Status > 0 && vipStatus.DailyNum > 0 {
|
|
|
packetMsg := dataexport.GetDataPacketMsg(vipStatus.GetUseId(), vipStatus.DailyNum)
|
|
|
packDetail["dailyPack"] = map[string]interface{}{
|
|
|
- "dailyNum": vipStatus.DailyNum, //每日限量
|
|
|
- "dailyUsed": packetMsg.GetUsed(true), //已使用
|
|
|
+ "limitToday": vipStatus.DailyNum, //每日限量
|
|
|
+ "usedToday": packetMsg.GetUsed(true), //已使用
|
|
|
}
|
|
|
}
|
|
|
//个人线上数据包
|
|
@@ -80,42 +80,41 @@ func (this *dataExportPackStruct) GetAccountMsg(sess *httpsession.Session, userI
|
|
|
entPack := make([]map[string]interface{}, 0, len(*entList))
|
|
|
//根据企业列表获取所在企业余额
|
|
|
for _, entMsg := range *entList {
|
|
|
- user_entId, user_entId_ok := entMsg["uid"].(int)
|
|
|
- ent_id, ent_id_ok := entMsg["eid"].(int)
|
|
|
+ user_entId, user_entId_ok := entMsg["uid"].(int64)
|
|
|
+ ent_id, ent_id_ok := entMsg["eid"].(int64)
|
|
|
ent_name, ent_name_ok := entMsg["eName"].(string)
|
|
|
ent_phone, ent_phone_ok := entMsg["ePhone"].(string)
|
|
|
if !ent_id_ok || !user_entId_ok || !ent_name_ok || !ent_phone_ok {
|
|
|
continue
|
|
|
}
|
|
|
entAllCount := GetCurrentCount(ent_name, ent_phone) //查询所属企业及账户余额
|
|
|
-
|
|
|
+ //查询个人企业每日导出限额和已导出数量
|
|
|
+ limit := util.Mysql.FindOne("entniche_export_limit", map[string]interface{}{"ent_id": ent_id, "user_id": user_entId}, "data_limit,remain_nums,export_nums", "")
|
|
|
+ if limit == nil || len(*limit) == 0 {
|
|
|
+ continue
|
|
|
+ }
|
|
|
entPack = append(entPack, map[string]interface{}{
|
|
|
- "entId": ent_id,
|
|
|
- "entName": ent_name,
|
|
|
- "entAllCount": entAllCount,
|
|
|
+ "entId": ent_id, //企业id
|
|
|
+ "entName": ent_name, //企业名字
|
|
|
+ "entAllCount": entAllCount, //企业总条数
|
|
|
+ "limitToday": qutil.IntAll((*limit)["data_limit"]), //个人今日限额
|
|
|
+ "surplusToday": qutil.IntAll((*limit)["remain_nums"]), //今日剩余
|
|
|
+ "usedToday": qutil.IntAll((*limit)["export_nums"]), //今日使用
|
|
|
})
|
|
|
-
|
|
|
- }
|
|
|
- query := map[string]interface{}{"ent_id": entId, "user_id": entUserId}
|
|
|
- data_limit, remain_nums, export_nums := 0, 0, 0
|
|
|
- limit := public.Mysql.FindOne("entniche_export_limit", query, "data_limit,remain_nums,export_nums", "")
|
|
|
- if limit != nil {
|
|
|
- data_limit = util.IntAll((*limit)["data_limit"])
|
|
|
- remain_nums = util.IntAll((*limit)["remain_nums"])
|
|
|
- export_nums = util.IntAll((*limit)["export_nums"])
|
|
|
}
|
|
|
+ packDetail["entPack"] = entPack
|
|
|
}
|
|
|
}
|
|
|
return packDetail, nil
|
|
|
}
|
|
|
|
|
|
func GetCurrentCount(entName, entPhone string) int {
|
|
|
- current, ok := public.Mgo_Qyfw.FindOne("user", map[string]interface{}{"phone": entPhone, "username": entName})
|
|
|
+ current, ok := util.MQFWENT.FindOne("user", map[string]interface{}{"phone": entPhone, "username": entName})
|
|
|
if current == nil || !ok {
|
|
|
return 0
|
|
|
}
|
|
|
- plan, plan_ok := (*current)["plan"].(map[string]interface{})
|
|
|
- if !plan_ok {
|
|
|
+ plan, planOk := (*current)["plan"].(map[string]interface{})
|
|
|
+ if !planOk {
|
|
|
return 0
|
|
|
}
|
|
|
return qutil.IntAll(plan["current"])
|