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