| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859 |
- <?php
- namespace common\models\forms;
- use common\components\Model;
- use yii\base\Exception;
- /**
- * Login form
- */
- class UserBonusForm extends Model
- {
- public $periodNum;
- private $_periodModel;
- private $_limit = 1000;
- /**
- * @inheritdoc
- */
- public function rules()
- {
- return [];
- }
- public function scenarios()
- {
- $parentScenarios = parent::scenarios();
- $customScenarios = [
- 'autoWithdraw' => [],
- ];
- return array_merge($parentScenarios, $customScenarios);
- }
- public function attributeLabels()
- {
- return [];
- }
- /**
- * 页面请求异步处理,生成提现单
- * @return string | null
- */
- public function autoWithdrawWebToAsync(){
- if(!$this->validate()){
- return null;
- }
- // 异步处理添加任务
- $settings = \Yii::$app->params['swooleAsyncTimer'];
- $bonusSettings = \Yii::$app->params['swooleBonusConfig'];
- $settings = array_merge($settings, $bonusSettings);
- $taskKey = \Yii::$app->swooleAsyncTimer->asyncHandle('bonus/auto-withdraw', \Yii::$app->request->get(), $settings);
- if($taskKey === false){
- $this->addError('perf', '请求失败');
- return null;
- }
- return 1;
- }
- }
|