WIN-2308041133\Administrator 6 months ago
parent
commit
c7f3a9d439
1 changed files with 55 additions and 45 deletions
  1. 55 45
      application/api/controller/Lave.php

+ 55 - 45
application/api/controller/Lave.php

@@ -237,57 +237,64 @@ class Lave extends Api
 
         } else $this->error(LaveMonthModel::getErrorInfo());
     }
-    /**
-     * 签约订单支付
-     * @param Request $request
-     * @return mixed
-     */
-    public function paySign(Request $request)
-    {
-//        var_dump(456);die();
-        list($uni, $paytype, $from) = UtilService::postMore([
-            ['uni', ''],
-            ['paytype', '0'],
-            ['from', 'weixin']
-        ], $request, true);
-        if (!$uni) $this->error('参数错误!');
-        $order = LaveMonthModel::where('cid', $this->cid)->where('order_id', $uni)->find();
-        if (!$order)
-            $this->error('订单不存在!');
-        if ($order['paid'])
-            $this->error('该订单已支付!');
-        $order['pay_type'] = $paytype; //重新支付选择支付方式
-        switch ($order['pay_type']) {
-            case '0':
-                try {
-                    if ($from == 'routine') {
-                        $jsConfig = LaveRepository::jsPaySign($this->cid, $order); //订单列表发起支付
-                    } else if ($from == 'weixinh5') {
-                        $jsConfig = LaveRepository::h5PaySign($this->cid, $order);
-                    } else {
-                        $jsConfig = LaveRepository::wxPaySign($this->cid, $order);
-                    }
-                } catch (\Exception $e) {
-                    $this->error($e->getMessage());
-                }
-                $this->success('获取成功', $jsConfig);
-                break;
-        }
-        return $this->error('支付方式错误');
-    }
+//    /**
+//     * 签约订单支付
+//     * @param Request $request
+//     * @return mixed
+//     */
+//    public function paySign(Request $request)
+//    {
+////        var_dump(456);die();
+//        list($uni, $paytype, $from) = UtilService::postMore([
+//            ['uni', ''],
+//            ['paytype', '0'],
+//            ['from', 'weixin']
+//        ], $request, true);
+//        if (!$uni) $this->error('参数错误!');
+//        $order = LaveMonthModel::where('cid', $this->cid)->where('order_id', $uni)->find();
+//        if (!$order)
+//            $this->error('订单不存在!');
+//        if ($order['paid'])
+//            $this->error('该订单已支付!');
+//        $order['pay_type'] = $paytype; //重新支付选择支付方式
+//        switch ($order['pay_type']) {
+//            case '0':
+//                try {
+//                    if ($from == 'routine') {
+//                        $jsConfig = LaveRepository::jsPaySign($this->cid, $order); //订单列表发起支付
+//                    } else if ($from == 'weixinh5') {
+//                        $jsConfig = LaveRepository::h5PaySign($this->cid, $order);
+//                    } else {
+//                        $jsConfig = LaveRepository::wxPaySign($this->cid, $order);
+//                    }
+//                } catch (\Exception $e) {
+//                    $this->error($e->getMessage());
+//                }
+//                $this->success('获取成功', $jsConfig);
+//                break;
+//        }
+//        return $this->error('支付方式错误');
+//    }
     //    申请扣款
     public function payPap(Request $request)
     {
-        @file_put_contents("quanju.txt", "测试申请扣款-\r\n", 8);
-        die();
+//        @file_put_contents("quanju.txt", "测试申请扣款-\r\n", 8);
+//        die();
         $list=WechatPlanRecord::where('is_signing',0)->select();
         $cid=$this->cid;
-
         $arr=[];
-
         $arr['body']='月捐款';
-
         foreach ($list as $k => $v){
+            $day = intval(date('d', $v['create_time']));
+//            @file_put_contents("quanju.txt", $day."-日期\r\n", 8);
+            $today = intval(date('d'));
+            var_dump($day);
+            var_dump($today);
+
+            if ($day ==1||$today == $day-1){
+                var_dump(123);
+            }
+            die();
             $cid=$v['cid'];
 //            if ($this->querySign($cid,$v['uid'],$v['plan_id'],$v['contract_code'])){
                 $arr['mch_id'] =Company::where('id', $cid)->value('pay_weixin_mchid');
@@ -296,11 +303,11 @@ class Lave extends Api
 //            $arr['trade_type'] = 'PAP';
                 $arr['contract_id'] = Company::where('id', $cid)->value('contract_id');
 //            $rs = WechatService::paymentOrder($openid, $orderInfo['order_id'], $orderInfo['amount'], "lave", $orderInfo['order_name'], '', 'JSAPI', [], $cid);
-                $rs = WechatService::papPayApply($arr['out_trade_no'], $arr['total_fee'], "lave", '月捐款', 'PAP', [], $cid,$arr['mch_id'],$arr['contract_id']);
+
                 $where1['cid']=$cid;
                 $where1['user_id']=$v['uid'];
                 $where1['order_name']=$v['order_name'];
-                $where1['category_id']=$v['category_id'];
+//                $where1['category_id']=$v['category_id'];
                 $where1['amount']=$arr['total_fee'];
                 $where1['name']=$v['contract_display_account'];
                 $where1['contact']='';
@@ -312,6 +319,9 @@ class Lave extends Api
 //                $where1['help_id']='0';
                 $order = LaveMonthModel::create($where1);
 //            }
+            var_dump($order);
+            die();
+            $rs = WechatService::papPayApply($arr['out_trade_no'], $arr['total_fee'], "lave", '月捐款', 'PAP', [], $cid,$arr['mch_id'],$arr['contract_id']);
         }
     }
 //    解除签约