PosterGlobal.php 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  1. <?php
  2. namespace common\globals;
  3. use common\globals\BaseGlobal;
  4. use common\globals\GlobalInvoke;
  5. use common\models\common\AddonsInvoker;
  6. class PosterGlobal extends BaseGlobal
  7. {
  8. ##########################################################################################################
  9. # 海报返回数据格式
  10. # [
  11. # 'page' => '/plugins/bargain/goodsDetail'
  12. # 'data' => [
  13. # 'user_id' => 73
  14. # 'nickname' => '昵称'
  15. # 'avatar_url' => 'https://thirdwx.qlogo.cn/mmopen/vi_32/110bN5gQSEcibC3782F9Ep4icGgB74EOJPK3ONHrT1OPViaogEllKWDwEKibwRxGEp6sRHDxRBXOyLh1BPLCmA8Grw/132'
  16. # 'item_id' => '38'
  17. # 'price' => '300.00'
  18. # 'min_price' => '10.00'
  19. # 'share_title' => '服务商300元'
  20. # 'share_img' => 'https://shuzixiangdao.oss-cn-guangzhou.aliyuncs.com/images/2022/01/03/image_1641177775_wuLAAMsb.jpeg'
  21. # ]
  22. # 'save_content' => [
  23. # 'marketing_type' => 'Bargain'
  24. # 'active_id' => '38'
  25. # 'item_id' => '38'
  26. # ]
  27. # ]
  28. # ];
  29. ##########################################################################################################
  30. /**
  31. * 获取提现限制条件
  32. * @param [type] $invokes
  33. * @param array $params
  34. * @return array
  35. */
  36. public function getPoster($invokes, $params = [])
  37. {
  38. $return = [];
  39. foreach ($invokes as $invoke) {
  40. try {
  41. $return = $this->invoke($invoke['class'], $invoke['method'], $params);
  42. $is_success = $this->validateInvokeReturn($params['invoke_id'], $return);
  43. if ($is_success) {
  44. if(!empty($return)){
  45. break;
  46. }
  47. } else {
  48. throw new \Exception('结果数据格式校验未通过');
  49. }
  50. } catch (\Exception $e) {
  51. \Yii::error('全局调用(INVOKE_GET_WITHDRAW_COND)出错:' . $invoke['class'] . '->' . $invoke['method'] . 'msg:' . $e->getMessage());
  52. continue;
  53. }
  54. }
  55. return $return;
  56. }
  57. /**
  58. * 验证调用结果
  59. * @param [type] $return
  60. * @return boolean
  61. */
  62. protected function validateGetPosterCond($return = null): bool
  63. {
  64. return true;
  65. }
  66. }