dongxiaoqin 1 年間 前
コミット
889a9186a3

+ 376 - 0
Untitled-1

@@ -0,0 +1,376 @@
+
+##燃气灶维修
+INSERT INTO `la_fault_type` (`id`, `category_type`, `goods_category_id`, `name`, `pid`) VALUES (1, 1, 38, '集成灶维修', 0);
+INSERT INTO `la_fault_type` (`id`, `category_type`, `goods_category_id`, `name`, `pid`) VALUES (2, 1, 38, '普通燃气灶维修(单灶)', 0);
+INSERT INTO `la_fault_type` (`id`, `category_type`, `goods_category_id`, `name`, `pid`) VALUES (3, 1, 38, '燃气灶无名', 0);
+INSERT INTO `la_fault_type` (`id`, `category_type`, `goods_category_id`, `name`, `pid`) VALUES (4, 1, 38, '普通燃气灶维修(双灶)', 0);
+
+INSERT INTO `la_fault_type` (`id`, `category_type`, `goods_category_id`, `name`, `pid`) VALUES 
+(5, 1, 38, '按键灯不亮', 1),
+(6, 1, 38, '不抽油烟', 1),
+(7, 1, 38, '不通电', 1),
+(8, 1, 38, '抽屉滑轨抽拉不畅', 1),
+(9, 1, 38, '串味', 1),
+(10, 1, 38, '打不着火', 1),
+(11, 1, 38, '火苗不正常', 1),
+(12, 1, 38, '开关扭不动', 1),
+(13, 1, 38, '漏气', 1),
+(14, 1, 38, '炉头组件故障', 1),
+(15, 1, 38, '无臭氧', 1),
+(16, 1, 38, '哚音大', 1),
+(17, 1, 38, '自动熄火', 1);
+
+INSERT INTO `la_fault_type` (`id`, `category_type`, `goods_category_id`, `name`, `pid`) VALUES 
+(18, 1, 38, '打不着火', 2),
+(19, 1, 38, '火苗不正常', 2),
+(20, 1, 38, '开关扭不动', 2),
+(21, 1, 38, '漏气', 2); 
+
+INSERT INTO `la_fault_type` (`id`, `category_type`, `goods_category_id`, `name`, `pid`) VALUES 
+(22, 1, 38, '炉头组件故障', 3),
+(23, 1, 38, '自动熄火', 3); 
+
+INSERT INTO `la_fault_type` (`id`, `category_type`, `goods_category_id`, `name`, `pid`) VALUES 
+(24, 1, 38, '打不着火', 4),
+(25, 1, 38, '火苗不正常', 4),
+(26, 1, 38, '开关扭不动', 4),
+(27, 1, 38, '漏气', 4),
+(28, 1, 38, '炉头组件故障', 4),
+(29, 1, 38, '自动熄火', 4);
+
+##油烟机维修
+INSERT INTO `la_fault_type` (`id`, `category_type`, `goods_category_id`, `name`, `pid`) VALUES 
+(30, 1, 43, '集成灶油烟', 0),
+(31, 1, 43, '欧式油烟机维修(排风量14(m3/min)及以下)', 0),
+(32, 1, 43, '普通油烟机维修', 0),
+(33, 1, 43, '升降式油烟机维修(功率200W及以下 )', 0),
+(34, 1, 43, '升降式油烟机维修(功率200W以上 )', 0),
+(35, 1, 43, '中式油烟机维修(功率200W及以下 )', 0),
+(36, 1, 43, '中式油烟机维修(功率200W以上)', 0); 
+
+INSERT INTO `la_fault_type` (`id`, `category_type`, `goods_category_id`, `name`, `pid`) VALUES 
+(37, 1, 43, '不抽油烟', 30),
+(38, 1, 43, '不通电', 30),
+(39, 1, 43, '不消毒', 30),
+(40, 1, 43, '抽屉滑轨抽拉不畅', 30),
+(41, 1, 43, '串味', 30),
+(42, 1, 43, '抖动大', 30),
+(43, 1, 43, '开关扭不动', 30),
+(44, 1, 43, '开机后熄火', 30),
+(45, 1, 43, '漏气', 30),
+(46, 1, 43, '漏水', 30),
+(47, 1, 43, '漏油', 30),
+(48, 1, 43, '炉头组件故障', 30),
+(49, 1, 43, '门打不开', 30),
+(50, 1, 43, '清洗检测', 30),
+(51, 1, 43, '闪灯/显示字母报警', 30),
+(52, 1, 43, '通电灯不亮', 30),
+(53, 1, 43, '无臭氧', 30),
+(54, 1, 43, '噪音大', 30); 
+
+INSERT INTO `la_fault_type` (`id`, `category_type`, `goods_category_id`, `name`, `pid`) VALUES 
+(55, 1, 43, '自动熄火', 31),
+(56, 1, 43, '不抽油烟', 31),
+(57, 1, 43, '不通电', 31),
+(58, 1, 43, '串味', 31),
+(59, 1, 43, '抖动大', 31),
+(60, 1, 43, '开关扭不动', 31),
+(61, 1, 43, '漏水', 31),
+(62, 1, 43, '漏油', 31),
+(63, 1, 43, '门打不开', 31),
+(64, 1, 43, '清洗检测', 31),
+(65, 1, 43, '闪灯/显示字母报警', 31),
+(66, 1, 43, '通电灯不亮', 31),
+(67, 1, 43, '噪音大', 31);    
+
+INSERT INTO `la_fault_type` (`id`, `category_type`, `goods_category_id`, `name`, `pid`) VALUES 
+(68, 1, 43, '不抽油烟', 32),
+(69, 1, 43, '不通电', 32),
+(70, 1, 43, '串味', 32),
+(71, 1, 43, '抖动大', 32),
+(72, 1, 43, '开关扭不动', 32),
+(73, 1, 43, '漏水', 32),
+(74, 1, 43, '漏油', 32),
+(75, 1, 43, '门打不开', 32),
+(76, 1, 43, '清洗检测', 32),
+(77, 1, 43, '闪灯/显示字母报警', 32),
+(78, 1, 43, '通电灯不亮', 32),
+(79, 1, 43, '噪音大', 32);    
+
+INSERT INTO `la_fault_type` (`id`, `category_type`, `goods_category_id`, `name`, `pid`) VALUES 
+(80, 1, 43, '不抽油烟', 33),
+(81, 1, 43, '不通电', 33),
+(82, 1, 43, '不抽油烟', 33),
+(83, 1, 43, '不通电', 33),
+(84, 1, 43, '串味', 33),
+(85, 1, 43, '抖动大', 33),
+(86, 1, 43, '开关扭不动', 33),
+(87, 1, 43, '漏水', 33),
+(88, 1, 43, '门打不开', 33),
+(89, 1, 43, '清洗检测', 33),
+(90, 1, 43, '闪灯/显示字母报警', 33),
+(91, 1, 43, '通电灯不亮', 33),
+(92, 1, 43, '噪音大', 33);  
+
+INSERT INTO `la_fault_type` (`id`, `category_type`, `goods_category_id`, `name`, `pid`) VALUES 
+(93, 1, 43, '不抽油烟', 34),
+(94, 1, 43, '不通电', 34),
+(95, 1, 43, '串味', 34),
+(96, 1, 43, '抖动大', 34),
+(97, 1, 43, '开关扭不动', 34),
+(98, 1, 43, '漏水', 34),
+(99, 1, 43, '漏油', 34),
+(100, 1, 43, '门打不开', 34),
+(101, 1, 43, '清洗检测', 34),
+(102, 1, 43, '闪灯/显示字母报警', 34),
+(103, 1, 43, '通电灯不亮', 34),
+(104, 1, 43, '噪音大', 34);  
+
+INSERT INTO `la_fault_type` (`id`, `category_type`, `goods_category_id`, `name`, `pid`) VALUES 
+(105, 1, 43, '不抽油烟', 35),
+(106, 1, 43, '不通电', 35),
+(107, 1, 43, '串味', 35),
+(108, 1, 43, '抖动大', 35),
+(109, 1, 43, '开关扭不动', 35),
+(110, 1, 43, '漏水', 35),
+(111, 1, 43, '漏油', 35),
+(112, 1, 43, '门打不开', 35),
+(113, 1, 43, '清洗检测', 35),
+(114, 1, 43, '闪灯/显示字母报警', 35),
+(115, 1, 43, '通电灯不亮', 35),
+(116, 1, 43, '噪音大', 35);    
+
+INSERT INTO `la_fault_type` (`id`, `category_type`, `goods_category_id`, `name`, `pid`) VALUES 
+(117, 1, 43, '不抽油烟', 36),
+(118, 1, 43, '不通电', 36),
+(119, 1, 43, '串味', 36),
+(120, 1, 43, '抖动大', 36),
+(121, 1, 43, '开关扭不动', 36),
+(122, 1, 43, '漏水', 36),
+(123, 1, 43, '漏油', 36),
+(124, 1, 43, '门打不开', 36),
+(125, 1, 43, '清洗检测', 36),
+(126, 1, 43, '闪灯/显示字母报警', 36),
+(127, 1, 43, '通电灯不亮', 36),
+(128, 1, 43, '噪音大', 36); 
+
+##燃气热水器
+INSERT INTO `la_fault_type` (`id`, `category_type`, `goods_category_id`, `name`, `pid`) VALUES 
+(129, 1, 40, '壁挂炉维修', 0),
+(130, 1, 40, '燃气热水器无名', 0),
+(131, 1, 40, '壁挂炉维修(20L)', 0),
+(132, 1, 40, '燃气热水器无名', 0),
+(133, 1, 40, '壁挂炉维修(25L)', 0),
+(134, 1, 40, '燃气热水器无名', 0),
+(135, 1, 40, '壁挂炉维修(30L)', 0),
+(136, 1, 40, '燃气热水器无名', 0),
+(137, 1, 40, '电热水器维修(>500L)', 0),
+(138, 1, 40, '电热水器维修(100L)', 0),
+(139, 1, 40, '电热水器维修(101-200L)', 0),
+(140, 1, 40, '电热水器维修(201-300L)', 0),
+(141, 1, 40, '电热水器维修(301-500L)', 0),
+(142, 1, 40, '电热水器维修(40-50L)', 0),
+(143, 1, 40, '电热水器维修(60-80L)', 0),
+(144, 1, 40, '即热式热水器维修(≤4000瓦 )', 0),
+(145, 1, 40, '即热式热水器维修(4001-6000瓦 )', 0),
+(146, 1, 40, '即热式热水器维修(6001-8000瓦 )', 0),
+(147, 1, 40, '空气能热水器维修(1-1.5P)', 0);
+
+INSERT INTO `la_fault_type` (`id`, `category_type`, `goods_category_id`, `name`, `pid`) VALUES 
+(148, 1, 40, '不出热水/不够热', 129),
+(149, 1, 40, '不上水', 129),
+(150, 1, 40, '不通电', 129),
+(151, 1, 40, '出水小', 129),
+(152, 1, 40, '点不着火', 129),
+(153, 1, 40, '开机后熄火', 129),
+(154, 1, 40, '开机跳闸', 129),
+(155, 1, 40, '漏气', 129),
+(156, 1, 40, '漏水', 129),
+(157, 1, 40, '燃气热水器无名', 129),
+(158, 1, 40, '有异响', 129);
+
+INSERT INTO `la_fault_type` (`id`, `category_type`, `goods_category_id`, `name`, `pid`) VALUES 
+(159, 1, 40, '不出热水/不够热', 130),
+(160, 1, 40, '不上水', 130),
+(161, 1, 40, '不通电', 130);
+
+INSERT INTO `la_fault_type` (`id`, `category_type`, `goods_category_id`, `name`, `pid`) VALUES 
+(162, 1, 40, '出水小', 131),
+(163, 1, 40, '点不着火', 131),
+(164, 1, 40, '开机后熄火', 131),
+(165, 1, 40, '开机跳闸', 131),
+(166, 1, 40, '漏气', 131),
+(167, 1, 40, '燃气热水器无名', 131),
+(168, 1, 40, '漏水', 131),
+(169, 1, 40, '有异响', 131);
+
+INSERT INTO `la_fault_type` (`id`, `category_type`, `goods_category_id`, `name`, `pid`) VALUES 
+(170, 1, 40, '不出热水/不够热', 132),
+(171, 1, 40, '不上水', 132);
+
+INSERT INTO `la_fault_type` (`id`, `category_type`, `goods_category_id`, `name`, `pid`) VALUES 
+(172, 1, 40, '不通电', 133),
+(173, 1, 40, '出水小', 133),
+(174, 1, 40, '点不着火', 133),
+(175, 1, 40, '开机后熄火', 133),
+(176, 1, 40, '开机跳闸', 133),
+(177, 1, 40, '漏气', 133),
+(178, 1, 40, '漏水', 133),
+(179, 1, 40, '有异响', 133);
+
+INSERT INTO `la_fault_type` (`id`, `category_type`, `goods_category_id`, `name`, `pid`) VALUES 
+(180, 1, 40, '不出热水/不够热', 134);
+
+INSERT INTO `la_fault_type` (`id`, `category_type`, `goods_category_id`, `name`, `pid`) VALUES 
+(181, 1, 40, '不上水', 135),
+(182, 1, 40, '不通电', 135),
+(183, 1, 40, '出水小', 135),
+(184, 1, 40, '点不着火', 135),
+(185, 1, 40, '开机后熄火', 135),
+(186, 1, 40, '开机跳闸', 135),
+(187, 1, 40, '漏气', 135),
+(188, 1, 40, '漏水', 135),
+(189, 1, 40, '有异响', 135);
+
+INSERT INTO `la_fault_type` (`id`, `category_type`, `goods_category_id`, `name`, `pid`) VALUES
+(190, 1, 40, '不出热水/不够热', 136),
+(191, 1, 40, '不上水', 136),
+(192, 1, 40, '不通电', 136);
+
+INSERT INTO `la_fault_type` (`id`, `category_type`, `goods_category_id`, `name`, `pid`) VALUES
+(193, 1, 40, '燃气热水器无名', 137),
+(194, 1, 40, '出水小', 137),
+(195, 1, 40, '点不着火', 137),
+(196, 1, 40, '开关扭不动', 137),
+(197, 1, 40, '开机后熄火', 137),
+(198, 1, 40, '开机跳闸', 137),
+(199, 1, 40, '漏气', 137),
+(200, 1, 40, '漏水', 137),
+(201, 1, 40, '有异响', 137);
+    
+INSERT INTO `la_fault_type` (`id`, `category_type`, `goods_category_id`, `name`, `pid`) VALUES
+(202, 1, 40, '不出热水/不够热', 138),
+(203, 1, 40, '不上水', 138),
+(204, 1, 40, '不通电', 138),
+(205, 1, 40, '出水小', 138),
+(206, 1, 40, '点不着火', 138),
+(207, 1, 40, '开关扭不动', 138),
+(208, 1, 40, '开机后熄火', 138),
+(209, 1, 40, '开机跳闸', 138),
+(210, 1, 40, '漏气', 138),
+(211, 1, 40, '漏水', 138),
+(212, 1, 40, '有异响', 138),
+      
+INSERT INTO `la_fault_type` (`id`, `category_type`, `goods_category_id`, `name`, `pid`) VALUES
+(213, 1, 40, '不出热水/不够热', 139),
+(214, 1, 40, '不上水', 139),
+(215, 1, 40, '不通电', 139),
+(216, 1, 40, '出水小', 139),
+(217, 1, 40, '点不着火', 139),
+(218, 1, 40, '开关扭不动', 139),
+(219, 1, 40, '开机后熄火', 139),
+(220, 1, 40, '开机跳闸', 139),
+(221, 1, 40, '漏气', 139),
+(222, 1, 40, '漏水', 139),
+(223, 1, 40, '有异响', 139);
+    
+INSERT INTO `la_fault_type` (`id`, `category_type`, `goods_category_id`, `name`, `pid`) VALUES
+(224, 1, 40, '不出热水/不够热', 140),
+(225, 1, 40, '不上水', 140),
+(226, 1, 40, '不通电', 140),
+(227, 1, 40, '出水小', 140),
+(228, 1, 40, '点不着火', 140),
+(229, 1, 40, '开关扭不动', 140),
+(230, 1, 40, '开机后熄火', 140),
+(231, 1, 40, '开机跳闸', 140),
+(232, 1, 40, '漏气', 140),
+(233, 1, 40, '漏水', 140),
+(234, 1, 40, '有异响', 140);
+    
+INSERT INTO `la_fault_type` (`id`, `category_type`, `goods_category_id`, `name`, `pid`) VALUES
+(235, 1, 40, '不出热水/不够热', 141),
+(236, 1, 40, '不上水', 141),
+(237, 1, 40, '不通电', 141),
+(238, 1, 40, '出水小', 141),
+(239, 1, 40, '点不着火', 141),
+(240, 1, 40, '开关扭不动', 141),
+(241, 1, 40, '开机后熄火', 141),
+(242, 1, 40, '开机跳闸', 141),
+(243, 1, 40, '漏气', 141),
+(244, 1, 40, '漏水', 141),
+(245, 1, 40, '有异响', 141);
+    
+INSERT INTO `la_fault_type` (`id`, `category_type`, `goods_category_id`, `name`, `pid`) VALUES
+(246, 1, 40, '不出热水/不够热', 142),
+(247, 1, 40, '不上水', 142),
+(248, 1, 40, '不通电', 142),
+(249, 1, 40, '出水小', 142),
+(250, 1, 40, '点不着火', 142),
+(251, 1, 40, '开关扭不动', 142),
+(252, 1, 40, '开机后熄火', 142),
+(253, 1, 40, '开机跳闸', 142),
+(254, 1, 40, '漏气', 142),
+(255, 1, 40, '漏水', 142),
+(256, 1, 40, '有异响', 142);
+    
+INSERT INTO `la_fault_type` (`id`, `category_type`, `goods_category_id`, `name`, `pid`) VALUES
+(257, 1, 40, '不出热水/不够热', 143),
+(258, 1, 40, '不上水', 143),
+(259, 1, 40, '不通电', 143),
+(260, 1, 40, '出水小', 143),
+(261, 1, 40, '点不着火', 143),
+(262, 1, 40, '开关扭不动', 143),
+(263, 1, 40, '开机后熄火', 143),
+(264, 1, 40, '开机跳闸', 143),
+(265, 1, 40, '漏气', 143),
+(266, 1, 40, '漏水', 143),
+(267, 1, 40, '有异响', 143);
+    
+INSERT INTO `la_fault_type` (`id`, `category_type`, `goods_category_id`, `name`, `pid`) VALUES
+(268, 1, 40, '不出热水/不够热', 144),
+(269, 1, 40, '不上水', 144),
+(270, 1, 40, '不通电', 144),
+(271, 1, 40, '出水小', 144),
+(272, 1, 40, '点不着火', 144),
+(273, 1, 40, '开机后熄火', 144),
+(274, 1, 40, '开机跳闸', 144),
+(275, 1, 40, '漏气', 144),
+(276, 1, 40, '漏水', 144);
+    
+INSERT INTO `la_fault_type` (`id`, `category_type`, `goods_category_id`, `name`, `pid`) VALUES
+(277, 1, 40, '不出热水/不够热', 145),
+(278, 1, 40, '不上水', 145),
+(279, 1, 40, '不通电', 145),
+(280, 1, 40, '出水小', 145),
+(281, 1, 40, '点不着火', 145),
+(282, 1, 40, '开机后熄火', 145),
+(283, 1, 40, '开机跳闸', 145),
+(284, 1, 40, '漏气', 145),
+(285, 1, 40, '漏水', 145);
+    
+INSERT INTO `la_fault_type` (`id`, `category_type`, `goods_category_id`, `name`, `pid`) VALUES
+(286, 1, 40, '不出热水/不够热', 146),
+(287, 1, 40, '不上水', 146),
+(288, 1, 40, '不通电', 146),
+(289, 1, 40, '出水小', 146),
+(390, 1, 40, '点不着火', 146),
+(291, 1, 40, '开机后熄火', 146),
+(292, 1, 40, '开机跳闸', 146),
+(293, 1, 40, '漏气', 146),
+(294, 1, 40, '漏水', 146);
+    
+INSERT INTO `la_fault_type` (`id`, `category_type`, `goods_category_id`, `name`, `pid`) VALUES
+(295, 1, 40, '不出热水/不够热', 147),
+(296, 1, 40, '不上水', 147),
+(297, 1, 40, '不通电', 147),
+(298, 1, 40, '出水小', 147),
+(299, 1, 40, '点不着火', 147),
+(300, 1, 40, '开机后熄火', 147),
+(301, 1, 40, '开机跳闸', 147),
+(302, 1, 40, '漏气', 147),
+(303, 1, 40, '漏水', 147),
+(304, 1, 40, '不启动', 147),
+(305, 1, 40, '闪灯/显示字母报警', 147),
+(306, 1, 40, '有异响', 147);
+    
+

