WithdrawGlobal.php 2.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283
  1. <?php
  2. namespace common\globals;
  3. use common\globals\BaseGlobal;
  4. use common\globals\GlobalInvoke;
  5. use common\models\common\AddonsInvoker;
  6. class WithdrawGlobal extends BaseGlobal{
  7. ##########################################################################################################
  8. # 提现条件,配置格式
  9. # [
  10. # [
  11. # 'id' => 1,
  12. # 'addons_name' => 'Agent',
  13. # 'render_setting' => [
  14. # 'text' => '个人经销佣金满____元',
  15. # 'setting' => [
  16. # ['type' => 'text', 'name' => 'personal_agent_commission', 'default_val' => 0],
  17. # ],
  18. # 'tips' => ''
  19. # ],
  20. # 'validate_invoke' => [
  21. # 'class' => 'addons\Agent\common\globalFunc\withdrawal\Withdrawal',
  22. # 'method' => 'checkWithdrawLimit1'
  23. # ]
  24. # ],
  25. # [
  26. # 'id' => 2,
  27. # 'addons_name' => 'Agent',
  28. # 'render_setting' => [
  29. # 'text' => '个人经销佣金小于____元',
  30. # 'setting' => [
  31. # ['type' => 'text', 'name' => 'personal_agent_lt__commission', 'default_val' => 0],
  32. # ],
  33. # 'tips' => ''
  34. # ],
  35. # 'validate_invoke' => [
  36. # 'class' => 'addons\Agent\common\globalFunc\withdrawal\Withdrawal',
  37. # 'method' => 'checkWithdrawLimit2'
  38. # ]
  39. # ]
  40. # ];
  41. ##########################################################################################################
  42. /**
  43. * 获取提现限制条件
  44. * @param [type] $invokes
  45. * @param array $params
  46. * @return void
  47. */
  48. public function getWithDrawLimitCond($invokes,$params=[]){
  49. $withdral_cond_list = [];
  50. foreach ($invokes as $invoke) {
  51. try{
  52. // 获取条件
  53. $withdral_cond = $this->invoke($invoke['class'],$invoke['method'],$params);
  54. $is_success = $this->validateInvokeReturn($params['invoke_id'],$withdral_cond);
  55. // 全局调用获取提现条件
  56. if($is_success){
  57. $withdral_cond_list = array_merge($withdral_cond_list, $withdral_cond);
  58. }else{
  59. throw new \Exception('结果数据格式校验未通过');
  60. }
  61. }catch(\Exception $e){
  62. \Yii::error('全局调用(INVOKE_GET_WITHDRAW_COND)出错:'.$invoke['class'].'->'.$invoke['method'].'msg:'.$e->getMessage());
  63. continue;
  64. }
  65. }
  66. return $withdral_cond_list;
  67. }
  68. /**
  69. * 验证调用结果
  70. * @param [type] $return
  71. * @return boolean
  72. */
  73. protected function validateWithDrawLimitCond($return=null):bool{
  74. return true;
  75. }
  76. }