| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283 |
- <?php
- namespace common\globals;
- use common\globals\BaseGlobal;
- use common\globals\GlobalInvoke;
- use common\models\common\AddonsInvoker;
- class WithdrawGlobal extends BaseGlobal{
- ##########################################################################################################
- # 提现条件,配置格式
- # [
- # [
- # 'id' => 1,
- # 'addons_name' => 'Agent',
- # 'render_setting' => [
- # 'text' => '个人经销佣金满____元',
- # 'setting' => [
- # ['type' => 'text', 'name' => 'personal_agent_commission', 'default_val' => 0],
- # ],
- # 'tips' => ''
- # ],
- # 'validate_invoke' => [
- # 'class' => 'addons\Agent\common\globalFunc\withdrawal\Withdrawal',
- # 'method' => 'checkWithdrawLimit1'
- # ]
- # ],
- # [
- # 'id' => 2,
- # 'addons_name' => 'Agent',
- # 'render_setting' => [
- # 'text' => '个人经销佣金小于____元',
- # 'setting' => [
- # ['type' => 'text', 'name' => 'personal_agent_lt__commission', 'default_val' => 0],
- # ],
- # 'tips' => ''
- # ],
- # 'validate_invoke' => [
- # 'class' => 'addons\Agent\common\globalFunc\withdrawal\Withdrawal',
- # 'method' => 'checkWithdrawLimit2'
- # ]
- # ]
- # ];
- ##########################################################################################################
- /**
- * 获取提现限制条件
- * @param [type] $invokes
- * @param array $params
- * @return void
- */
- public function getWithDrawLimitCond($invokes,$params=[]){
- $withdral_cond_list = [];
- foreach ($invokes as $invoke) {
- try{
- // 获取条件
- $withdral_cond = $this->invoke($invoke['class'],$invoke['method'],$params);
- $is_success = $this->validateInvokeReturn($params['invoke_id'],$withdral_cond);
- // 全局调用获取提现条件
- if($is_success){
- $withdral_cond_list = array_merge($withdral_cond_list, $withdral_cond);
- }else{
- throw new \Exception('结果数据格式校验未通过');
- }
- }catch(\Exception $e){
- \Yii::error('全局调用(INVOKE_GET_WITHDRAW_COND)出错:'.$invoke['class'].'->'.$invoke['method'].'msg:'.$e->getMessage());
- continue;
- }
- }
- return $withdral_cond_list;
- }
- /**
- * 验证调用结果
- * @param [type] $return
- * @return boolean
- */
- protected function validateWithDrawLimitCond($return=null):bool{
- return true;
- }
- }
|