auto check commission

This commit is contained in:
Tokumeikoi 2020-05-03 23:17:55 +08:00
parent 890626d892
commit 998ac1d500
3 changed files with 22 additions and 1 deletions

View File

@ -38,6 +38,25 @@ class CheckCommission extends Command
* @return mixed
*/
public function handle()
{
$this->autoCheck();
$this->autoPayCommission();
}
public function autoCheck()
{
if ((int)config('v2board.commission_auto_check_enable')) {
Order::where('commission_status', 0)
->where('status', 3)
->where('commission_balance', '>', 0)
->where('updated_at', '>=', strtotime('+3 day', time()))
->update([
'commission_status' => 1
]);
}
}
public function autoPayCommission()
{
$order = Order::where('commission_status', 1)
->where('status', 3)

View File

@ -30,7 +30,8 @@ class ConfigController extends Controller
'invite_commission' => config('v2board.invite_commission', 10),
'invite_gen_limit' => config('v2board.invite_gen_limit', 5),
'invite_never_expire' => config('v2board.invite_never_expire', 0),
'commission_first_time_enable' => config('v2board.commission_first_time_enable', 1)
'commission_first_time_enable' => config('v2board.commission_first_time_enable', 1),
'commission_auto_check' => config('v2board.commission_auto_check_enable', 1)
],
'site' => [
'safe_mode_enable' => (int)config('v2board.safe_mode_enable', 0),

View File

@ -14,6 +14,7 @@ class ConfigSave extends FormRequest
'invite_gen_limit' => 'integer',
'invite_never_expire' => 'in:0,1',
'commission_first_time_enable' => 'in:0,1',
'commission_auto_check_enable' => 'in:0,1',
// site
'stop_register' => 'in:0,1',
'email_verify' => 'in:0,1',