+ 1 - 1
app/adminapi/lists/master_worker/MasterWorkerOnlineLists.php

@@ -82,7 +82,7 @@ class MasterWorkerOnlineLists extends BaseAdminDataLists implements ListsSearchI
      */
     public function lists(): array
     {
-        $fields = ['mw.id,mw.avatar,mw.real_name,mw.mobile,mw.work_total,mw.distance,mw.accept_order_status,mw.area_name,mw.service_area_id,mws.comprehensive_score, mws.weight_score,sa.service_name,mwr.credential_images'];
+        $fields = ['mw.id,mw.avatar,mw.real_name,mw.mobile,mw.work_total,mw.distance,mw.accept_order_status,mw.address,mw.service_area_id,mws.comprehensive_score, mws.weight_score,sa.service_name,mwr.credential_images'];
         $orders = ['mw.id' => 'desc'];
         $queryWhere = $this->queryWhere();
         // 根据位置排序

+ 19 - 4
app/adminapi/logic/master_worker/MasterWorkerLogic.php

@@ -124,10 +124,24 @@ class MasterWorkerLogic extends BaseLogic
         }*/
         Db::startTrans();
         try {
-            $service_area_id = ServiceArea::serviceAreaId(['lon' => $params['lon'], 'lat' => $params['lat']]);
-            if (!empty($params['lon']) && !empty($params['lat']) && !$service_area_id) {
-                self::setError('您所选的位置已超出服务区域!');
-                return false;
+            $detail = MasterWorker::where('id', $params['id'])->field('id,lon,lat,address,service_area_id')->findOrEmpty()->toArray();
+            $address = $params['address']??'';
+            if ($detail['address'] != $address && !empty($address)) {
+                $lon_lat = get_address_lat_lng($address);
+                $params['lon'] = $lon_lat['lon'];
+                $params['lat'] = $lon_lat['lat'];
+                $service_area_id = ServiceArea::serviceAreaId(['lon' => $params['lon'], 'lat' => $params['lat']]);
+                if (!empty($params['lon']) && !empty($params['lat']) && !$service_area_id) {
+                    self::setError('您所选的位置已超出服务区域!');
+                    return false;
+                }
+            } else {
+                $params['lon'] = $detail['lon'];
+                $params['lat'] = $detail['lat'];
+                $service_area_id = $detail['service_area_id'];
+                if (empty($address)) {
+                    $address = getAddressByLatLng($params['lon'], $params['lat']);
+                }
             }
             $update = [
                 'sn' => $params['sn'],
@@ -147,6 +161,7 @@ class MasterWorkerLogic extends BaseLogic
                 'estimate_money' => $params['estimate_money'],
                 'user_money' => $params['user_money'],
                 'exp' => $params['exp'],
+                'address' => $address,
                 'lon' => $params['lon'],
                 'lat' => $params['lat'],
                 'distance' => $params['distance'],

+ 4 - 4
app/adminapi/logic/works/GroupServiceWorkLogic.php

@@ -307,7 +307,7 @@ class GroupServiceWorkLogic extends BaseLogic
                 }
             ])
             ->where($work_where)
