Merge branch 'dev' of http://git.legu.cc/liwei_3d/go_dreamfactory into dev
This commit is contained in:
commit
b3f93e1360
@ -131,9 +131,6 @@ func (this *SociatyMineView) CreateView(t *model.TestCase) fyne.CanvasObject {
|
|||||||
//申请列表
|
//申请列表
|
||||||
applyListBtn := widget.NewButton("申请审批", this.showSociatyApplyListWin)
|
applyListBtn := widget.NewButton("申请审批", this.showSociatyApplyListWin)
|
||||||
|
|
||||||
// 任务列表
|
|
||||||
taskListBtn := widget.NewButton("任务列表", this.showTaskListWin)
|
|
||||||
|
|
||||||
// 日志
|
// 日志
|
||||||
logBtn := widget.NewButton("日志", this.showLogWin)
|
logBtn := widget.NewButton("日志", this.showLogWin)
|
||||||
|
|
||||||
@ -156,7 +153,7 @@ func (this *SociatyMineView) CreateView(t *model.TestCase) fyne.CanvasObject {
|
|||||||
} else {
|
} else {
|
||||||
btns.Add(quitBtn)
|
btns.Add(quitBtn)
|
||||||
}
|
}
|
||||||
btns.Add(taskListBtn)
|
|
||||||
btns.Add(logBtn)
|
btns.Add(logBtn)
|
||||||
this.sociatyRender(item)
|
this.sociatyRender(item)
|
||||||
this.form.Refresh()
|
this.form.Refresh()
|
||||||
@ -540,33 +537,6 @@ func (this *SociatyMineView) showSignWin() {
|
|||||||
dconf.Show()
|
dconf.Show()
|
||||||
}
|
}
|
||||||
|
|
||||||
// 任务列表
|
|
||||||
func (this *SociatyMineView) showTaskListWin() {
|
|
||||||
refreshBtn := widget.NewButtonWithIcon("", theme.ViewRefreshIcon(), func() {
|
|
||||||
this.memberList.Reset()
|
|
||||||
this.taskList()
|
|
||||||
})
|
|
||||||
|
|
||||||
btns := container.NewHBox(refreshBtn)
|
|
||||||
|
|
||||||
c := container.NewBorder(btns, nil, nil, nil, this.memberList.ItemList)
|
|
||||||
dconf := dialog.NewCustom("任务", "关闭", c, this.w)
|
|
||||||
dconf.Resize(fyne.NewSize(800, 500))
|
|
||||||
dconf.Show()
|
|
||||||
}
|
|
||||||
|
|
||||||
func (this *SociatyMineView) taskList() {
|
|
||||||
this.obs.AddListener(observer.EVENT_REQ_RSP, observer.Listener{
|
|
||||||
OnNotify: func(d interface{}, args ...interface{}) {
|
|
||||||
data := d.(*pb.UserMessage)
|
|
||||||
if !(data.MainType == string(comm.ModuleSociaty) &&
|
|
||||||
data.SubType == sociaty.SociatySubTypeMembers) {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
},
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
// 日志列表
|
// 日志列表
|
||||||
func (this *SociatyMineView) showLogWin() {
|
func (this *SociatyMineView) showLogWin() {
|
||||||
this.logList = common.NewItemList()
|
this.logList = common.NewItemList()
|
||||||
|
@ -21,14 +21,14 @@ import (
|
|||||||
|
|
||||||
type SociatyTasklistView struct {
|
type SociatyTasklistView struct {
|
||||||
BaseformView
|
BaseformView
|
||||||
taskList func()
|
taskList func()
|
||||||
itemList *common.ItemList
|
itemList *common.ItemList
|
||||||
flag bool
|
flag bool
|
||||||
|
activityItemList *common.ItemList
|
||||||
}
|
}
|
||||||
|
|
||||||
func (this *SociatyTasklistView) CreateView(t *model.TestCase) fyne.CanvasObject {
|
func (this *SociatyTasklistView) CreateView(t *model.TestCase) fyne.CanvasObject {
|
||||||
this.itemList = common.NewItemList()
|
this.itemList = common.NewItemList()
|
||||||
|
|
||||||
this.itemList.ItemList = this.itemList.CreateList()
|
this.itemList.ItemList = this.itemList.CreateList()
|
||||||
|
|
||||||
this.taskList = func() {
|
this.taskList = func() {
|
||||||
@ -48,7 +48,7 @@ func (this *SociatyTasklistView) CreateView(t *model.TestCase) fyne.CanvasObject
|
|||||||
})
|
})
|
||||||
|
|
||||||
// 领取
|
// 领取
|
||||||
receiveBtn := widget.NewButton("", func() {
|
receiveBtn := widget.NewButton("领取", func() {
|
||||||
selId := this.itemList.SelItemId
|
selId := this.itemList.SelItemId
|
||||||
if selId == "" {
|
if selId == "" {
|
||||||
common.ShowTip("请选择项目")
|
common.ShowTip("请选择项目")
|
||||||
@ -65,17 +65,52 @@ func (this *SociatyTasklistView) CreateView(t *model.TestCase) fyne.CanvasObject
|
|||||||
})
|
})
|
||||||
|
|
||||||
//活跃度领取
|
//活跃度领取
|
||||||
activityBtn := widget.NewButton("", nil)
|
activityBtn := widget.NewButton("活跃度领取", func() {
|
||||||
activityVal := canvas.NewText("", nil)
|
if err := service.GetPttService().SendToClient(
|
||||||
|
string(comm.ModuleSociaty),
|
||||||
|
sociaty.SociatySubTypeActivityReceive,
|
||||||
|
&pb.SociatyActivityReceiveReq{
|
||||||
|
Id: 1,
|
||||||
|
}); err != nil {
|
||||||
|
logrus.Error(err)
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
// 活跃度列表
|
||||||
|
this.activityItemList = common.NewItemList()
|
||||||
|
this.activityItemList.ItemList = this.activityItemList.CreateList()
|
||||||
|
this.activityList()
|
||||||
|
|
||||||
|
activityVal := canvas.NewText("0", nil)
|
||||||
buttonBar := container.NewHBox(refreshBtn, receiveBtn)
|
buttonBar := container.NewHBox(refreshBtn, receiveBtn)
|
||||||
|
|
||||||
c1 := container.NewBorder(buttonBar, nil, nil, nil, this.itemList.ItemList)
|
c1 := container.NewBorder(buttonBar, nil, nil, nil, this.itemList.ItemList)
|
||||||
c2 := container.NewBorder(nil, nil, nil, nil, container.NewVBox(container.NewCenter(activityVal), activityBtn))
|
c2 := container.NewBorder(container.NewVBox(container.NewCenter(activityVal), activityBtn), nil, nil, nil, this.activityItemList.ItemList)
|
||||||
cols := container.NewGridWithColumns(2, c1, c2)
|
cols := container.NewGridWithColumns(2, c1, c2)
|
||||||
this.dataListener()
|
this.dataListener()
|
||||||
return cols
|
return cols
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (this *SociatyTasklistView) activityList() {
|
||||||
|
n := map[int32]int32{
|
||||||
|
1: 1000,
|
||||||
|
2: 2000,
|
||||||
|
3: 3000,
|
||||||
|
4: 4000,
|
||||||
|
5: 5000,
|
||||||
|
}
|
||||||
|
|
||||||
|
var nn int
|
||||||
|
for k, v := range n {
|
||||||
|
nn++
|
||||||
|
item := common.Item{
|
||||||
|
Id: cast.ToString(k),
|
||||||
|
Text: fmt.Sprintf("%d - Id:%v 活跃度:%d ", nn, k, v),
|
||||||
|
}
|
||||||
|
this.activityItemList.AddItem(item)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
func (this *SociatyTasklistView) dataListener() {
|
func (this *SociatyTasklistView) dataListener() {
|
||||||
if this.flag {
|
if this.flag {
|
||||||
return
|
return
|
||||||
|
@ -35,6 +35,7 @@ func (this *apiComp) Agree(session comm.IUserSession, req *pb.SociatyAgreeReq) (
|
|||||||
code = pb.ErrorCode_SociatyNoRight
|
code = pb.ErrorCode_SociatyNoRight
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
if err := this.module.modelSociaty.agree(req.Uid, sociaty); err != nil {
|
if err := this.module.modelSociaty.agree(req.Uid, sociaty); err != nil {
|
||||||
code = pb.ErrorCode_SociatyAgree
|
code = pb.ErrorCode_SociatyAgree
|
||||||
this.module.Errorf("申请同意失败:%v", err)
|
this.module.Errorf("申请同意失败:%v", err)
|
||||||
|
@ -25,6 +25,7 @@ func (this *apiComp) Sign(session comm.IUserSession, req *pb.SociatySignReq) (co
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 判断是否已签到
|
||||||
if this.module.modelSociaty.IsSign(uid, sociaty) {
|
if this.module.modelSociaty.IsSign(uid, sociaty) {
|
||||||
code = pb.ErrorCode_SociatySigned
|
code = pb.ErrorCode_SociatySigned
|
||||||
return
|
return
|
||||||
@ -61,6 +62,10 @@ func (this *apiComp) Sign(session comm.IUserSession, req *pb.SociatySignReq) (co
|
|||||||
if err := this.module.modelSociaty.updateSociatyExp(cfg.Exp.N, sociaty); err != nil {
|
if err := this.module.modelSociaty.updateSociatyExp(cfg.Exp.N, sociaty); err != nil {
|
||||||
this.module.Errorf("公会经验更新失败:%v", err)
|
this.module.Errorf("公会经验更新失败:%v", err)
|
||||||
}
|
}
|
||||||
|
// 更新等级
|
||||||
|
if err := this.module.modelSociaty.changeLv(sociaty); err != nil {
|
||||||
|
this.module.Errorf("公会等级更新失败:%v", err)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -311,7 +311,9 @@ func (this *ModelSociaty) delFromApplyRecord(uid string, sociaty *pb.DBSociaty)
|
|||||||
|
|
||||||
//添加成员
|
//添加成员
|
||||||
func (this *ModelSociaty) addMember(uid string, sociaty *pb.DBSociaty) error {
|
func (this *ModelSociaty) addMember(uid string, sociaty *pb.DBSociaty) error {
|
||||||
defer this.moduleSociaty.modelSociatyLog.addLog(Log_Add, sociaty.Id, uid)
|
if int32(len(sociaty.Members)) >= this.getMemberMax(sociaty) {
|
||||||
|
return fmt.Errorf("member max")
|
||||||
|
}
|
||||||
sociaty.Members = append(sociaty.Members, &pb.SociatyMember{
|
sociaty.Members = append(sociaty.Members, &pb.SociatyMember{
|
||||||
Uid: uid,
|
Uid: uid,
|
||||||
Job: pb.SociatyJob_MEMBER,
|
Job: pb.SociatyJob_MEMBER,
|
||||||
@ -328,8 +330,12 @@ func (this *ModelSociaty) addMember(uid string, sociaty *pb.DBSociaty) error {
|
|||||||
updateEx := map[string]interface{}{
|
updateEx := map[string]interface{}{
|
||||||
"sociatyId": sociaty.Id,
|
"sociatyId": sociaty.Id,
|
||||||
}
|
}
|
||||||
|
if err := this.moduleSociaty.ModuleUser.ChangeRemoteUserExpand(uid, updateEx); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
return this.moduleSociaty.ModuleUser.ChangeRemoteUserExpand(uid, updateEx)
|
this.moduleSociaty.modelSociatyLog.addLog(Log_Add, sociaty.Id, uid)
|
||||||
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// 成员列表
|
// 成员列表
|
||||||
@ -631,14 +637,64 @@ func (this *ModelSociaty) rank() (rank []*pb.DBSociatyRank) {
|
|||||||
|
|
||||||
rank = this.sort(rank)
|
rank = this.sort(rank)
|
||||||
|
|
||||||
rank = append(rank[:0], rank[19:]...)
|
if len(rank) > 20 {
|
||||||
|
rank = append(rank[:0], rank[19:]...)
|
||||||
|
}
|
||||||
|
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// CD
|
||||||
func (this *ModelSociaty) isInCDHour(userCdTime int64) bool {
|
func (this *ModelSociaty) isInCDHour(userCdTime int64) bool {
|
||||||
if userCdTime == 0 {
|
if userCdTime == 0 {
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
return time.Now().Unix() < userCdTime
|
return time.Now().Unix() < userCdTime
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 等级更新
|
||||||
|
func (this *ModelSociaty) changeLv(sociaty *pb.DBSociaty) error {
|
||||||
|
ggl, err := this.moduleSociaty.configure.getSociatyLvCfg()
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
if ggl == nil {
|
||||||
|
return errors.New("sociatyLvConf is nil")
|
||||||
|
}
|
||||||
|
|
||||||
|
curLv := sociaty.Lv
|
||||||
|
update := map[string]interface{}{}
|
||||||
|
|
||||||
|
lv := curLv + 1
|
||||||
|
if conf, ok := ggl.GetDataMap()[lv]; ok {
|
||||||
|
if sociaty.Exp > conf.Exp {
|
||||||
|
update["lv"] = lv
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if len(update) > 0 {
|
||||||
|
if err = this.updateSociaty(sociaty.Id, update); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// 获取可容纳的最大上限
|
||||||
|
func (this *ModelSociaty) getMemberMax(sociaty *pb.DBSociaty) int32 {
|
||||||
|
ggl, err := this.moduleSociaty.configure.getSociatyLvCfg()
|
||||||
|
if err != nil {
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
|
||||||
|
if ggl == nil {
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
|
||||||
|
if conf, ok := ggl.GetDataMap()[sociaty.Lv]; ok {
|
||||||
|
return conf.MemberMax
|
||||||
|
}
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user