Skip to content

修复MySQL 8+ SQL执行报错问题 #96

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion crmeb/app/dao/activity/coupon/StoreCouponUserDao.php
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,7 @@ public function memberCouponUserGroupBymonth(array $where)
->whereMonth('add_time')
->whereIn('cid', $where['couponIds'])
->field('count(id) as num,FROM_UNIXTIME(add_time, \'%Y-%m\') as time')
->group("FROM_UNIXTIME(add_time, '%Y-%m')")
->group("time")
->select()->toArray();
}

Expand Down
2 changes: 1 addition & 1 deletion crmeb/app/dao/order/OtherOrderDao.php
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ public function getGroupField(array $where, string $field, string $group)
$query->field("sum($field) as number,FROM_UNIXTIME($group, '$timeUinx') as time");
$query->group("FROM_UNIXTIME($group, '$timeUinx')");
})
->order('add_time ASC')->select()->toArray();
->order('time ASC')->select()->toArray();
}

/**根据条件获取单条信息
Expand Down
14 changes: 7 additions & 7 deletions crmeb/app/dao/order/StoreOrderDao.php
Original file line number Diff line number Diff line change
Expand Up @@ -352,9 +352,9 @@ public function orderAddTimeList($datebefor, $dateafter, $timeType = "week")
break;
}
$query->field("FROM_UNIXTIME(add_time,'$timeUnix') as day,count(*) as count,sum(pay_price) as price");
$query->group("FROM_UNIXTIME(add_time, '$timeUnix')");
$query->group("day");
})
->order('add_time asc')
->order('day asc')
->select()->toArray();
}

Expand Down Expand Up @@ -397,9 +397,9 @@ public function nowOrderList($now_datebefor, $now_dateafter, $timeType = "week")
break;
}
$query->field("FROM_UNIXTIME(add_time,'$timeUnix') as day,count(*) as count,sum(pay_price) as price");
$query->group("FROM_UNIXTIME(add_time, '$timeUnix')");
$query->group("day");
})
->order('add_time asc')
->order('day asc')
->select()->toArray();
}

Expand Down Expand Up @@ -712,7 +712,7 @@ public function getDayGroupMoney(array $where, string $sumField, string $group)
$timeUinx = "%Y-%m";
}
$query->field("sum($sumField) as number,FROM_UNIXTIME($group, '$timeUinx') as time");
$query->group("FROM_UNIXTIME($group, '$timeUinx')");
$query->group("time");
})
->order('pay_time ASC,id DESC')->select()->toArray();
}
Expand Down Expand Up @@ -740,7 +740,7 @@ public function getOrderGroupCount(array $where, string $sumField = "*")
$timeUinx = "%Y-%m";
}
$query->field("count($sumField) as number,FROM_UNIXTIME(pay_time, '$timeUinx') as time");
$query->group("FROM_UNIXTIME(pay_time, '$timeUinx')");
$query->group("time");
})
->order('pay_time ASC,id DESC')->select()->toArray();
}
Expand Down Expand Up @@ -783,7 +783,7 @@ public function getPayOrderGroupPeople($where)
$timeUinx = "%H";
}
$query->field("count(distinct uid) as number,FROM_UNIXTIME(pay_time, '$timeUinx') as time");
$query->group("FROM_UNIXTIME(pay_time, '$timeUinx')");
$query->group("time");
})
->order('pay_time ASC,id DESC')->select()->toArray();
}
Expand Down
2 changes: 1 addition & 1 deletion crmeb/app/dao/order/StoreOrderRefundDao.php
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@ public function getDayGroupMoney(array $where, string $sumField, string $group)
$timeUinx = "%Y-%m";
}
$query->field("sum($sumField) as number,FROM_UNIXTIME($group, '$timeUinx') as time");
$query->group("FROM_UNIXTIME($group, '$timeUinx')");
$query->group("time");
})
->order('add_time ASC')->select()->toArray();
}
Expand Down
2 changes: 1 addition & 1 deletion crmeb/app/dao/system/statistics/CapitalFlowDao.php
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ public function getRecordList($where, int $page = 0, int $limit = 0)
$model = $this->search($where, false)
->when(isset($where['type']) && $where['type'] !== '', function ($query) use ($where, $timeUnix) {
$query->field("FROM_UNIXTIME(add_time,'$timeUnix') as day,sum(if(price >= 0,price,0)) as income_price,sum(if(price < 0,price,0)) as exp_price,add_time");
$query->group("FROM_UNIXTIME(add_time, '$timeUnix')");
$query->group("day");
});
$count = $model->count();
$list = $model->when($page && $limit, function ($query) use ($page, $limit) {
Expand Down
2 changes: 1 addition & 1 deletion crmeb/app/dao/user/UserBillDao.php
Original file line number Diff line number Diff line change
Expand Up @@ -273,7 +273,7 @@ public function getGroupField(array $where, string $field, string $group)
$timeUinx = "%Y-%m";
}
$query->field("sum($field) as number,FROM_UNIXTIME($group, '$timeUinx') as time");
$query->group("FROM_UNIXTIME($group, '$timeUinx')");
$query->group("time");
})
->order('add_time ASC')->select()->toArray();
}
Expand Down
4 changes: 2 additions & 2 deletions crmeb/app/dao/user/UserDao.php
Original file line number Diff line number Diff line change
Expand Up @@ -249,8 +249,8 @@ public function userList($starday, $yesterday)
return $this->getModel()
->whereBetweenTime('add_time', $starday, $yesterday)
->field("FROM_UNIXTIME(add_time,'%m-%e') as day,count(*) as count")
->group("FROM_UNIXTIME(add_time, '%Y%m%e')")
->order('add_time asc')->select()->toArray();
->group("day")
->order('day asc')->select()->toArray();
}

/**
Expand Down
2 changes: 1 addition & 1 deletion crmeb/app/dao/user/UserExtractDao.php
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ public function getGroupField(array $where, string $field, string $group)
$timeUinx = "%Y-%m";
}
$query->field("sum($field) as number,FROM_UNIXTIME($group, '$timeUinx') as time");
$query->group("FROM_UNIXTIME($group, '$timeUinx')");
$query->group("time");
})
->order('add_time ASC')->select()->toArray();
}
Expand Down
2 changes: 1 addition & 1 deletion crmeb/app/dao/user/UserMoneyDao.php
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ public function getGroupField(array $where, string $field, string $group)
$timeUinx = "%Y-%m";
}
$query->field("sum($field) as number,FROM_UNIXTIME($group, '$timeUinx') as time");
$query->group("FROM_UNIXTIME($group, '$timeUinx')");
$query->group("time");
})
->order('add_time ASC')->select()->toArray();
}
Expand Down
2 changes: 1 addition & 1 deletion crmeb/app/dao/user/UserRechargeDao.php
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ public function getGroupField(array $where, string $field, string $group)
$timeUinx = "%Y-%m";
}
$query->field("sum($field) as number,FROM_UNIXTIME($group, '$timeUinx') as time");
$query->group("FROM_UNIXTIME($group, '$timeUinx')");
$query->group("time");
})
->order('add_time ASC')->select()->toArray();

Expand Down