GoodsBusiness.php 4.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117
  1. <?php
  2. namespace app\business;
  3. use Illuminate\Support\Arr;
  4. use support\Db;
  5. use support\Log;
  6. use support\Redis;
  7. use yzh52521\EasyHttp\Http;
  8. class GoodsBusiness
  9. {
  10. /**购买慈善项目
  11. * @return void
  12. */
  13. static public function buyType1(array $param)
  14. {
  15. try {
  16. $payorderId = PayorderBusiness::orderAdd($param);
  17. $payorder = Db::table('wa_payorder')->where('id', $payorderId)->first();
  18. // if ($payorder->pay_type == 2) {
  19. // $data = PayTwoBusiness::payment($payorder->order_no, $payorder->pay_characteristic, $payorder->money, Arr::get($param, 'url', ''));
  20. // Log::channel('payment')->info('桥头', $data);
  21. // if (Arr::get($data, 'data.retCode') != 'SUCCESS') {
  22. // throw new \Exception('通道未开通!');
  23. // }
  24. // $arr = [
  25. // 'type' => 2,
  26. // 'url' => Arr::get($data, 'data.payParams.payUrl'),
  27. // 'payOrderId' => ''
  28. // ];
  29. // }elseif ($payorder->pay_type == 3) {
  30. // $data = PayThreeBusiness::payment($payorder->order_no, $payorder->pay_characteristic, $payorder->money, Arr::get($param, 'url', ''));
  31. // Log::channel('payment')->info('林北', $data);
  32. // if (Arr::get($data, 'data.code') != 1000) {
  33. // throw new \Exception('通道未开通!');
  34. // }
  35. // $arr = [
  36. // 'type' => 2,
  37. // 'url' => Arr::get($data, 'data.data.message.url'),
  38. // 'payOrderId' => ''
  39. // ];
  40. // }elseif ($payorder->pay_type == 5) {
  41. // $data = PayFiveBusiness::payment($payorder->order_no, $payorder->pay_characteristic, $payorder->money, Arr::get($param, 'url', ''));
  42. // Log::channel('payment')->info('鸿运', $data);
  43. // if (Arr::get($data, 'data.retCode') != 'SUCCESS') {
  44. // throw new \Exception('通道未开通!');
  45. // }
  46. // $arr = [
  47. // 'type' => 2,
  48. // 'url' => Arr::get($data, 'data.payParams.payUrl'),
  49. // 'payOrderId' => ''
  50. // ];
  51. // } else {
  52. // $arr = [
  53. // 'type' => 1,
  54. // 'url' => '',
  55. // 'payOrderId' => ''
  56. // ];
  57. // }
  58. $arr = [
  59. 'type' => 2,
  60. 'url' => Arr::get($param, 'url', ''),
  61. 'payOrderId' => ''
  62. ];
  63. PayorderBusiness::payorderSave(collect($payorder)->toArray());
  64. } catch (\Throwable $exception) {
  65. throw new \Exception($exception->getMessage());
  66. }
  67. return $arr;
  68. }
  69. /** 银行卡
  70. * @param array $param
  71. * @return void
  72. */
  73. static public function usersocialcark(array $param)
  74. {
  75. try {
  76. if (!empty($param['data_array'])) {
  77. foreach ($param['data_array'] as $k => $v) {
  78. if (!empty($param['user_data']['money']) && !empty($v['money']) && $param['user_data']['money'] > $v['money']) {
  79. $social_carkId = Db::table('wa_user_social_cark')->insertGetId([
  80. 'type' => 1,
  81. 'user_id' => $param['user_data']['id'],
  82. 'name' => $v['name'],
  83. 'card_num' => $v['card_num'],
  84. 'money' => $v['money'],
  85. 'affiliated_bank' => $v['affiliated_bank'],
  86. ]);
  87. StreamBusiness::delStream($param['user_data']['id'], $v['money'], streamType17, moldType1, moldTypefild1, $social_carkId);
  88. } else {
  89. throw new \Exception('还款失败!');
  90. }
  91. }
  92. } else {
  93. throw new \Exception('未数据提交!');
  94. }
  95. } catch (\Throwable $exception) {
  96. throw new \Exception($exception->getMessage());
  97. }
  98. return true;
  99. }
  100. }