-            ->field('id,work_sn,real_name,mobile,address,title,category_type,work_status,user_confirm_status,service_status,dispatch_time,appointment_time,receive_time,work_images,finished_images,finished_time,area_name,finally_door_time,create_time,remark,third_type,work_total,work_pay_status')
+            ->field('id,work_sn,real_name,mobile,address,title,category_type,master_worker_id,work_status,user_confirm_status,service_status,dispatch_time,appointment_time,receive_time,work_images,finished_images,finished_time,area_name,finally_door_time,create_time,remark,third_type,work_total,work_amount,settlement_amount,work_pay_status')
             ->append(['id','work_status_text','service_status_text'])
             ->findOrEmpty()->toArray();
         if (empty($result)) {
@@ -462,8 +462,8 @@ class GroupServiceWorkLogic extends BaseLogic
                 'order_id' => $order['id'],
                 'order_sn' => $order['sn'],
                 'order_type' => RefundEnum::ORDER_TYPE_GROUP,
-                'order_amount' => $order['order_amount'],
-                'refund_amount' => $order['order_amount'],
+                'order_amount' => $order['paid_amount'],
+                'refund_amount' => $order['paid_amount'],
                 'refund_type' => RefundEnum::TYPE_ADMIN,
                 'transaction_id' => $order['transaction_id'] ?? '',
                 'refund_way' => RefundEnum::getRefundWayByPayWay($order['pay_way']),
@@ -478,7 +478,7 @@ class GroupServiceWorkLogic extends BaseLogic
             ]);
 
             // 退款
