|
|
@@ -2031,6 +2031,7 @@ func (r *QhjTeamOrder) buildSql() string {
|
|
|
" and e.enumdiccode = 'goodsunit'" +
|
|
|
" where 1 = 1"
|
|
|
sqlId.AndEx("u.refereeuserid", r.USERID, r.USERID > 0)
|
|
|
+ sqlId.AndEx("m.trademode", r.TRADEMODE, r.TRADEMODE > 0)
|
|
|
sqlCur := fmt.Sprintf(sqlId.String(), "trade_tradedetail")
|
|
|
sqlHis := fmt.Sprintf(sqlId.String(), "his_trade_tradedetail")
|
|
|
if len(r.FilterName) > 0 {
|
|
|
@@ -2140,3 +2141,72 @@ func (r *QhjBrokerRewardLog) GetDataEx() (interface{}, error) {
|
|
|
}
|
|
|
return sData, err
|
|
|
}
|
|
|
+
|
|
|
+// QhjScoreLog 积分流水
|
|
|
+type QhjScoreLog struct {
|
|
|
+ LOGID string `json:"logid" xorm:"LOGID" form:"logid"` // 流水ID(211+Unix秒时间戳(10位)+2位(MarketServiceID)+xxxx)
|
|
|
+ TRADEDATE string `json:"tradedate" xorm:"TRADEDATE" form:"tradedate"` // 交易日(yyyyMMdd)
|
|
|
+ USERID int64 `json:"userid" xorm:"USERID" form:"userid"` // 用户ID
|
|
|
+ SCORETYPE int32 `json:"scoretype" xorm:"SCORETYPE" form:"scoretype"` // 积分类型 - 1:提货积分
|
|
|
+ SCOREVALUE float64 `json:"scorevalue" xorm:"SCOREVALUE" form:"scorevalue"` // 积分
|
|
|
+ RELATEDORDERID string `json:"relatedorderid" xorm:"RELATEDORDERID" form:"relatedorderid"` // 关联单号(ScoreType=1为Trade_GoodsPickup)
|
|
|
+ RELATEDAMOUNT float64 `json:"relatedamount" xorm:"RELATEDAMOUNT" form:"relatedamount"` // 关联金额
|
|
|
+ SCORECONFIGVALUE1 int32 `json:"scoreconfigvalue1" xorm:"SCORECONFIGVALUE1" form:"scoreconfigvalue1"` // 积分配置1
|
|
|
+ SCORECONFIGVALUE2 int32 `json:"scoreconfigvalue2" xorm:"SCORECONFIGVALUE2" form:"scoreconfigvalue2"` // 积分配置1
|
|
|
+ GOODSID int64 `json:"goodsid" xorm:"GOODSID" form:"goodsid"` // 商品ID
|
|
|
+ ACCOUNTID int64 `json:"accountid" xorm:"ACCOUNTID" form:"accountid"` // 账户ID
|
|
|
+ MARKETID int32 `json:"marketid" xorm:"MARKETID" form:"marketid"` // 市场ID
|
|
|
+ CREATETIME string `json:"createtime" xorm:"CREATETIME" form:"createtime"` // 创建时间(时间)
|
|
|
+ HASUPLOADED int32 `json:"hasuploaded" xorm:"HASUPLOADED" form:"hasuploaded"` // 是否已同步(千海金) 0:未同步 1;已同步
|
|
|
+ UPLOADEDTIME string `json:"uploadedtime" xorm:"UPLOADEDTIME" form:"uploadedtime"` // 同步时间
|
|
|
+
|
|
|
+ BeginDate string `json:"-" form:"begindate"` // 开始交易日
|
|
|
+ EndDate string `json:"-" form:"enddate"` // 结束交易日
|
|
|
+ LastNum int `json:"-" form:"lastnum"` // 最近多少条
|
|
|
+}
|
|
|
+
|
|
|
+func (r *QhjScoreLog) calc() {
|
|
|
+
|
|
|
+}
|
|
|
+
|
|
|
+func (r *QhjScoreLog) buildSql() string {
|
|
|
+ var sqlId utils.SQLVal = "SELECT t.LOGID," +
|
|
|
+ " t.TRADEDATE," +
|
|
|
+ " t.USERID," +
|
|
|
+ " t.SCORETYPE," +
|
|
|
+ " t.SCOREVALUE," +
|
|
|
+ " to_char(t.RELATEDORDERID) RELATEDORDERID," +
|
|
|
+ " t.RELATEDAMOUNT," +
|
|
|
+ " t.SCORECONFIGVALUE1," +
|
|
|
+ " t.SCORECONFIGVALUE2," +
|
|
|
+ " t.GOODSID," +
|
|
|
+ " t.ACCOUNTID," +
|
|
|
+ " t.MARKETID," +
|
|
|
+ " to_char(t.CREATETIME, 'yyyy-mm-dd hh24:mi:ss') CREATETIME," +
|
|
|
+ " t.HASUPLOADED," +
|
|
|
+ " to_char(t.UPLOADEDTIME, 'yyyy-mm-dd hh24:mi:ss') UPLOADEDTIME" +
|
|
|
+ " FROM QHJ_SCORELOG t" +
|
|
|
+ " WHERE 1 = 1"
|
|
|
+ sqlId.AndEx("t.USERID", r.USERID, r.USERID > 0)
|
|
|
+ if r.BeginDate != "" {
|
|
|
+ sqlId.JoinFormat(" and to_char(t.CREATETIME, 'yyyymmdd') >= '%v'", r.BeginDate)
|
|
|
+ }
|
|
|
+ if r.EndDate != "" {
|
|
|
+ sqlId.JoinFormat(" and to_char(t.CREATETIME, 'yyyymmdd') <= '%v'", r.EndDate)
|
|
|
+ }
|
|
|
+ sqlId.Join(" order by t.CREATETIME desc")
|
|
|
+ if r.LastNum > 0 {
|
|
|
+ sqlId.Page(1, r.LastNum)
|
|
|
+ }
|
|
|
+ return sqlId.String()
|
|
|
+}
|
|
|
+
|
|
|
+// GetDataEx 获取积分流水
|
|
|
+func (r *QhjScoreLog) GetDataEx() (interface{}, error) {
|
|
|
+ sData := make([]QhjScoreLog, 0)
|
|
|
+ err := db.GetEngine().SQL(r.buildSql()).Find(&sData)
|
|
|
+ for i := range sData {
|
|
|
+ sData[i].calc()
|
|
|
+ }
|
|
|
+ return sData, err
|
|
|
+}
|