| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123 |
- <?php
- namespace app\controller;
- use app\business\StreamBusiness;
- use Illuminate\Support\Arr;
- use support\Db;
- use support\Log;
- use support\Request;
- class IssueController
- {
- public function index(Request $request)
- {
- $param=$request->all();
- Log::channel('issue')->info('接口回调',$param);
- Db::beginTransaction();
- try {
- $order=Db::table('wa_withdraw')->where('order_no',$param['merchantUniqueOrderId'])->first();
- if(empty($order)){
- throw new \Exception('订单号不存在!');
- }
- if($order->status != 2){
- throw new \Exception('当前订单已处理!');
- }
- if(Arr::get($param,'status') == '100'){
- $status = 3;
- }else{
- if (empty($order)) {
- throw new \Exception('暂无订单');
- }
- if ($order->status != 2) {
- throw new \Exception('【' . $order->order_no . '】已被审核!');
- }
- StreamBusiness::addStream($order->user_id, $order->money, streamType6, $order->type, moldTypefild($order->type),$order->id);
- $status = 4;
- }
- Db::table('wa_withdraw')->where('id',$order->id)->update(['status'=>$status]);
- Db::commit();
- }catch (\Throwable $exception){
- Db::rollBack();
- Log::channel('issue')->error('接口回调'.$exception->getMessage(),$param);
- }
- return "success";
- }
- public function indextwo(Request $request)
- {
- $param=$request->all();
- Log::channel('issue')->info('接口回调',$param);
- Db::beginTransaction();
- try {
- $order=Db::table('wa_withdraw')->where('order_no',$param['merchantUniqueOrderId'])->first();
- if(empty($order)){
- throw new \Exception('订单号不存在!');
- }
- if($order->status != 2){
- throw new \Exception('当前订单已处理!');
- }
- if(Arr::get($param,'status') == '100'){
- $status = 3;
- }else{
- if (empty($order)) {
- throw new \Exception('暂无订单');
- }
- if ($order->status != 2) {
- throw new \Exception('【' . $order->order_no . '】已被审核!');
- }
- StreamBusiness::addStream($order->user_id, $order->money, streamType6, $order->type, moldTypefild($order->type), $order->id);
- $status = 4;
- }
- Db::table('wa_withdraw')->where('id',$order->id)->update(['status'=>$status]);
- Db::commit();
- }catch (\Throwable $exception){
- Db::rollBack();
- Log::channel('issue')->error('接口回调'.$exception->getMessage(),$param);
- }
- return "success";
- }
- public function issue_three(Request $request)
- {
- $param=$request->all();
- Log::channel('issue')->info('接口回调',$param);
- Db::beginTransaction();
- try {
- $order=Db::table('wa_withdraw')->where('order_no',$param['tradeid'])->first();
- if(empty($order)){
- throw new \Exception('订单号不存在!');
- }
- if($order->status != 2){
- throw new \Exception('当前订单已处理!');
- }
- if(Arr::get($param,'status') == 88){
- $status = 3;
- }else{
- if (empty($order)) {
- throw new \Exception('暂无订单');
- }
- if ($order->status != 2) {
- throw new \Exception('【' . $order->order_no . '】已被审核!');
- }
- StreamBusiness::addStream($order->user_id, $order->money, streamType6, $order->type, moldTypefild($order->type),$order->id);
- $status = 4;
- }
- Db::table('wa_withdraw')->where('id',$order->id)->update(['status'=>$status]);
- Db::commit();
- }catch (\Throwable $exception){
- Db::rollBack();
- Log::channel('issue')->error('接口回调'.$exception->getMessage(),$param);
- }
- return "success";
- }
- }
|