...
|
...
|
@@ -57,6 +57,18 @@ func (dao *EmployeeDao) ChangePrincipal(companyId int64, employeeAccount string) |
|
|
return nil
|
|
|
}
|
|
|
|
|
|
// ChangePhone TODO 修改用户手机号
|
|
|
func (dao *EmployeeDao) ChangePhone(oldPhone string, newPhone string) error {
|
|
|
tx := dao.transactionContext.PgTx
|
|
|
if _, err := tx.QueryOne(
|
|
|
pg.Scan(),
|
|
|
"UPDATE employees SET employee_account=? WHERE employee_account=?",
|
|
|
oldPhone, newPhone); err != nil {
|
|
|
return err
|
|
|
}
|
|
|
return nil
|
|
|
}
|
|
|
|
|
|
// 更新用户素币
|
|
|
func (dao *EmployeeDao) TransferSuMoney(uid int64, suMoney float64) error {
|
|
|
tx := dao.transactionContext.PgTx
|
...
|
...
|
@@ -139,7 +151,7 @@ func (dao *EmployeeDao) CalculatePersonSuMoney(uid int64) (map[string]interface{ |
|
|
}
|
|
|
|
|
|
// 计算系统已兑换现金素币、未兑换素币
|
|
|
func (dao *EmployeeDao) CalculateSystemSuMoney(companyId int64) (map[string] interface{}, error) {
|
|
|
func (dao *EmployeeDao) CalculateSystemSuMoney(companyId int64) (map[string]interface{}, error) {
|
|
|
var systemUnExchangeSuMoney float64
|
|
|
var systemExchangedSuMoney float64
|
|
|
var systemExchangedSuMoneyRestore float64
|
...
|
...
|
@@ -172,14 +184,14 @@ func (dao *EmployeeDao) CalculateSystemSuMoney(companyId int64) (map[string] int |
|
|
Select(&systemExchangedSuMoneyRestore); err != nil {
|
|
|
return nil, err
|
|
|
}
|
|
|
return map[string] interface{} {
|
|
|
return map[string]interface{}{
|
|
|
"systemUnExchangeSuMoney": systemUnExchangeSuMoney,
|
|
|
"systemExchangedSuMoney": systemExchangedSuMoney - systemExchangedSuMoneyRestore,
|
|
|
},nil
|
|
|
}, nil
|
|
|
}
|
|
|
|
|
|
// 计算现金池已兑换现金、未兑换现金
|
|
|
func (dao *EmployeeDao) CalculateSystemCash(companyId int64) (map[string] interface{}, error) {
|
|
|
func (dao *EmployeeDao) CalculateSystemCash(companyId int64) (map[string]interface{}, error) {
|
|
|
tx := dao.transactionContext.PgTx
|
|
|
var (
|
|
|
systemUnExchangeCash float64
|
...
|
...
|
@@ -192,7 +204,7 @@ func (dao *EmployeeDao) CalculateSystemCash(companyId int64) (map[string] interf |
|
|
Where("cash_pool.company_id = ?", companyId).
|
|
|
Order("id DESC").
|
|
|
Limit(1).
|
|
|
Select(&systemExchangedCash) ; err != nil {
|
|
|
Select(&systemExchangedCash); err != nil {
|
|
|
return nil, err
|
|
|
}
|
|
|
// 系统未兑换现金
|
...
|
...
|
@@ -201,10 +213,10 @@ func (dao *EmployeeDao) CalculateSystemCash(companyId int64) (map[string] interf |
|
|
Where("cash_pool.company_id = ?", companyId).
|
|
|
Order("id DESC").
|
|
|
Limit(1).
|
|
|
Select(&systemUnExchangeCash) ; err != nil {
|
|
|
Select(&systemUnExchangeCash); err != nil {
|
|
|
return nil, err
|
|
|
}
|
|
|
return map[string] interface{} {
|
|
|
return map[string]interface{}{
|
|
|
"systemUnExchangeCash": systemUnExchangeCash,
|
|
|
"systemExchangedCash": systemExchangedCash,
|
|
|
}, nil
|
...
|
...
|
|