WIN-2308041133\Administrator 5 mesiacov pred
rodič
commit
45192f23e2

+ 21 - 21
application/api/controller/Lave.php

@@ -199,26 +199,26 @@ class Lave extends Api
         @file_put_contents("quanju.txt", $plan_id . "-签约模版编号\r\n", 8);
 //        unset($where1['plan_id']);
         $where1['contract_code'] = WechatPlanRecord::getNewCode();
-        if ($where['user_id'] != 6779 && $where['user_id'] != 12125) {
-            $order = LaveMonthModel::create($where1);
-            if (!$order) $this->error(LaveMonthModel::getErrorInfo());
-            $orderId = $order['order_id'];
-            $order['plan_id'] = $plan_id;
-        } else {
+//        if ($where['user_id'] != 6779 && $where['user_id'] != 12125) {
+//            $order = LaveMonthModel::create($where1);
+//            if (!$order) $this->error(LaveMonthModel::getErrorInfo());
+//            $orderId = $order['order_id'];
+//            $order['plan_id'] = $plan_id;
+//        } else {
             $orderId = $where1['order_id'];
-        }
+//        }
         $where1['contract_display_account'] = $where1['name'];
         cache('lave_' . $where['user_id'], '1', 10);
 
         $info['contract_code'] =$where1['contract_code'];
         if ($orderId) {
-            if ($where['user_id'] != 6779 && $where['user_id'] != 12125&&$where['user_id']!=63) {
-                $orderInfo = LaveMonthModel::where('order_id', $orderId)->find();
-                if (!$orderInfo || !isset($orderInfo['paid'])) {
-                    $this->error('支付订单不存在!');
-                }
-                if ($orderInfo['paid']) $this->error('支付已支付!');
-            }
+//            if ($where['user_id'] != 6779 && $where['user_id'] != 12125&&$where['user_id']!=63) {
+//                $orderInfo = LaveMonthModel::where('order_id', $orderId)->find();
+//                if (!$orderInfo || !isset($orderInfo['paid'])) {
+//                    $this->error('支付订单不存在!');
+//                }
+//                if ($orderInfo['paid']) $this->error('支付已支付!');
+//            }
 //          创建签约
             $plan_record = [
                 'plan_id' => $plan_id,
@@ -236,9 +236,9 @@ class Lave extends Api
             $count = WechatPlanRecord::where('uid', $where1['user_id'])->where('plan_id', $plan_id)->count();
             $record = WechatPlanRecord::create($plan_record);
             @file_put_contents("quanju.txt", json_encode($record) . "-签约模版记录\r\n", 8);
-            if ($where['user_id'] != 6779 && $where['user_id'] != 12125&&$where['user_id']!=63) {
-                LaveMonthModel::where('order_id', $orderId)->update(['record_id' => $record['id']]);
-            }
+//            if ($where['user_id'] != 6779 && $where['user_id'] != 12125&&$where['user_id']!=63) {
+//                LaveMonthModel::where('order_id', $orderId)->update(['record_id' => $record['id']]);
+//            }
             $plan_record['spbill_create_ip'] = User::where('id', $where1['user_id'])->value('loginip');
             $plan_record['contract_notify_url'] = Request::instance()->domain() . "/api/wechat/notify/" . $where['cid'];
             try {
@@ -248,7 +248,7 @@ class Lave extends Api
                     $jsConfig = LaveRepository::h5PaySign($this->cid, $orderId, $plan_record);
                 } else {
                     @file_put_contents("quanju3.txt", $return_web . "-返回地址3\r\n", 8);
-                    $jsConfig = LaveRepository::wxPaySign($this->cid, $orderId, $plan_record,$return_web );
+                    $jsConfig = LaveRepository::wxPaySign($this->cid, $orderId, $plan_record );
                 }
             } catch (\Exception $e) {
                 return $this->error($e->getMessage());
@@ -348,9 +348,9 @@ class Lave extends Api
 //        die();
 
         $plan = WechatPlanRecord::where('contract_code', $contract_code)->find();
-        if ($plan['uid'] != 6779 && $plan['uid'] != 12125&&$plan['uid']!=63) {
-            return false;
-        }
+//        if ($plan['uid'] != 6779 && $plan['uid'] != 12125&&$plan['uid']!=63) {
+//            return false;
+//        }
         @file_put_contents("quanju3.txt", $plan['uid'] . "测试申请扣款uid-\r\n", 8);
         if (!empty($plan)) {
             $cid = $plan['cid'];

+ 1 - 2
extend/liuniu/WechatService.php

@@ -597,7 +597,7 @@ class WechatService
      * @param string $trade_type
      * @param array $options
      */
-    public static function signedOrder($contract_code, $plan_id,$return_web, $cid = 0,$contract_display_account='')
+    public static function signedOrder($contract_code, $plan_id, $cid = 0,$contract_display_account='')
     {
 //        $total_fee = bcmul($total_fee, 100, 0);
 //        $timestamp=time();
@@ -606,7 +606,6 @@ class WechatService
         if (empty($company)){
             return'企业不存在';
         }
-        @file_put_contents("quanju3.txt", $return_web . "-返回地址2\r\n", 8);
         // 微信支付配置参数
 //        $mch_id = "1623907696";
         $mch_id =  $company['pay_weixin_mchid'];

+ 16 - 17
extend/liuniu/repositories/LaveRepository.php

@@ -88,28 +88,27 @@ class LaveRepository
      * @return array|string
      * @throws Exception
      */
-    public static function wxpaySign($cid, $orderId,$plan_record,$return_web, $field = "order_id")
+    public static function wxpaySign($cid, $orderId,$plan_record, $field = "order_id")
     {
-        @file_put_contents("quanju3.txt", $return_web . "-返回地址4\r\n", 8);
         $openid = UserRelation::userIdToOpenId($plan_record['uid']);
-        if ($plan_record['uid']==6779||$plan_record['uid']==12125||$plan_record['uid']==63){
+//        if ($plan_record['uid']==6779||$plan_record['uid']==12125||$plan_record['uid']==63){
             $username = User::where('id',$plan_record['uid'])->value('username');
-            $rs = WechatService::signedOrder($plan_record['contract_code'],$plan_record['plan_id'],$return_web,$cid,$plan_record['contract_display_account']);
+            $rs = WechatService::signedOrder($plan_record['contract_code'],$plan_record['plan_id'],$cid,$plan_record['contract_display_account']);
             @file_put_contents("quanju3.txt", json_encode($rs) . "-签约返回结果测试2\r\n", 8);
             return $rs;
-        }else{
-            if (is_string($orderId))
-                $orderInfo = LaveMonthModel::where($field, $orderId)->find();
-            else
-                $orderInfo = $orderId;
-
-            if (!$orderInfo || !isset($orderInfo['paid'])) exception('支付订单不存在!');
-            if ($orderInfo['paid']) exception('支付已支付!');
-            if ($orderInfo['amount'] <= 0) exception('该支付无需支付!');
-            //                                          ($openid, $out_trade_no,         $total_fee,                  $attach,  $body,                   $contract_code,              $plan_id,              $spbill_create_ip                   ,$detail = '', $trade_type = 'JSAPI', $options = [], $cid = 0,$contract_display_account='')
-            $rs = WechatService::paysignedOrder($openid, $orderInfo['order_id'], $orderInfo['amount'], "lave", $orderInfo['order_name'], $plan_record['contract_code'],$plan_record['plan_id'],$plan_record['spbill_create_ip'],'', 'JSAPI', [], $cid,$plan_record['contract_display_account']);
-
-        }
+//        }else{
+//            if (is_string($orderId))
+//                $orderInfo = LaveMonthModel::where($field, $orderId)->find();
+//            else
+//                $orderInfo = $orderId;
+//
+//            if (!$orderInfo || !isset($orderInfo['paid'])) exception('支付订单不存在!');
+//            if ($orderInfo['paid']) exception('支付已支付!');
+//            if ($orderInfo['amount'] <= 0) exception('该支付无需支付!');
+//            //                                          ($openid, $out_trade_no,         $total_fee,                  $attach,  $body,                   $contract_code,              $plan_id,              $spbill_create_ip                   ,$detail = '', $trade_type = 'JSAPI', $options = [], $cid = 0,$contract_display_account='')
+//            $rs = WechatService::paysignedOrder($openid, $orderInfo['order_id'], $orderInfo['amount'], "lave", $orderInfo['order_name'], $plan_record['contract_code'],$plan_record['plan_id'],$plan_record['spbill_create_ip'],'', 'JSAPI', [], $cid,$plan_record['contract_display_account']);
+//
+//        }
         return WechatService::jspay($cid, $rs['prepay_id']);
 
     }