| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117 |
- <?php
- namespace app\business;
- use Illuminate\Support\Arr;
- use support\Db;
- use support\Log;
- use support\Redis;
- use yzh52521\EasyHttp\Http;
- class GoodsBusiness
- {
- /**购买慈善项目
- * @return void
- */
- static public function buyType1(array $param)
- {
- try {
- $payorderId = PayorderBusiness::orderAdd($param);
- $payorder = Db::table('wa_payorder')->where('id', $payorderId)->first();
- //
- // if ($payorder->pay_type == 2) {
- // $data = PayTwoBusiness::payment($payorder->order_no, $payorder->pay_characteristic, $payorder->money, Arr::get($param, 'url', ''));
- // Log::channel('payment')->info('桥头', $data);
- // if (Arr::get($data, 'data.retCode') != 'SUCCESS') {
- // throw new \Exception('通道未开通!');
- // }
- // $arr = [
- // 'type' => 2,
- // 'url' => Arr::get($data, 'data.payParams.payUrl'),
- // 'payOrderId' => ''
- // ];
- // }elseif ($payorder->pay_type == 3) {
- // $data = PayThreeBusiness::payment($payorder->order_no, $payorder->pay_characteristic, $payorder->money, Arr::get($param, 'url', ''));
- // Log::channel('payment')->info('林北', $data);
- // if (Arr::get($data, 'data.code') != 1000) {
- // throw new \Exception('通道未开通!');
- // }
- // $arr = [
- // 'type' => 2,
- // 'url' => Arr::get($data, 'data.data.message.url'),
- // 'payOrderId' => ''
- // ];
- // }elseif ($payorder->pay_type == 5) {
- // $data = PayFiveBusiness::payment($payorder->order_no, $payorder->pay_characteristic, $payorder->money, Arr::get($param, 'url', ''));
- // Log::channel('payment')->info('鸿运', $data);
- // if (Arr::get($data, 'data.retCode') != 'SUCCESS') {
- // throw new \Exception('通道未开通!');
- // }
- // $arr = [
- // 'type' => 2,
- // 'url' => Arr::get($data, 'data.payParams.payUrl'),
- // 'payOrderId' => ''
- // ];
- // } else {
- // $arr = [
- // 'type' => 1,
- // 'url' => '',
- // 'payOrderId' => ''
- // ];
- // }
- $arr = [
- 'type' => 2,
- 'url' => Arr::get($param, 'url', ''),
- 'payOrderId' => ''
- ];
- PayorderBusiness::payorderSave(collect($payorder)->toArray());
- } catch (\Throwable $exception) {
- throw new \Exception($exception->getMessage());
- }
- return $arr;
- }
- /** 银行卡
- * @param array $param
- * @return void
- */
- static public function usersocialcark(array $param)
- {
- try {
- if (!empty($param['data_array'])) {
- foreach ($param['data_array'] as $k => $v) {
- if (!empty($param['user_data']['money']) && !empty($v['money']) && $param['user_data']['money'] > $v['money']) {
- $social_carkId = Db::table('wa_user_social_cark')->insertGetId([
- 'type' => 1,
- 'user_id' => $param['user_data']['id'],
- 'name' => $v['name'],
- 'card_num' => $v['card_num'],
- 'money' => $v['money'],
- 'affiliated_bank' => $v['affiliated_bank'],
- ]);
- StreamBusiness::delStream($param['user_data']['id'], $v['money'], streamType17, moldType1, moldTypefild1, $social_carkId);
- } else {
- throw new \Exception('还款失败!');
- }
- }
- } else {
- throw new \Exception('未数据提交!');
- }
- } catch (\Throwable $exception) {
- throw new \Exception($exception->getMessage());
- }
- return true;
- }
- }
|