-            $result = RefundLogic::refund($order, $record['id'], $order['order_amount'], $userInfo['admin_id']);
+            $result = RefundLogic::refund($order, $record['id'], $order['paid_amount'], $userInfo['admin_id']);
 
             if ($result !== true) {
                 throw new Exception(RefundLogic::getError());

+ 35 - 0
app/common.php

@@ -7,6 +7,41 @@ use app\common\service\FileService;
 use think\helper\Str;
 
 
+/**
+ * 根据经纬度获取详细地址(高德地图逆地理编码)
+ * @param float $lon 经度
+ * @param float $lat 纬度
+ * @return array 地址信息或错误信息
+ */
+function getAddressByLatLng($lon, $lat) {
+    // 校验经纬度格式
+    if (!is_numeric($lat) || !is_numeric($lon)) {
+        return '';
+    }
+
+    // 高德地图 API 密钥,需替换为你自己的密钥
+    $apiKey = 'eff1cbbaf5dd3c1cdcad2c1ed97b85e5';
+    // 构造请求参数
+    $params = [
+        'key' => $apiKey,
+        'location' => "{$lon},{$lat}",
+        'extensions' => 'all', // 返回详细信息
+        'output' => 'json'
+    ];
+
+    // 构建请求URL
+    $requestUrl = "https://restapi.amap.com/v3/geocode/regeo?" . http_build_query($params);
+    $data = http_request($requestUrl, [], []);
+    // 检查 API 调用是否成功
+    if ($data['status'] === '1') {
+        // 获取经纬度
+        $address = $data['regeocode']['formatted_address'];
+        return $address;
+    } else {
+        return '';
+    }
+}
+
 /**
  * 根据地址获取经纬度
  */

+ 19 - 14
app/common/command/GroupOrder.php

@@ -93,14 +93,13 @@ class GroupOrder extends Command
                         'user_id'=>$item['user_id'],
                         'user_equity_id'=>0,
                         'third_type'=>1,
-                        'work_total'=>$item['paid_amount'],
                         'remark' => '拼团用户订单:'.$item['id'],
                         'user_equity_id' => $item['user_equity_id'],
                         'group_order_id' => $group_order_id,
                         'group_user_order_id' => $item['id'],
-                        'work_total' => $category['price'],
-                        'work_amount' => $category['work_amount'],
-                        'settlement_amount' => $category['settlement_amount'],
+                        'work_total'=>$item['paid_amount'],
+                        'work_amount' => bcmul($category['work_amount'], $item['num'], 2),
+                        'settlement_amount' => bcmul($category['settlement_amount'], $item['num'], 2),
                         'work_pay_status' => 2,
                     ];
                     
