|
@@ -27,9 +27,10 @@ class BackflowService extends BaseService
|
|
|
*/
|
|
*/
|
|
|
public static function grant($id): bool
|
|
public static function grant($id): bool
|
|
|
{
|
|
{
|
|
|
- $params = ['id' => $id, 'status' => 0];
|
|
|
|
|
|
|
+ $params = ['id' => $id];
|
|
|
$backflow = static::findOne($params);
|
|
$backflow = static::findOne($params);
|
|
|
if (!$backflow) throw new Exception('数据不存在', HttpStatus::CUSTOM_ERROR);
|
|
if (!$backflow) throw new Exception('数据不存在', HttpStatus::CUSTOM_ERROR);
|
|
|
|
|
+ if ($backflow->status !== 0) throw new Exception("已回水,无需再次回水", HttpStatus::CUSTOM_ERROR);
|
|
|
$date = Carbon::now('Asia/Shanghai')->format('Y-m');
|
|
$date = Carbon::now('Asia/Shanghai')->format('Y-m');
|
|
|
if (strtotime($backflow->date) >= strtotime($date)) {
|
|
if (strtotime($backflow->date) >= strtotime($date)) {
|
|
|
throw new Exception('未到发放时间', HttpStatus::CUSTOM_ERROR);
|
|
throw new Exception('未到发放时间', HttpStatus::CUSTOM_ERROR);
|
|
@@ -124,7 +125,7 @@ class BackflowService extends BaseService
|
|
|
|
|
|
|
|
$date = Carbon::now('Asia/Shanghai')->format('Y-m');
|
|
$date = Carbon::now('Asia/Shanghai')->format('Y-m');
|
|
|
$query = static::$MODEL::where(static::getWhere($search));
|
|
$query = static::$MODEL::where(static::getWhere($search));
|
|
|
-// $query->where('date', '<', $date);
|
|
|
|
|
|
|
+ $query->where('date', '<', $date);
|
|
|
if (isset($search['username']) && !empty($search['username'])) {
|
|
if (isset($search['username']) && !empty($search['username'])) {
|
|
|
$username = $search['username'];
|
|
$username = $search['username'];
|
|
|
$query = $query->whereHas('user', function ($query1) use ($username) {
|
|
$query = $query->whereHas('user', function ($query1) use ($username) {
|