15954078560 2 år sedan
förälder
incheckning
0f273ece5c
2 ändrade filer med 74 tillägg och 3 borttagningar
  1. 12 2
      application/api/controller/Index.php
  2. 62 1
      application/api/controller/User.php

+ 12 - 2
application/api/controller/Index.php

@@ -500,6 +500,14 @@ class Index extends Api
                 $this->error('网络延迟,请稍后再试');
             }
         }
+        //扣除优惠券
+        if ($active_people_arr[0]['is_self'] == 1 && $active_people_arr[0]['coupon_id']) {
+            $user_coupon_rs = Db::name('user_coupon')->where(['id' => $active_people_arr[0]['coupon_id'], 'user_id' => $this->auth->id, 'status' => 0])->setField(['active_id' => $id, 'order_id' => $rs, 'status' => 1]);
+            if (!$user_coupon_rs) {
+                Db::rollback();
+                $this->error('网络延迟,请稍后再试');
+            }
+        }
         //扣款 支付方式:0=余额,1=微信
         if ($paytype == 0) {
             $res = create_log(-$total_amount, '支付活动订单', $this->auth->id, 2, $rs);
@@ -523,6 +531,8 @@ class Index extends Api
                         'purpose' => $invite_coupon['purpose'],
                         'starttime' => time(),
                         'endtime' => time() + $invite_coupon['effectiveday'] * 86400,
+                        'active_id' => $id,
+                        'order_id' => $rs,
                         'createtime' => time()
                     ];
 
@@ -557,8 +567,8 @@ class Index extends Api
             //构建支付链接数据
             $wxData['body'] = '报名活动支付';
             $wxData['out_trade_no'] = $rechar_order['order_no'];
-            $wxData['total_fee'] = $total_amount;
-//            $wxData['total_fee'] = 0.01;
+//            $wxData['total_fee'] = $total_amount;
+            $wxData['total_fee'] = 0.01;
             $wxData['openid'] = $this->auth->openid;
 
 //            require_once($_SERVER['DOCUMENT_ROOT'] . '/Plugins/Weixin/WxPay/WxPay.php');

+ 62 - 1
application/api/controller/User.php

@@ -1642,7 +1642,6 @@ class User extends Api
         if (!$id) {
             $this->error('参数缺失');
         }
-
         $info = Db::name('active_order')->where(['id' => $id, 'user_id' => $this->auth->id])->find();
         if (!$info) {
             $this->error('数据不存在');
@@ -1666,5 +1665,67 @@ class User extends Api
 
         $this->success('我的订单详情', $info);
     }
+    
+    //查看报名人信息
+    public function activepeople() {
+        $id = input('id', 0, 'intval'); //报名人员id
+        if (!$id) {
+            $this->error('参数缺失');
+        }
+        $info = Db::name('active_people')->where(['id' => $id, 'user_id' => $this->auth->id])->find();
+        if (!$info) {
+            $this->error('数据不存在');
+        }
+
+        $this->success('查看报名人信息', $info);
+    }
+
+    //修改报名人信息
+    public function modifyactivepeople() {
+        $id = input('id', 0, 'intval'); //报名人员id
+        $name = input('name', '', 'trim'); //姓名
+        $idcard = input('idcard', '', 'trim'); //身份证号
+        $mobile = input('mobile', '', 'trim'); //手机号
+        $emergencycontact = input('emergencycontact', '', 'trim'); //紧急联系人
+        $contactmobile = input('contactmobile', '', 'trim'); //紧急联系方式
+
+        if (!$id) {
+            $this->error('参数缺失');
+        }
+        $info = Db::name('active_people')->where(['id' => $id, 'user_id' => $this->auth->id])->find();
+        if (!$info) {
+            $this->error('数据不存在');
+        }
+        if ($info['status'] == 2) {
+            $this->success('订单已经结束');
+        }
+        if ($info['status'] == 3) {
+            $this->success('订单已经取消');
+        }
+        if ($info['modifystatus'] == 1) {
+            $this->error('报名信息正在修改中,请等待后台审核');
+        }
+        //查询活动状态
+        $active = Db::name('active')->find($info['active_id']);
+        if (!$active) {
+            $this->success('活动不存在或已取消');
+        }
+        if ($active['status'] == 1) {
+            $this->error('活动已成行,不能修改信息');
+        }
+        if (time() < $active['refundendtime'] || time() > $active['starttime']) {
+            $this->error('当前时间段暂不可修改信息');
+        }
+        //查询是否申请过退款
+        $active_refund = Db::name('active_refund')->where(['order_id' => $info['active_id'], 'status' => 0])->count('id');
+        if ($active_refund) {
+            $this->error('您正在申请退款,暂不可修改信息');
+        }
+
+
+
+
+
+    }
 
 }