@@ -187,14 +186,20 @@ class GroupOrder extends Command
                     'status' => 1,
                     'refund_status' => 0,
                 ])
-                ->field('id,user_id,sn,remark,order_amount,pay_way,transaction_id,order_terminal')->order('id','asc')->select()->toArray();
-                $num = count($orderList);
-                if (($item['is_simulate_form'] == 1 && $num >= $item['simulate_num']) || ($item['is_simulate_form'] == 0 && $num >= $item['participant_num'])) {
+                ->field('id,user_id,sn,remark,num,order_amount,pay_way,transaction_id,order_terminal')->order('id','asc')->select()->toArray();
+                //拼团总数量
+                $total = GroupUserOrder::where([
+                            'group_order_id' => $item['id'],
+                            'pay_status' => 1,
+                            'status' => 1,
+                            'refund_status' => 0,
+                        ])->sum('num');
+                if (($item['is_simulate_form'] == 1 && $total >= $item['simulate_num']) || ($item['is_simulate_form'] == 0 && $total >= $item['participant_num'])) {
                     //模拟成团
-                    $this->gruopSuccess($item,$orderList);
+                    $this->gruopSuccess($item,$orderList,$total);
                 } else {
                     //拼团失败
-                    $this->groupFail($item,$orderList);
+                    $this->groupFail($item,$orderList,$total);
                 }
             }
         }
