Explorar o código

编号生成规则调整

gorden hai 1 mes
pai
achega
023eea044e

+ 7 - 3
app/admin/controller/coupon/CouponController.php

@@ -3,6 +3,7 @@
 namespace app\admin\controller\coupon;
 
 use app\admin\service\coupon\CouponDetailService;
+use app\admin\service\coupon\CouponService;
 use app\admin\validate\coupon\CouponValidate;
 use app\admin\validate\device\DeviceValidate;
 use app\controller\Curd;
@@ -108,7 +109,7 @@ class CouponController extends Curd
                         $item['coupon_use_member'] = 'member';
                         $item['memberList'] = $couponJson['member']['list'];
                     } else if (isset($couponJson['member']['where']) && !empty($couponJson['member']['where'])) {
-                        if (trim($couponJson['member']['where']) == '1') {
+                        if (trim($couponJson['member']['where']) == '1' || trim($couponJson['member']['where']) == '') {
                             $item['coupon_use_member'] = 'all';
                         } else {
                             $item['coupon_use_member'] = 'condition';
@@ -124,6 +125,8 @@ class CouponController extends Curd
                                 }
                             }
                         }
+                    }else if(!isset($couponJson['member']['where']) || empty($couponJson['member']['where'])){
+                        $item['coupon_use_member'] = 'all';
                     }
                 }
                 if (isset($couponJson['premises'])) {
@@ -152,6 +155,7 @@ class CouponController extends Curd
                     }
                 }
             }
+            $item['coupon_explain'] = CouponService::couponClassifyInfo($item['coupon_classify'],$item['coupon_category'], $item['coupon_value'], $item['coupon_minimum_limit']);
             unset($item['detail']);
         }
 
