dongxiaoqin 1 год назад
Родитель
Сommit
45eeeb805c

+ 1 - 1
app/adminapi/lists/group_activity/GroupActivityCategoryLists.php

@@ -62,7 +62,7 @@ class GroupActivityCategoryLists extends BaseAdminDataLists implements ListsSear
     public function lists(): array
     public function lists(): array
     {
     {
         $list = GroupActivityCategory::where($this->searchWhere)
         $list = GroupActivityCategory::where($this->searchWhere)
-            ->field(['id', 'title', 'start_time', 'end_time', 'participant_num', 'type', 'form_time_limit', 'is_simulate_form', 'simulate_num','area','status','create_time'])
+            ->field(['id', 'title', 'start_time', 'end_time', 'service_time', 'participant_num', 'type', 'form_time_limit', 'is_simulate_form', 'simulate_num','area','status','create_time'])
             ->limit($this->limitOffset, $this->limitLength)
             ->limit($this->limitOffset, $this->limitLength)
             ->order(['id' => 'desc'])
             ->order(['id' => 'desc'])
             ->select()
             ->select()

+ 17 - 8
app/adminapi/lists/group_activity/GroupOrderLists.php

@@ -44,11 +44,14 @@ class GroupOrderLists extends BaseAdminDataLists implements ListsSearchInterface
 
 
     public function queryWhere(){
     public function queryWhere(){
         $where = [];
         $where = [];
+        if (!empty($this->params['mobile'])) {
+            $where[] = ['b.mobile', '=', $this->params['mobile']];
+        }
         if(!empty($this->params['title'])){
         if(!empty($this->params['title'])){
-            $where[] = ['b.title', 'like', '%'.$this->params['title'].'%'];
+            $where[] = ['c.title', 'like', '%'.$this->params['title'].'%'];
         }
         }
-        if (!empty($this->params['mobile'])) {
-            $where[] = ['c.mobile', '=', $this->params['mobile']];
+        if(!empty($this->params['area'])){
+            $where[] = ['d.area', 'like', '%'.$this->params['area'].'%'];
         }
         }
         return $where;
         return $where;
     }
     }
@@ -64,15 +67,20 @@ class GroupOrderLists extends BaseAdminDataLists implements ListsSearchInterface
      */
      */
     public function lists(): array
     public function lists(): array
     {
     {
-        $list = GroupOrder::alias('a')->leftJoin('group_activity b', 'b.id = a.group_activity_id')
-            ->leftJoin('user c', 'c.id = a.user_id')
+        $list = GroupOrder::alias('a')
+        ->leftJoin('user b', 'b.id = a.user_id')
+        ->leftJoin('group_activity c', 'c.id = a.group_activity_id')
+        ->leftJoin('group_activity_category d', 'd.id = c.group_category_id')
         ->where($this->searchWhere)
         ->where($this->searchWhere)
         ->where($this->queryWhere())
         ->where($this->queryWhere())
-            ->field(['a.*', 'b.title', 'b.image','c.mobile'])
+        ->field(['a.*','b.mobile', 'c.title', 'c.image','d.area'])
         ->limit($this->limitOffset, $this->limitLength)
         ->limit($this->limitOffset, $this->limitLength)
         ->order(['a.id' => 'desc'])
         ->order(['a.id' => 'desc'])
         ->select()
         ->select()
         ->toArray();
         ->toArray();
+        foreach($list as &$item) {
+            $item['area'] = explode(",",$item['area']);
+        }
         return $list;
         return $list;
     }
     }
 
 
@@ -86,8 +94,9 @@ class GroupOrderLists extends BaseAdminDataLists implements ListsSearchInterface
     public function count(): int
     public function count(): int
     {
     {
         return GroupOrder::alias('a')
         return GroupOrder::alias('a')
-        ->leftJoin('group_activity b', 'b.id = a.group_activity_id')
-        ->leftJoin('user c', 'c.id = a.user_id')
+        ->leftJoin('user b', 'b.id = a.user_id')
+        ->leftJoin('group_activity c', 'c.id = a.group_activity_id')
+        ->leftJoin('group_activity_category d', 'd.id = c.group_category_id')
         ->where($this->searchWhere)
         ->where($this->searchWhere)
         ->where($this->queryWhere())
         ->where($this->queryWhere())
         ->count();
         ->count();

+ 2 - 0
app/adminapi/logic/group_activity/GroupActivityCategoryLogic.php

@@ -61,6 +61,7 @@ class GroupActivityCategoryLogic extends BaseLogic
                 'images' => $params['images'],
                 'images' => $params['images'],
                 'start_time' => strtotime($params['start_time']),
                 'start_time' => strtotime($params['start_time']),
                 'end_time' => strtotime($params['end_time']),
                 'end_time' => strtotime($params['end_time']),
+                'service_time' => strtotime($params['service_time']),
                 'participant_num' => $params['participant_num'],
                 'participant_num' => $params['participant_num'],
                 'type' => $params['type'],
                 'type' => $params['type'],
                 'form_time_limit' => $params['form_time_limit'],
                 'form_time_limit' => $params['form_time_limit'],
@@ -161,6 +162,7 @@ class GroupActivityCategoryLogic extends BaseLogic
                 'images' => $params['images'],
                 'images' => $params['images'],
                 'start_time' => strtotime($params['start_time']),
                 'start_time' => strtotime($params['start_time']),
                 'end_time' => strtotime($params['end_time']),
                 'end_time' => strtotime($params['end_time']),
+                'service_time' => strtotime($params['service_time']),
                 'participant_num' => $params['participant_num'],
                 'participant_num' => $params['participant_num'],
                 'type' => $params['type'],
                 'type' => $params['type'],
                 'form_time_limit' => $params['form_time_limit'],
                 'form_time_limit' => $params['form_time_limit'],

+ 4 - 0
app/adminapi/service/WeCallService.php

@@ -16,6 +16,7 @@
 namespace app\adminapi\service;
 namespace app\adminapi\service;
 
 
 use app\common\model\dict\DictData;
 use app\common\model\dict\DictData;
+use think\facade\Log;
 
 
 
 
 
 
@@ -88,6 +89,7 @@ class WeCallService
             'X-YS-SIGNATURE: '.$sign,
             'X-YS-SIGNATURE: '.$sign,
         ];
         ];
         $response = http_request('https://b.163.com/open/api/wecall/v1/task/importCustomer', $requestBody, $header);
         $response = http_request('https://b.163.com/open/api/wecall/v1/task/importCustomer', $requestBody, $header);
+        Log::write("外呼导入用户");
         return $response;
         return $response;
     }
     }
 
 