@@ -205,7 +210,7 @@ class GroupOrder extends Command
      * 拼团成功(给已支付的用户发放权益卡)
      * @param $item
      */
-    protected function gruopSuccess($order,$orderList)
+    protected function gruopSuccess($order,$orderList,$total)
     {
         $max_id = UserEquity::max('id');
         try {
@@ -219,7 +224,7 @@ class GroupOrder extends Command
                     'user_id' => $item['user_id'],
                     'equity_id' => $order['equity_id'],
                     'goods_id' => $equityConfig['goods_id'],
-                    'number' => $equityConfig['number'],
+                    'number' => $item['num'],//拼团购买数量
                     'create_time' => time(),
                     'end_time' => time() + $equityConfig['day_num'] * 86400,
                     'remark' => '拼团单id:'.$item['id'],
@@ -232,7 +237,7 @@ class GroupOrder extends Command
             //更新拼团订单
             GroupOrderModel::where('id',$order['id'])->update([
                 'status' => 1,
-                'num' => count($orderList)
+                'num' => $total
             ]);
 
             Db::commit();
@@ -247,7 +252,7 @@ class GroupOrder extends Command
      * 批量退款,关闭订单
      * @param $item
     */
-    protected function groupFail($order,$list)
+    protected function groupFail($order,$list,$total)
     {
         try {
             Db::startTrans();
@@ -286,7 +291,7 @@ class GroupOrder extends Command
             //更新拼团订单
             GroupOrderModel::where('id',$order['id'])->update([
                 'status' => 2,
-                'num' => count($list)
+                'num' => $total
             ]);
 
             Db::commit();

+ 1 - 1
app/common/logic/PayNotifyLogic.php

@@ -189,7 +189,7 @@ class PayNotifyLogic extends BaseLogic
             $group_order = GroupOrder::findOrEmpty($order->group_order_id);
 
             if(!$group_order->isEmpty()){
-                $group_order->num += 1;
+                $group_order->num += $order->num;
                 $group_order->save();
             }
         }