@@ -253,7 +257,7 @@ class CouponController extends Curd
     {
         $params = $request->post();
         $data = $this->inputFilter($params);
-        $data['coupon_id'] = "CU" . date("ymdH") . random_string(6, 'up');
+        $data['coupon_id'] = "CU" . date("ymdHi") . random_string(4, 'up');
         if (!empty($params['coupon_use_time']) && $params['coupon_use_time'] == 'date') {
             $data['coupon_validdate_day'] = 0;
             $data['coupon_validdate_begin'] = date("Y-m-d H:i:s", strtotime($data['coupon_validdate_begin']));
@@ -756,7 +760,7 @@ class CouponController extends Curd
     {
         for ($i = 0; $i < intval($nbr); $i++) {
             CouponDetail::insert([
-                'coupon_detail_id' => 'CUDT' . date("ymdH") . random_string(6, 'up'),
+                'coupon_detail_id' => 'CUDT' . date("ymdHi") . random_string(4, 'up'),
                 'join_detail_coupon_id' => $couponId,
                 'coupon_detail_status' => $couponStatus == 'ACTIVED' ? 'PENDING' : 'INIT',
                 'coupon_detail_addtimes' => time()

+ 1 - 1
app/admin/controller/coupon/CouponPacketController.php

@@ -200,7 +200,7 @@ class CouponPacketController extends Curd
     {
         $params = $request->post();
         $data = $this->inputFilter($params);
-        $data['coupon_packet_id'] = "CP" . date("ymdH") . random_string(6, 'up');
+        $data['coupon_packet_id'] = "CP" . date("ymdHi") . random_string(4, 'up');
         $coupons = [];
         if (!empty($params['coupons'])) {
             foreach ($params['coupons'] as $coupon) {

+ 1 - 1
app/admin/controller/customer/IndexController.php

@@ -164,7 +164,7 @@ class IndexController extends Curd
         Db::beginTransaction();
 
         try {
-            $memberId = "ME" . date("ymdH") . random_string(6, 'up');
+            $memberId = "ME" . date("ymdHi") . random_string(4, 'up');
             $member = [
                 'member_id' => $memberId,
                 'member_is_owner' => 'N',

+ 2 - 2
app/admin/controller/member/QuotaController.php

@@ -311,7 +311,7 @@ class QuotaController extends Curd
             } else {
                 $quota = $quotas[0];
                 for ($i = 0; $i < $nbr; $i++) {
-                    $quota['member_quota_id'] = 'MQ' . date('ymdH') . random_string(6, 'up');
+                    $quota['member_quota_id'] = 'MQ' . date('ymdHi') . random_string(4, 'up');
                     $quota['member_quota_status'] = 'USED';
                     $quota['member_quota_used_json'] = json_encode($writeOffData);
                     $quota['member_quota_addtimes'] = strtotime($quota['member_quota_addtimes']);
@@ -406,7 +406,7 @@ class QuotaController extends Curd
                 } else {
                     $quota = $quotas[0];
                     for ($i = 0; $i < $nbr; $i++) {
-                        $quota['member_quota_id'] = 'MQ' . date('ymdH') . random_string(6, 'up');
+                        $quota['member_quota_id'] = 'MQ' . date('ymdHi') . random_string(4, 'up');
                         $quota['member_quota_status'] = 'USED';
                         $quota['member_quota_used_json'] = json_encode($writeOffData);
                         $quota['member_quota_addtimes'] = strtotime($quota['member_quota_addtimes']);

+ 1 - 1
app/admin/controller/member/RoleController.php

@@ -93,7 +93,7 @@ class RoleController extends Curd
     protected function insertInput(Request $request): array
     {
         $data = $this->inputFilter($request->post());
-        $data['member_role_id'] = "MR" . date('ymdH') . random_string(6, 'up');
+        $data['member_role_id'] = "MR" . date('ymdHi') . random_string(4, 'up');
 
         $data['member_role_rule_json'] = json_encode([
             'pricing' => $request->post('join_member_role_rule_pricing_id',''),

+ 1 - 1
app/admin/controller/member/RuleAddedController.php

@@ -97,7 +97,7 @@ class RuleAddedController extends Curd
     protected function insertInput(Request $request): array
     {
         $data = $this->inputFilter($request->post());
-        $data['rule_added_id'] = "RA" . date("ymdH") . random_string(6, 'up');
+        $data['rule_added_id'] = "RA" . date("ymdHi") . random_string(4, 'up');
 
         return $data;
     }

+ 1 - 1
app/admin/controller/member/RulePricingController.php

@@ -54,7 +54,7 @@ class RulePricingController extends Curd
     protected function insertInput(Request $request): array
     {
         $data = $this->inputFilter($request->post());
-        $data['rule_pricing_id'] = "RP" . date("ymdH") . random_string(6, 'up');
+        $data['rule_pricing_id'] = "RP" . date("ymdHi") . random_string(4, 'up');
         $data['rulr_priceing_nbr'] = $data['rulr_priceing_nbr'] / 100;
 //        if (!empty($data['rule_pricing_goods_json'])) {
 //            $data['rule_pricing_goods_json'] = json_encode(explode(',', $data['rule_pricing_goods_json']));

+ 4 - 4
app/admin/controller/order/KangyangCityController.php

@@ -234,7 +234,7 @@ class KangyangCityController extends Curd
                 if (Member::where('member_mobile', $params['mobile'])->exists()) {
                     throw new BusinessException('会员已存在');
                 }
-                $params['join_order_member_id'] = $params['member_id'] = 'MR' . date('ymdH') . random_string(6, 'up');
+                $params['join_order_member_id'] = $params['member_id'] = 'MR' . date('ymdHi') . random_string(4, 'up');
                 // 创建会员
                 MemberService::createMember($params);
             } else if (empty($params['join_order_member_id']) && empty($params['mobile'])) {
@@ -245,8 +245,8 @@ class KangyangCityController extends Curd
             }
 
             $qrcodePayAmount = 0;
-            $params['orderId'] = 'OD' . date('ymdH') . random_string(6, 'up');
-            $params['orderGroupId'] = 'OD' . date('ymdH') . random_string(6, 'up');
+            $params['orderId'] = 'OD' . date('ymdHi') . random_string(4, 'up');
+            $params['orderGroupId'] = 'OD' . date('ymdHi') . random_string(4, 'up');
             // 查询是否有未完全支付订单
             $paidOrder = Order::where('join_order_member_id', $params['join_order_member_id'])
                 ->where('order_category', 'VIP')
@@ -423,7 +423,7 @@ class KangyangCityController extends Curd
 
         $params['orderId'] = $params['order_id'];
 
-        $params['orderGroupId'] = 'OD' . date('ymdH') . random_string(6, 'up');
+        $params['orderGroupId'] = 'OD' . date('ymdHi') . random_string(4, 'up');
         $order->order_groupby = $params['orderGroupId'];
 
         $goods = Goods::where('goods_id', $params['join_sheet_goods_id'])

+ 2 - 2
app/admin/controller/order/PayDetailController.php

@@ -336,8 +336,8 @@ class PayDetailController extends Curd
                 $data['pay_amount'] = $goods->goods_sales_price;
             }
 
-            $orderId = "OD" . date('ymdH') . random_string(6, 'up');
-            $orderGroupId = "OD" . date('ymdH') . random_string(6, 'up');
+            $orderId = "OD" . date('ymdHi') . random_string(4, 'up');
+            $orderGroupId = "OD" . date('ymdHi') . random_string(4, 'up');
             $orderData = [
                 'order_id' => $orderId,
                 'order_groupby' => $orderGroupId,

+ 2 - 2
app/admin/controller/order/ReturnController.php

@@ -106,10 +106,10 @@ class ReturnController extends Curd
         try {
             [$id, $data] = $this->updateInput($request);
 
-            if($data['order_return_status'] == 'DOING'){
+//            if($data['order_return_status'] == 'DOING'){
                 $data['order_return_accept_datetime'] = date('Y-m-d H:i:s');
                 $data['join_order_return_user_id'] = JwtToken::getCurrentId();
-            }
+//            }
 
             $this->doUpdate($id, $data);
 

+ 93 - 28
app/admin/controller/order/WholeController.php

@@ -408,7 +408,7 @@ class WholeController extends Curd
                 } else {
                     $item['skus'] = [];
                 }
-                if (in_array($item['goods']['goods_classify'], ['SERVICE', 'CHNMED', 'CHNNCD', 'PACKAGE']) && $order->order_status_system == 'DONE') {
+                if (in_array($item['goods']['goods_classify'], ['SERVICE', 'CHNMED', 'CHNNCD'])) {
                     $item['appontment'] = [];
                     $appontments = Appointment::where('join_appointment_order_id', $orderId)
                         ->where('appointment_status', 'DONE')
@@ -544,7 +544,7 @@ class WholeController extends Curd
                         $classify = CouponService::couponClassifyInfo($coupon->coupon_classify, $coupon->coupon_category, $coupon->coupon_value, $coupon->coupon_minimum_limit);
                         $discount['coupon_name'] .= $coupon->coupon_classify . ':' . $coupon->coupon_name . '(优惠¥' . sprintf("%.2f", $discountItem['coupon_value']) . '), ';
                     }
-                    if ($discountItem['coupon_classify'] == '退款'){
+                    if ($discountItem['coupon_classify'] == '退款') {
                         continue;
                     }
                     if (empty($discountItem['coupon_id']) && !empty($discountItem['coupon_classify'])) {
@@ -885,7 +885,7 @@ class WholeController extends Curd
                     $order->order_status_system = $systemStatus;
                     $order->order_status_payment = 'SUCCESS';
                 }
-            }  else if ($params['pay_category'] == 'VIP') {    // 余额支付
+            } else if ($params['pay_category'] == 'VIP') {    // 余额支付
                 $account = MemberAccount::where('join_account_member_id', $params['join_order_member_id'])
                     ->where('member_account_classify', 'VIP')
                     ->where('member_account_status', 'ACTIVED')
@@ -1148,7 +1148,7 @@ class WholeController extends Curd
                 $payData['pay_prepayid'] = $params['join_order_member_id'] . '-CASH';
             } else if ($params['pay_category'] == 'WELFARE') {
                 $payData['pay_prepayid'] = $params['join_order_member_id'] . '-WELFARE';
-            }  else if ($params['pay_category'] == 'VIP') {
+            } else if ($params['pay_category'] == 'VIP') {
                 $payData['pay_prepayid'] = $params['join_order_member_id'] . '-VIP';
             } else if ($params['pay_category'] == 'CARD') {
                 $payData['pay_prepayid'] = $params['card_nbr'];
@@ -1213,11 +1213,11 @@ class WholeController extends Curd
                 foreach ($params['goodsContentList'] as $goods) {
                     $params['join_sheet_goods_id'] = $goods['goods_id'];
                     if (isset($goods['goods_classify']) && in_array($goods['goods_classify'], ['SERVICE', 'CHNMED', 'CHNNCD'])) {
-                        $params['benefitId'] = 'BF' . date('ymdH') . random_string(6, 'up');
+                        $params['benefitId'] = 'BF' . date('ymdHi') . random_string(4, 'up');
                         $params['order_sheet_num'] = $goods['nbr'];
                         // 预约表
                         for ($i = 0; $i < intval($params['order_sheet_num']); $i++) {
-                            $params['appointmentId'] = 'AP' . date('ymdH') . random_string(6, 'up');
+                            $params['appointmentId'] = 'AP' . date('ymdHi') . random_string(4, 'up');
                             // 入预约记录
                             $this->insertAppointment($params, $writeOffDate, $applyData);
                         }
@@ -1237,10 +1237,10 @@ class WholeController extends Curd
                         foreach ($components as $component) {
                             $componentJson = json_decode($component['goods_component_json'], true);
                             $params['join_sheet_goods_sku_id'] = $componentJson['sku_id'];
-                            $params['benefitId'] = 'BF' . date('ymdH') . random_string(6, 'up');
+                            $params['benefitId'] = 'BF' . date('ymdHi') . random_string(4, 'up');
                             $params['order_sheet_num'] = $goods['nbr'] * $componentJson['nbr'];
                             for ($i = 0; $i < intval($params['order_sheet_num']); $i++) {
-                                $params['appointmentId'] = 'AP' . date('ymdH') . random_string(6, 'up');
+                                $params['appointmentId'] = 'AP' . date('ymdHi') . random_string(4, 'up');
                                 // 入预约记录
                                 $this->insertAppointment($params, $writeOffDate);
                             }
@@ -1658,11 +1658,11 @@ class WholeController extends Curd
                 foreach ($params['goodsContentList'] as $goods) {
                     $params['join_sheet_goods_id'] = $goods['goods_id'];
                     if (isset($goods['goods_classify']) && in_array($goods['goods_classify'], ['SERVICE', 'CHNMED', 'CHNNCD'])) {
-                        $params['benefitId'] = 'BF' . date('ymdH') . random_string(6, 'up');
+                        $params['benefitId'] = 'BF' . date('ymdHi') . random_string(4, 'up');
                         $params['order_sheet_num'] = $goods['nbr'];
                         // 预约表
                         for ($i = 0; $i < intval($params['order_sheet_num']); $i++) {
-                            $params['appointmentId'] = 'AP' . date('ymdH') . random_string(6, 'up');
+                            $params['appointmentId'] = 'AP' . date('ymdHi') . random_string(4, 'up');
                             // 入预约记录
                             $this->insertAppointment($params, $writeOffDate, $applyData);
                         }
@@ -1682,10 +1682,10 @@ class WholeController extends Curd
                         foreach ($components as $component) {
                             $componentJson = json_decode($component['goods_component_json'], true);
                             $params['join_sheet_goods_sku_id'] = $componentJson['sku_id'];
-                            $params['benefitId'] = 'BF' . date('ymdH') . random_string(6, 'up');
+                            $params['benefitId'] = 'BF' . date('ymdHi') . random_string(4, 'up');
                             $params['order_sheet_num'] = $goods['nbr'] * $componentJson['nbr'];
                             for ($i = 0; $i < intval($params['order_sheet_num']); $i++) {
-                                $params['appointmentId'] = 'AP' . date('ymdH') . random_string(6, 'up');
+                                $params['appointmentId'] = 'AP' . date('ymdHi') . random_string(4, 'up');
                                 // 入预约记录
                                 $this->insertAppointment($params, $writeOffDate);
                             }
@@ -1946,7 +1946,7 @@ class WholeController extends Curd
                 }
             }
             // 余额、福利、储值卡 验证短信
-            if ($params['settlement_now'] == 'Y' && $params['pay_constitute'] == 'N' && in_array($params['pay_category'], ['CASH', 'CARD', 'WELFARE','VIP'])) {
+            if ($params['settlement_now'] == 'Y' && $params['pay_constitute'] == 'N' && in_array($params['pay_category'], ['CASH', 'CARD', 'WELFARE', 'VIP'])) {
                 $code = $params['sms_code'];
                 if (!$code) {
                     throw new BusinessException('验证码错误,请重新输入');
@@ -1972,7 +1972,7 @@ class WholeController extends Curd
                 if (Member::where('member_mobile', $params['mobile'])->exists()) {
                     throw new BusinessException('会员已存在');
                 }
-                $params['join_order_member_id'] = $params['member_id'] = 'MR' . date('ymdH') . random_string(6, 'up');
+                $params['join_order_member_id'] = $params['member_id'] = 'MR' . date('ymdHi') . random_string(4, 'up');
                 // 创建会员
                 MemberService::createMember($params);
             } else if (empty($params['join_order_member_id']) && empty($params['mobile'])) {
@@ -1983,8 +1983,8 @@ class WholeController extends Curd
             }
 
             $qrcodePayAmount = 0;
-            $params['orderId'] = 'OD' . date('ymdH') . random_string(6, 'up');
-            $params['orderGroupId'] = 'OD' . date('ymdH') . random_string(6, 'up');
+            $params['orderId'] = 'OD' . date('ymdHi') . random_string(4, 'up');
+            $params['orderGroupId'] = 'OD' . date('ymdHi') . random_string(4, 'up');
 
             $systemStatus = 'SENDING';  // 待发货
             // 立即结算
@@ -2366,13 +2366,13 @@ class WholeController extends Curd
                 foreach ($params['goodsContentList'] as $goods) {
                     $params['join_sheet_goods_id'] = $goods['goods_id'];
                     if (isset($goods['goods_classify']) && in_array($goods['goods_classify'], ['SERVICE', 'CHNMED', 'CHNNCD'])) {
-                        $params['benefitId'] = 'BF' . date('ymdH') . random_string(6, 'up');
+                        $params['benefitId'] = 'BF' . date('ymdHi') . random_string(4, 'up');
                         $params['join_sheet_goods_sku_id'] = $goods['sku_id'];
                         $params['goods_id'] = $goods['goods_id'];
                         $params['order_sheet_num'] = $goods['nbr'];
                         // 预约表
                         for ($i = 0; $i < intval($params['order_sheet_num']); $i++) {
-                            $params['appointmentId'] = 'AP' . date('ymdH') . random_string(6, 'up');
+                            $params['appointmentId'] = 'AP' . date('ymdHi') . random_string(4, 'up');
                             // 入预约记录
                             $this->insertAppointment($params, $writeOffDate, $applyData);
                         }
@@ -2392,10 +2392,10 @@ class WholeController extends Curd
                         foreach ($components as $component) {
                             $componentJson = json_decode($component['goods_component_json'], true);
                             $params['join_sheet_goods_sku_id'] = $componentJson['sku_id'];
-                            $params['benefitId'] = 'BF' . date('ymdH') . random_string(6, 'up');
+                            $params['benefitId'] = 'BF' . date('ymdHi') . random_string(4, 'up');
                             $params['order_sheet_num'] = $goods['nbr'] * $componentJson['nbr'];
                             for ($i = 0; $i < intval($params['order_sheet_num']); $i++) {
-                                $params['appointmentId'] = 'AP' . date('ymdH') . random_string(6, 'up');
+                                $params['appointmentId'] = 'AP' . date('ymdHi') . random_string(4, 'up');
                                 // 入预约记录
                                 $this->insertAppointment($params, $writeOffDate);
                             }
@@ -2577,7 +2577,7 @@ class WholeController extends Curd
                 if (Member::where('member_mobile', $params['mobile'])->exists()) {
                     throw new BusinessException("会员已存在");
                 }
-                $params['join_order_member_id'] = $params['member_id'] = 'MR' . date('ymdH') . random_string(6, 'up');
+                $params['join_order_member_id'] = $params['member_id'] = 'MR' . date('ymdHi') . random_string(4, 'up');
                 // 创建会员
                 MemberService::createMember($params);
             } else if (empty($params['join_order_member_id']) && empty($params['mobile'])) {
@@ -2588,9 +2588,9 @@ class WholeController extends Curd
             }
 
             $qrcodePayAmount = 0;
-            $params['orderId'] = 'OD' . date('ymdH') . random_string(6, 'up');
-            $params['orderGroupId'] = 'OD' . date('ymdH') . random_string(6, 'up');
-            $params['benefitId'] = 'BF' . date('ymdH') . random_string(6, 'up');
+            $params['orderId'] = 'OD' . date('ymdHi') . random_string(4, 'up');
+            $params['orderGroupId'] = 'OD' . date('ymdHi') . random_string(4, 'up');
+            $params['benefitId'] = 'BF' . date('ymdHi') . random_string(4, 'up');
 
             $systemStatus = 'SENDING';  // 待发货
             // 立即结算
@@ -2850,13 +2850,13 @@ class WholeController extends Curd
                 foreach ($params['goodsContentList'] as $goods) {
                     $params['join_sheet_goods_id'] = $goods['goods_id'];
                     if (isset($goods['goods_classify']) && in_array($goods['goods_classify'], ['SERVICE', 'CHNMED', 'CHNNCD'])) {
-                        $params['benefitId'] = 'BF' . date('ymdH') . random_string(6, 'up');
+                        $params['benefitId'] = 'BF' . date('ymdHi') . random_string(4, 'up');
                         $params['join_sheet_goods_sku_id'] = $goods['sku_id'];
                         $params['goods_id'] = $goods['goods_id'];
                         $params['order_sheet_num'] = $goods['nbr'];
                         // 预约表
                         for ($i = 0; $i < intval($params['order_sheet_num']); $i++) {
-                            $params['appointmentId'] = 'AP' . date('ymdH') . random_string(6, 'up');
+                            $params['appointmentId'] = 'AP' . date('ymdHi') . random_string(4, 'up');
                             // 入预约记录
                             $this->insertAppointment($params, $writeOffDate, $applyData);
                         }
@@ -2876,10 +2876,10 @@ class WholeController extends Curd
                         foreach ($components as $component) {
                             $componentJson = json_decode($component['goods_component_json'], true);
                             $params['join_sheet_goods_sku_id'] = $componentJson['sku_id'];
-                            $params['benefitId'] = 'BF' . date('ymdH') . random_string(6, 'up');
+                            $params['benefitId'] = 'BF' . date('ymdHi') . random_string(4, 'up');
                             $params['order_sheet_num'] = $goods['nbr'] * $componentJson['nbr'];
                             for ($i = 0; $i < intval($params['order_sheet_num']); $i++) {
-                                $params['appointmentId'] = 'AP' . date('ymdH') . random_string(6, 'up');
+                                $params['appointmentId'] = 'AP' . date('ymdHi') . random_string(4, 'up');
                                 // 入预约记录
                                 $this->insertAppointment($params, $writeOffDate);
                             }
@@ -4610,6 +4610,71 @@ class WholeController extends Curd
         return json_success("success", ['pay_amount' => $amountBalance['pay_amount']]);
     }
 
+
+    /**
+     * @Desc 订单的核销记录
+     * @Author Gorden
+     * @Date 2024/9/13 14:28
+     *
+     * @param Request $request
+     * @return Response
+     */
+    public function writeOffList(Request $request)
+    {
+        $orderId = $request->get('order_id');
+        $page = $request->get('page', 1);
+        $pageSize = $request->get('pageSize', 20);
+        if (!$orderId) {
+            return json_fail("参数异常");
+        }
+
+        $appointments = Appointment::with([
+            'member' => function ($query) {
+                $query->select('member_id', 'member_mobile');
+            },
+            'memberInfo',
+            'cert',
+            'goods' => function ($query) {
+                $query->select('goods_id', 'goods_name');
+            }
+        ])->where('join_appointment_order_id', $orderId)
+            ->where('appointment_status', 'DONE')
+            ->select('join_appointment_member_id', 'join_appointment_goods_id','appointment_done_datetime','appointment_done_json');
+        $total = $appointments->count();
+        $rows = $appointments->forPage($page, $pageSize)
+            ->orderBy('appointment_done_datetime', 'DESC')
+            ->get();
+        foreach ($rows as &$item){
+            $memberMobile = '';
+            if (!empty($item['member']) && !empty($item['member']['member_mobile'])){
+                $memberMobile = $item['member']['member_mobile'];
+            }
+            $memberNickname = '';
+            if (!empty($item['member_info']) && !empty($item['member_info']['member_info_nickname'])){
+                $memberNickname = $item['member_info']['member_info_nickname'];
+            }
+            $memberName = '';
+            if (!empty($item['cert']) && !empty($item['cert']['member_cert_name'])){
+                $memberName = $item['cert']['member_cert_name'];
+            }
+            unset($item['member'],$item['member_info'],$item['cert']);
+            $item['member_name'] = MemberService::getMemberName($memberMobile,$memberName,$memberNickname);
+            if (!empty($item['appointment_done_json'])){
+                $doneJson = json_decode($item['appointment_done_json'],true);
+                if (isset($doneJson['charge']) && !empty($doneJson['charge']['charge_user_id'])){
+                    $item['username'] = SysUser::where('user_id',$doneJson['charge']['charge_user_id'])->value('user_name');
+                }
+                if (isset($doneJson['charge']) && !empty($doneJson['charge']['charge_premises'])){
+                    $item['premise'] = $doneJson['charge']['charge_premises'];
+                }
+                $item['nbr'] = 1;
+            }
+        }
+
+
+        return json_success('', compact('rows', 'page', 'pageSize', 'total'));
+    }
+
     public static $goodsClassify = [
         // goodsClassify: {GOODS:"健康产品订单",SERVICE:"服务订单",DEVICE:"设备订单",SPECIAL:"专题业务订单",PACKAGE:"套餐订单",RECHARGE:"充值订单",OTHER:"其他订单"},
 

+ 1 - 1
app/admin/controller/sys_manage/ApiController.php

@@ -31,7 +31,7 @@ class ApiController extends Curd
     protected function insertInput(Request $request): array
     {
         $data = $this->inputFilter($request->post());
-        $data['api_id'] = "AP" . date('ymdH') . random_string(6, 'up');
+        $data['api_id'] = "AP" . date('ymdHi') . random_string(4, 'up');
         $data['api_extend_json'] = $data['api_extend_json'] ?? '{}';
         $data['api_request_json'] = $data['api_request_json'] ?? '{}';
         $data['api_response_json'] = $data['api_response_json'] ?? '{}';

+ 1 - 1
app/admin/service/coupon/CouponDetailService.php

@@ -21,7 +21,7 @@ class CouponDetailService
     {
         try {
             CouponDetail::insert([
-                'coupon_detail_id' => 'CUDT' . date("ymdH") . random_string(6, 'up'),
+                'coupon_detail_id' => 'CUDT' . date("ymdHi") . random_string(4, 'up'),
                 'join_detail_coupon_id' => $params['coupon_id'],
                 'join_coupon_detail_member_id' => $params['member_id'],
                 'coupon_detail_status' => 'ACTIVED',

+ 3 - 3
app/admin/service/goods/GoodsService.php

@@ -1107,7 +1107,7 @@ class GoodsService
     {
         Db::beginTransaction();
         try {
-            $params['goods_id'] = "GD" . date('ymdH') . random_string(6, 'up');
+            $params['goods_id'] = "GD" . date('ymdHi') . random_string(4, 'up');
             // 主表
             self::mainInsert($params);
             // 商品详情表
@@ -1155,7 +1155,7 @@ class GoodsService
         try {
             Db::beginTransaction();
             $goods = new Goods();
-            $goods->goods_id = "GD" . date('ymdH') . random_string(6, 'up');
+            $goods->goods_id = "GD" . date('ymdHi') . random_string(4, 'up');
             $goods->join_goods_category_id = 59;
             $goods->goods_classify = 'RECHARGE';
             $goods->goods_status = $params['goods_status'];
@@ -1231,7 +1231,7 @@ class GoodsService
     {
         Db::beginTransaction();
         try {
-            $params['goods_id'] = "GD" . date('ymdH') . random_string(6, 'up');
+            $params['goods_id'] = "GD" . date('ymdHi') . random_string(4, 'up');
             // 主表
             self::mainInsert($params);
             // 商品详情表

+ 1 - 1
app/admin/service/member/MemberService.php

@@ -1239,7 +1239,7 @@ class MemberService
     {
         $id = SysSerial::getSerial();
 
-        return "MR" . date('ymdH') . random_string(6, 'up');
+        return "MR" . date('ymdHi') . random_string(4, 'up');
     }
 
     public static function getMemberName($mobile, $certName, $nickname)

+ 1 - 1
app/admin/service/notify/RechargeService.php

@@ -246,7 +246,7 @@ class RechargeService
     private static function doSaveMemberQuota($memberId, $component, $nbr)
     {
         $model = new MemberQuota();
-        $model->member_quota_id = 'MQ' . date('ymdH') . random_string(6, 'up');
+        $model->member_quota_id = 'MQ' . date('ymdHi') . random_string(4, 'up');
         $model->join_quota_member_id = $memberId;
         $model->join_member_rule_added_component_id = $component['rule_added_component_id'];
         $model->member_quota_status = 'PENDING';

+ 7 - 7
app/admin/service/order/AppointmentService.php

@@ -209,8 +209,8 @@ class AppointmentService
             $applyJson = json_decode($appointment->appointment_apply_json,true);
             $goods = Goods::where('goods_id',$appointment->join_appointment_goods_id)->first();
             $sku = GoodsSku::where('goods_sku_id',$appointment->join_appointment_goods_sku_id)->where('goods_sku_status','ON')->first();
-            $orderId = 'OD' . date('ymdH') . random_string(6, 'up');
-            $groupBy = 'OD' . date('ymdH') . random_string(6, 'up');
+            $orderId = 'OD' . date('ymdHi') . random_string(4, 'up');
+            $groupBy = 'OD' . date('ymdHi') . random_string(4, 'up');
             $order = [
                 'order_id' => $orderId,
                 'order_groupby' => $groupBy,
@@ -293,12 +293,12 @@ class AppointmentService
                     Db::rollBack();
                     return json_fail('会员已存在,请勿重复创建');
                 }
-                $memberId = 'MR' . date('ymdH') . random_string(6, 'up');
+                $memberId = 'MR' . date('ymdHi') . random_string(4, 'up');
                 $params['join_appointment_member_id'] = $params['member_id'] = $memberId;
                 // 创建会员
                 MemberService::createMember($params);
             }
-            $appointmentId = "AP" . date('ymdH') . random_string(6, 'up');
+            $appointmentId = "AP" . date('ymdHi') . random_string(4, 'up');
             $data = [
                 'appointment_id' => $appointmentId,
                 'join_appointment_member_id' => $params['join_appointment_member_id'] ?? '',
@@ -453,8 +453,8 @@ class AppointmentService
             // 如果服务结束,没有生成过订单,生成订单
             if ($params['appointment_status'] == 'DONE' && empty($appointment->join_appointment_order_id) && $params['settlement_mode'] != 'QUOTA') {
                 $sku = GoodsSku::find($params['join_appointment_goods_sku_id']);    
-                $orderId = 'OD' . date('ymdH') . random_string(6, 'up');
-                $groupBy = 'OD' . date('ymdH') . random_string(6, 'up');
+                $orderId = 'OD' . date('ymdHi') . random_string(4, 'up');
+                $groupBy = 'OD' . date('ymdHi') . random_string(4, 'up');
                 $order = [
                     'order_id' => $orderId,
                     'order_groupby' => $groupBy,
@@ -567,7 +567,7 @@ class AppointmentService
                 }
 
                 // 回写权益表
-                $benefitId = 'BF'.date('ymdH').random_string(6,'up');
+                $benefitId = 'BF'.date('ymdHi').random_string(4,'up');
                 $benefitData = [
                     'member_benefit_id'=>$benefitId,
                     'join_benefit_member_id'=>$params['join_appointment_member_id'],

+ 2 - 2
app/admin/service/sys_manage/UserService.php

@@ -278,8 +278,8 @@ class UserService
 
     public static function generateUserId()
     {
-        $random = random_string(6,'up');
+        $random = random_string(4,'up');
 
-        return 'UR' . date('ymdH') . $random;
+        return 'UR' . date('ymdHi') . $random;
     }
 }

+ 1 - 1
app/event/order/KangyangCityEvent.php

@@ -78,7 +78,7 @@ class KangyangCityEvent
                     $num = $coupon['num'];
                     for ($i = 0; $i < $num; $i++) {
                         CouponDetail::insert([
-                            'coupon_detail_id' => 'CUDT' . date("ymdH") . random_string(6, 'up'),
+                            'coupon_detail_id' => 'CUDT' . date("ymdHi") . random_string(4, 'up'),
                             'join_detail_coupon_id' => $key,
                             'join_coupon_detail_member_id' => $params['member_id'],
                             'coupon_detail_status' => 'ACTIVED',

+ 1 - 0
route/admin.php

@@ -935,6 +935,7 @@ Route::group('/admin', function () {
             Route::post('/customPrinter', [\app\admin\controller\order\WholeController::class, 'customPrinter']);
             Route::post('/cancelOrder', [\app\admin\controller\order\WholeController::class, 'cancelOrder']);
             Route::get('/getOrderPayStatus', [\app\admin\controller\order\WholeController::class, 'getOrderPayStatus']);
+            Route::get('/writeOffList', [\app\admin\controller\order\WholeController::class, 'writeOffList']);
         })->middleware([
             \app\middleware\AdminAuthCheck::class
         ]);