@@ -113,6 +115,7 @@ class WeCallService
             'X-YS-SIGNATURE: '.$sign,
             'X-YS-SIGNATURE: '.$sign,
         ];
         ];
         $response = http_request('https://b.163.com/open/api/wecall/v1/task/start', $requestBody, $header);
         $response = http_request('https://b.163.com/open/api/wecall/v1/task/start', $requestBody, $header);
+        Log::write("外呼任务开始");
         return $response;
         return $response;
     }
     }
 
 
@@ -138,6 +141,7 @@ class WeCallService
             'X-YS-SIGNATURE: '.$sign,
             'X-YS-SIGNATURE: '.$sign,
         ];
         ];
         $response = http_request('https://b.163.com/open/api/wecall/v1/task/stop', $requestBody, $header);
         $response = http_request('https://b.163.com/open/api/wecall/v1/task/stop', $requestBody, $header);
+        Log::write("外呼任务停止");
         return $response;
         return $response;
     }
     }
 
 

+ 1 - 2
app/api/lists/group_activity/UserOrderLists.php

@@ -33,8 +33,7 @@ class UserOrderLists extends BaseApiDataLists implements ListsSearchInterface
     {
     {
         $lists = GroupUserOrder::alias('a')->leftJoin('group_order b','a.group_order_id=b.id')
         $lists = GroupUserOrder::alias('a')->leftJoin('group_order b','a.group_order_id=b.id')
             ->leftJoin('group_activity c','a.group_activity_id=c.id')
             ->leftJoin('group_activity c','a.group_activity_id=c.id')
-            ->leftJoin('group_equity d','c.group_equity_id=d.id')
-            ->field('a.id,a.sn,a.group_activity_id,a.status,a.order_amount,a.paid_amount,a.pay_status,a.refund_status,a.create_time,b.goods_id,b.num,b.origin_price,b.end_time,d.title,d.image')
+            ->field('a.id,a.sn,a.group_activity_id,a.status,a.order_amount,a.paid_amount,a.pay_status,a.refund_status,a.create_time,b.goods_id,b.num,b.origin_price,b.end_time,c.title,c.image')
             ->where([
             ->where([
                 'a.user_id' => $this->userId,
                 'a.user_id' => $this->userId,
             ])
             ])

+ 8 - 14
app/api/logic/GroupActivityLogic.php

@@ -30,17 +30,7 @@ class GroupActivityLogic extends BaseLogic
      */
      */
     public static function categoryList($id,$block_key = ''){
     public static function categoryList($id,$block_key = ''){
         
         
-        if ($block_key) {
-            $result = GroupActivity::getActivityList($id,$block_key);
-            return [
-                'timestamp' => time(),
-                'block_key' => $block_key,
-                'activity' => current($result['block_data'])['activity'],
-            ];
-        } else {
-            $result = GroupActivity::getActivityList($id);
-            return $result;
-        }
+        return GroupActivity::getActivityList($id,$block_key);
         
         
     }
     }
 
 
@@ -80,6 +70,7 @@ class GroupActivityLogic extends BaseLogic
         $detail = GroupOrder::where(['id'=>$order_id])->findOrEmpty()->toArray();
         $detail = GroupOrder::where(['id'=>$order_id])->findOrEmpty()->toArray();
         if(!empty($detail)){
         if(!empty($detail)){
             $detail['activity'] = GroupActivity::getDetail($detail['group_activity_id']);
             $detail['activity'] = GroupActivity::getDetail($detail['group_activity_id']);
+            $detail['activity']['goods'] = self::getEquityGoods($detail['activity']['equity_id']); 
             $detail['is_paid'] = 0;
             $detail['is_paid'] = 0;
             $detail['order_id'] = 0;
             $detail['order_id'] = 0;
 
 
@@ -179,7 +170,7 @@ class GroupActivityLogic extends BaseLogic
                     throw new Exception('拼团活动已结束!'); //拼团活动已结束
                     throw new Exception('拼团活动已结束!'); //拼团活动已结束
                 }
                 }
                     
                     
-                $order_amount = explode(",",$activity['price'])[0];
+                $order_amount = $activity['price'][0];
                 //生成拼团单
                 //生成拼团单
                 $data = [
                 $data = [
                     'sn' => generate_sn(GroupOrder::class, 'sn'),
                     'sn' => generate_sn(GroupOrder::class, 'sn'),
@@ -353,9 +344,11 @@ class GroupActivityLogic extends BaseLogic
             if ($result !== true) {
             if ($result !== true) {
                 $flag = false;
                 $flag = false;
                 $resultMsg = RefundLogic::getError();
                 $resultMsg = RefundLogic::getError();
+                Db::rollback();
+            } else {
+                Db::commit();
             }
             }
 
 
-            Db::commit();
             return [$flag, $resultMsg];
             return [$flag, $resultMsg];
         }
         }
         catch (\Exception $e) {
         catch (\Exception $e) {
@@ -402,7 +395,8 @@ class GroupActivityLogic extends BaseLogic
             $response = (new WeChatMnpService())->getUnlimitedQRCode(
             $response = (new WeChatMnpService())->getUnlimitedQRCode(
                 'page='.$scene_page.'&id='.$params['id'].'&oid='.$params['order_id']."&cid=".$params['category_id'],
                 'page='.$scene_page.'&id='.$params['id'].'&oid='.$params['order_id']."&cid=".$params['category_id'],
                 $mnp_page,
                 $mnp_page,
-                env('miniprogram.mini_env_version', 'release'),
+                'trial',
+                //env('miniprogram.mini_env_version', 'release'),
                 false
                 false
             );
             );
             $qrcode = $response->getContent();
             $qrcode = $response->getContent();

+ 6 - 2
app/common/model/group_activity/GroupActivity.php

@@ -37,11 +37,12 @@ class GroupActivity extends BaseModel
     public static function getDetail($id) {
     public static function getDetail($id) {
         $detail = GroupActivity::alias('a')->leftJoin('group_activity_category b','a.group_category_id=b.id')
         $detail = GroupActivity::alias('a')->leftJoin('group_activity_category b','a.group_category_id=b.id')
                     ->where('a.id',$id)
                     ->where('a.id',$id)
-                    ->field('a.title,a.image,a.equity_id,a.origin_price,a.price,a.work_amount,b.start_time,b.end_time,b.area,b.participant_num,b.form_time_limit,b.is_simulate_form,b.simulate_num,b.type')
+                    ->field('a.id,a.title,a.image,a.equity_id,a.origin_price,a.price,a.work_amount,b.start_time,b.end_time,b.service_time,b.area,b.participant_num,b.form_time_limit,b.is_simulate_form,b.simulate_num,b.type')
                     ->findOrEmpty()
                     ->findOrEmpty()
                     ->toArray();
                     ->toArray();
         if(!empty($detail)){
         if(!empty($detail)){
             $detail['start_time'] = date('Y-m-d H:i:s',$detail['start_time']);
             $detail['start_time'] = date('Y-m-d H:i:s',$detail['start_time']);
+            $detail['service_time'] = date('Y-m-d H:i:s',$detail['service_time']);
             $detail['area'] = explode(",",$detail['area']);
             $detail['area'] = explode(",",$detail['area']);
             $detail['price'] = explode(",",$detail['price']);
             $detail['price'] = explode(",",$detail['price']);
             $detail['participant_num'] = explode(",",$detail['participant_num']);
             $detail['participant_num'] = explode(",",$detail['participant_num']);
@@ -55,7 +56,7 @@ class GroupActivity extends BaseModel
             $where['block_key'] = $block_key;
             $where['block_key'] = $block_key;
         }
         }
         $detail = GroupActivityCategory::where('id',$catetory_id)
         $detail = GroupActivityCategory::where('id',$catetory_id)
-                ->field('id,title,images,start_time,end_time,area,participant_num,form_time_limit,is_simulate_form,simulate_num,type,block_data')
+                ->field('id,title,images,start_time,end_time,service_time,area,participant_num,form_time_limit,is_simulate_form,simulate_num,type,block_data')
                 ->findOrEmpty()
                 ->findOrEmpty()
                 ->toArray();
                 ->toArray();
         $category = [
         $category = [
@@ -84,6 +85,9 @@ class GroupActivity extends BaseModel
             if (isset($list[$item['block_key']])) {
             if (isset($list[$item['block_key']])) {
                 $item['activity'] = $list[$item['block_key']]['activity'];
                 $item['activity'] = $list[$item['block_key']]['activity'];
             }
             }
+            if ($block_key && $item['block_key'] == $block_key) {
+                return $item;
+            }
         }
         }
         return $category;
         return $category;
     }
     }

+ 4 - 0
app/common/model/group_activity/GroupActivityCategory.php

@@ -37,5 +37,9 @@ class GroupActivityCategory extends BaseModel
     {
     {
         return !empty($data['start_time'])?date('Y-m-d H:i:s',$data['start_time']):'';
         return !empty($data['start_time'])?date('Y-m-d H:i:s',$data['start_time']):'';
     }
     }
+    public function getServiceTimeAttr($value,$data)
+    {
+        return !empty($data['service_time'])?date('Y-m-d H:i:s',$data['service_time']):'';
+    }
     
     
 }
 }