Browse Source

小程序接口

牟新芬 3 years ago
parent
commit
218e1ecc65
33 changed files with 76 additions and 5257 deletions
  1. 10 445
      app/api/controller/PublicController.php
  2. 0 1
      app/api/controller/activity/.WeDrive
  3. 0 387
      app/api/controller/activity/StoreAssistanceController.php
  4. 0 407
      app/api/controller/activity/StoreBargainController.php
  5. 0 295
      app/api/controller/activity/StoreCombinationController.php
  6. 0 74
      app/api/controller/activity/StoreRechargeCardController.php
  7. 0 177
      app/api/controller/activity/StoreSeckillController.php
  8. 0 1
      app/api/controller/admin/.WeDrive
  9. 0 406
      app/api/controller/admin/StoreOrderController.php
  10. 7 8
      app/api/controller/auti/ArticleController.php
  11. 44 0
      app/api/controller/auti/CourseController.php
  12. 0 28
      app/api/controller/company/CompanyController.php
  13. 0 1
      app/api/controller/order/.WeDrive
  14. 0 735
      app/api/controller/order/StoreOrderController.php
  15. 0 1
      app/api/controller/publics/.WeDrive
  16. 0 33
      app/api/controller/publics/ArticleCategoryController.php
  17. 0 75
      app/api/controller/publics/ArticleController.php
  18. 0 1
      app/api/controller/store/.WeDrive
  19. 0 21
      app/api/controller/store/CategoryController.php
  20. 0 119
      app/api/controller/store/StoreCartController.php
  21. 0 125
      app/api/controller/store/StoreCouponsController.php
  22. 0 309
      app/api/controller/store/StoreProductController.php
  23. 0 1
      app/api/controller/user/.WeDrive
  24. 0 50
      app/api/controller/user/StoreService.php
  25. 0 343
      app/api/controller/user/UserBillController.php
  26. 0 651
      app/api/controller/user/UserController.php
  27. 0 99
      app/api/controller/user/UserExtractController.php
  28. 0 61
      app/api/controller/user/UserLevelController.php
  29. 0 128
      app/api/controller/user/UserRechargeController.php
  30. 1 1
      app/api/controller/wechat/WechatController.php
  31. 12 273
      app/api/route/route.php
  32. 1 0
      app/models/article/ArticleModel.php
  33. 1 1
      crmeb/services/QrcodeService.php

+ 10 - 445
app/api/controller/PublicController.php

@@ -2,39 +2,11 @@
 
 
 namespace app\api\controller;
 namespace app\api\controller;
 
 
-use app\models\system\SystemAttachment;
-use app\models\store\StoreCategory;
-use app\models\store\StoreCouponIssue;
-use app\models\store\StoreProduct;
-use app\models\store\StoreService;
-use app\models\store\StoreOrder;
-use app\models\store\StoreAssistanceActive;
-use app\models\system\Express;
-use app\models\system\SystemCity;
-use app\models\system\SystemStore;
-use app\models\system\SystemStoreStaff;
-use app\models\user\UserBill;
-use app\models\user\WechatUser;
-use app\models\user\UserBrokerage;
-use app\models\user\UserRecharge;
-use app\models\wechat\WechatTemplate;
+use app\models\page\PageModel;
 use app\Request;
 use app\Request;
-use crmeb\services\CacheService;
-use crmeb\services\MiniProgramService;
-use crmeb\services\UploadService;
-use crmeb\services\UtilService;
-use crmeb\subscribes\OrderSubscribe;
-use crmeb\repositories\PaymentRepositories;
-use crmeb\services\workerman\ChannelService;
-use crmeb\jobs\PaySuccessJob;
-use Exception;
-use Psr\SimpleCache\InvalidArgumentException;
 use think\db\exception\DataNotFoundException;
 use think\db\exception\DataNotFoundException;
 use think\db\exception\DbException;
 use think\db\exception\DbException;
 use think\db\exception\ModelNotFoundException;
 use think\db\exception\ModelNotFoundException;
-use think\facade\Cache;
-use app\models\store\StorePink;
-use app\models\user\User;
 
 
 /**
 /**
  * 公共类
  * 公共类
@@ -43,146 +15,6 @@ use app\models\user\User;
  */
  */
 class PublicController
 class PublicController
 {
 {
-
-    /**
-     * @param Request $request
-     * @throws Exception
-     */
-    public function test()
-    {
-        dump(MiniProgramService::profit_sharing(
-            '4200000744202011046045636579',
-            'wx160447244549420541',
-            [
-                [
-                    'type' => 'PERSONAL_OPENID',
-                    'account' => 'oSAh95RkTKmfzT_s1KaAkIuDMDP0',
-                    'amount' => 2,
-                    'description' => '测试分账'
-                ],
-                [
-                    'type' => 'PERSONAL_OPENID',
-                    'account' => 'oSAh95ZJfUnDWWdZ-z7wfBkUz_B0',
-                    'amount' => 1,
-                    'description' => '测试分账'
-                ]
-            ],
-            11
-        ));
-    }
-
-    public function test111()
-    {
-        $res = StoreOrder::where('mer_id', 11)->where('transaction_id', '<>', '')->where('assistance_id', '=', '')->select();
-        foreach($res as $value){
-            dump(MiniProgramService::profit_sharing_finish(
-                $value['transaction_id'],
-                $value['order_id'],
-                $value['mer_id']
-            ));
-        }
-    }
-
-    public function test222()
-    {
-        $res = UserRecharge::where('mer_id', 11)->where('transaction_id', '<>', '')->select();
-        foreach($res as $value){
-            dump(MiniProgramService::profit_sharing_finish(
-                $value['transaction_id'],
-                $value['order_id'],
-                $value['mer_id']
-            ));
-        }
-    }
-
-    public function order_pay_success()
-    {
-        $orderId = 'wx160679322986954873';
-        $order = StoreOrder::where('order_id', $orderId)->find();
-        OrderSubscribe::onOrderPaySuccess($order);
-    }
-
-    public function profitSharingFinish(Request $request)
-    {
-        list($order_id) = UtilService::getMore([
-            ['order_id', ''],
-        ], $request, true);
-        $order = StoreOrder::where('order_id', $order_id)->find();
-        PaySuccessJob::profitSharingFinish($order);
-    }
-
-    public function test_profit_sharing_finish()
-    {
-        dump(MiniProgramService::profit_sharing_finish(
-            '4200000753202011045607878421',
-            'wx160445808633819879',
-            11
-        ));
-    }
-
-    public function test_recharge(Request $request)
-    {
-        list($order_id) = UtilService::getMore([
-            ['order_id', ''],
-        ], $request, true);
-        UserRecharge::rechargeSuccess($order_id);
-    }
-
-    public function test_refund()
-    {
-        $refund_no = UserBrokerage::getNewRefundNo();
-        dump(MiniProgramService::payOrderRefund(
-            'wx2020102914273410024',
-            [
-                'pay_price' => 0.1,
-                'refund_price' => 0.01,
-                'refund_id' => $refund_no
-            ],
-            11
-        ));
-    }
-
-    public function wechat_user_recharge()
-    {
-        $orderNo = 'wx2020110616055410365';
-        PaymentRepositories::wechatUserRechargeCard($orderNo);
-    }
-
-    public function pay_success(Request $request)
-    {
-        list($orderId) = UtilService::postMore([
-            ['order_id', ''],
-        ], $request, true);
-        PaymentRepositories::wechatProduct($orderId);
-    }
-
-    public function test2($order_id)
-    {
-        $order = StoreOrder::where('order_id', $orderId)->find();
-        if ($order->assistance_id && $res1 && !$order->refund_status) $resAssistance = StoreAssistanceActive::createAssistanceActive($order);//创建助力
-    }
-
-    public function test3(Request $request)
-    {
-        $mer_id = 11;
-        list($uni) = UtilService::postMore([
-            ['uni', ''],
-        ], $request, true);
-        $uid = 24;
-        $order = StoreOrder::getUserOrderDetail($uid, $uni, $mer_id);
-        $res = User::backOrderBrokerage($order);
-        return $res;
-    }
-
-    public function clearCache(Request $request)
-    {
-        $config_name = UtilService::postMore([
-            ['name', ''],
-        ], $request);
-        $cacheName = "data_{$config_name['name']}";
-        return CacheService::delete($cacheName);
-    }
-
     /**
     /**
      * @param Request $request
      * @param Request $request
      * @return mixed
      * @return mixed
@@ -192,56 +24,20 @@ class PublicController
      */
      */
     public function index(Request $request)
     public function index(Request $request)
     {
     {
-        $mer_id = $request->mer_id() ?: '';
-        $banner = sys_data('routine_home_banner', 0, $mer_id) ?: [];//TODO 首页banner图
-        $menus = sys_data('routine_home_menus', 0, $mer_id) ?: [];//TODO 首页按钮
-        $roll = sys_data('routine_home_roll_news', 0, $mer_id) ?: [];//TODO 首页滚动新闻
-        $activity = sys_data('routine_home_activity', 5, $mer_id) ?: [];//TODO 首页活动区域图片
-        $explosive_money = sys_data('index_categy_images', 0, $mer_id) ?: [];//TODO 首页超值爆款
-        $site_name = sys_config('site_name', '', $mer_id);
-        $routine_index_page = sys_data('routine_index_page', 0, $mer_id);
-        $info['fastInfo'] = $routine_index_page[0]['fast_info'] ?? '';//sys_config('fast_info');//TODO 快速选择简介
-        $info['bastInfo'] = $routine_index_page[0]['bast_info'] ?? '';//sys_config('bast_info');//TODO 精品推荐简介
-        $info['firstInfo'] = $routine_index_page[0]['first_info'] ?? '';//sys_config('first_info');//TODO 首发新品简介
-        $info['salesInfo'] = $routine_index_page[0]['sales_info'] ?? '';//sys_config('sales_info');//TODO 促销单品简介
-        $logoUrl = sys_config('routine_index_logo', '', $mer_id);
-        if (strstr($logoUrl, 'http') === false && $logoUrl) $logoUrl = sys_config('site_url', '', $mer_id) . $logoUrl;
-        $logoUrl = str_replace('\\', '/', $logoUrl);
-        $fastNumber = sys_config('fast_number', 0, $mer_id);//TODO 快速选择分类个数
-        $bastNumber = sys_config('bast_number', 0, $mer_id);//TODO 精品推荐个数
-        $firstNumber = sys_config('first_number', 0, $mer_id);//TODO 首发新品个数
-        $promotionNumber = sys_config('promotion_number', 0, $mer_id);//TODO 首发新品个数
-        $info['fastList'] = StoreCategory::byIndexList((int)$fastNumber, false, $mer_id);//TODO 快速选择分类个数
-        $info['bastList'] = StoreProduct::getBestProduct('id,image,store_name,cate_id,price,ot_price,IFNULL(sales,0) + IFNULL(ficti,0) as sales,unit_name', (int)$bastNumber, $request->uid(), false, 0, 0, $mer_id);//TODO 精品推荐个数
-        $info['firstList'] = StoreProduct::getNewProduct('id,image,store_name,cate_id,price,unit_name,IFNULL(sales,0) + IFNULL(ficti,0) as sales', (int)$firstNumber, $request->uid(), false, 0, 0, $mer_id);//TODO 首发新品个数
-        $info['bastBanner'] = sys_data('routine_home_bast_banner', 0, $mer_id) ?? [];//TODO 首页精品推荐图片
-        $benefit = StoreProduct::getBenefitProduct('id,image,store_name,cate_id,price,ot_price,stock,unit_name', $promotionNumber, 0, 0, $mer_id);//TODO 首页促销单品
-        $lovely = sys_data('routine_home_new_banner', 0, $mer_id) ?: [];//TODO 首发新品顶部图
-        $likeInfo = StoreProduct::getHotProduct('id,image,store_name,cate_id,price,ot_price,unit_name', 3, $request->uid(), 0, 0, $mer_id);//TODO 热门榜单 猜你喜欢
-        $couponList = StoreCouponIssue::getIssueCouponList($request->uid(), 3);
-        if ($request->uid()) {
-            $subscribe = WechatUser::where('uid', $request->uid())->value('subscribe') ? true : false;
-        } else {
-            $subscribe = true;
-        }
-        $newGoodsBananr = sys_config('new_goods_bananr', '', $mer_id);
-        $tengxun_map_key = sys_config('tengxun_map_key', '', $mer_id);
-        return app('json')->successful(compact('banner', 'menus', 'roll', 'info', 'activity', 'lovely', 'benefit', 'likeInfo', 'logoUrl', 'couponList', 'site_name', 'subscribe', 'newGoodsBananr', 'tengxun_map_key', 'explosive_money'));
+        $banner = sys_data('home_banner', 0, 1) ?: [];//TODO 首页轮播图
+        $menus = sys_data('home_menus', 0, 1) ?: [];//TODO 首页导航
+        $pics = sys_data('home_pis', 0, 1) ?: [];//TODO 首页展示图
+        $tengxun_map_key = sys_config('tengxun_map_key', '');
+        return app('json')->successful(compact('banner', 'menus', 'pics', 'tengxun_map_key'));
     }
     }
 
 
-    /**
-     * 获取门店商品
-     */
-    public function getStoreProduct(Request $request)
+    public function page($unique)
     {
     {
-        $data = UtilService::getMore([
-            ['page', 1],
-            ['limit', 4],
-        ], $request);
-        $res = SystemStore::getStoreProduct($data['page'], $data['limit'], $request->mer_id());
-        return app('json')->successful($res);
+        $info = PageModel::where('is_del', 0)->where('unique', $unique)->find()->toArray();
+        return app('json')->successful($info);
     }
     }
 
 
+
     /**
     /**
      * 获取分享配置
      * 获取分享配置
      * @param Request $request
      * @param Request $request
@@ -257,235 +53,4 @@ class PublicController
         $data['synopsis'] = sys_config('wechat_share_synopsis', '', $mer_id);
         $data['synopsis'] = sys_config('wechat_share_synopsis', '', $mer_id);
         return app('json')->successful(compact('data'));
         return app('json')->successful(compact('data'));
     }
     }
-
-
-    /**
-     * 获取个人中心菜单
-     * @param Request $request
-     * @return mixed
-     */
-    public function menu_user(Request $request)
-    {
-        $menusInfo = sys_data('routine_my_menus', 0, $request->mer_id()) ?? [];
-        $user = $request->user();
-        $vipOpen = sys_config('vip_open', '', $request->mer_id());
-        $vipOpen = is_string($vipOpen) ? (int)$vipOpen : $vipOpen;
-        foreach ($menusInfo as $key => &$value) {
-            $value['pic'] = set_file_url($value['pic']);
-            if ($value['id'] == 137 && !(intval(sys_config('store_brokerage_statu', '', $request->mer_id())) == 2 || $user->is_promoter == 1))
-                unset($menusInfo[$key]);
-            if ($value['id'] == 174 && !StoreService::orderServiceStatus($user->uid))
-                unset($menusInfo[$key]);
-            if (((!StoreService::orderServiceStatus($user->uid)) && (!SystemStoreStaff::verifyStatus($user->uid))) && $value['url'] === '/pages/admin/order_cancellation/index')
-                unset($menusInfo[$key]);
-            if ((!StoreService::orderServiceStatus($user->uid)) && $value['url'] === '/pages/admin/order/index')
-                unset($menusInfo[$key]);
-            if ($value['url'] == '/pages/users/user_vip/index' && !$vipOpen)
-                unset($menusInfo[$key]);
-        }
-        $bannerInfo = sys_data('routine_my_banner', 0, $request->mer_id()) ?? [];
-        return app('json')->successful(['routine_my_menus' => $menusInfo, 'routine_my_banner' => $bannerInfo]);
-    }
-
-    /**
-     * 热门搜索关键字获取
-     * @return mixed
-     * @throws DataNotFoundException
-     * @throws ModelNotFoundException
-     * @throws \think\exception\DbException
-     */
-    public function search(Request $request)
-    {
-        $routineHotSearch = sys_data('routine_hot_search', 0, $request->mer_id()) ?? [];
-        $searchKeyword = [];
-        if (count($routineHotSearch)) {
-            foreach ($routineHotSearch as $key => &$item) {
-                array_push($searchKeyword, $item['title']);
-            }
-        }
-        return app('json')->successful($searchKeyword);
-    }
-
-
-    /**
-     * 图片上传
-     * @param Request $request
-     * @return mixed
-     * @throws InvalidArgumentException
-     */
-    public function upload_image(Request $request)
-    {
-        $data = UtilService::postMore([
-            ['filename', 'file'],
-        ], $request);
-        if (!$data['filename']) return app('json')->fail('参数有误');
-        if (Cache::has('start_uploads_' . $request->uid()) && Cache::get('start_uploads_' . $request->uid()) >= 100) return app('json')->fail('非法操作');
-        $upload = UploadService::init(null, $request->mer_id());
-        $info = $upload->to('store/comment')->validate()->move($data['filename']);
-        if ($info === false) {
-            return app('json')->fail($upload->getError());
-        }
-        $res = $upload->getUploadInfo();
-        SystemAttachment::attachmentAdd($res['name'], $res['size'], $res['type'], $res['dir'], $res['thumb_path'], 1, (int)sys_config('upload_type', 1), $res['time'], 2);
-        if (Cache::has('start_uploads_' . $request->uid()))
-            $start_uploads = (int)Cache::get('start_uploads_' . $request->uid());
-        else
-            $start_uploads = 0;
-        $start_uploads++;
-        Cache::set('start_uploads_' . $request->uid(), $start_uploads, 86400);
-        $res['dir'] = path_to_url($res['dir']);
-        if (strpos($res['dir'], 'http') === false) $res['dir'] = $request->domain() . $res['dir'];
-        return app('json')->successful('图片上传成功!', ['name' => $res['name'], 'url' => $res['dir']]);
-    }
-
-    /**
-     * 物流公司
-     * @return mixed
-     */
-    public function logistics()
-    {
-        $expressList = Express::lst();
-        if (!$expressList) return app('json')->successful([]);
-        return app('json')->successful($expressList->hidden(['code', 'id', 'sort', 'is_show'])->toArray());
-    }
-
-    /**
-     * 短信购买异步通知
-     *
-     * @param Request $request
-     * @return mixed
-     * @throws Exception
-     */
-    public function sms_pay_notify(Request $request)
-    {
-        list($order_id, $price, $status, $num, $pay_time, $attach) = UtilService::postMore([
-            ['order_id', ''],
-            ['price', 0.00],
-            ['status', 400],
-            ['num', 0],
-            ['pay_time', time()],
-            ['attach', 0],
-        ], $request, true);
-        if ($status == 200) {
-            try {
-                ChannelService::instance()->send('PAY_SMS_SUCCESS', ['price' => $price, 'number' => $num], [$attach]);
-            } catch (\Throwable $e) {
-            }
-            return app('json')->successful();
-        }
-        return app('json')->fail();
-    }
-
-    /**
-     * 记录用户分享
-     * @param Request $request
-     * @return mixed
-     * @throws InvalidArgumentException
-     * @throws DataNotFoundException
-     * @throws DbException
-     * @throws ModelNotFoundException
-     */
-    public function user_share(Request $request)
-    {
-        return app('json')->successful(UserBill::setUserShare($request->uid(), 300, $request->mer_id()));
-    }
-
-    /**
-     * 获取图片base64
-     * @param Request $request
-     * @return mixed
-     * @throws Exception
-     */
-    public function get_image_base64(Request $request)
-    {
-        list($imageUrl, $codeUrl) = UtilService::postMore([
-            ['image', ''],
-            ['code', ''],
-        ], $request, true);
-        try {
-            $codeTmp = $code = $codeUrl ? image_to_base64($codeUrl) : false;
-            if (!$codeTmp) {
-                $putCodeUrl = put_image($codeUrl);
-                $code = $putCodeUrl ? image_to_base64($_SERVER['HTTP_HOST'] . '/' . $putCodeUrl) : false;
-                $code ?? unlink($_SERVER["DOCUMENT_ROOT"] . '/' . $putCodeUrl);
-            }
-
-            $imageTmp = $image = $imageUrl ? image_to_base64($imageUrl) : false;
-            if (!$imageTmp) {
-                $putImageUrl = put_image($imageUrl);
-                $image = $putImageUrl ? image_to_base64($_SERVER['HTTP_HOST'] . '/' . $putImageUrl) : false;
-                $image ?? unlink($_SERVER["DOCUMENT_ROOT"] . '/' . $putImageUrl);
-            }
-            return app('json')->successful(compact('code', 'image'));
-        } catch (Exception $e) {
-            return app('json')->fail($e->getMessage());
-        }
-    }
-
-    /**
-     * 门店列表
-     * @param Request $request
-     * @return mixed
-     * @throws Exception
-     */
-    public function store_list(Request $request)
-    {
-        list($latitude, $longitude, $page, $limit, $product_id) = UtilService::getMore([
-            ['latitude', ''],
-            ['longitude', ''],
-            [['page', 'd'], 1],
-            [['limit', 'd'], 10],
-            ['product_id', '']
-        ], $request, true);
-        $list = SystemStore::lst($latitude, $longitude, $page, $limit, '', 0, $request->mer_id(), $product_id);
-        if (!$list) $list = [];
-        $data['list'] = $list;
-        $data['tengxun_map_key'] = sys_config('tengxun_map_key', '', $request->mer_id());
-        return app('json')->successful($data);
-    }
-
-    /**
-     * 查找城市数据
-     * @param Request $request
-     * @return mixed
-     * @throws \throwable
-     */
-    public function city_list(Request $request)
-    {
-        $list = CacheService::get('CITY_LIST', function () {
-            $list = SystemCity::with('children')->field(['city_id', 'name', 'id', 'parent_id'])->where('parent_id', 0)->order('id asc')->select()->toArray();
-            $data = [];
-            foreach ($list as &$item) {
-                $value = ['v' => $item['city_id'], 'n' => $item['name']];
-                if ($item['children']) {
-                    foreach ($item['children'] as $key => &$child) {
-                        $value['c'][$key] = ['v' => $child['city_id'], 'n' => $child['name']];
-                        unset($child['id'], $child['area_code'], $child['merger_name'], $child['is_show'], $child['level'], $child['lng'], $child['lat'], $child['lat']);
-                        if (SystemCity::where('parent_id', $child['city_id'])->count()) {
-                            $child['children'] = SystemCity::where('parent_id', $child['city_id'])->field(['city_id', 'name', 'id', 'parent_id'])->select()->toArray();
-                            foreach ($child['children'] as $kk => $vv) {
-                                $value['c'][$key]['c'][$kk] = ['v' => $vv['city_id'], 'n' => $vv['name']];
-                            }
-                        }
-                    }
-                }
-                $data[] = $value;
-            }
-            return $data;
-        }, 0);
-        return app('json')->successful($list);
-    }
-
-    /**
-     * 获取拼团数据
-     * @return mixed
-     */
-    public function pink(Request $request)
-    {
-        $data['pink_count'] = StorePink::merSet($request->mer_id())->where(['status' => 2, 'is_refund' => 0])->count();
-        $data['avatars'] = User::whereIn('uid', function ($query) {
-            $query->name('store_pink')->where(['status' => 2, 'is_refund' => 0])->field(['uid'])->select();
-        })->limit(3)->order('uid desc')->column('avatar');
-        return app('json')->successful($data);
-    }
 }
 }

+ 0 - 1
app/api/controller/activity/.WeDrive

@@ -1 +0,0 @@
-/Users/huangjianfeng/WeDrive/六牛科技/源码/CRMEB_PRO_v1.0.0(9)/app/api/controller/activity

+ 0 - 387
app/api/controller/activity/StoreAssistanceController.php

@@ -1,387 +0,0 @@
-<?php
-
-namespace app\api\controller\activity;
-
-use app\models\store\StoreDescription;
-use app\models\store\StoreProductAttr;
-use app\models\store\StoreProductAttrValue;
-use app\models\store\StoreProductRelation;
-use app\models\system\SystemAttachment;
-use app\models\routine\RoutineCode;
-use app\models\store\StoreAssistance;
-use app\models\store\StoreAssistanceActive;
-use app\models\store\StoreProductReply;
-use app\models\store\StoreOrder;
-use app\models\store\{PopScreen as PopScreenModel};
-use app\Request;
-use crmeb\services\QrcodeService;
-use crmeb\services\SystemConfigService;
-use crmeb\services\UploadService;
-use crmeb\services\UtilService;
-use crmeb\services\CacheService;
-
-/**
- * 助力类
- * Class StoreAssistanceController
- * @package app\api\controller\activity
- */
-class StoreAssistanceController
-{
-    /**
-     * 助力列表
-     * @param Request $request
-     * @return mixed
-     */
-    public function lst(Request $request)
-    {
-        list($page, $limit) = UtilService::getMore([
-            ['page', 1],
-            ['limit', 10],
-        ], $request, true);
-        $assistanceList = StoreAssistance::getAll($page, $limit, $request->mer_id());
-        if (!count($assistanceList)) return app('json')->successful([]);
-        return app('json')->successful($assistanceList->hidden(['info', 'product_id', 'images', 'mer_id', 'attr', 'sort', 'stock', 'sales', 'add_time', 'is_del', 'is_show', 'browse', 'cost', 'is_show', 'start_time', 'stop_time', 'postage', 'is_postage', 'is_host', 'mer_use'])->toArray());
-    }
-
-    /**
-     * 助力商品详情
-     * @param Request $request
-     * @param $id
-     * @return mixed
-     */
-    public function detail(Request $request, $id)
-    {
-        if (!$id || !($assistanceOne = StoreAssistance::getAssistanceOne($id))) return app('json')->fail('助力不存在或已下架');
-        $assistanceOne = $assistanceOne->hidden(['mer_id', 'attr', 'sort', 'add_time', 'is_host', 'is_show', 'is_del', 'mer_use', 'cost', 'assistance'])->toArray();
-        $assistanceOne['images'] = json_decode($assistanceOne['images'], true);
-        list($assistance, $assistanceAll) = StoreAssistanceActive::getAssistanceAll($id, true);//助力列表
-        $siteUrl = sys_config('site_url');
-        $assistanceOne['image'] = set_file_url($assistanceOne['image'], $siteUrl);
-        $assistanceOne['image_base'] = set_file_url($assistanceOne['image'], $siteUrl);
-        $assistanceOne['code_base'] = QrcodeService::getWechatQrcodePath($id . '_assistance_detail_wap.jpg', '/pages/activity/goods_assistance_status/index?id=' . $id);
-        $assistanceOne['sale_stock'] = 0;
-        if ($assistanceOne['stock'] > 0) $assistanceOne['sale_stock'] = 1;
-        if (!strlen(trim($assistanceOne['unit_name']))) $assistanceOne['unit_name'] = '个';
-        $uid = $request->uid();
-        $assistanceOne['userCollect'] = StoreProductRelation::isProductRelation($assistanceOne['product_id'], $uid, 'collect');
-        $assistanceOne['description'] = htmlspecialchars_decode(StoreDescription::getDescription($id, 4));
-        $data['assistance'] = $assistance;
-        $data['assistanceAll'] = $assistanceAll;
-        $data['storeInfo'] = $assistanceOne;
-        $data['assistance_ok_list'] = StoreAssistanceActive::getAssistanceOkList($uid);
-        $data['assistance_ok_sum'] = StoreAssistanceActive::getAssistanceOkSumTotalNum($id);
-        $data['reply'] = StoreProductReply::getRecProductReply($assistanceOne['product_id']);
-        $data['replyCount'] = StoreProductReply::productValidWhere()->where('product_id', $assistanceOne['product_id'])->count();
-        if ($data['replyCount']) {
-            $goodReply = StoreProductReply::productValidWhere()->where('product_id', $assistanceOne['product_id'])->where('product_score', 5)->count();
-            $data['replyChance'] = $goodReply;
-            if ($goodReply) {
-                $data['replyChance'] = bcdiv($goodReply, $data['replyCount'], 2);
-                $data['replyChance'] = bcmul($data['replyChance'], 100, 3);
-            }
-        } else $data['replyChance'] = 100;
-        list($productAttr, $productValue) = StoreProductAttr::getProductAttrDetail($id, $uid, 0, 4);
-        foreach ($productValue as $k => $v) {
-            $productValue[$k]['product_stock'] = StoreProductAttrValue::where('product_id', $assistanceOne['product_id'])->where('suk', $v['suk'])->where('type', 0)->value('stock');
-            $productValue[$k]['subsidy'] = bcmul($v['price'], $assistanceOne['p_separate_account']/100, 2);
-        }
-        $data['productAttr'] = $productAttr;
-        $data['productValue'] = $productValue;
-        return app('json')->successful($data);
-    }
-
-    /**
-     * 参与助力
-     * @param Request $request
-     * @param $id
-     * @return mixed
-     * @throws DataNotFoundException
-     * @throws DbException
-     * @throws ModelNotFoundException
-     */
-    public function assistanceActive(Request $request, $id)
-    {
-        $is_ok = 0;//判断助力是否完成
-        $userBool = 0;//判断当前用户是否在团内  0未在 1在
-        $assitanceBool = 0;//判断助力是否成功  0未在 1在
-        $user = $request->user();
-        if (!$id) return app('json')->fail('参数错误');
-        $assistance = StoreAssistanceActive::getAssistanceUserOne($id, $request->mer_id());
-        if (!$assistance) return app('json')->fail('参数错误');
-        if (isset($assistance['is_refund']) && $assistance['is_refund']) {
-            if ($assistance['is_refund'] != $assistance['id']) {
-                $id = $assistance['is_refund'];
-                return $this->assistance($request, $id);
-            } else {
-                return app('json')->fail('订单已退款');
-            }
-        }
-        list($assistanceAll, $assistanceT, $count, $idAll, $uidAll) = StoreAssistanceActive::getAssistanceMemberAndAssistanceK($assistance);
-        if ($assistanceT['status'] == 2) {
-            $assitanceBool = 1;
-            $is_ok = 1;
-        } else if ($assistanceT['status'] == 3) {
-            $assitanceBool = -1;
-            $is_ok = 0;
-        } else {
-            if ($count < 1) {//组团完成
-                $is_ok = 1;
-                $assitanceBool = StoreAssistanceActive::AssistanceComplete($uidAll, $idAll, $user['uid'], $assistanceT);
-            } else {
-                $assitanceBool = StoreAssistanceActive::AssistanceFail($assistanceAll, $assistanceT, $assitanceBool);
-            }
-        }
-        if (!empty($assistanceAll)) {
-            foreach ($assistanceAll as $v) {
-                if ($v['uid'] == $user['uid']) $userBool = 1;
-            }
-        }
-        if ($assistanceT['uid'] == $user['uid']) $userBool = 1;
-        $assistanceOne = StoreAssistance::getAssistanceOne($assistance['cid'], $request->mer_id());
-        if (!$assistanceOne) return app('json')->fail('助力不存在或已下架');
-        $data['qrcode'] = sys_data('routine_wechat_qrcode', 0, $request->mer_id()) ?: [];
-        $data['userInfo']['uid'] = $user['uid'];
-        $data['userInfo']['nickname'] = $user['nickname'];
-        $data['userInfo']['avatar'] = $user['avatar'];
-        $data['is_ok'] = $is_ok;
-        $data['userBool'] = $userBool;
-        $data['assitanceBool'] = $assitanceBool;
-        $data['store_assistance'] = $assistanceOne->hidden(['mer_id', 'images', 'attr', 'info', 'sort', 'sales', 'stock', 'add_time', 'is_host', 'is_show', 'is_del', 'assistance', 'mer_use', 'is_postage', 'postage', 'start_time', 'stop_time', 'cost', 'browse', 'product_price'])->toArray();
-        $data['assistanceT'] = $assistanceT;
-        $data['assistanceAll'] = $assistanceAll;
-        $data['count'] = $count <= 0 ? 0 : $count;
-        $data['helped'] = $assistanceT['people'] - $count;
-        $data['store_assistance_host'] = StoreAssistance::getAssistanceHost(0, $request->mer_id());
-        $data['current_assistance_order'] = StoreAssistanceActive::getCurrentAssistance($id, $user['uid']);
-        list($productAttr, $productValue) = StoreProductAttr::getProductAttrDetail($assistanceOne['id'], $user['uid'], 0, 4);
-        foreach ($productValue as $k => $v) {
-            $productValue[$k]['product_stock'] = StoreProductAttrValue::where('product_id', $assistanceOne['product_id'])->where('suk', $v['suk'])->where('type', 0)->value('stock');
-        }
-        $data['store_assistance']['productAttr'] = $productAttr;
-        $data['store_assistance']['productValue'] = $productValue;
-        return app('json')->successful($data);
-    }
-
-    /**
-     * 取消助力
-     * @param Request $request
-     * @return mixed
-     * @throws Exception
-     */
-    public function remove(Request $request)
-    {
-        list($id, $cid) = UtilService::postMore([
-            ['id', 0],
-            ['cid', 0],
-        ], $request, true);
-        if (!$id || !$cid) return app('json')->fail('缺少参数');
-        $res = StoreAssistanceActive::removeAssistance($request->uid(), $cid, $id);
-        if ($res) {
-            return app('json')->successful('取消成功');
-        }
-        $error = StoreAssistanceActive::getErrorInfo();
-        if (is_array($error)) return app('json')->status($error['status'], $error['msg']);
-        return app('json')->fail($error);
-    }
-
-    /**
-     * 助力海报
-     * @param Request $request
-     * @return mixed
-     * @throws Exception
-     */
-    public function poster(Request $request)
-    {
-        $mer_id = $request->mer_id();
-        list($assistanceId, $from) = UtilService::postMore([['id', 0], ['from', 'wechat']], $request, true);
-        if (!$assistanceId) return app('json')->fail('参数错误');
-        $user = $request->user();
-        $assistanceInfo = StoreAssistanceActive::getAssistanceUserOne($assistanceId, $request->mer_id());
-        $storeAssistanceInfo = StoreAssistance::getAssistanceOne($assistanceInfo['cid']);
-        $data['title'] = $storeAssistanceInfo['title'];
-        $data['image'] = $storeAssistanceInfo['image'];
-        $data['price'] = $assistanceInfo['total_price'];
-        $data['label'] = $assistanceInfo['people'] . '人团';
-        if ($assistanceInfo['k_id']) $assistanceAll = StoreAssistanceActive::getAssistanceMember($assistanceInfo['k_id']);
-        else $assistanceAll = StoreAssistanceActive::getAssistanceMember($assistanceInfo['id']);
-        $count = count($assistanceAll);
-        $data['msg'] = '原价¥' . $storeAssistanceInfo['product_price'] . ' 还差' . (int)bcsub((int)$assistanceInfo['people'], $count, 0) . '人助力成功';
-        try {
-            $siteUrl = sys_config('site_url', '', $mer_id);
-            if ($from == 'routine') {
-                //小程序
-                $name = $assistanceId . '_' . $user['uid'] . '_' . $user['is_promoter'] . '_assistance_share_routine.jpg';
-                $imageInfo = SystemAttachment::getInfo($name, 'name');
-                if (!$imageInfo) {
-                    $valueData = 'id=' . $assistanceId;
-                    if ($user['is_promoter'] || sys_config('store_brokerage_statu', '', $mer_id) == 2) $valueData .= '&pid=' . $user['uid'];
-                    $res = RoutineCode::getPageCode('pages/activity/goods_assistance_status/index', $valueData, 280, $mer_id);
-                    if (!$res) return app('json')->fail('二维码生成失败');
-                    $uploadType = (int)sys_config('upload_type', 1, $mer_id);
-                    $upload = UploadService::init(null, $mer_id);
-                    $res = $upload->to('routine/activity/assistance/code')->validate()->stream($res, $name);
-                    if ($res === false) {
-                        return app('json')->fail($upload->getError());
-                    }
-                    $imageInfo = $upload->getUploadInfo();
-                    $imageInfo['image_type'] = $uploadType;
-                    if ($imageInfo['image_type'] == 1) $remoteImage = UtilService::remoteImage($siteUrl . $imageInfo['dir']);
-                    else $remoteImage = UtilService::remoteImage($imageInfo['dir']);
-                    if (!$remoteImage['status']) return app('json')->fail($remoteImage['msg']);
-                    SystemAttachment::attachmentAdd($imageInfo['name'], $imageInfo['size'], $imageInfo['type'], $imageInfo['dir'], $imageInfo['thumb_path'], 1, $imageInfo['image_type'], $imageInfo['time'], 2);
-                    $url = $imageInfo['dir'];
-                } else $url = $imageInfo['att_dir'];
-                $data['url'] = $url;
-                if ($imageInfo['image_type'] == 1)
-                    $data['url'] = $siteUrl . $url;
-                $posterImage = UtilService::setShareMarketingPoster($data, 'routine/activity/assistance/poster');
-                if (!is_array($posterImage)) return app('json')->fail('海报生成失败');
-                SystemAttachment::attachmentAdd($posterImage['name'], $posterImage['size'], $posterImage['type'], $posterImage['dir'], $posterImage['thumb_path'], 1, $posterImage['image_type'], $posterImage['time'], 2);
-                if ($posterImage['image_type'] == 1) $posterImage['dir'] = $siteUrl . $posterImage['dir'];
-                $routinePosterImage = set_http_type($posterImage['dir'], 0);//小程序推广海报
-                return app('json')->successful(['url' => $routinePosterImage]);
-            } else if ($from == 'wechat') {
-                //公众号
-                $name = $assistanceId . '_' . $user['uid'] . '_' . $user['is_promoter'] . '_assistance_share_wap.jpg';
-                $imageInfo = SystemAttachment::getInfo($name, 'name');
-                if (!$imageInfo) {
-                    $codeUrl = set_http_type($siteUrl . '/pages/activity/goods_assistance_status/index?id=' . $assistanceId . '&spread=' . $user['uid'], 1);//二维码链接
-                    $imageInfo = UtilService::getQRCodePath($codeUrl, $name);
-                    if (is_string($imageInfo)) {
-                        return app('json')->fail('二维码生成失败', ['error' => $imageInfo]);
-                    }
-                    SystemAttachment::attachmentAdd($imageInfo['name'], $imageInfo['size'], $imageInfo['type'], $imageInfo['dir'], $imageInfo['thumb_path'], 1, $imageInfo['image_type'], $imageInfo['time'], 2);
-                    $url = $imageInfo['dir'];
-                } else $url = $imageInfo['att_dir'];
-                $data['url'] = $url;
-                if ($imageInfo['image_type'] == 1) $data['url'] = $siteUrl . $url;
-                $posterImage = UtilService::setShareMarketingPoster($data, 'wap/activity/assistance/poster');
-                if (!is_array($posterImage)) return app('json')->fail('海报生成失败');
-                SystemAttachment::attachmentAdd($posterImage['name'], $posterImage['size'], $posterImage['type'], $posterImage['dir'], $posterImage['thumb_path'], 1, $posterImage['image_type'], $posterImage['time'], 2);
-                if ($posterImage['image_type'] == 1) $posterImage['dir'] = $siteUrl . $posterImage['dir'];
-                $wapPosterImage = set_http_type($posterImage['dir'], 1);//公众号推广海报
-                return app('json')->successful(['url' => $wapPosterImage]);
-            }
-            return app('json')->fail('参数错误');
-        } catch (Exception $e) {
-            return app('json')->fail(['line' => $e->getLine(), 'message' => $e->getMessage()]);
-        }
-
-
-    }
-
-    /**
-     * 获取助力小程序二维码
-     * @param Request $request
-     * @param $id
-     * @return mixed
-     */
-    public function code(Request $request, $id)
-    {
-        $url = QrcodeService::getRoutineQrcodePath($id, $request->uid(), 3, [], $request->mer_id());
-        if ($url) {
-            return app('json')->success(['code' => $url]);
-        } else {
-            return app('json')->success(['code' => '']);
-        }
-    }
-
-    /**
-     * 获取助力页面二维码
-     */
-    public function zhuli_code(Request $request, $id)
-    {
-        $url = QrcodeService::getRoutineQrcodePath($id, $request->uid(), 4, [], $request->mer_id());
-        if ($url) {
-            return app('json')->success(['code' => $url]);
-        } else {
-            return app('json')->success(['code' => '']);
-        }
-    }
-
-    /**
-     * 参与助力
-     */
-    public function attend(Request $request, $id)
-    {
-        // 从redis缓存attend_user获取某uid的值,如果存在,不允许助力,返回异常
-        $attend_uid = CacheService::redisHandler()->get('attend_user'. $request->uid());
-        if (self::checktime($attend_uid)) return app('json')->fail('您今天助力过一次了,请明天再来');
-
-        $assistanceActive = StoreAssistanceActive::get($id);
-        // 查询可助力人数
-        $assistanceActiveAll = StoreAssistanceActive::getAssistanceMember($id);
-        $count = count($assistanceActiveAll);
-        $count = (int)bcsub($assistanceActive['people'], $count, 0);
-        // 判断是否可助力:如果人已满,或已经超过了可助力的时间,返回false,即不可助力
-        if($count <= 0) return app('json')->fail('该助力人数已满');
-        if($assistanceActive['stop_time'] < time()) return app('json')->fail('该助力已超过了可参与的时间');
-        foreach ($assistanceActiveAll as $key => $value) {
-            if ($value['uid'] == $request->uid()) {
-                return app('json')->fail('您已参与过该助力了');
-            }
-        }
-        // 新增一条redis缓存记录
-        CacheService::redisHandler()->set('attend_user'. $request->uid(), time(), 24*60*60);
-        // 记录助力次数
-        $assistance = StoreAssistance::get($assistanceActive['cid']);
-        $assistance->assistance_times += 1;
-        $assistance->save();
-        // 先加入,再做是否已满的处理
-        $res = StoreAssistanceActive::attendAssistance($request->uid(), $id);
-        if ($res) {
-            // 执行已满后的处理
-            list($assistanceAll, $assistanceT, $count, $idAll, $uidAll) = StoreAssistanceActive::getAssistanceMemberAndAssistanceK($assistanceActive);
-            if ($assistanceT['status'] == 1) {
-                if (!$count){//组团完成
-                    $this->isFull($assistanceActive['order_id_key'], $uidAll, $idAll, $request->uid(), $assistanceT, $request->mer_id());
-                    return app('json')->successful('参与成功!');
-                }
-            }
-            return app('json')->successful('参与成功');
-        } else {
-            return app('json')->fail('参与失败,请稍后再试');
-        }
-    }
-
-    /**
-     * 处理已满
-     */
-    private function isFull($order_id, $uidAll, $idAll, $uid, $assistanceT, $mer_id = '')
-    {
-        // 更改助力订单状态
-        StoreAssistanceActive::changeAssistanceActiveStatus($uidAll, $idAll, $uid, $assistanceT);
-        // 发送订阅消息
-        // $this->sendMessage($order_id);
-        $order = StoreOrder::get($order_id);
-        if($order['pay_type'] == 'weixin'){
-            // 处理奖励
-            StoreAssistanceActive::treatmentAward($order_id, $mer_id);
-            // 记录本次助力分账奖励
-            StoreAssistanceActive::recordAssistanceMoney($order_id);
-        }
-    }
-
-    public function checktime($time)
-    {
-        $start = strtotime(date("Y-m-d"),time());
-        $end = $start + 60*60*24;
-
-        if($start < $time && $time < $end){
-            return true;
-        }else{
-           return false;
-        }
-    }
-
-    //霸屏广告
-    public function popScreen($url)
-    {
-        $where['domain_name']=$url;
-        $info = PopScreenModel::getOne($where);
-        $info["click"] = $info["click"] + 1;
-        PopScreenModel::edit(['click'=>$info["click"]],$info['id']);//增加推广人次
-        $data['info'] = $info;
-        return app('json')->successful($data);
-    }
-}

+ 0 - 407
app/api/controller/activity/StoreBargainController.php

@@ -1,407 +0,0 @@
-<?php
-
-namespace app\api\controller\activity;
-
-use app\models\store\StoreDescription;
-use app\models\store\StoreProductAttr;
-use app\models\store\StoreProductAttrValue;
-use app\models\system\SystemAttachment;
-use app\models\routine\RoutineCode;
-use app\models\routine\RoutineTemplate;
-use app\models\store\StoreBargain;
-use app\models\store\StoreBargainUser;
-use app\models\store\StoreBargainUserHelp;
-use app\models\store\StoreOrder;
-use app\models\user\User;
-use app\models\user\WechatUser;
-use app\models\wechat\WechatTemplate;
-use app\Request;
-use crmeb\services\GroupDataService;
-use crmeb\services\QrcodeService;
-use crmeb\services\SystemConfigService;
-use crmeb\services\UploadService;
-use crmeb\services\UtilService;
-use crmeb\services\WechatTemplateService;
-use think\db\exception\DataNotFoundException;
-use think\db\exception\DbException;
-use think\db\exception\ModelNotFoundException;
-use think\Exception;
-use think\facade\Route;
-
-/**
- * 砍价商品类
- * Class StoreBargainController
- * @package app\api\controller\activity
- */
-class StoreBargainController
-{
-
-    /**
-     * 砍价列表顶部图
-     * @return mixed
-     * @throws DataNotFoundException
-     * @throws ModelNotFoundException
-     * @throws \think\exception\DbException
-     */
-    public function config(Request $request)
-    {
-        $lovely = sys_data('routine_lovely', 0, $request->mer_id()) ?? [];//banner图
-        $info = isset($lovely[2]) ? $lovely[2] : [];
-        return app('json')->successful($info);
-    }
-
-    /**
-     * 砍价商品列表
-     * @param Request $request
-     * @return mixed
-     * @throws \Exception
-     */
-    public function lst(Request $request)
-    {
-        list($page, $limit) = UtilService::getMore([
-            ['page', 0],
-            ['limit', 0],
-        ], $request, true);
-        $bargainList = StoreBargain::getList($page, $limit, $request->mer_id());
-        return app('json')->successful($bargainList);
-    }
-
-    /**
-     * 砍价详情和当前登录人信息
-     * @param Request $request
-     * @param $id
-     * @return mixed
-     * @throws DataNotFoundException
-     * @throws ModelNotFoundException
-     * @throws DbException
-     */
-    public function detail(Request $request, $id)
-    {
-        if (!$id) return app('json')->fail('参数错误');
-        if (!($bargain = StoreBargain::getBargainTerm($id, $request->mer_id()))) return app('json')->fail('砍价已结束');
-        StoreBargain::addBargainLook($id);
-        $bargain['time'] = time();
-        $user = $request->user();
-        $data['userInfo']['uid'] = $user['uid'];
-        $data['userInfo']['nickname'] = $user['nickname'];
-        $data['userInfo']['avatar'] = $user['avatar'];
-        $bargain['description'] = htmlspecialchars_decode(StoreDescription::getDescription($id, 2));
-        list($productAttr, $productValue) = StoreProductAttr::getProductAttrDetail($id, $user['uid'], 2, 2);
-        foreach ($productValue as $k => $v) {
-            $v['product_stock'] = StoreProductAttrValue::where('product_id', $bargain['product_id'])->where('suk', $v['suk'])->where('type', 0)->value('stock');
-            $bargain['attr'] = $v;
-        }
-        $data['bargain'] = $bargain;
-        $data['bargainSumCount'] = StoreOrder::getBargainPayCount($id);
-        $data['userBargainStatus'] = StoreBargainUser::isBargainUser($id, $user['uid']);
-        return app('json')->successful($data);
-    }
-
-    /**
-     * 砍价 观看/分享/参与次数
-     * @param Request $request
-     * @return mixed
-     * @throws \Exception
-     */
-    public function share(Request $request)
-    {
-        list($bargainId) = UtilService::postMore([['bargainId', 0]], $request, true);
-        $data['lookCount'] = StoreBargain::getBargainLook();//TODO 观看人数
-        $data['shareCount'] = StoreBargain::getBargainShare();//TODO 分享人数
-        $data['userCount'] = StoreBargainUser::count();//TODO 参与人数
-        if (!$bargainId) return app('json')->successful($data);
-        StoreBargain::addBargainShare($bargainId);
-        $data['shareCount'] = StoreBargain::getBargainShare();//TODO 分享人数
-        return app('json')->successful($data);
-    }
-
-    /**
-     * 砍价开启
-     * @param Request $request
-     * @return mixed
-     * @throws DataNotFoundException
-     * @throws DbException
-     * @throws Exception
-     * @throws ModelNotFoundException
-     * @throws \Exception
-     */
-    public function start(Request $request)
-    {
-        list($bargainId) = UtilService::postMore([['bargainId', 0]], $request, true);
-        if (!($bargain = StoreBargain::getBargainTerm($bargainId, $request->mer_id()))) return app('json')->fail('砍价已结束');
-        if (!$bargainId) return app('json')->fail('参数错误');
-        $count = StoreBargainUser::isBargainUser($bargainId, $request->uid());
-        if ($count === false) return app('json')->fail('参数错误');
-        else if ($count) return app('json')->status('SUCCESSFUL', '参与成功');
-        else $res = StoreBargainUser::setBargain($bargainId, $request->uid());
-        if (!$res) return app('json')->fail('参与失败');
-        else return app('json')->status('SUCCESS', '参与成功');
-    }
-
-    /**
-     * 砍价 帮助好友砍价
-     * @param Request $request
-     * @return mixed
-     * @throws Exception
-     * @throws DataNotFoundException
-     * @throws ModelNotFoundException
-     * @throws DbException
-     * @throws \Exception
-     */
-    public function help(Request $request)
-    {
-        list($bargainId, $bargainUserUid) = UtilService::postMore([['bargainId', 0], ['bargainUserUid', 0]], $request, true);
-        if (!$bargainId || !$bargainUserUid) return app('json')->fail('参数错误');
-        if (!StoreBargain::merSet($request->mer_id())->where('id', $bargainId)->where('is_del', 0)->find()) return app('json')->fail('砍价已结束');
-        $count = StoreBargainUserHelp::isBargainUserHelpCount($bargainId, $bargainUserUid, $request->uid());
-        if (!$count) return app('json')->status('SUCCESSFUL', '砍价成功');
-        $res = StoreBargainUserHelp::setBargainUserHelp($bargainId, $bargainUserUid, $request->uid());
-        if ($res) {
-            if (!StoreBargainUserHelp::getSurplusPrice($bargainId, $bargainUserUid)) {
-                $bargainUserTableId = StoreBargainUser::getBargainUserTableId($bargainId, $bargainUserUid);// TODO 获取用户参与砍价表编号
-                $bargainInfo = StoreBargain::get($bargainId);//TODO 获取砍价商品信息
-                $bargainUserInfo = StoreBargainUser::get($bargainUserTableId);// TODO 获取用户参与砍价信息
-                //TODO 砍价成功给开启砍价用户发送模板消息
-                $openid = WechatUser::uidToOpenid($bargainUserUid, 'openid');
-                $routineOpenid = WechatUser::uidToOpenid($bargainUserUid, 'routine_openid');
-                if ($openid) {//公众号
-//                    $urlWeChat = Route::buildUrl('/activity/dargain_detail/' . $bargainId . '/' . $bargainUserUid)->suffix('')->domain(true)->build();
-//                    WechatTemplateService::sendTemplate($openid, WechatTemplateService::BARGAIN_SUCCESS, [
-//                        'first' => '好腻害!你的朋友们已经帮你砍到底价了!',
-//                        'keyword1' => $bargainInfo['title'],
-//                        'keyword2' => $bargainInfo['min_price'],
-//                        'remark' => '点击查看订单详情'
-//                    ], $urlWeChat);
-                    $wechatTemplate = new WechatTemplate();
-                    $wechatTemplate->sendBrgainSuccess($bargainUserUid, $bargainInfo);
-                } else if ($routineOpenid) { //小程序
-                    RoutineTemplate::sendBargainSuccess($bargainInfo, $bargainUserInfo, $bargainUserUid);
-                }
-            }
-            return app('json')->status('SUCCESS', '砍价成功');
-        } else return app('json')->fail('砍价失败');
-    }
-
-    /**
-     * 砍价 砍掉金额
-     * @param Request $request
-     * @return mixed
-     * @throws \Exception
-     */
-    public function help_price(Request $request)
-    {
-        list($bargainId, $bargainUserUid) = UtilService::postMore([['bargainId', 0], ['bargainUserUid', 0]], $request, true);
-        if (!$bargainId || !$bargainUserUid || !!StoreBargain::merSet($request->mer_id())->where('id', $bargainId)->where('is_del', 0)->find()) return app('json')->fail('参数错误');
-        $bargainUserTableId = StoreBargainUser::getBargainUserTableId($bargainId, $bargainUserUid);//TODO 获取用户参与砍价表编号
-        $price = StoreBargainUserHelp::getBargainUserBargainPrice($bargainId, $bargainUserTableId, $request->uid(), 'price');// TODO 获取用户砍掉的金额
-        if ($price) return app('json')->successful(['price' => $price]);
-        else return app('json')->fail('获取失败');
-    }
-
-    /**
-     * 砍价 砍价帮总人数、剩余金额、进度条、已经砍掉的价格
-     * @param Request $request
-     * @return mixed
-     * @throws Exception
-     * @throws DataNotFoundException
-     * @throws ModelNotFoundException
-     * @throws DbException
-     * @throws \Exception
-     */
-    public function help_count(Request $request)
-    {
-        list($bargainId, $bargainUserUid) = UtilService::postMore([['bargainId', 0], ['bargainUserUid', 0]], $request, true);
-        $data['userBargainStatus'] = StoreBargainUserHelp::isBargainUserHelpCount($bargainId, $bargainUserUid, $request->uid());
-        if (!$bargainId || !$bargainUserUid || !StoreBargain::merSet($request->mer_id())->where('id', $bargainId)->where('is_del', 0)->find()) return app('json')->fail('参数错误');
-        $bargainUserTableId = StoreBargainUser::getBargainUserTableId($bargainId, $bargainUserUid);//TODO 获取用户参与砍价表编号
-        if ($bargainUserTableId) {
-            $count = StoreBargainUserHelp::getBargainUserHelpPeopleCount($bargainId, $bargainUserUid);//TODO 获取砍价帮总人数
-            $price = StoreBargainUserHelp::getSurplusPrice($bargainId, $bargainUserUid);//TODO 获取砍价剩余金额
-            $alreadyPrice = StoreBargainUser::getBargainUserPrice($bargainUserTableId);//TODO 用户已经砍掉的价格 好友砍价之后获取用户已经砍掉的价格
-            $pricePercent = StoreBargainUserHelp::getSurplusPricePercent($bargainId, $bargainUserUid);//TODO 获取砍价进度条
-            $data['count'] = $count;
-            $data['price'] = $price;
-            $data['status'] = StoreBargainUser::getBargainUserStatusEnd($bargainUserTableId);
-            $data['alreadyPrice'] = $alreadyPrice;
-            $data['pricePercent'] = $pricePercent > 10 ? $pricePercent : 10;
-        } else {
-            $data['count'] = 0;
-            $data['price'] = StoreBargain::where('id', $bargainId)->value('price - min_price');
-            $data['status'] = StoreBargainUser::getBargainUserStatusEnd($bargainUserTableId);
-            $data['alreadyPrice'] = 0;
-            $data['pricePercent'] = 0;
-        }
-        return app('json')->successful($data);
-    }
-
-
-    /**
-     * 砍价 砍价帮
-     * @param Request $request
-     * @return mixed
-     * @throws Exception
-     * @throws DataNotFoundException
-     * @throws ModelNotFoundException
-     * @throws DbException
-     */
-    public function help_list(Request $request)
-    {
-        list($bargainId, $bargainUserUid, $page, $limit) = UtilService::postMore([
-            ['bargainId', 0],
-            ['bargainUserUid', 0],
-            ['page', 0],
-            ['limit', 20]
-        ], $request, true);
-        if (!$bargainId || !$bargainUserUid || !StoreBargain::merSet($request->mer_id())->where('id', $bargainId)->where('is_del', 0)->find()) return app('json')->fail('参数错误');
-        $bargainUserTableId = StoreBargainUser::getBargainUserTableId($bargainId, $bargainUserUid); //TODO 砍价帮获取参与砍价表编号
-        $storeBargainUserHelp = StoreBargainUserHelp::getList($bargainUserTableId, $page, $limit);
-        return app('json')->successful($storeBargainUserHelp);
-    }
-
-    /**
-     * 砍价 开启砍价用户信息
-     * @param Request $request
-     * @return mixed
-     * @throws DataNotFoundException
-     * @throws ModelNotFoundException
-     * @throws DbException
-     * @throws \Exception
-     */
-    public function start_user(Request $request)
-    {
-        list($bargainId, $bargainUserUid) = UtilService::postMore([
-            ['bargainId', 0],
-            ['bargainUserUid', 0],
-        ], $request, true);
-        if (!$bargainId || !$bargainUserUid) return app('json')->fail('参数错误');
-//        $bargainUserTableId = StoreBargainUser::getBargainUserTableId($bargainId,$bargainUserUid);//TODO 获取用户参与砍价表编号
-//        if(!$bargainUserTableId) return app('json')->fail('参数错误');
-        $userInfo = User::getUserInfo($bargainUserUid, 'nickname,avatar', $request->mer_id());
-        return app('json')->successful($userInfo);
-    }
-
-
-    /**
-     * 砍价列表(已参与)
-     * @param Request $request
-     * @return mixed
-     * @throws \Exception
-     */
-    public function user_list(Request $request)
-    {
-        list($page, $limit) = UtilService::getMore([
-            ['page', 0],
-            ['limit', 0],
-        ], $request, true);
-        $uid = $request->uid();
-        StoreBargainUser::editBargainUserStatus($uid);// TODO 判断过期砍价活动
-        $list = StoreBargainUser::getBargainUserAll($uid, $page, $limit);
-        if (count($list)) return app('json')->successful($list);
-        else return app('json')->fail('暂无参与砍价');
-    }
-
-    /**
-     * 砍价取消
-     * @param Request $request
-     * @return mixed
-     * @throws \Exception
-     */
-    public function user_cancel(Request $request)
-    {
-        list($bargainId) = UtilService::postMore([['bargainId', 0]], $request, true);
-        if (!$bargainId || !StoreBargain::merSet($request->mer_id())->where('id', $bargainId)->where('is_del', 0)->find()) return app('json')->fail('参数错误');
-        $status = StoreBargainUser::getBargainUserStatus($bargainId, $request->uid());
-        if ($status != 1) return app('json')->fail('状态错误');
-        $id = StoreBargainUser::getBargainUserTableId($bargainId, $request->uid());
-        $res = StoreBargainUser::edit(['is_del' => 1], $id);
-        if ($res) return app('json')->successful('取消成功');
-        else return app('json')->successful('取消失败');
-    }
-
-    /**
-     * 砍价海报
-     * @param Request $request
-     * @return mixed
-     * @throws DataNotFoundException
-     * @throws ModelNotFoundException
-     * @throws DbException
-     * @throws \Exception
-     */
-    public function poster(Request $request)
-    {
-        $mer_id = $request->mer_id();
-        list($bargainId, $from) = UtilService::postMore([['bargainId', 0], ['from', 'wechat']], $request, true);
-        if (!$bargainId || !StoreBargain::merSet($request->mer_id())->where('id', $bargainId)->where('is_del', 0)->find()) return app('json')->fail('参数错误');
-        $user = $request->user();
-        $storeBargainInfo = StoreBargain::getBargain($bargainId);
-        $price = StoreBargainUserHelp::getSurplusPrice($bargainId, $user['uid']);//TODO 获取砍价剩余金额
-        $alreadyPrice = StoreBargainUser::getBargainUserPrice(StoreBargainUser::getBargainUserTableId($bargainId, $user['uid']));
-        try {
-            $siteUrl = sys_config('site_url', '', $mer_id);
-            $data['title'] = $storeBargainInfo['title'];
-            $data['image'] = $storeBargainInfo['image'];
-            $data['price'] = bcsub($storeBargainInfo['price'], $alreadyPrice, 2);
-            $data['label'] = '已砍至';
-            $data['msg'] = '还差' . $price . '元即可砍价成功';
-            if ($from == 'routine') {
-                //小程序
-                $name = $bargainId . '_' . $user['uid'] . '_' . $user['is_promoter'] . '_bargain_share_routine.jpg';
-                $imageInfo = SystemAttachment::getInfo($name, 'name');
-                if (!$imageInfo) {
-                    $valueData = 'id=' . $bargainId . '&bargain=' . $user['uid'];
-                    if ($user['is_promoter'] || sys_config('store_brokerage_statu', '', $mer_id) == 2) $valueData .= '&pid=' . $user['uid'];
-                    $res = RoutineCode::getPageCode('pages/activity/goods_bargain_details/index', $valueData, 280, $mer_id);
-                    if (!$res) return app('json')->fail('二维码生成失败');
-                    $uploadType = (int)sys_config('upload_type', 1, $mer_id);
-                    $upload = UploadService::init(null, $mer_id);
-                    $res = $upload->to('routine/activity/bargain/code')->validate()->stream($res, $name);
-                    if ($res === false) {
-                        return app('json')->fail($upload->getError());
-                    }
-                    $imageInfo = $upload->getUploadInfo();
-                    $imageInfo['image_type'] = $uploadType;
-                    if ($imageInfo['image_type'] == 1) $remoteImage = UtilService::remoteImage($siteUrl . $imageInfo['dir']);
-                    else $remoteImage = UtilService::remoteImage($imageInfo['dir']);
-                    if (!$remoteImage['status']) return app('json')->fail($remoteImage['msg']);
-                    SystemAttachment::attachmentAdd($imageInfo['name'], $imageInfo['size'], $imageInfo['type'], $imageInfo['dir'], $imageInfo['thumb_path'], 1, $imageInfo['image_type'], $imageInfo['time'], 2);
-                    $url = $imageInfo['dir'];
-                } else $url = $imageInfo['att_dir'];
-                $data['url'] = $url;
-                if ($imageInfo['image_type'] == 1)
-                    $data['url'] = $siteUrl . $url;
-                $posterImage = UtilService::setShareMarketingPoster($data, 'routine/activity/bargain/poster');
-                if (!is_array($posterImage)) return app('json')->fail('海报生成失败');
-                SystemAttachment::attachmentAdd($posterImage['name'], $posterImage['size'], $posterImage['type'], $posterImage['dir'], $posterImage['thumb_path'], 1, $posterImage['image_type'], $posterImage['time'], 2);
-                if ($posterImage['image_type'] == 1) $posterImage['dir'] = $siteUrl . $posterImage['dir'];
-                $routinePosterImage = set_http_type($posterImage['dir'], 0);//小程序推广海报
-                return app('json')->successful(['url' => $routinePosterImage]);
-            } else if ($from == 'wechat') {
-                //公众号
-                $name = $bargainId . '_' . $user['uid'] . '_' . $user['is_promoter'] . '_bargain_share_wap.jpg';
-                $imageInfo = SystemAttachment::getInfo($name, 'name');
-                if (!$imageInfo) {
-                    $codeUrl = set_http_type($siteUrl . '/pages/activity/goods_bargain_details/index?id=' . $bargainId . '&bargain=' . $user['uid'] . '&spread=' . $user['uid'], 1);//二维码链接
-                    $imageInfo = UtilService::getQRCodePath($codeUrl, $name);
-                    if (is_string($imageInfo)) {
-                        return app('json')->fail('二维码生成失败', ['error' => $imageInfo]);
-                    }
-                    SystemAttachment::attachmentAdd($imageInfo['name'], $imageInfo['size'], $imageInfo['type'], $imageInfo['dir'], $imageInfo['thumb_path'], 1, $imageInfo['image_type'], $imageInfo['time'], 2);
-                    $url = $imageInfo['dir'];
-                } else $url = $imageInfo['att_dir'];
-                $data['url'] = $url;
-                if ($imageInfo['image_type'] == 1) $data['url'] = $siteUrl . $url;
-                $posterImage = UtilService::setShareMarketingPoster($data, 'wap/activity/bargain/poster');
-                if (!is_array($posterImage)) return app('json')->fail('海报生成失败');
-                SystemAttachment::attachmentAdd($posterImage['name'], $posterImage['size'], $posterImage['type'], $posterImage['dir'], $posterImage['thumb_path'], 1, $posterImage['image_type'], $posterImage['time'], 2);
-                if ($posterImage['image_type'] == 1) $posterImage['dir'] = $siteUrl . $posterImage['dir'];
-                $wapPosterImage = set_http_type($posterImage['dir'], 1);//公众号推广海报
-                return app('json')->successful(['url' => $wapPosterImage]);
-            }
-            return app('json')->fail('参数错误');
-        } catch (\Exception $e) {
-            return app('json')->fail(['line' => $e->getLine(), 'message' => $e->getMessage()]);
-        }
-    }
-
-
-}

+ 0 - 295
app/api/controller/activity/StoreCombinationController.php

@@ -1,295 +0,0 @@
-<?php
-
-namespace app\api\controller\activity;
-
-use app\models\store\StoreDescription;
-use app\models\store\StoreProductAttr;
-use app\models\store\StoreProductAttrValue;
-use app\models\store\StoreProductRelation;
-use app\models\system\SystemAttachment;
-use app\models\routine\RoutineCode;
-use app\models\store\StoreCombination;
-use app\models\store\StorePink;
-use app\models\store\StoreProductReply;
-use app\Request;
-use crmeb\services\QrcodeService;
-use crmeb\services\SystemConfigService;
-use crmeb\services\UploadService;
-use crmeb\services\UtilService;
-use Exception;
-use think\db\exception\DataNotFoundException;
-use think\db\exception\DbException;
-use think\db\exception\ModelNotFoundException;
-
-/**
- * 拼团类
- * Class StoreCombinationController
- * @package app\api\controller\activity
- */
-class StoreCombinationController
-{
-
-    /**
-     * 拼团列表
-     * @param Request $request
-     * @return mixed
-     * @throws Exception
-     */
-    public function lst(Request $request)
-    {
-        list($page, $limit) = UtilService::getMore([
-            ['page', 1],
-            ['limit', 10],
-        ], $request, true);
-        $combinationList = StoreCombination::getAll($page, $limit, $request->mer_id());
-        if (!count($combinationList)) return app('json')->successful([]);
-        return app('json')->successful($combinationList->hidden(['info', 'product_id', 'images', 'mer_id', 'attr', 'sort', 'stock', 'sales', 'add_time', 'is_del', 'is_show', 'browse', 'cost', 'is_show', 'start_time', 'stop_time', 'postage', 'is_postage', 'is_host', 'mer_use', 'combination'])->toArray());
-    }
-
-
-    /**
-     * 拼团商品详情
-     * @param Request $request
-     * @param $id
-     * @return mixed
-     */
-    public function detail(Request $request, $id)
-    {
-        if (!$id || !($combinationOne = StoreCombination::getCombinationOne($id))) return app('json')->fail('拼团不存在或已下架');
-        $combinationOne = $combinationOne->hidden(['mer_id', 'attr', 'sort', 'add_time', 'is_host', 'is_show', 'is_del', 'mer_use', 'cost', 'combination'])->toArray();
-        $combinationOne['images'] = json_decode($combinationOne['images'], true);
-        list($pink, $pindAll) = StorePink::getPinkAll($id, true);//拼团列表
-        $siteUrl = sys_config('site_url');
-        $combinationOne['image'] = set_file_url($combinationOne['image'], $siteUrl);
-        $combinationOne['image_base'] = set_file_url($combinationOne['image'], $siteUrl);
-        $combinationOne['code_base'] = QrcodeService::getWechatQrcodePath($id . '_combination_detail_wap.jpg', '/pages/activity/goods_combination_status/index?id=' . $id);
-        $combinationOne['sale_stock'] = 0;
-        if ($combinationOne['stock'] > 0) $combinationOne['sale_stock'] = 1;
-        if (!strlen(trim($combinationOne['unit_name']))) $combinationOne['unit_name'] = '个';
-        $uid = $request->uid();
-        $combinationOne['userCollect'] = StoreProductRelation::isProductRelation($combinationOne['product_id'], $uid, 'collect');
-        $combinationOne['description'] = htmlspecialchars_decode(StoreDescription::getDescription($id, 3));
-        $data['pink'] = $pink;
-        $data['pindAll'] = $pindAll;
-        $data['storeInfo'] = $combinationOne;
-        $data['pink_ok_list'] = StorePink::getPinkOkList($uid);
-        $data['pink_ok_sum'] = StorePink::getPinkOkSumTotalNum($id);
-        $data['reply'] = StoreProductReply::getRecProductReply($combinationOne['product_id']);
-        $data['replyCount'] = StoreProductReply::productValidWhere()->where('product_id', $combinationOne['product_id'])->count();
-        if ($data['replyCount']) {
-            $goodReply = StoreProductReply::productValidWhere()->where('product_id', $combinationOne['product_id'])->where('product_score', 5)->count();
-            $data['replyChance'] = $goodReply;
-            if ($goodReply) {
-                $data['replyChance'] = bcdiv($goodReply, $data['replyCount'], 2);
-                $data['replyChance'] = bcmul($data['replyChance'], 100, 3);
-            }
-        } else $data['replyChance'] = 100;
-        list($productAttr, $productValue) = StoreProductAttr::getProductAttrDetail($id, $uid, 0, 3);
-        foreach ($productValue as $k => $v) {
-            $productValue[$k]['product_stock'] = StoreProductAttrValue::where('product_id', $combinationOne['product_id'])->where('suk', $v['suk'])->where('type', 0)->value('stock');
-        }
-        $data['productAttr'] = $productAttr;
-        $data['productValue'] = $productValue;
-        return app('json')->successful($data);
-    }
-
-    /**
-     * 拼团 开团
-     * @param Request $request
-     * @param $id
-     * @return mixed
-     * @throws DataNotFoundException
-     * @throws DbException
-     * @throws ModelNotFoundException
-     */
-    public function pink(Request $request, $id)
-    {
-        $is_ok = 0;//判断拼团是否完成
-        $userBool = 0;//判断当前用户是否在团内  0未在 1在
-        $pinkBool = 0;//判断拼团是否成功  0未在 1在
-        $user = $request->user();
-        if (!$id) return app('json')->fail('参数错误');
-        $pink = StorePink::getPinkUserOne($id, $request->mer_id());
-        if (!$pink) return app('json')->fail('参数错误');
-        if (isset($pink['is_refund']) && $pink['is_refund']) {
-            if ($pink['is_refund'] != $pink['id']) {
-                $id = $pink['is_refund'];
-                return $this->pink($request, $id);
-            } else {
-                return app('json')->fail('订单已退款');
-            }
-        }
-        list($pinkAll, $pinkT, $count, $idAll, $uidAll) = StorePink::getPinkMemberAndPinkK($pink);
-        if ($pinkT['status'] == 2) {
-            $pinkBool = 1;
-            $is_ok = 1;
-        } else if ($pinkT['status'] == 3) {
-            $pinkBool = -1;
-            $is_ok = 0;
-        } else {
-            if ($count < 1) {//组团完成
-                $is_ok = 1;
-                $pinkBool = StorePink::PinkComplete($uidAll, $idAll, $user['uid'], $pinkT);
-            } else {
-                $pinkBool = StorePink::PinkFail($pinkAll, $pinkT, $pinkBool);
-            }
-        }
-        if (!empty($pinkAll)) {
-            foreach ($pinkAll as $v) {
-                if ($v['uid'] == $user['uid']) $userBool = 1;
-            }
-        }
-        if ($pinkT['uid'] == $user['uid']) $userBool = 1;
-        if ($pinkBool) {
-            $combinationOne = StoreCombination::getCombinationById($pink['cid'], $request->mer_id());
-            if (!$combinationOne) return app('json')->fail('拼团不存在或已下架');
-        }else{
-            $combinationOne = StoreCombination::getCombinationOne($pink['cid'], $request->mer_id());
-            if (!$combinationOne) return app('json')->fail('拼团不存在或已下架');
-        }
-        $data['userInfo']['uid'] = $user['uid'];
-        $data['userInfo']['nickname'] = $user['nickname'];
-        $data['userInfo']['avatar'] = $user['avatar'];
-        $data['is_ok'] = $is_ok;
-        $data['userBool'] = $userBool;
-        $data['pinkBool'] = $pinkBool;
-        $data['store_combination'] = $combinationOne->hidden(['mer_id', 'images', 'attr', 'info', 'sort', 'sales', 'stock', 'add_time', 'is_host', 'is_show', 'is_del', 'combination', 'mer_use', 'is_postage', 'postage', 'start_time', 'stop_time', 'cost', 'browse', 'product_price'])->toArray();
-        $data['pinkT'] = $pinkT;
-        $data['pinkAll'] = $pinkAll;
-        $data['count'] = $count <= 0 ? 0 : $count;
-        $data['store_combination_host'] = StoreCombination::getCombinationHost(0, $request->mer_id());
-        $data['current_pink_order'] = StorePink::getCurrentPink($id, $user['uid']);
-        list($productAttr, $productValue) = StoreProductAttr::getProductAttrDetail($combinationOne['id'], $user['uid'], 0, 3);
-        foreach ($productValue as $k => $v) {
-            $productValue[$k]['product_stock'] = StoreProductAttrValue::where('product_id', $combinationOne['product_id'])->where('suk', $v['suk'])->where('type', 0)->value('stock');
-        }
-        $data['store_combination']['productAttr'] = $productAttr;
-        $data['store_combination']['productValue'] = $productValue;
-        return app('json')->successful($data);
-    }
-
-    /**
-     * 拼团 取消开团
-     * @param Request $request
-     * @return mixed
-     * @throws Exception
-     */
-    public function remove(Request $request)
-    {
-        list($id, $cid) = UtilService::postMore([
-            ['id', 0],
-            ['cid', 0],
-        ], $request, true);
-        if (!$id || !$cid) return app('json')->fail('缺少参数');
-        $res = StorePink::removePink($request->uid(), $cid, $id);
-        if ($res) {
-            return app('json')->successful('取消成功');
-        }
-        $error = StorePink::getErrorInfo();
-        if (is_array($error)) return app('json')->status($error['status'], $error['msg']);
-        return app('json')->fail($error);
-    }
-
-
-    /**
-     * 拼团海报
-     * @param Request $request
-     * @return mixed
-     * @throws Exception
-     */
-    public function poster(Request $request)
-    {
-        $mer_id = $request->mer_id();
-        list($pinkId, $from) = UtilService::postMore([['id', 0], ['from', 'wechat']], $request, true);
-        if (!$pinkId) return app('json')->fail('参数错误');
-        $user = $request->user();
-        $pinkInfo = StorePink::getPinkUserOne($pinkId, $request->mer_id());
-        $storeCombinationInfo = StoreCombination::getCombinationOne($pinkInfo['cid']);
-        $data['title'] = $storeCombinationInfo['title'];
-        $data['image'] = $storeCombinationInfo['image'];
-        $data['price'] = $pinkInfo['total_price'];
-        $data['label'] = $pinkInfo['people'] . '人团';
-        if ($pinkInfo['k_id']) $pinkAll = StorePink::getPinkMember($pinkInfo['k_id']);
-        else $pinkAll = StorePink::getPinkMember($pinkInfo['id']);
-        $count = count($pinkAll) + 1;
-        $data['msg'] = '原价¥' . $storeCombinationInfo['product_price'] . ' 还差' . (int)bcsub((int)$pinkInfo['people'], $count, 0) . '人拼团成功';
-        try {
-            $siteUrl = sys_config('site_url', '', $mer_id);
-            if ($from == 'routine') {
-                //小程序
-                $name = $pinkId . '_' . $user['uid'] . '_' . $user['is_promoter'] . '_pink_share_routine.jpg';
-                $imageInfo = SystemAttachment::getInfo($name, 'name');
-                if (!$imageInfo) {
-                    $valueData = 'id=' . $pinkId;
-                    if ($user['is_promoter'] || sys_config('store_brokerage_statu', '', $mer_id) == 2) $valueData .= '&pid=' . $user['uid'];
-                    $res = RoutineCode::getPageCode('pages/activity/goods_combination_status/index', $valueData, 280, $mer_id);
-                    if (!$res) return app('json')->fail('二维码生成失败');
-                    $uploadType = (int)sys_config('upload_type', 1, $mer_id);
-                    $upload = UploadService::init(null, $mer_id);
-                    $res = $upload->to('routine/activity/pink/code')->validate()->stream($res, $name);
-                    if ($res === false) {
-                        return app('json')->fail($upload->getError());
-                    }
-                    $imageInfo = $upload->getUploadInfo();
-                    $imageInfo['image_type'] = $uploadType;
-                    if ($imageInfo['image_type'] == 1) $remoteImage = UtilService::remoteImage($siteUrl . $imageInfo['dir']);
-                    else $remoteImage = UtilService::remoteImage($imageInfo['dir']);
-                    if (!$remoteImage['status']) return app('json')->fail($remoteImage['msg']);
-                    SystemAttachment::attachmentAdd($imageInfo['name'], $imageInfo['size'], $imageInfo['type'], $imageInfo['dir'], $imageInfo['thumb_path'], 1, $imageInfo['image_type'], $imageInfo['time'], 2);
-                    $url = $imageInfo['dir'];
-                } else $url = $imageInfo['att_dir'];
-                $data['url'] = $url;
-                if ($imageInfo['image_type'] == 1)
-                    $data['url'] = $siteUrl . $url;
-                $posterImage = UtilService::setShareMarketingPoster($data, 'routine/activity/pink/poster');
-                if (!is_array($posterImage)) return app('json')->fail('海报生成失败');
-                SystemAttachment::attachmentAdd($posterImage['name'], $posterImage['size'], $posterImage['type'], $posterImage['dir'], $posterImage['thumb_path'], 1, $posterImage['image_type'], $posterImage['time'], 2);
-                if ($posterImage['image_type'] == 1) $posterImage['dir'] = $siteUrl . $posterImage['dir'];
-                $routinePosterImage = set_http_type($posterImage['dir'], 0);//小程序推广海报
-                return app('json')->successful(['url' => $routinePosterImage]);
-            } else if ($from == 'wechat') {
-                //公众号
-                $name = $pinkId . '_' . $user['uid'] . '_' . $user['is_promoter'] . '_pink_share_wap.jpg';
-                $imageInfo = SystemAttachment::getInfo($name, 'name');
-                if (!$imageInfo) {
-                    $codeUrl = set_http_type($siteUrl . '/pages/activity/goods_combination_status/index?id=' . $pinkId . '&spread=' . $user['uid'], 1);//二维码链接
-                    $imageInfo = UtilService::getQRCodePath($codeUrl, $name);
-                    if (is_string($imageInfo)) {
-                        return app('json')->fail('二维码生成失败', ['error' => $imageInfo]);
-                    }
-                    SystemAttachment::attachmentAdd($imageInfo['name'], $imageInfo['size'], $imageInfo['type'], $imageInfo['dir'], $imageInfo['thumb_path'], 1, $imageInfo['image_type'], $imageInfo['time'], 2);
-                    $url = $imageInfo['dir'];
-                } else $url = $imageInfo['att_dir'];
-                $data['url'] = $url;
-                if ($imageInfo['image_type'] == 1) $data['url'] = $siteUrl . $url;
-                $posterImage = UtilService::setShareMarketingPoster($data, 'wap/activity/pink/poster');
-                if (!is_array($posterImage)) return app('json')->fail('海报生成失败');
-                SystemAttachment::attachmentAdd($posterImage['name'], $posterImage['size'], $posterImage['type'], $posterImage['dir'], $posterImage['thumb_path'], 1, $posterImage['image_type'], $posterImage['time'], 2);
-                if ($posterImage['image_type'] == 1) $posterImage['dir'] = $siteUrl . $posterImage['dir'];
-                $wapPosterImage = set_http_type($posterImage['dir'], 1);//公众号推广海报
-                return app('json')->successful(['url' => $wapPosterImage]);
-            }
-            return app('json')->fail('参数错误');
-        } catch (Exception $e) {
-            return app('json')->fail(['line' => $e->getLine(), 'message' => $e->getMessage()]);
-        }
-
-
-    }
-
-    /**
-     * 获取秒杀小程序二维码
-     * @param Request $request
-     * @param $id
-     * @return mixed
-     */
-    public function code(Request $request, $id)
-    {
-        $url = QrcodeService::getRoutineQrcodePath($id, $request->uid(), 1, [], $request->mer_id());
-        if ($url) {
-            return app('json')->success(['code' => $url]);
-        } else {
-            return app('json')->success(['code' => '']);
-        }
-    }
-}

+ 0 - 74
app/api/controller/activity/StoreRechargeCardController.php

@@ -1,74 +0,0 @@
-<?php
-
-namespace app\api\controller\activity;
-
-use app\models\store\StoreRechargeCard;
-use app\models\user\UserRechargeCard;
-use app\models\user\User;
-use app\Request;
-use crmeb\services\UtilService;
-use crmeb\services\CacheService;
-
-/**
- * 充值卡类
- * Class StoreRechargeCardController
- * @package app\api\controller\activity
- */
-class StoreRechargeCardController
-{
-	/**
-     * 充值卡列表选择
-     */
-    public function index(Request $request)
-    {
-        $rechargeCard = StoreRechargeCard::getAll($request->mer_id());
-        if (!count($rechargeCard)) return app('json')->successful([]);
-        return app('json')->successful($rechargeCard->toArray());
-    }
-
-    /**
-     * 充值卡详情
-     */
-    public function detail(Request $request, $id)
-    {
-    	if (!$id || !($rechargeCardOne = StoreRechargeCard::getRechargeCardOne($id))) return app('json')->fail('充值卡不存在或已下架');
-    	return app('json')->successful($rechargeCardOne->toArray());
-    }
-
-    /**
-     * 充值卡购买
-     */
-    public function buy_recharge_card(Request $request)
-    {
-    	list($id, $uid) = UtilService::getMore([
-    		['id', ''],
-            ['uid', ''],
-        ], $request, true);
-        if (!$id) return app('json')->fail('参数错误');
-        if (!$chargeCardOne = StoreRechargeCard::getRechargeCardOne($id)) return app('json')->fail('充值卡不存在或已下架');
-        if ($uid && !User::find($uid)) return app('json')->fail('此用户不存在');
-        $status = $chargeCardOne['is_brokerage'] ? 1 : 0;
-        $rechargeOrder = UserRechargeCard::addRecharge($request->uid(), $id, $chargeCardOne['price'], $chargeCardOne['give_money'], 0, $chargeCardOne['is_brokerage'], $uid, $status, $request->mer_id());
-    	if (!$rechargeOrder) return app('json')->fail('充值订单生成失败!');
-        try {
-            return app('json')->successful(UserRechargeCard::jsPay($rechargeOrder, $request->mer_id()));
-        } catch (\Exception $e) {
-            return app('json')->fail($e->getMessage());
-        }
-    }
-
-    /**
-     * 获取用户充值记录
-     */
-    public function get_user_recharge_card_list(Request $request)
-    {
-        $where = UtilService::getMore([
-            ['page', 1],
-            ['limit', 20]
-        ], $request);
-        $where['uid'] = $request->uid();
-        $where['mer_id'] = $request->mer_id();
-        $where['paid'] = 1;
-        return app('json')->successful(UserRechargeCard::getUsereRechargeCardList($where));
-    }
-}

+ 0 - 177
app/api/controller/activity/StoreSeckillController.php

@@ -1,177 +0,0 @@
-<?php
-
-namespace app\api\controller\activity;
-
-use app\models\store\StoreDescription;
-use app\models\store\StoreProductAttr;
-use app\models\store\StoreProductAttrValue;
-use app\models\store\StoreVisit;
-use app\models\system\SystemAttachment;
-use app\models\store\StoreProductRelation;
-use app\models\store\StoreProductReply;
-use app\models\store\StoreSeckill;
-use app\Request;
-use crmeb\services\GroupDataService;
-use crmeb\services\QrcodeService;
-use crmeb\services\SystemConfigService;
-use crmeb\services\UtilService;
-use Exception;
-use think\db\exception\DataNotFoundException;
-use think\db\exception\DbException;
-use think\db\exception\ModelNotFoundException;
-
-/**
- * 秒杀商品类
- * Class StoreSeckillController
- * @package app\api\controller\activity
- */
-class StoreSeckillController
-{
-    /**
-     * 秒杀商品时间区间
-     * @param Request $request
-     * @return mixed
-     */
-    public function index(Request $request)
-    {
-        //秒杀时间段
-        $seckillTime = GroupDataService::getData('routine_seckill_time', 0, true, $request->mer_id()) ?? [];
-        $seckillTimeIndex = 0;
-        if (count($seckillTime)) {
-            foreach ($seckillTime as $key => &$value) {
-                $currentHour = date('H');
-                $activityEndHour = bcadd((int)$value['time'], (int)$value['continued'], 0);
-                if ($activityEndHour > 24) {
-                    $value['time'] = strlen((int)$value['time']) == 2 ? (int)$value['time'] . ':00' : '0' . (int)$value['time'] . ':00';
-                    $value['state'] = '即将开始';
-                    $value['status'] = 2;
-                    $value['stop'] = (int)bcadd(strtotime(date('Y-m-d')), bcmul($activityEndHour, 3600, 0));
-                } else {
-                    if ($currentHour >= (int)$value['time'] && $currentHour < $activityEndHour) {
-                        $value['time'] = strlen((int)$value['time']) == 2 ? (int)$value['time'] . ':00' : '0' . (int)$value['time'] . ':00';
-                        $value['state'] = '抢购中';
-                        $value['stop'] = (int)bcadd(strtotime(date('Y-m-d')), bcmul($activityEndHour, 3600, 0));
-                        $value['status'] = 1;
-                        if (!$seckillTimeIndex) $seckillTimeIndex = $key;
-                    } else if ($currentHour < (int)$value['time']) {
-                        $value['time'] = strlen((int)$value['time']) == 2 ? (int)$value['time'] . ':00' : '0' . (int)$value['time'] . ':00';
-                        $value['state'] = '即将开始';
-                        $value['status'] = 2;
-                        $value['stop'] = (int)bcadd(strtotime(date('Y-m-d')), bcmul($activityEndHour, 3600, 0));
-                    } else if ($currentHour >= $activityEndHour) {
-                        $value['time'] = strlen((int)$value['time']) == 2 ? (int)$value['time'] . ':00' : '0' . (int)$value['time'] . ':00';
-                        $value['state'] = '已结束';
-                        $value['status'] = 0;
-                        $value['stop'] = (int)bcadd(strtotime(date('Y-m-d')), bcmul($activityEndHour, 3600, 0));
-                    }
-                }
-            }
-        }
-        $data['lovely'] = SystemConfigService::get('seckill_header_banner', '', false, $request->mer_id());
-        if (strstr($data['lovely'], 'http') === false && strlen(trim($data['lovely']))) $data['lovely'] = SystemConfigService::get('site_url', '', false, $request->mer_id()) . $data['lovely'];
-        $data['lovely'] = str_replace('\\', '/', $data['lovely']);
-        $data['seckillTime'] = $seckillTime;
-        $data['seckillTimeIndex'] = $seckillTimeIndex;
-        return app('json')->successful($data);
-    }
-
-    /**
-     * 秒杀商品列表
-     * @param Request $request
-     * @param $time
-     * @return mixed
-     * @throws Exception
-     */
-    public function lst(Request $request, $time)
-    {
-        list($page, $limit) = UtilService::getMore([
-            ['page', 0],
-            ['limit', 0],
-        ], $request, true);
-        if (!$time) return app('json')->fail('参数错误');
-        $seckillInfo = StoreSeckill::seckillList($time, $page, $limit, $request->mer_id());
-        if (count($seckillInfo)) {
-            foreach ($seckillInfo as $key => &$item) {
-                if ($item['quota'] > 0) {
-                    $quota = StoreProductAttrValue::where('product_id', $item['id'])->where('type', 1)->value('SUM(quota)');
-                    $percent = (int)bcmul(bcdiv(bcsub($item['quota'], $quota), $item['quota'], 2), 100, 0);
-                    $item['percent'] = $percent;
-                    $item['stock'] = $quota;
-                } else {
-                    $item['percent'] = 100;
-                    $item['stock'] = 0;
-                }
-                $item['price'] = floatval($item['price']);
-                $item['ot_price'] = floatval($item['ot_price']);
-
-            }
-        }
-        return app('json')->successful($seckillInfo);
-    }
-
-    /**
-     * 秒杀商品详情
-     * @param Request $request
-     * @param $id
-     * @param int $time
-     * @return mixed
-     * @throws DataNotFoundException
-     * @throws DbException
-     * @throws ModelNotFoundException
-     */
-    public function detail(Request $request, $id, $time = 0)
-    {
-        $mer_id = $request->mer_id();
-        $storeInfo = StoreSeckill::getValidProduct($id, '*', $request->mer_id());
-        if ($storeInfo)
-            $storeInfo = $storeInfo->hidden(['cost', 'add_time', 'is_del'])->toArray();
-        else
-            $storeInfo = [];
-        if (!$id || !$storeInfo) return app('json')->fail('商品不存在或已下架!');
-        $siteUrl = sys_config('site_url', '', $mer_id);
-        $storeInfo['image'] = set_file_url($storeInfo['image'], $siteUrl);
-        $storeInfo['image_base'] = set_file_url($storeInfo['image'], $siteUrl);
-        $storeInfo['code_base'] = QrcodeService::getWechatQrcodePath($id . '_seckill_detail_wap.jpg', '/pages/activity/goods_seckill_details/index?id=' . $id . '&time=' . $time . '&status=1');
-        $uid = $request->uid();
-        $storeInfo['userLike'] = StoreProductRelation::isProductRelation($id, $uid, 'like', 'product_seckill');
-        $storeInfo['like_num'] = StoreProductRelation::productRelationNum($id, 'like', 'product_seckill');
-        $storeInfo['userCollect'] = StoreProductRelation::isProductRelation($storeInfo['product_id'], $uid, 'collect');
-        $storeInfo['uid'] = $uid;
-        $storeInfo['description'] = StoreDescription::getDescription($id, 1);
-        $data['storeInfo'] = $storeInfo;
-        StoreVisit::setView($uid, $id, $storeInfo['product_id'], 'viwe');
-        $data['reply'] = StoreProductReply::getRecProductReply($storeInfo['product_id']);
-        $data['replyCount'] = StoreProductReply::productValidWhere()->where('product_id', $storeInfo['product_id'])->count();
-        if ($data['replyCount']) {
-            $goodReply = StoreProductReply::productValidWhere()->where('product_id', $storeInfo['product_id'])->where('product_score', 5)->count();
-            $data['replyChance'] = $goodReply;
-            if ($goodReply) {
-                $data['replyChance'] = bcdiv($goodReply, $data['replyCount'], 2);
-                $data['replyChance'] = bcmul($data['replyChance'], 100, 2);
-            }
-        } else $data['replyChance'] = 100;
-        list($productAttr, $productValue) = StoreProductAttr::getProductAttrDetail($id, $uid, 0, 1);
-        foreach ($productValue as $k => $v) {
-            $productValue[$k]['product_stock'] = StoreProductAttrValue::where('product_id', $storeInfo['product_id'])->where('suk', $v['suk'])->where('type', 0)->value('stock');
-        }
-        $data['productAttr'] = $productAttr;
-        $data['productValue'] = $productValue;
-        return app('json')->successful($data);
-    }
-
-    /**
-     * 获取秒杀小程序二维码
-     * @param Request $request
-     * @param $id
-     * @return mixed
-     */
-    public function code(Request $request, $id, $stop_time = '')
-    {
-        $url = QrcodeService::getRoutineQrcodePath($id, $request->uid(), 2, compact('stop_time'), $request->mer_id());
-        if ($url) {
-            return app('json')->success(['code' => $url]);
-        } else {
-            return app('json')->success(['code' => '']);
-        }
-    }
-}

+ 0 - 1
app/api/controller/admin/.WeDrive

@@ -1 +0,0 @@
-/Users/huangjianfeng/WeDrive/六牛科技/源码/CRMEB_PRO_v1.0.0(9)/app/api/controller/admin

+ 0 - 406
app/api/controller/admin/StoreOrderController.php

@@ -1,406 +0,0 @@
-<?php
-
-namespace app\api\controller\admin;
-
-use app\models\store\StoreOrder;
-use app\models\store\StoreOrderStatus;
-use app\models\store\StorePink;
-use app\models\store\StoreService;
-use app\models\user\User;
-use app\models\user\UserBill;
-use app\Request;
-use crmeb\repositories\OrderRepository;
-use crmeb\services\MiniProgramService;
-use crmeb\services\UtilService;
-use crmeb\services\WechatService;
-
-/**
- * 订单类
- * Class StoreOrderController
- * @package app\api\controller\admin\order
- */
-class StoreOrderController
-{
-    /**
-     *  订单数据统计
-     * @param Request $request
-     * @return mixed
-     */
-    public function statistics(Request $request)
-    {
-        $uid = $request->uid();
-        if (!StoreService::orderServiceStatus($uid))
-            return app('json')->fail('权限不足');
-        $dataCount = StoreOrder::getOrderDataAdmin();
-        $dataPrice = StoreOrder::getOrderTimeData();
-        $data = array_merge($dataCount, $dataPrice);
-        return app('json')->successful($data);
-    }
-
-    /**
-     * 订单每月统计数据
-     * @param Request $request
-     * @return mixed
-     */
-    public function data(Request $request)
-    {
-        $uid = $request->uid();
-        if (!StoreService::orderServiceStatus($uid))
-            return app('json')->fail('权限不足');
-        list($page, $limit) = UtilService::getMore([['page', 1], ['limit', 7]], $request, true);
-        if (!$limit) return app('json')->successful([]);
-        $data = StoreOrder::getOrderDataPriceCount($page, $limit);
-        if ($data) return app('json')->successful($data->toArray());
-        return app('json')->successful([]);
-    }
-
-    /**
-     * 订单列表
-     * @param Request $request
-     * @return mixed
-     */
-    public function lst(Request $request)
-    {
-        $uid = $request->uid();
-        if (!StoreService::orderServiceStatus($uid))
-            return app('json')->fail('权限不足');
-        $where = UtilService::getMore([
-            ['status', ''],
-            ['is_del', 0],
-            ['data', ''],
-            ['type', ''],
-            ['order', ''],
-            ['page', 0],
-            ['limit', 0]
-        ], $request);
-        if (!$where['limit']) return app('json')->successful([]);
-        return app('json')->successful(StoreOrder::orderList($where));
-    }
-
-    /**
-     * 订单详情
-     * @param Request $request
-     * @param $orderId
-     * @return mixed
-     * @throws \think\Exception
-     * @throws \think\db\exception\DataNotFoundException
-     * @throws \think\db\exception\ModelNotFoundException
-     * @throws \think\exception\DbException
-     */
-    public function detail(Request $request, $orderId)
-    {
-        $uid = $request->uid();
-        if (!StoreService::orderServiceStatus($uid))
-            return app('json')->fail('权限不足');
-        $order = StoreOrder::getAdminOrderDetail($orderId, 'id,uid,order_id,add_time,status,total_num,total_price,total_postage,pay_price,pay_postage,paid,refund_status,remark,pink_id,combination_id,mark,seckill_id,bargain_id,delivery_type,pay_type,real_name,user_phone,user_address,coupon_price,freight_price,delivery_name,delivery_type,delivery_id');
-        if (!$order) return app('json')->fail('订单不存在');
-        $order = $order->toArray();
-        $nickname = User::getUserInfo($order['uid'], 'nickname')['nickname'];
-        $orderInfo = StoreOrder::tidyAdminOrder([$order], true)[0];
-        unset($orderInfo['uid'], $orderInfo['seckill_id'], $orderInfo['pink_id'], $orderInfo['combination_id'], $orderInfo['bargain_id'], $orderInfo['status'], $orderInfo['total_postage']);
-        $orderInfo['nickname'] = $nickname;
-        return app('json')->successful('ok', $orderInfo);
-    }
-
-    /**
-     * 订单发货获取订单信息
-     * @param Request $request
-     * @param $orderId
-     * @return mixed
-     * @throws \think\Exception
-     * @throws \think\db\exception\DataNotFoundException
-     * @throws \think\db\exception\ModelNotFoundException
-     * @throws \think\exception\DbException
-     */
-    public function delivery_gain(Request $request, $orderId)
-    {
-        $uid = $request->uid();
-        if (!StoreService::orderServiceStatus($uid))
-            return app('json')->fail('权限不足');
-        $order = StoreOrder::getAdminOrderDetail($orderId, 'real_name,user_phone,user_address,order_id,uid,status,paid');
-        if (!$order) return app('json')->fail('订单不存在');
-        if ($order['paid']) {
-            $order['nickname'] = User::getUserInfo($order['uid'], 'nickname')['nickname'];
-            $order = $order->hidden(['uid', 'status', 'paid'])->toArray();
-            return app('json')->successful('ok', $order);
-        }
-        return app('json')->fail('状态错误');
-    }
-
-    /**
-     * 订单发货
-     * @param Request $request
-     * @return mixed
-     * @throws \think\db\exception\DataNotFoundException
-     * @throws \think\db\exception\ModelNotFoundException
-     * @throws \think\exception\DbException
-     */
-    public function delivery_keep(Request $request)
-    {
-        $uid = $request->uid();
-        if (!StoreService::orderServiceStatus($uid))
-            return app('json')->fail('权限不足');
-        list($order_id, $delivery_type, $delivery_name, $delivery_id) = UtilService::postMore([
-            ['order_id', ''],
-            ['delivery_type', 0],
-            ['delivery_name', ''],
-            ['delivery_id', ''],
-        ], $request, true);
-        $order = StoreOrder::getAdminOrderDetail($order_id, 'id,status,paid');
-        if (!$order) return app('json')->fail('订单不存在');
-        if (!$order['status'] && $order['paid']) {
-            $deliveryTypeArr = ['send', 'express', 'fictitious'];
-            if (!strlen(trim($delivery_type))) return app('json')->fail('请填写发货方式');
-            if (!in_array($delivery_type, $deliveryTypeArr)) return app('json')->fail('发货方式错误');
-            if ($delivery_type == 'express') {
-                if (!strlen(trim($delivery_name))) return app('json')->fail('请选择快递公司');
-                if (!strlen(trim($delivery_id))) return app('json')->fail('请填写快递单号');
-            }
-            if ($delivery_type == 'send') {
-                if (!strlen(trim($delivery_name))) return app('json')->fail('请填写发货人');
-                if (!strlen(trim($delivery_id))) return app('json')->fail('请填写发货手机号');
-            }
-            $data['status'] = 1;
-            $data['delivery_type'] = $delivery_type;
-            $data['delivery_name'] = $delivery_name;
-            $data['delivery_id'] = $delivery_id;
-            $res = StoreOrder::edit($data, $order['id'], 'id');
-            if ($res) {
-                if ($delivery_type == 'express') {
-                    StoreOrderStatus::status($order['id'], 'delivery_goods', '已发货 快递公司:' . $data['delivery_name'] . ' 快递单号:' . $data['delivery_id']);
-                } else if ($delivery_type == 'send') {
-                    StoreOrderStatus::status($order['id'], 'delivery', '已配送 发货人:' . $delivery_name . ' 发货人电话:' . $delivery_id);
-                } else if ($delivery_type == 'fictitious') {
-                    StoreOrderStatus::status($order['id'], 'delivery_fictitious', '虚拟商品已发货');
-                }
-            }
-            event('StoreProductOrderDeliveryGoodsAfter', [$data, $order['id']]);
-            return app('json')->successful('发货成功!');
-        }
-        return app('json')->fail('状态错误');
-    }
-
-    /**
-     * 订单改价
-     * @param Request $request
-     * @return mixed
-     * @throws \think\db\exception\DataNotFoundException
-     * @throws \think\db\exception\ModelNotFoundException
-     * @throws \think\exception\DbException
-     */
-    public function price(Request $request)
-    {
-        $uid = $request->uid();
-        if (!StoreService::orderServiceStatus($uid))
-            return app('json')->fail('权限不足');
-        list($order_id, $price) = UtilService::postMore([
-            ['order_id', ''],
-            ['price', '']
-        ], $request, true);
-        $order = StoreOrder::getAdminOrderDetail($order_id, 'id,paid,pay_price,order_id,total_price,total_postage,pay_postage,gain_integral');
-        if (!$order) return app('json')->fail('订单不存在');
-        $order = $order->toArray();
-        if (!$order['paid']) {
-            if ($price === '') return app('json')->fail('请填写实际支付金额');
-            if ($price < 0) return app('json')->fail('实际支付金额不能小于0元');
-            if ($order['pay_price'] == $price) return app('json')->successful('修改成功');
-            if (!StoreOrder::edit(['pay_price' => $price], $order['id'], 'id'))
-                return app('json')->fail('状态错误');
-            $order['pay_price'] = $price;
-            event('StoreProductOrderEditAfter', [$order, $order['id']]);
-            StoreOrderStatus::status($order['id'], 'order_edit', '修改实际支付金额' . $price);
-            return app('json')->successful('修改成功');
-        }
-        return app('json')->fail('状态错误');
-    }
-
-    /**
-     * 订单备注
-     * @param Request $request
-     * @return mixed
-     * @throws \think\db\exception\DataNotFoundException
-     * @throws \think\db\exception\ModelNotFoundException
-     * @throws \think\exception\DbException
-     */
-    public function remark(Request $request)
-    {
-        $uid = $request->uid();
-        if (!StoreService::orderServiceStatus($uid))
-            return app('json')->fail('权限不足');
-        list($order_id, $remark) = UtilService::postMore([
-            ['order_id', ''],
-            ['remark', '']
-        ], $request, true);
-        $order = StoreOrder::getAdminOrderDetail($order_id, 'id');
-        if (!$order) return app('json')->fail('订单不存在');
-        $order = $order->toArray();
-        if (!strlen(trim($remark))) return app('json')->fail('请填写备注内容');
-        if (!StoreOrder::edit(['remark' => $remark], $order['id']))
-            return app('json')->fail('备注失败');
-        return app('json')->successful('备注成功');
-    }
-
-    /**
-     * 订单交易额/订单数量时间统计
-     * @param Request $request
-     * @return bool
-     */
-    public function time(Request $request)
-    {
-        $uid = $request->uid();
-        if (!StoreService::orderServiceStatus($uid))
-            return app('json')->fail('权限不足');
-        list($start, $stop, $type) = UtilService::getMore([
-            ['start', strtotime(date('Y-m'))],
-            ['stop', time()],
-            ['type', 1]
-        ], $request, true);
-        if ($start == $stop) return false;
-        if ($start > $stop) {
-            $middle = $stop;
-            $stop = $start;
-            $start = $middle;
-        }
-        $space = bcsub($stop, $start, 0);//间隔时间段
-        $front = bcsub($start, $space, 0);//第一个时间段
-        if ($type == 1) {//销售额
-            $frontPrice = StoreOrder:: getOrderTimeBusinessVolumePrice($front, $start);
-            $afterPrice = StoreOrder:: getOrderTimeBusinessVolumePrice($start, $stop);
-            $chartInfo = StoreOrder::chartTimePrice($start, $stop);
-            $data['chart'] = $chartInfo;//营业额图表数据
-            $data['time'] = $afterPrice;//时间区间营业额
-            $increase = (float)bcsub($afterPrice, $frontPrice, 2); //同比上个时间区间增长营业额
-            $growthRate = abs($increase);
-            if ($growthRate == 0) $data['growth_rate'] = 0;
-            else if ($frontPrice == 0) $data['growth_rate'] = $growthRate;
-            else $data['growth_rate'] = (int)bcmul(bcdiv($growthRate, $frontPrice, 2), 100, 0);//时间区间增长率
-            $data['increase_time'] = abs($increase); //同比上个时间区间增长营业额
-            $data['increase_time_status'] = $increase >= 0 ? 1 : 2; //同比上个时间区间增长营业额增长 1 减少 2
-        } else {//订单数
-            $frontNumber = StoreOrder:: getOrderTimeBusinessVolumeNumber($front, $start);
-            $afterNumber = StoreOrder:: getOrderTimeBusinessVolumeNumber($start, $stop);
-            $chartInfo = StoreOrder::chartTimeNumber($start, $stop);
-            $data['chart'] = $chartInfo;//订单数图表数据
-            $data['time'] = $afterNumber;//时间区间订单数
-            $increase = (int)bcsub($afterNumber, $frontNumber, 0); //同比上个时间区间增长订单数
-            $growthRate = abs($increase);
-            if ($growthRate == 0) $data['growth_rate'] = 0;
-            else if ($frontNumber == 0) $data['growth_rate'] = $growthRate;
-            else $data['growth_rate'] = (int)bcmul(bcdiv($growthRate, $frontNumber, 2), 100, 0);//时间区间增长率
-            $data['increase_time'] = abs($increase); //同比上个时间区间增长营业额
-            $data['increase_time_status'] = $increase >= 0 ? 1 : 2; //同比上个时间区间增长营业额增长 1 减少 2
-        }
-        return app('json')->successful($data);
-    }
-
-    /**
-     * 订单支付
-     * @param Request $request
-     * @return mixed
-     * @throws \think\db\exception\DataNotFoundException
-     * @throws \think\db\exception\ModelNotFoundException
-     * @throws \think\exception\DbException
-     */
-    public function offline(Request $request)
-    {
-        list($orderId) = UtilService::postMore([['order_id', '']], $request, true);
-        $orderInfo = StoreOrder::getAdminOrderDetail($orderId, 'id');
-        if (!$orderInfo) return app('json')->fail('参数错误');
-        $id = $orderInfo->id;
-        $res = StoreOrder::updateOffline($id);
-        if ($res) {
-            event('StoreProductOrderOffline', [$id]);
-            StoreOrderStatus::status($id, 'offline', '线下付款');
-            return app('json')->successful('修改成功!');
-        }
-        return app('json')->fail(StoreOrder::getErrorInfo('修改失败!'));
-    }
-
-    /**
-     * 订单退款
-     * @param Request $request
-     * @return mixed
-     * @throws \think\Exception
-     * @throws \think\db\exception\DataNotFoundException
-     * @throws \think\db\exception\ModelNotFoundException
-     * @throws \think\exception\DbException
-     * @throws \think\db\exception\DbException
-     */
-    public function refund(Request $request)
-    {
-        list($orderId, $price, $type) = UtilService::postMore([
-            ['order_id', ''],
-            ['price', 0],
-            ['type', 1],
-        ], $request, true);
-        if (!strlen(trim($orderId))) return app('json')->fail('参数错误');
-        $orderInfo = StoreOrder::getAdminOrderDetail($orderId);
-        if (!$orderInfo) return app('json')->fail('数据不存在!');
-        $orderInfo = $orderInfo->toArray();
-        if ($type == 1)
-            $data['refund_status'] = 2;
-        else if ($type == 2)
-            $data['refund_status'] = 0;
-        else
-            return app('json')->fail('退款修改状态错误');
-        if ($orderInfo['pay_price'] == 0 || $type == 2) {
-            StoreOrder::update($data, ['order_id' => $orderId]);
-            return app('json')->successful('修改退款状态成功!');
-        }
-        if ($orderInfo['pay_price'] == $orderInfo['refund_price']) return app('json')->fail('已退完支付金额!不能再退款了');
-        if (!$price) return app('json')->fail('请输入退款金额');
-        $data['refund_price'] = bcadd($price, $orderInfo['refund_price'], 2);
-        $bj = bccomp((float)$orderInfo['pay_price'], (float)$data['refund_price'], 2);
-        if ($bj < 0) return app('json')->fail('退款金额大于支付金额,请修改退款金额');
-        $refundData['pay_price'] = $orderInfo['pay_price'];
-        $refundData['refund_price'] = $price;
-        if ($orderInfo['pay_type'] == 'weixin') {
-            if ($orderInfo['is_channel'] == 1) {// 小程序
-                try {
-                    MiniProgramService::payOrderRefund($orderInfo['order_id'], $refundData, $request->mer_id());
-                } catch (\Exception $e) {
-                    return app('json')->fail($e->getMessage());
-                }
-            } else {// 公众号
-                try {
-                    WechatService::payOrderRefund($orderInfo['order_id'], $refundData);
-                } catch (\Exception $e) {
-                    return app('json')->fail($e->getMessage());
-                }
-            }
-        } else if ($orderInfo['pay_type'] == 'yue') {//余额
-            StoreOrder::beginTrans();
-            $userInfo = User::getUserInfo($orderInfo['uid'], 'now_money');
-            if (!$userInfo) {
-                StoreOrder::rollbackTrans();
-                return app('json')->fail('订单用户不存在');
-            }
-            $res1 = User::bcInc($orderInfo['uid'], 'now_money', $price, 'uid');
-            $res2 = $res2 = UserBill::income('商品退款', $orderInfo['uid'], 'now_money', 'pay_product_refund', $price, $orderInfo['id'], bcadd($userInfo['now_money'], $price, 2), '订单退款到余额' . floatval($price) . '元');
-            try {
-                OrderRepository::storeOrderYueRefund($orderInfo, $refundData);
-            } catch (\Exception $e) {
-                StoreOrder::rollbackTrans();
-                return app('json')->fail($e->getMessage());
-            }
-            $res = $res1 && $res2;
-            StoreOrder::checkTrans($res);
-            if (!$res) return app('json')->fail('余额退款失败!');
-        }
-        $resEdit = StoreOrder::edit($data, $orderInfo['id'], 'id');
-        if ($resEdit) {
-            $data['type'] = $type;
-            if ($data['type'] == 1) StorePink::setRefundPink($orderInfo['id']);
-            try {
-                OrderRepository::storeProductOrderRefundY($data, $orderInfo['id']);
-            } catch (\Exception $e) {
-                return app('json')->fail($e->getMessage());
-            }
-            StoreOrderStatus::status($orderInfo['id'], 'refund_price', '退款给用户' . $price . '元');
-            return app('json')->successful('修改成功!');
-        } else {
-            StoreOrderStatus::status($orderInfo['id'], 'refund_price', '退款给用户' . $price . '元失败');
-            return app('json')->successful('修改失败!');
-        }
-    }
-}

+ 7 - 8
app/api/controller/company/SectionController.php → app/api/controller/auti/ArticleController.php

@@ -1,28 +1,27 @@
 <?php
 <?php
 
 
-namespace app\api\controller\company;
+namespace app\api\controller\auti;
 
 
-use app\models\section\SectionModel;
+use app\models\article\ArticleModel;
 use app\Request;
 use app\Request;
 use crmeb\services\UtilService;
 use crmeb\services\UtilService;
 
 
-class SectionController
+class ArticleController
 {
 {
     public function list(Request $request)
     public function list(Request $request)
     {
     {
         $where = UtilService::getMore([
         $where = UtilService::getMore([
             [['page', 'd'], 1],
             [['page', 'd'], 1],
             [['limit', 'd'], 15],
             [['limit', 'd'], 15],
-            [['status', 0], 1]
+            ['is_show', 0]
         ], $request);
         ], $request);
-        if ($where['status'] == '') $where['status'] = 1;
-        $list = SectionModel::systemPage($where);
+        $list = ArticleModel::systemPage($where);
         return app('json')->successful($list);
         return app('json')->successful($list);
     }
     }
 
 
-    public function details($id)
+    public function detail($id)
     {
     {
-        $info = SectionModel::where('is_del', 0)->find($id)->toArray();
+        $info = ArticleModel::where('is_del', 0)->find($id)->toArray();
         return app('json')->successful($info);
         return app('json')->successful($info);
     }
     }
 }
 }

+ 44 - 0
app/api/controller/auti/CourseController.php

@@ -0,0 +1,44 @@
+<?php
+
+namespace app\api\controller\auti;
+
+use app\models\course\OrganModel;
+use app\models\course\CourseModel;
+use app\Request;
+use crmeb\services\UtilService;
+
+class CourseController
+{
+    public function organList(Request $request)
+    {
+        $where = UtilService::getMore([
+            [['page', 'd'], 1],
+            [['limit', 'd'], 15]
+        ], $request);
+        $list = OrganModel::systemPage($where);
+        return app('json')->successful($list);
+    }
+
+    public function organ($id)
+    {
+        $info = OrganModel::where('is_del', 0)->find($id)->toArray();
+        return app('json')->successful($info);
+    }
+
+    public function list(Request $request)
+    {
+        $where = UtilService::getMore([
+            [['page', 'd'], 1],
+            [['limit', 'd'], 15],
+            ['area', '']
+        ], $request);
+        $list = CourseModel::systemPage($where);
+        return app('json')->successful($list);
+    }
+
+    public function detail($id)
+    {
+        $info = CourseModel::where('is_del', 0)->find($id)->toArray();
+        return app('json')->successful($info);
+    }
+}

+ 0 - 28
app/api/controller/company/CompanyController.php

@@ -1,28 +0,0 @@
-<?php
-
-namespace app\api\controller\company;
-
-use app\models\company\CompanyModel;
-use app\Request;
-use crmeb\services\UtilService;
-
-class CompanyController
-{
-    public function list(Request $request)
-    {
-        $where = UtilService::getMore([
-            ['title', ''],
-            ['sid', ''],
-            ['page', 1],
-            ['limit', 15],
-        ], $request);
-        $list = CompanyModel::systemPage($where);
-        return app('json')->successful($list);
-    }
-
-    public function details($id)
-    {
-        $info = CompanyModel::getOne($id);
-        return app('json')->successful(compact('info'));
-    }
-}

+ 0 - 1
app/api/controller/order/.WeDrive

@@ -1 +0,0 @@
-/Users/huangjianfeng/WeDrive/六牛科技/源码/CRMEB_PRO_v1.0.0(9)/app/api/controller/order

+ 0 - 735
app/api/controller/order/StoreOrderController.php

@@ -1,735 +0,0 @@
-<?php
-
-namespace app\api\controller\order;
-
-use app\models\store\StoreCouponIssue;
-use app\models\system\ShippingTemplates;
-use app\models\system\SystemAttachment;
-use app\models\store\StoreBargainUser;
-use app\models\store\StoreCart;
-use app\models\store\StoreCouponUser;
-use app\models\store\StoreOrder;
-use app\models\store\StoreOrderCartInfo;
-use app\models\store\StorePink;
-use app\models\store\StoreProductReply;
-use app\models\system\SystemStore;
-use app\models\user\User;
-use app\models\user\UserAddress;
-use app\models\user\UserLevel;
-use app\Request;
-use crmeb\services\CacheService;
-use crmeb\services\ExpressService;
-use crmeb\services\SystemConfigService;
-use crmeb\services\UtilService;
-use Exception;
-use Psr\SimpleCache\InvalidArgumentException;
-use think\db\exception\DataNotFoundException;
-use think\db\exception\DbException;
-use think\db\exception\ModelNotFoundException;
-use think\facade\Db;
-
-/**
- * 订单类
- * Class StoreOrderController
- * @package app\api\controller\order
- */
-class StoreOrderController
-{
-    /**
-     * 订单确认
-     * @param Request $request
-     * @return mixed
-     * @throws DataNotFoundException
-     * @throws DbException
-     * @throws ModelNotFoundException
-     * @throws InvalidArgumentException
-     * @throws Exception
-     */
-    public function confirm(Request $request)
-    {
-        $mer_id = $request->mer_id();
-        $temp = ShippingTemplates::merSet($request->mer_id())->order('id', 'asc')->find();
-        if (!$temp) return app('json')->fail('默认模板未配置,无法下单');
-        list($cartId) = UtilService::postMore(['cartId'], $request, true);
-        if (!is_string($cartId) || !$cartId) return app('json')->fail('请提交购买的商品');
-        $uid = $request->uid();
-        $cartGroup = StoreCart::getUserProductCartListV1($uid, $cartId, 1, $mer_id);
-        if (count($cartGroup['invalid'])) return app('json')->fail($cartGroup['invalid'][0]['productInfo']['store_name'] . '已失效!');
-        if (!$cartGroup['valid']) return app('json')->fail('请提交购买的商品');
-        if (!$cartGroup['bool']) return app('json')->fail('购物车内商品发货方式不一致');
-        $cartInfo = $cartGroup['valid'];
-        $addr = UserAddress::where('uid', $uid)->where('is_default', 1)->find();
-        $priceGroup = StoreOrder::getOrderPriceGroup($cartInfo, $addr);
-        if ($priceGroup === false) {
-            return app('json')->fail(StoreOrder::getErrorInfo('运费模板不存在'));
-        }
-        $other = [
-            'offlinePostage' => sys_config('offline_postage', '', $mer_id),
-            'integralRatio' => sys_config('integral_ratio', '', $mer_id)
-        ];
-        $usableCoupons = StoreCouponUser::getUsableCouponList($uid, $cartGroup, $priceGroup['totalPrice'], $mer_id);
-        $usableCoupon = isset($usableCoupons[0]) ? $usableCoupons[0] : null;
-        $cartIdA = explode(',', $cartId);
-        $seckill_id = 0;
-        $combination_id = 0;
-        $assistance_id = 0;
-        $bargain_id = 0;
-        if (count($cartIdA) == 1) {
-            $seckill_id = isset($cartGroup['deduction']['seckill_id']) ? $cartGroup['deduction']['seckill_id'] : 0;
-            $combination_id = isset($cartGroup['deduction']['combination_id']) ? $cartGroup['deduction']['combination_id'] : 0;
-            $assistance_id = isset($cartGroup['deduction']['assistance_id']) ? $cartGroup['deduction']['assistance_id'] : 0;
-            $bargain_id = isset($cartGroup['deduction']['bargain_id']) ? $cartGroup['deduction']['bargain_id'] : 0;
-        }
-        $data['deduction'] = $seckill_id || $combination_id || $assistance_id || $bargain_id;
-        $data['usableCoupon'] = $usableCoupon;
-        $data['addressInfo'] = UserAddress::getUserDefaultAddress($uid);
-        $data['seckill_id'] = $seckill_id;
-        $data['combination_id'] = $combination_id;
-        $data['assistance_id'] = $assistance_id;
-        $data['bargain_id'] = $bargain_id;
-        $data['cartInfo'] = $cartInfo;
-        $data['priceGroup'] = $priceGroup;
-        $data['orderKey'] = StoreOrder::cacheOrderInfo($uid, $cartInfo, $priceGroup, $other);
-        $data['offlinePostage'] = $other['offlinePostage'];
-        $vipId = UserLevel::getUserLevel($uid);
-        $user = $request->user();
-        if (isset($user['pwd'])) unset($user['pwd']);
-        $user['vip'] = $vipId !== false ? true : false;
-        if ($user['vip']) {
-            $user['vip_id'] = $vipId;
-            $user['discount'] = UserLevel::getUserLevelInfo($vipId, 'discount');
-        }
-        $data['userInfo'] = $user;
-        $data['integralRatio'] = $other['integralRatio'];
-        $data['offline_pay_status'] = (int)sys_config('offline_pay_status', '', $mer_id) ?? (int)2;
-        $data['yue_pay_status'] = (int)sys_config('yue_pay_status', '', $mer_id) ?? (int)2;//余额支付 1 开启 2 关闭
-        $data['store_self_mention'] = (int)sys_config('store_self_mention', '', $mer_id) ?? 0;//门店自提是否开启
-        $data['store_self_mention'] = empty($cartGroup['type']) && ($cartGroup['type'] !== 0) ? $data['store_self_mention'] : $cartGroup['type'];
-        $data['system_store'] = ($res = SystemStore::getStoreDispose(0, '', $mer_id)) ? $res : [];//门店信息
-        return app('json')->successful($data);
-    }
-
-    /**
-     * 计算订单金额
-     * @param Request $request
-     * @param $key
-     * @return mixed
-     * @throws \think\Exception
-     * @throws DataNotFoundException
-     * @throws ModelNotFoundException
-     * @throws DbException
-     * @throws Exception
-     */
-    public function computedOrder(Request $request, $key)
-    {
-        $mer_id = $request->mer_id() ?: '';
-        if (!$key) return app('json')->fail('参数错误!');
-        $uid = $request->uid();
-        if (StoreOrder::be(['order_id|unique' => $key, 'uid' => $uid, 'is_del' => 0, 'mer_id' => $mer_id]))
-            return app('json')->status('extend_order', '订单已生成', ['orderId' => $key, 'key' => $key]);
-        list($addressId, $couponId, $payType, $useIntegral, $mark, $assistanceId, $assistanceActiveId, $combinationId, $pinkId, $seckill_id, $formId, $bargainId, $shipping_type) = UtilService::postMore([
-            'addressId', 'couponId', ['payType', 'yue'], ['useIntegral', 0], 'mark', ['assistanceId', 0], ['assistanceActiveId', 0], ['combinationId', 0], ['pinkId', 0], ['seckill_id', 0], ['formId', ''], ['bargainId', ''],
-            ['shipping_type', 1],
-        ], $request, true);
-        $payType = strtolower($payType);
-        if ($bargainId) {
-            $bargainUserTableId = StoreBargainUser::getBargainUserTableId($bargainId, $uid);//TODO 获取用户参与砍价表编号
-            if (!$bargainUserTableId)
-                return app('json')->fail('砍价失败');
-            $status = StoreBargainUser::getBargainUserStatusEnd($bargainUserTableId);
-            if ($status == 3)
-                return app('json')->fail('砍价已支付');
-            StoreBargainUser::setBargainUserStatus($bargainId, $uid); //修改砍价状态
-        }
-        if ($pinkId) {
-            if (StorePink::getIsPinkUid($pinkId, $uid))
-                return app('json')->status('ORDER_EXIST', '订单生成失败,你已经在该团内不能再参加了', ['orderId' => StoreOrder::getStoreIdPink($pinkId, $request->uid())]);
-            if (StoreOrder::getIsOrderPink($pinkId, $uid))
-                return app('json')->status('ORDER_EXIST', '订单生成失败,你已经参加该团了,请先支付订单', ['orderId' => StoreOrder::getStoreIdPink($pinkId, $request->uid())]);
-        }
-        $priceGroup = StoreOrder::cacheKeyCreateOrder($uid, $key, $addressId, $payType, (int)$useIntegral, $couponId, $mark, $assistanceId, $assistanceActiveId, $combinationId, $pinkId, $seckill_id, $bargainId, true, 0, $shipping_type, '', '', 0, $mer_id);
-        if ($priceGroup)
-            return app('json')->status('NONE', 'ok', $priceGroup);
-        else
-            return app('json')->fail(StoreOrder::getErrorInfo('计算失败'));
-    }
-
-    /**
-     * 订单创建
-     * @param Request $request
-     * @param $key
-     * @return mixed
-     * @throws \think\Exception
-     * @throws DataNotFoundException
-     * @throws ModelNotFoundException
-     * @throws DbException
-     * @throws Exception
-     */
-    public function create(Request $request, $key)
-    {
-        $mer_id = $request->mer_id();
-        if (!$key) return app('json')->fail('参数错误!');
-        $uid = $request->uid();
-        if (StoreOrder::be(['order_id|unique' => $key, 'uid' => $uid, 'is_del' => 0, 'mer_id' => [0, $mer_id]]))
-            return app('json')->status('extend_order', '订单已生成', ['orderId' => $key, 'key' => $key]);
-        list($addressId, $couponId, $payType, $useIntegral, $mark, $assistanceId, $assistanceActiveId, $combinationId, $pinkId, $seckill_id, $formId, $bargainId, $from, $shipping_type, $real_name, $phone, $storeId) = UtilService::postMore([
-            'addressId', 'couponId', 'payType', ['useIntegral', 0], 'mark', ['assistanceId', 0], ['assistanceActiveId', 0], ['combinationId', 0], ['pinkId', 0], ['seckill_id', 0], ['formId', ''], ['bargainId', ''], ['from', 'weixin'],
-            ['shipping_type', 1], ['real_name', ''], ['phone', ''], ['store_id', 0]
-        ], $request, true);
-        $payType = strtolower($payType);
-        if ($bargainId) {
-            $bargainUserTableId = StoreBargainUser::getBargainUserTableId($bargainId, $uid);//TODO 获取用户参与砍价表编号
-            if (!$bargainUserTableId)
-                return app('json')->fail('砍价失败');
-            $status = StoreBargainUser::getBargainUserStatusEnd($bargainUserTableId);
-            if ($status == 3)
-                return app('json')->fail('砍价已支付');
-            StoreBargainUser::setBargainUserStatus($bargainId, $uid); //修改砍价状态
-        }
-        if ($pinkId) {
-            if (StorePink::getIsPinkUid($pinkId, $request->uid()))
-                return app('json')->status('ORDER_EXIST', '订单生成失败,你已经在该团内不能再参加了', ['orderId' => StoreOrder::getStoreIdPink($pinkId, $request->uid())]);
-            if (StoreOrder::getIsOrderPink($pinkId, $request->uid()))
-                return app('json')->status('ORDER_EXIST', '订单生成失败,你已经参加该团了,请先支付订单', ['orderId' => StoreOrder::getStoreIdPink($pinkId, $request->uid())]);
-        }
-        $isChannel = 1;
-        if ($from == 'weixin')
-            $isChannel = 0;
-        elseif ($from == 'weixinh5')
-            $isChannel = 2;
-        $order = StoreOrder::cacheKeyCreateOrder($request->uid(), $key, $addressId, $payType, (int)$useIntegral, $couponId, $mark, $assistanceId, $assistanceActiveId, $combinationId, $pinkId, $seckill_id, $bargainId, false, $isChannel, $shipping_type, $real_name, $phone, $storeId, $mer_id);
-        if ($order === false) return app('json')->fail(StoreOrder::getErrorInfo('订单生成失败'));
-        $orderId = $order['order_id'];
-        $isAssistance = $assistanceId ? 1 : 0;
-        $info = compact('orderId', 'key', 'isAssistance');
-        if ($orderId) {
-            event('OrderCreated', [$order]); //订单创建成功事件
-            switch ($payType) {
-                case "weixin":
-                    $orderInfo = StoreOrder::where('order_id', $orderId)->find();
-                    if (!$orderInfo || !isset($orderInfo['paid'])) return app('json')->fail('支付订单不存在!');
-                    $orderInfo = $orderInfo->toArray();
-                    if ($orderInfo['paid']) return app('json')->fail('支付已支付!');
-                    //支付金额为0
-                    if (bcsub((float)$orderInfo['pay_price'], 0, 2) <= 0) {
-                        //创建订单jspay支付
-                        $payPriceStatus = StoreOrder::jsPayPrice($orderId, $uid, $formId, $mer_id);
-                        if ($payPriceStatus)//0元支付成功
-                            return app('json')->status('success', '微信支付成功', $info);
-                        else
-                            return app('json')->status('pay_error', StoreOrder::getErrorInfo());
-                    } else {
-                        try {
-                            if ($from == 'routine') {
-                                $jsConfig = StoreOrder::jsPay($orderId, 'order_id', $mer_id); //创建订单jspay
-                            } else if ($from == 'weixinh5') {
-                                $jsConfig = StoreOrder::h5Pay($orderId, 'order_id', $mer_id);
-                            } else {
-                                $jsConfig = StoreOrder::wxPay($orderId, 'order_id', $mer_id);
-                            }
-                        } catch (Exception $e) {
-                            return app('json')->status('pay_error', $e->getMessage(), $info);
-                        }
-                        $info['jsConfig'] = $jsConfig;
-                        if ($from == 'weixinh5') {
-                            return app('json')->status('wechat_h5_pay', '订单创建成功', $info);
-                        } else {
-                            return app('json')->status('wechat_pay', '订单创建成功', $info);
-                        }
-                    }
-                    break;
-                case 'yue':
-                    if (StoreOrder::yuePay($orderId, $request->uid(), $formId, $mer_id))
-                        return app('json')->status('success', '余额支付成功', $info);
-                    else {
-                        $errorinfo = StoreOrder::getErrorInfo();
-                        if (is_array($errorinfo))
-                            return app('json')->status($errorinfo['status'], $errorinfo['msg'], $info);
-                        else
-                            return app('json')->status('pay_error', $errorinfo);
-                    }
-                    break;
-                case 'offline':
-                    return app('json')->status('success', '订单创建成功', $info);
-                    break;
-            }
-        } else return app('json')->fail(StoreOrder::getErrorInfo('订单生成失败!'));
-    }
-
-    /**
-     * 订单 再次下单
-     * @param Request $request
-     * @return mixed
-     * @throws Exception
-     */
-    public function again(Request $request)
-    {
-        $mer_id = $request->mer_id();
-        list($uni) = UtilService::postMore([
-            ['uni', ''],
-        ], $request, true);
-        if (!$uni) return app('json')->fail('参数错误!');
-        $order = StoreOrder::getUserOrderDetail($request->uid(), $uni, $mer_id);
-        if (!$order) return app('json')->fail('订单不存在!');
-        $order = StoreOrder::tidyOrder($order, true, false, $mer_id);
-        $res = [];
-        foreach ($order['cartInfo'] as $v) {
-            if ($v['combination_id']) return app('json')->fail('拼团商品不能再来一单,请在拼团商品内自行下单!');
-            else if ($v['bargain_id']) return app('json')->fail('砍价商品不能再来一单,请在砍价商品内自行下单!');
-            else if ($v['seckill_id']) return app('json')->ail('秒杀商品不能再来一单,请在秒杀商品内自行下单!');
-            else $res[] = StoreCart::setCart($request->uid(), $v['product_id'], $v['cart_num'], isset($v['productInfo']['attrInfo']['unique']) ? $v['productInfo']['attrInfo']['unique'] : '', 'product', 1, 0, 0, 0, 0, $mer_id);
-        }
-        $cateId = [];
-        foreach ($res as $v) {
-            if (!$v) return app('json')->fail('再来一单失败,请重新下单!');
-            $cateId[] = $v['id'];
-        }
-        event('OrderCreateAgain', implode(',', $cateId));
-        return app('json')->successful('ok', ['cateId' => implode(',', $cateId)]);
-    }
-
-
-    /**
-     * 订单支付
-     * @param Request $request
-     * @return mixed
-     * @throws DataNotFoundException
-     * @throws DbException
-     * @throws ModelNotFoundException
-     */
-    public function pay(Request $request)
-    {
-        $mer_id = $request->mer_id();
-        list($uni, $paytype, $from) = UtilService::postMore([
-            ['uni', ''],
-            ['paytype', 'weixin'],
-            ['from', 'weixin']
-        ], $request, true);
-        if (!$uni) return app('json')->fail('参数错误!');
-        $order = StoreOrder::getUserOrderDetail($request->uid(), $uni, $mer_id);
-        if (!$order)
-            return app('json')->fail('订单不存在!');
-        if ($order['paid'])
-            return app('json')->fail('该订单已支付!');
-        if ($order['pink_id']) if (StorePink::isPinkStatus($order['pink_id']))
-            return app('json')->fail('该订单已失效!');
-        if ($from == 'weixin') {//0
-            if (in_array($order->is_channel, [1, 2]))
-                $order['order_id'] = mt_rand(100, 999) . '_' . $order['order_id'];
-        }
-        if ($from == 'weixinh5') {//2
-            if (in_array($order->is_channel, [0, 1]))
-                $order['order_id'] = mt_rand(100, 999) . '_' . $order['order_id'];
-        }
-        if ($from == 'routine') {//1
-            if (in_array($order->is_channel, [0, 2]))
-                $order['order_id'] = mt_rand(100, 999) . '_' . $order['order_id'];
-        }
-        $order['pay_type'] = $paytype; //重新支付选择支付方式
-        switch ($order['pay_type']) {
-            case 'weixin':
-                try {
-                    if ($from == 'routine') {
-                        $jsConfig = StoreOrder::jsPay($order, 'order_id', $mer_id); //订单列表发起支付
-                    } else if ($from == 'weixinh5') {
-                        $jsConfig = StoreOrder::h5Pay($order, 'order_id', $mer_id);
-                    } else {
-                        $jsConfig = StoreOrder::wxPay($order, 'order_id', $mer_id);
-                    }
-                } catch (Exception $e) {
-                    return app('json')->fail($e->getMessage());
-                }
-                if ($from == 'weixinh5') {
-                    return app('json')->status('wechat_h5_pay', ['jsConfig' => $jsConfig, 'order_id' => $order['order_id']]);
-                } else {
-                    return app('json')->status('wechat_pay', ['jsConfig' => $jsConfig, 'order_id' => $order['order_id']]);
-                }
-                break;
-            case 'yue':
-                if (StoreOrder::yuePay($order['order_id'], $request->uid(), '', $mer_id))
-                    return app('json')->status('success', '余额支付成功');
-                else {
-                    $error = StoreOrder::getErrorInfo();
-                    return app('json')->fail(is_array($error) && isset($error['msg']) ? $error['msg'] : $error);
-                }
-                break;
-            case 'offline':
-                StoreOrder::createOrderTemplate($order);
-                if (StoreOrder::setOrderTypePayOffline($order['order_id']))
-                    return app('json')->status('success', '订单创建成功');
-                else
-                    return app('json')->status('success', '支付失败');
-                break;
-        }
-        return app('json')->fail('支付方式错误');
-    }
-
-    /**
-     * 订单列表
-     * @param Request $request
-     * @return mixed
-     * @throws Exception
-     */
-    public function lst(Request $request)
-    {
-        list($type, $page, $limit, $search) = UtilService::getMore([
-            ['type', ''],
-            ['page', 0],
-            ['limit', ''],
-            ['search', ''],
-        ], $request, true);
-        return app('json')->successful(StoreOrder::getUserOrderSearchList($request->uid(), $type, $page, $limit, $search, $request->mer_id()));
-    }
-
-    /**
-     * 订单详情
-     * @param Request $request
-     * @param $uni
-     * @return mixed
-     * @throws DataNotFoundException
-     * @throws DbException
-     * @throws ModelNotFoundException
-     * @throws \think\Exception
-     */
-    public function detail(Request $request, $uni)
-    {
-        $mer_id = $request->mer_id();
-        if (!strlen(trim($uni))) return app('json')->fail('参数错误');
-        $order = StoreOrder::getUserOrderDetail($request->uid(), $uni, $mer_id);
-        if (!$order) return app('json')->fail('订单不存在');
-        $order = $order->toArray();
-        //是否开启门店自提
-        $store_self_mention = sys_config('store_self_mention');
-        //关闭门店自提后 订单隐藏门店信息
-        if ($store_self_mention == 0) $order['shipping_type'] = 1;
-        if ($order['verify_code']) {
-            $verify_code = $order['verify_code'];
-            $verify[] = substr($verify_code, 0, 4);
-            $verify[] = substr($verify_code, 4, 4);
-            $verify[] = substr($verify_code, 8);
-            $order['_verify_code'] = implode(' ', $verify);
-        }
-        $order['add_time_y'] = date('Y-m-d', $order['add_time']);
-        $order['add_time_h'] = date('H:i:s', $order['add_time']);
-        $order['system_store'] = SystemStore::getStoreDispose($order['store_id']);
-        if ($order['shipping_type'] === 2 && $order['verify_code']) {
-            $name = $order['verify_code'] . '.jpg';
-            $imageInfo = SystemAttachment::getInfo($name, 'name');
-            $siteUrl = sys_config('site_url');
-            if (!$imageInfo) {
-                $imageInfo = UtilService::getQRCodePath($order['verify_code'], $name);
-                if (is_array($imageInfo)) {
-                    SystemAttachment::attachmentAdd($imageInfo['name'], $imageInfo['size'], $imageInfo['type'], $imageInfo['dir'], $imageInfo['thumb_path'], 1, $imageInfo['image_type'], $imageInfo['time'], 2);
-                    $url = $imageInfo['dir'];
-                } else
-                    $url = '';
-            } else $url = $imageInfo['att_dir'];
-            if (isset($imageInfo['image_type']) && $imageInfo['image_type'] == 1) $url = $siteUrl . $url;
-            $order['code'] = $url;
-        }
-        $order['mapKey'] = sys_config('tengxun_map_key');
-        return app('json')->successful('ok', StoreOrder::tidyOrder($order, true, true, $mer_id));
-    }
-
-    /**
-     * 订单删除
-     * @param Request $request
-     * @return mixed
-     * @throws Exception
-     */
-    public function del(Request $request)
-    {
-        list($uni) = UtilService::postMore([
-            ['uni', ''],
-        ], $request, true);
-        if (!$uni) return app('json')->fail('参数错误!');
-        $res = StoreOrder::removeOrder($uni, $request->uid(), $request->mer_id());
-        if ($res)
-            return app('json')->successful();
-        else
-            return app('json')->fail(StoreOrder::getErrorInfo());
-    }
-
-    /**
-     * 订单收货
-     * @param Request $request
-     * @return mixed
-     * @throws DataNotFoundException
-     * @throws DbException
-     * @throws ModelNotFoundException
-     * @throws Exception
-     */
-    public function take(Request $request)
-    {
-        $mer_id = $request->mer_id();
-        list($uni) = UtilService::postMore([
-            ['uni', ''],
-        ], $request, true);
-        if (!$uni) return app('json')->fail('参数错误!');
-        $res = StoreOrder::takeOrder($uni, $request->uid(), $mer_id);
-        if ($res) {
-            $order_info = StoreOrder::merSet($mer_id)->where('order_id', $uni)->find();
-            $gain_integral = intval($order_info['gain_integral']);
-
-            $gain_coupon = StoreCouponIssue::alias('a')
-                ->join('store_coupon b', 'a.cid = b.id')
-                ->where('a.status', 1)
-                ->where('a.is_full_give', 1)
-                ->where('a.is_del', 0)
-                ->where('a.full_reduction', '<=', $order_info['total_price'])
-                ->sum('b.coupon_price');
-
-            return app('json')->successful(['gain_integral' => $gain_integral, 'gain_coupon' => $gain_coupon]);
-        } else
-            return app('json')->fail(StoreOrder::getErrorInfo());
-    }
-
-
-    /**
-     * 订单 查看物流
-     * @param Request $request
-     * @param $uni
-     * @return mixed
-     * @throws \throwable
-     */
-    public function express(Request $request, $uni)
-    {
-        if (!$uni || !($order = StoreOrder::getUserOrderDetail($request->uid(), $uni, $request->mer_id()))) return app('json')->fail('查询订单不存在!');
-        if ($order['delivery_type'] != 'express' || !$order['delivery_id']) return app('json')->fail('该订单不存在快递单号!');
-        $cacheName = $uni . $order['delivery_id'];
-        $result = CacheService::get($cacheName, null);
-        if ($result === NULL) {
-            $result = ExpressService::query($order['delivery_id'], '', $request->mer_id());
-            if (is_array($result) &&
-                isset($result['result']) &&
-                isset($result['result']['deliverystatus']) &&
-                $result['result']['deliverystatus'] >= 3)
-                $cacheTime = 0;
-            else
-                $cacheTime = 1800;
-            CacheService::set($cacheName, $result, $cacheTime);
-        }
-        $orderInfo = [];
-        $cartInfo = StoreOrderCartInfo::where('oid', $order['id'])->column('cart_info', 'unique') ?? [];
-        $info = [];
-        $cartNew = [];
-        foreach ($cartInfo as $k => $cart) {
-            $cart = json_decode($cart, true);
-            $cartNew['cart_num'] = $cart['cart_num'];
-            $cartNew['truePrice'] = $cart['truePrice'];
-            $cartNew['productInfo']['image'] = $cart['productInfo']['image'];
-            $cartNew['productInfo']['store_name'] = $cart['productInfo']['store_name'];
-            $cartNew['productInfo']['unit_name'] = $cart['productInfo']['unit_name'] ?? '';
-            array_push($info, $cartNew);
-            unset($cart);
-        }
-        $orderInfo['delivery_id'] = $order['delivery_id'];
-        $orderInfo['delivery_name'] = $order['delivery_name'];
-        $orderInfo['delivery_type'] = $order['delivery_type'];
-        $orderInfo['cartInfo'] = $info;
-        return app('json')->successful(['order' => $orderInfo, 'express' => $result ? $result : []]);
-    }
-
-    /**
-     * 订单评价
-     * @param Request $request
-     * @return mixed
-     * @throws DataNotFoundException
-     * @throws ModelNotFoundException
-     * @throws DbException
-     * @throws Exception
-     */
-    public function comment(Request $request)
-    {
-        $group = UtilService::postMore([
-            ['unique', ''], ['comment', ''], ['pics', ''], ['product_score', 5], ['service_score', 5]
-        ], $request);
-        $unique = $group['unique'];
-        unset($group['unique']);
-        if (!$unique) return app('json')->fail('参数错误!');
-        $cartInfo = StoreOrderCartInfo::where('unique', $unique)->find();
-        $uid = $request->uid();
-        $user_info = User::getUserInfo($uid, '', $request->mer_id());
-        $group['nickname'] = $user_info['nickname'];
-        $group['avatar'] = $user_info['avatar'];
-        if (!$cartInfo) return app('json')->fail('评价商品不存在!');
-        $orderUid = StoreOrder::getOrderInfo($cartInfo['oid'], 'uid', $request->mer_id())['uid'];
-        if ($uid != $orderUid) return app('json')->fail('评价商品不存在!');
-        if (StoreProductReply::be(['oid' => $cartInfo['oid'], 'unique' => $unique]))
-            return app('json')->fail('该商品已评价!');
-        $group['comment'] = htmlspecialchars(trim($group['comment']));
-        if ($group['product_score'] < 1) return app('json')->fail('请为商品评分');
-        else if ($group['service_score'] < 1) return app('json')->fail('请为商家服务评分');
-        if ($cartInfo['cart_info']['combination_id']) $productId = $cartInfo['cart_info']['product_id'];
-        else if ($cartInfo['cart_info']['seckill_id']) $productId = $cartInfo['cart_info']['product_id'];
-        else if ($cartInfo['cart_info']['bargain_id']) $productId = $cartInfo['cart_info']['product_id'];
-        else if ($cartInfo['cart_info']['assistance_id']) $productId = $cartInfo['cart_info']['product_id'];
-        else $productId = $cartInfo['product_id'];
-        if ($group['pics']) $group['pics'] = json_encode(is_array($group['pics']) ? $group['pics'] : explode(',', $group['pics']));
-        $group = array_merge($group, [
-            'uid' => $uid,
-            'oid' => $cartInfo['oid'],
-            'unique' => $unique,
-            'product_id' => $productId,
-            'add_time' => time(),
-            'reply_type' => 'product'
-        ]);
-        StoreProductReply::beginTrans();
-        $res = StoreProductReply::reply($group, 'product');
-        if (!$res) {
-            StoreProductReply::rollbackTrans();
-            return app('json')->fail('评价失败!');
-        }
-        try {
-            StoreOrder::checkOrderOver($cartInfo['oid']);
-        } catch (Exception $e) {
-            StoreProductReply::rollbackTrans();
-            return app('json')->fail($e->getMessage());
-        }
-        StoreProductReply::commitTrans();
-        event('UserCommented', $res);
-        event('AdminNewPush');
-        return app('json')->successful();
-    }
-
-    /**
-     * 订单统计数据
-     * @param Request $request
-     * @return mixed
-     */
-    public function data(Request $request)
-    {
-        return app('json')->successful(StoreOrder::getOrderData($request->uid(), $request->mer_id()));
-    }
-
-    /**
-     * 订单退款理由
-     * @param Request $request
-     * @return mixed
-     */
-    public function refund_reason(Request $request)
-    {
-        $reason = sys_config('stor_reason', '', $request->mer_id()) ?: [];//退款理由
-        $reason = str_replace("\r\n", "\n", $reason);//防止不兼容
-        $reason = explode("\n", $reason);
-        return app('json')->successful($reason);
-    }
-
-    /**
-     * 订单退款审核
-     * @param Request $request
-     * @return mixed
-     * @throws Exception
-     */
-    public function refund_verify(Request $request)
-    {
-        $data = UtilService::postMore([
-            ['text', ''],
-            ['refund_reason_wap_img', ''],
-            ['refund_reason_wap_explain', ''],
-            ['uni', '']
-        ], $request);
-        $uni = $data['uni'];
-        unset($data['uni']);
-        if ($data['refund_reason_wap_img']) $data['refund_reason_wap_img'] = explode(',', $data['refund_reason_wap_img']);
-        if (!$uni || $data['text'] == '') return app('json')->fail('参数错误!');
-        $res = StoreOrder::orderApplyRefund($uni, $request->uid(), $data['text'], $data['refund_reason_wap_explain'], $data['refund_reason_wap_img'], $request->mer_id());
-        if ($res)
-            return app('json')->successful('提交申请成功');
-        else
-            return app('json')->fail(StoreOrder::getErrorInfo());
-    }
-
-
-    /**
-     * 订单取消   未支付的订单回退积分,回退优惠券,回退库存
-     * @param Request $request
-     * @return mixed
-     * @throws DataNotFoundException
-     * @throws ModelNotFoundException
-     * @throws DbException
-     * @throws Exception
-     */
-    public function cancel(Request $request)
-    {
-        list($id) = UtilService::postMore([['id', 0]], $request, true);
-        if (!$id) return app('json')->fail('参数错误');
-        if (StoreOrder::cancelOrder($id, $request->uid()))
-            return app('json')->successful('取消订单成功');
-        return app('json')->fail(StoreOrder::getErrorInfo('取消订单失败'));
-    }
-
-
-    /**
-     * 订单商品信息
-     * @param Request $request
-     * @return mixed
-     * @throws DataNotFoundException
-     * @throws ModelNotFoundException
-     * @throws DbException
-     * @throws Exception
-     */
-    public function product(Request $request)
-    {
-        list($unique) = UtilService::postMore([['unique', '']], $request, true);
-        if (!$unique || !StoreOrderCartInfo::be(['unique' => $unique]) || !($cartInfo = StoreOrderCartInfo::where('unique', $unique)->find())) return app('json')->fail('评价商品不存在!');
-        $cartInfo = $cartInfo->toArray();
-        $cartProduct = [];
-        $cartProduct['cart_num'] = $cartInfo['cart_info']['cart_num'];
-        $cartProduct['productInfo']['image'] = isset($cartInfo['cart_info']['productInfo']['image']) ? $cartInfo['cart_info']['productInfo']['image'] : '';
-        $cartProduct['productInfo']['price'] = isset($cartInfo['cart_info']['productInfo']['price']) ? $cartInfo['cart_info']['productInfo']['price'] : 0;
-        $cartProduct['productInfo']['store_name'] = isset($cartInfo['cart_info']['productInfo']['store_name']) ? $cartInfo['cart_info']['productInfo']['store_name'] : '';
-        if (isset($cartInfo['cart_info']['productInfo']['attrInfo'])) {
-            $cartProduct['productInfo']['attrInfo']['product_id'] = isset($cartInfo['cart_info']['productInfo']['attrInfo']['product_id']) ? $cartInfo['cart_info']['productInfo']['attrInfo']['product_id'] : '';
-            $cartProduct['productInfo']['attrInfo']['suk'] = isset($cartInfo['cart_info']['productInfo']['attrInfo']['suk']) ? $cartInfo['cart_info']['productInfo']['attrInfo']['suk'] : '';
-            $cartProduct['productInfo']['attrInfo']['price'] = isset($cartInfo['cart_info']['productInfo']['attrInfo']['price']) ? $cartInfo['cart_info']['productInfo']['attrInfo']['price'] : '';
-            $cartProduct['productInfo']['attrInfo']['image'] = isset($cartInfo['cart_info']['productInfo']['attrInfo']['image']) ? $cartInfo['cart_info']['productInfo']['attrInfo']['image'] : '';
-        }
-        $cartProduct['product_id'] = isset($cartInfo['cart_info']['product_id']) ? $cartInfo['cart_info']['product_id'] : 0;
-        $cartProduct['combination_id'] = isset($cartInfo['cart_info']['combination_id']) ? $cartInfo['cart_info']['combination_id'] : 0;
-        $cartProduct['seckill_id'] = isset($cartInfo['cart_info']['seckill_id']) ? $cartInfo['cart_info']['seckill_id'] : 0;
-        $cartProduct['bargain_id'] = isset($cartInfo['cart_info']['bargain_id']) ? $cartInfo['cart_info']['bargain_id'] : 0;
-        $cartProduct['order_id'] = StoreOrder::where('id', $cartInfo['oid'])->value('order_id');
-        return app('json')->successful($cartProduct);
-    }
-
-    /**
-     * 门店核销
-     * @param Request $request
-     */
-    public function order_verific(Request $request)
-    {
-        list($verify_code, $is_confirm) = UtilService::postMore([
-            ['verify_code', ''],
-            ['is_confirm', 0]
-        ], $request, true);
-        if (!$verify_code) return app('json')->fail('缺少核销码');
-        $orderInfo = StoreOrder::where('verify_code', $verify_code)->where('paid', 1)->where('refund_status', 0)->find();
-        if (!$orderInfo) return app('json')->fail('核销的订单不存在或未支付或已退款');
-        if ($orderInfo->status > 0) return app('json')->fail('订单已经核销');
-        if ($orderInfo->combination_id && $orderInfo->pink_id) {
-            $res = StorePink::where('id', $orderInfo->pink_id)->where('status', '<>', 2)->count();
-            if ($res) return app('json')->fail('拼团订单暂未成功无法核销!');
-        }
-        if (!$is_confirm) {
-            $orderInfo['image'] = StoreCart::getProductImage($orderInfo->cart_id);
-            return app('json')->success($orderInfo->toArray());
-        }
-        StoreOrder::beginTrans();
-        try {
-            $orderInfo->status = 2;
-            if ($orderInfo->save()) {
-                StoreOrder::commitTrans();
-                return app('json')->success('核销成功');
-            } else {
-                StoreOrder::rollbackTrans();
-                return app('json')->fail('核销失败');
-            }
-        } catch (\PDOException $e) {
-            StoreOrder::rollbackTrans();
-            return app('json')->fail($e->getMessage());
-        }
-
-    }
-
-}

+ 0 - 1
app/api/controller/publics/.WeDrive

@@ -1 +0,0 @@
-/Users/huangjianfeng/WeDrive/六牛科技/源码/CRMEB_PRO_v1.0.0(9)/app/api/controller/publics

+ 0 - 33
app/api/controller/publics/ArticleCategoryController.php

@@ -1,33 +0,0 @@
-<?php
-namespace app\api\controller\publics;
-
-use app\models\article\ArticleCategory;
-use think\db\exception\DataNotFoundException;
-use think\db\exception\DbException;
-use think\db\exception\ModelNotFoundException;
-use app\Request;
-
-/**
- * 文章分类类
- * Class ArticleCategoryController
- * @package app\api\controller\publics
- */
-class ArticleCategoryController
-{
-    /**
-     * 文章分类列表
-     * @return mixed
-     * @throws DataNotFoundException
-     * @throws ModelNotFoundException
-     * @throws DbException
-     */
-   public function lst(Request $request)
-   {
-       $mer_id = $request->mer_id() ?: '';
-       $cateInfo = ArticleCategory::getArticleCategory($mer_id);
-       if($cateInfo) $cateInfo = $cateInfo->toArray();
-       else $cateInfo = [];
-       array_unshift($cateInfo,['id'=>0,'title'=>'热门']);
-       return app('json')->successful($cateInfo);
-   }
-}

+ 0 - 75
app/api/controller/publics/ArticleController.php

@@ -1,75 +0,0 @@
-<?php
-namespace app\api\controller\publics;
-
-use app\models\article\Article;
-use app\models\article\ArticleCategory;
-use app\Request;
-use crmeb\services\UtilService;
-
-/**
- * 文章类
- * Class ArticleController
- * @package app\api\controller\publics
- */
-class ArticleController
-{
-    /**
-     * 文章列表
-     * @param Request $request
-     * @param $cid
-     * @return mixed
-     */
-    public function lst(Request $request, $cid)
-    {
-        list($page, $limit) = UtilService::getMore([
-            ['page',1],
-            ['limit',10],
-        ],$request, true);
-        $mer_id = $request->mer_id() ?: '';
-        $list = Article::cidByArticleList($cid,$page,$limit,"id,title,image_input,visit,from_unixtime(add_time,'%Y-%m-%d %H:%i') as add_time,synopsis,url", $mer_id) ?? [];
-        if(is_object($list)) $list = $list->toArray();
-        return app('json')->successful($list);
-    }
-    /**
-     * 文章详情
-     * @param $id
-     * @return mixed
-     * @throws \think\db\exception\DataNotFoundException
-     * @throws \think\db\exception\ModelNotFoundException
-     * @throws \think\exception\DbException
-     */
-   public function details($id)
-   {
-       $content = Article::getArticleOne($id);
-       if(!$content) return $this->fail('此文章已经不存在!');
-       $content["visit"] = $content["visit"] + 1;
-       $content["cart_name"] = ArticleCategory::getArticleCategoryField($content['cid']);
-       $content['add_time'] = date('Y-m-d',$content['add_time']);
-       Article::edit(['visit'=>$content["visit"]],$id);//增加浏览次数
-       return app('json')->successful($content);
-   }
-
-    /**
-     * 文章 热门
-     * @return mixed
-     */
-    public function hot(Request $request)
-    {
-        $mer_id = $request->mer_id() ?: '';
-        $list = Article::getArticleListHot("id,title,image_input,visit,from_unixtime(add_time,'%Y-%m-%d %H:%i') as add_time,synopsis,url", $mer_id) ?? [];
-        if(is_object($list)) $list = $list->toArray();
-        return app('json')->successful($list);
-    }
-
-    /**
-     * 文章 banner
-     * @return mixed
-     */
-    public function banner(Request $request)
-    {
-        $mer_id = $request->mer_id() ?: '';
-        $list = Article::getArticleListBanner("id,title,image_input,visit,from_unixtime(add_time,'%Y-%m-%d %H:%i') as add_time,synopsis,url", $mer_id) ?? [];
-        if(is_object($list)) $list = $list->toArray();
-        return app('json')->successful($list);
-    }
-}

+ 0 - 1
app/api/controller/store/.WeDrive

@@ -1 +0,0 @@
-/Users/huangjianfeng/WeDrive/六牛科技/源码/CRMEB_PRO_v1.0.0(9)/app/api/controller/store

+ 0 - 21
app/api/controller/store/CategoryController.php

@@ -1,21 +0,0 @@
-<?php
-
-namespace app\api\controller\store;
-
-use app\models\store\StoreCategory;
-use app\Request;
-
-class CategoryController
-{
-    public function category(Request $request)
-    {
-        $cateogry = StoreCategory::with('children')->where('mer_id', $request->mer_id())->where('is_show', 1)->order('sort desc,id desc')->where('pid', 0)->select();
-        return app('json')->success($cateogry->hidden(['add_time', 'is_show', 'sort', 'children.sort', 'children.add_time', 'children.pid', 'children.is_show'])->toArray());
-    }
-
-    public function second_category(Request $request)
-    {
-    	$res = StoreCategory::where('mer_id', $request->mer_id())->where('is_show', 1)->order('sort desc, id desc')->where('pid', '<>', 0)->select()->toArray();
-    	return app('json')->success($res);
-    }
-}

+ 0 - 119
app/api/controller/store/StoreCartController.php

@@ -1,119 +0,0 @@
-<?php
-
-namespace app\api\controller\store;
-
-use app\models\store\StoreBargainUserHelp;
-use app\models\store\StoreCart;
-use app\models\store\StoreProduct;
-use app\Request;
-use crmeb\services\UtilService;
-use Exception;
-use think\db\exception\DataNotFoundException;
-use think\db\exception\DbException;
-use think\db\exception\ModelNotFoundException;
-
-/**
- * 购物车类
- * Class StoreCartController
- * @package app\api\controller\store
- */
-class StoreCartController
-{
-
-    /**
-     * 购物车 列表
-     * @param Request $request
-     * @return mixed
-     * @throws DataNotFoundException
-     * @throws DbException
-     * @throws ModelNotFoundException
-     */
-    public function lst(Request $request)
-    {
-        return app('json')->successful(StoreCart::getUserProductCartList($request->uid(), '', 0, $request->mer_id()));
-    }
-
-    /**
-     * 购物车 添加
-     * @param Request $request
-     * @return mixed
-     * @throws DataNotFoundException
-     * @throws ModelNotFoundException
-     * @throws DbException
-     * @throws Exception
-     */
-    public function add(Request $request)
-    {
-        list($productId, $cartNum, $uniqueId, $assistanceId, $combinationId, $secKillId, $bargainId, $new) = UtilService::postMore([
-            [['productId', 'd'], 0],//普通商品编号
-            [['cartNum', 'd'], 1], //购物车数量
-            ['uniqueId', ''],//属性唯一值
-            [['assistanceId', 'd'], 0],//助力商品编号
-            [['combinationId', 'd'], 0],//拼团商品编号
-            [['secKillId', 'd'], 0],//秒杀商品编号
-            [['bargainId', 'd'], 0],//砍价商品编号
-            [['new', 'd'], 1], // 1 加入购物车直接购买  0 加入购物车
-        ], $request, true);
-        if (!$productId || !is_numeric($productId)) return app('json')->fail('参数错误');
-        if (!StoreProduct::merSet($request->mer_id())->where('id', $productId)->find()) return app('json')->fail('参数错误');
-        if ($bargainId && StoreBargainUserHelp::getSurplusPrice($bargainId, $request->uid())) return app('json')->fail('请先砍价');
-        $res = StoreCart::setCart($request->uid(), $productId, $cartNum, $uniqueId, 'product', $new, $assistanceId, $combinationId, $secKillId, $bargainId, $request->mer_id());
-        if (!$res) return app('json')->fail(StoreCart::getErrorInfo());
-        else  return app('json')->successful('ok', ['cartId' => $res->id]);
-    }
-
-    /**
-     * 购物车 删除商品
-     * @param Request $request
-     * @return mixed
-     * @throws Exception
-     */
-    public function del(Request $request)
-    {
-        list($ids) = UtilService::postMore([
-            ['ids', []],//购物车编号
-        ], $request, true);
-        if (!count($ids))
-            return app('json')->fail('参数错误!');
-        if (StoreCart::removeUserCart($request->uid(), $ids))
-            return app('json')->successful();
-        return app('json')->fail('清除失败!');
-    }
-
-    /**
-     * 购物车 修改商品数量
-     * @param Request $request
-     * @return mixed
-     * @throws DataNotFoundException
-     * @throws ModelNotFoundException
-     * @throws DbException
-     * @throws Exception
-     */
-    public function num(Request $request)
-    {
-        list($id, $number) = UtilService::postMore([
-            ['id', 0],//购物车编号
-            ['number', 0],//购物车编号
-        ], $request, true);
-        if (!$id || !$number || !is_numeric($id) || !is_numeric($number)) return app('json')->fail('参数错误!');
-        $res = StoreCart::changeUserCartNum($id, $number, $request->uid(), $request->mer_id());
-        if ($res) return app('json')->successful();
-        else return app('json')->fail(StoreCart::getErrorInfo('修改失败'));
-    }
-
-    /**
-     * 购物车 获取数量
-     * @param Request $request
-     * @return mixed
-     * @throws Exception
-     */
-    public function count(Request $request)
-    {
-        list($numType) = UtilService::postMore([
-            ['numType', true],//购物车编号
-        ], $request, true);
-        if (!(int)$numType) $numType = false;
-        return app('json')->success('ok', ['count' => StoreCart::getUserCartNum($request->uid(), 'product', $numType)]);
-    }
-
-}

+ 0 - 125
app/api/controller/store/StoreCouponsController.php

@@ -1,125 +0,0 @@
-<?php
-
-namespace app\api\controller\store;
-
-
-use app\models\store\StoreCouponIssue;
-use app\Request;
-use crmeb\services\UtilService;
-use app\models\store\StoreCouponUser;
-
-/**
- * 优惠券类
- * Class StoreCouponsController
- * @package app\api\controller\store
- */
-class StoreCouponsController
-{
-    /**
-     * 可领取优惠券列表
-     * @param Request $request
-     * @return mixed
-     * @throws \Exception
-     */
-    public function lst(Request $request)
-    {
-        $data = UtilService::getMore([
-            ['type', 0],
-            ['page', 0],
-            ['limit', 0],
-            ['product_id', 0]
-        ], $request);
-        return app('json')->successful(StoreCouponIssue::getIssueCouponList($request->uid(), $data['limit'], $data['page'], $data['type'], $data['product_id'], $request->mer_id()));
-    }
-
-    /**
-     * 领取优惠券
-     *
-     * @param Request $request
-     * @return mixed
-     */
-    public function receive(Request $request)
-    {
-        list($couponId) = UtilService::getMore([['couponId', 0]], $request, true);
-        if (!$couponId || !is_numeric($couponId)) return app('json')->fail('参数错误!');
-        if (StoreCouponIssue::issueUserCoupon($couponId, $request->uid(), $request->mer_id())) {
-            return app('json')->successful('领取成功');
-        } else {
-            return app('json')->fail(StoreCouponIssue::getErrorInfo('领取失败!'));
-        }
-    }
-
-    /**
-     * 用户已领取优惠券
-     * @param Request $request
-     * @param $types
-     * @return mixed
-     * @throws \think\db\exception\DataNotFoundException
-     * @throws \think\db\exception\ModelNotFoundException
-     * @throws \think\exception\DbException
-     */
-    public function user(Request $request, $types)
-    {
-        switch ($types) {
-            case 0:
-            case '':
-                $list = StoreCouponUser::getUserAllCoupon($request->uid(), $request->mer_id());
-                break;
-            case 1:
-                $list = StoreCouponUser::getUserValidCoupon($request->uid(), $request->mer_id());
-                break;
-            case 2:
-                $list = StoreCouponUser::getUserAlreadyUsedCoupon($request->uid(), $request->mer_id());
-                break;
-            default:
-                $list = StoreCouponUser::getUserBeOverdueCoupon($request->uid(), $request->mer_id());
-                break;
-        }
-        foreach ($list as &$v) {
-            $v['add_time'] = date('Y/m/d', $v['add_time']);
-            $v['end_time'] = date('Y/m/d', $v['end_time']);
-        }
-        return app('json')->successful($list);
-    }
-
-    /**
-     * 批量领取优惠券
-     * @param Request $request
-     * @return mixed
-     */
-    public function receive_batch(Request $request)
-    {
-        list($couponIds) = UtilService::postMore([
-            ['couponId', []],
-        ], $request, true);
-        if (!count($couponIds)) return app('json')->fail('参数错误');
-        $couponIdsError = [];
-        $count = 0;
-        $msg = '';
-        foreach ($couponIds as $key => &$item) {
-            if (!StoreCouponIssue::issueUserCoupon($item, $request->uid(), $request->mer_id())) {
-                $couponIdsError[$count]['id'] = $item;
-                $couponIdsError[$count]['msg'] = StoreCouponIssue::getErrorInfo('领取失败');
-            } else {
-                $couponIdsError[$count]['id'] = $item;
-                $couponIdsError[$count]['msg'] = '领取成功';
-            }
-            $count++;
-        }
-        foreach ($couponIdsError as $key => &$value) {
-            $msg = $msg . StoreCouponIssue::getIssueCouponTitle($value['id']) . ',' . $value['msg'];
-        }
-        return app('json')->fail($msg);
-    }
-
-    /**
-     * 优惠券 订单获取
-     * @param Request $request
-     * @param $price
-     * @return mixed
-     */
-    public function order(Request $request, $cartId, $price)
-    {
-        return app('json')->successful(StoreCouponUser::beUsableCouponList($request->uid(), $cartId, $price, $request->mer_id()));
-    }
-}

+ 0 - 309
app/api/controller/store/StoreProductController.php

@@ -1,309 +0,0 @@
-<?php
-
-namespace app\api\controller\store;
-
-use app\models\store\StoreDescription;
-use app\models\system\SystemAttachment;
-use app\models\store\StoreOrder;
-use app\models\store\StoreVisit;
-use app\models\system\SystemStore;
-use app\models\store\StoreProduct;
-use app\models\store\StoreProductAttr;
-use app\models\store\StoreProductRelation;
-use app\models\store\StoreProductReply;
-use app\models\store\StoreGiftCode;
-use app\models\user\User;
-use app\Request;
-use crmeb\services\GroupDataService;
-use crmeb\services\QrcodeService;
-use crmeb\services\SystemConfigService;
-use crmeb\services\UploadService;
-use crmeb\services\UtilService;
-use app\models\routine\RoutineCode;
-use think\db\exception\DataNotFoundException;
-use think\db\exception\DbException;
-use think\db\exception\ModelNotFoundException;
-
-/**
- * 商品类
- * Class StoreProductController
- * @package app\api\controller\store
- */
-class StoreProductController
-{
-    /**
-     * 商品列表
-     * @param Request $request
-     * @return mixed
-     * @throws DataNotFoundException
-     * @throws DbException
-     * @throws ModelNotFoundException
-     */
-    public function lst(Request $request)
-    {
-        $data = UtilService::getMore([
-            [['sid', 'd'], 0],
-            [['cid', 'd'], 0],
-            ['store_id', 0],
-            ['keyword', ''],
-            ['priceOrder', ''],
-            ['salesOrder', ''],
-            [['news', 'd'], 0],
-            [['page', 'd'], 0],
-            [['limit', 'd'], 0],
-            [['type', 0], 0]
-        ], $request);
-        return app('json')->successful(StoreProduct::getProductList($data, $request->uid(), $request->mer_id()));
-    }
-
-    /**
-     * 商品分享二维码 推广员
-     * @param Request $request
-     * @param $id
-     * @return mixed
-     * @throws DataNotFoundException
-     * @throws DbException
-     * @throws ModelNotFoundException
-     */
-    public function code(Request $request, $id)
-    {
-        $mer_id = $request->mer_id();
-        if (!$id || !($storeInfo = StoreProduct::getValidProduct($id, 'id', $mer_id))) return app('json')->fail('商品不存在或已下架');
-        $userType = $request->get('user_type', 'wechat');
-        $user = $request->user();
-        try {
-            switch ($userType) {
-                case 'wechat':
-                    //公众号
-                    $name = $id . '_product_detail_' . $user['uid'] . '_is_promoter_' . $user['is_promoter'] . '_wap.jpg';
-                    $url = QrcodeService::getWechatQrcodePath($name, '/pages/goods_details/index?id=' . $id . '&spread=' . $user['uid']);
-                    if ($url === false)
-                        return app('json')->fail('二维码生成失败');
-                    else
-                        return app('json')->successful(['code' => image_to_base64($url)]);
-                    break;
-                case 'routine':
-                    //小程序
-                    $name = $id . '_' . $user['uid'] . '_' . $user['is_promoter'] . '_product.jpg';
-                    $imageInfo = SystemAttachment::getInfo($name, 'name');
-                    $siteUrl = sys_config('site_url', '', $mer_id);
-                    if (!$imageInfo) {
-                        $data = 'id=' . $id;
-                        if ($user['is_promoter'] || sys_config('store_brokerage_statu', '', $mer_id) == 2) $data .= '&pid=' . $user['uid'];
-                        $res = RoutineCode::getPageCode('pages/subs/goods_details/index', $data, 280, $mer_id);
-                        if (!$res) return app('json')->fail('二维码生成失败');
-                        $uploadType = (int)sys_config('upload_type', 1, $mer_id);
-                        $upload = UploadService::init(null, $mer_id);
-                        $res = $upload->to('routine/product')->validate()->stream($res, $name);
-                        if ($res === false) {
-                            return app('json')->fail($upload->getError());
-                        }
-                        $imageInfo = $upload->getUploadInfo();
-                        $imageInfo['image_type'] = $uploadType;
-                        if ($imageInfo['image_type'] == 1) $remoteImage = UtilService::remoteImage($siteUrl . $imageInfo['dir']);
-                        else $remoteImage = UtilService::remoteImage($imageInfo['dir']);
-                        if (!$remoteImage['status']) return app('json')->fail('小程序二维码未能生成');
-                        SystemAttachment::attachmentAdd($imageInfo['name'], $imageInfo['size'], $imageInfo['type'], $imageInfo['dir'], $imageInfo['thumb_path'], 1, $imageInfo['image_type'], $imageInfo['time'], 2);
-                        $url = $imageInfo['dir'];
-                    } else $url = $imageInfo['att_dir'];
-                    if ($imageInfo['image_type'] == 1) $url = $siteUrl . $url;
-                    return app('json')->successful(['code' => $url]);
-            }
-        } catch (\Exception $e) {
-            return app('json')->fail($e->getMessage(), [
-                'code' => $e->getCode(),
-                'line' => $e->getLine(),
-                'message' => $e->getMessage()
-            ]);
-        }
-    }
-
-    /**
-     * 商品详情
-     * @param Request $request
-     * @param $id
-     * @param int $type
-     * @return mixed
-     * @throws DataNotFoundException
-     * @throws DbException
-     * @throws ModelNotFoundException
-     */
-    public function detail(Request $request, $id, $type = 0)
-    {
-        list($code) = UtilService::getMore([
-            ['code', ''],
-        ], $request, true);
-        $mer_id = $request->mer_id();
-        if ($id && $code && $storeInfo = StoreProduct::getValidOneProduct($id, 'add_time,browse,cate_id,code_path,cost,ficti,give_integral,id,image,is_sub,is_bargain,is_benefit,is_best,is_del,is_hot,is_new,is_postage,is_seckill,is_show,keyword,mer_id,mer_use,ot_price,postage,price,sales,slider_image,sort,stock,store_info,store_name,unit_name,vip_price,spec_type,IFNULL(sales,0) + IFNULL(ficti,0) as fsales,video_link', $mer_id)){
-            $giftCode = StoreGiftCode::where('code', $code)->where('mer_id', $mer_id)->find();
-            if(!$giftCode) return app('json')->fail('请通过专属链接购买商品');
-            if(!$request->uid()) return app('json')->fail('请先登录');
-            if($giftCode['is_use']){
-                if($giftCode['uid'] != $request->uid()){
-                    return app('json')->fail('此商品已经被他人使用');
-                }
-            }else{
-                $codeData['uid'] = $request->uid();
-                $codeData['is_use'] = 1;
-                $giftCode->save($codeData);
-            }
-        }else if (!$id || !($storeInfo = StoreProduct::getValidProduct($id, 'add_time,browse,cate_id,code_path,cost,ficti,give_integral,id,image,is_sub,is_bargain,is_benefit,is_best,is_del,is_hot,is_new,is_postage,is_seckill,is_show,keyword,mer_id,mer_use,ot_price,postage,price,sales,slider_image,sort,stock,store_info,store_name,unit_name,vip_price,spec_type,IFNULL(sales,0) + IFNULL(ficti,0) as fsales,video_link', $mer_id)))
-            return app('json')->fail('商品不存在或已下架');
-        $siteUrl = sys_config('site_url', '', $mer_id);
-        $storeInfo['image'] = set_file_url($storeInfo['image'], $siteUrl);
-        $storeInfo['image_base'] = set_file_url($storeInfo['image'], $siteUrl);
-        $storeInfo['slider_image'] = json_decode($storeInfo['slider_image'], true);
-        $storeInfo['code_base'] = QrcodeService::getWechatQrcodePath($id . '_product_detail_wap.jpg', '/pages/goods_details/index?id=' . $id);
-        $s= strripos($storeInfo['code_base'], ":");
-        $header = substr($storeInfo['code_base'], 0, $s);
-        if($header == 'http'){
-            $storeInfo['code_base'] = str_replace('http', 'https', $storeInfo['code_base']);
-        }
-        $uid = $request->uid();
-        $data['uid'] = $uid;
-        $storeInfo['description'] = StoreDescription::getDescription($id);
-        //替换windows服务器下正反斜杠问题导致图片无法显示
-        $storeInfo['description'] = preg_replace_callback('#<img.*?src="([^"]*)"[^>]*>#i', function ($imagsSrc) {
-            return isset($imagsSrc[1]) && isset($imagsSrc[0]) ? str_replace($imagsSrc[1], str_replace('\\', '/', $imagsSrc[1]), $imagsSrc[0]) : '';
-        }, $storeInfo['description']);
-        $storeInfo['userCollect'] = StoreProductRelation::isProductRelation($id, $uid, 'collect');
-        $storeInfo['userLike'] = StoreProductRelation::isProductRelation($id, $uid, 'like');
-        list($productAttr, $productValue) = StoreProductAttr::getProductAttrDetail($id, $uid, $type);
-        set_view($uid, $id, $storeInfo['cate_id'], 'viwe');
-        $data['storeInfo'] = StoreProduct::setLevelPrice($storeInfo, $uid, true, $mer_id);
-        $data['similarity'] = StoreProduct::cateIdBySimilarityProduct($storeInfo['cate_id'], 'id,store_name,image,price,sales,ficti', 4, $mer_id);
-        $data['productAttr'] = $productAttr;
-        $prices = array_column($productValue, 'price');
-        array_multisort($prices, SORT_ASC, SORT_NUMERIC, $productValue);
-        $keys = array_keys($productValue);
-        $productValue = array_combine($keys, $productValue);
-        $data['productValue'] = $productValue;
-        $data['priceName'] = 0;
-        if ($uid) {
-            $user = $request->user();
-            if (!$user->is_promoter) {
-                $price = StoreOrder::where(['paid' => 1, 'refund_status' => 0, 'uid' => $uid])->sum('pay_price');
-                $status = is_brokerage_statu($price);
-                if ($status) {
-                    User::where('uid', $uid)->update(['is_promoter' => 1]);
-                    $user->is_promoter = 1;
-                }
-            }
-            if ($user->is_promoter) {
-                $data['priceName'] = StoreProduct::getPacketPrice($storeInfo, $productValue, $mer_id);
-            }
-            if (!strlen(trim($data['priceName'])))
-                $data['priceName'] = 0;
-        }
-        $data['reply'] = StoreProductReply::getRecProductReply($storeInfo['id']);
-        $data['replyCount'] = StoreProductReply::productValidWhere()->where('product_id', $storeInfo['id'])->count();
-        if ($data['replyCount']) {
-            $goodReply = StoreProductReply::productValidWhere()->where('product_id', $storeInfo['id'])->where('product_score', 5)->count();
-            $data['replyChance'] = $goodReply;
-            if ($goodReply) {
-                $data['replyChance'] = bcdiv($goodReply, $data['replyCount'], 2);
-                $data['replyChance'] = bcmul($data['replyChance'], 100, 2);
-            }
-        } else $data['replyChance'] = 100;
-        $data['mer_id'] = $storeInfo['mer_id'];
-        $data['system_store'] = ($res = SystemStore::getStoreDispose(0, '', $mer_id)) ? $res : [];
-        $data['product_store'] = SystemStore::getProductStore($id);
-        $data['good_list'] = StoreProduct::getGoodList(18, 'image,store_name,price,id,ot_price', $mer_id);
-        $data['mapKey'] = sys_config('tengxun_map_key');
-        $data['store_self_mention'] = (int)sys_config('store_self_mention') ?? 0;//门店自提是否开启
-        $data['activity'] = StoreProduct::activity($data['storeInfo']['id'], false);
-        return app('json')->successful($data);
-    }
-
-    /**
-     * 为你推荐
-     *
-     * @param Request $request
-     * @return mixed
-     * @throws DataNotFoundException
-     * @throws ModelNotFoundException
-     * @throws DbException
-     * @throws \Exception
-     */
-    public function product_hot(Request $request)
-    {
-        list($page, $limit) = UtilService::getMore([
-            [['page', 'd'], 0],
-            [['limit', 'd'], 0]
-        ], $request, true);
-        if (!$limit) return app('json')->successful([]);
-        $productHot = StoreProduct::getHotProductLoading('id,image,store_name,cate_id,price,unit_name,ot_price', (int)$page, (int)$limit, $request->mer_id());
-        if (!empty($productHot)) {
-            foreach ($productHot as $k => $v) {
-                $productHot[$k]['activity'] = StoreProduct::activity($v['id']);
-            }
-        }
-        return app('json')->successful($productHot);
-    }
-
-    /**
-     * 获取首页推荐不同类型商品的轮播图和商品
-     * @param Request $request
-     * @param $type
-     * @return mixed
-     * @throws DataNotFoundException
-     * @throws ModelNotFoundException
-     * @throws DbException
-     * @throws \Exception
-     */
-    public function groom_list(Request $request, $type)
-    {
-        $mer_id = $request->mer_id();
-        list($page, $limit) = UtilService::getMore([
-            [['page', 'd'], 0],
-            [['limit', 'd'], 0]
-        ], $request, true);
-        $info['banner'] = [];
-        $info['list'] = [];
-        if ($type == 1) {//TODO 精品推荐
-            $info['banner'] = sys_data('routine_home_bast_banner', 0, $mer_id) ?: [];//TODO 首页精品推荐图片
-            $info['list'] = StoreProduct::getBestProduct('id,image,store_name,cate_id,price,ot_price,IFNULL(sales,0) + IFNULL(ficti,0) as sales,unit_name,sort', 0, $request->uid(), true, $page, $limit, $mer_id);//TODO 精品推荐个数
-            $info['count'] = count(StoreProduct::getBestProduct('id,image,store_name,cate_id,price,ot_price,IFNULL(sales,0) + IFNULL(ficti,0) as sales,unit_name,sort', 0, $request->uid(), true, 0, 0, $mer_id));
-        } else if ($type == 2) {//TODO  热门榜单
-            $info['banner'] = sys_data('routine_home_hot_banner', 0, $mer_id) ?: [];//TODO 热门榜单 猜你喜欢推荐图片
-            $info['list'] = StoreProduct::getHotProduct('id,image,store_name,cate_id,price,ot_price,unit_name,sort,IFNULL(sales,0) + IFNULL(ficti,0) as sales', 0, $request->uid(), $page, $limit, $mer_id);//TODO 热门榜单 猜你喜欢
-        } else if ($type == 3) {//TODO 首发新品
-            $info['banner'] = sys_data('routine_home_new_banner', 0, $mer_id) ?: [];//TODO 首发新品推荐图片
-            $info['list'] = StoreProduct::getNewProduct('id,image,store_name,cate_id,price,ot_price,unit_name,sort,IFNULL(sales,0) + IFNULL(ficti,0) as sales', 0, $request->uid(), true, $page, $limit, $mer_id);//TODO 首发新品
-        } else if ($type == 4) {//TODO 促销单品
-            $info['banner'] = sys_data('routine_home_benefit_banner', 0, $mer_id) ?: [];//TODO 促销单品推荐图片
-            $info['list'] = StoreProduct::getBenefitProduct('id,image,store_name,cate_id,price,ot_price,stock,unit_name,sort,IFNULL(sales,0) + IFNULL(ficti,0) as sales', 0, $page, $limit, $mer_id);//TODO 促销单品
-        }
-        return app('json')->successful($info);
-    }
-
-    /**
-     * 商品评价数量和好评度
-     * @param $id
-     * @return mixed
-     */
-    public function reply_config($id)
-    {
-        if (!$id || !is_numeric($id)) return app('json')->fail('参数错误!');
-        return app('json')->successful(StoreProductReply::productReplyCount($id));
-    }
-
-    /**
-     * 获取商品评论
-     * @param Request $request
-     * @param $id
-     * @param $type
-     * @return mixed
-     * @throws \Exception
-     */
-    public function reply_list(Request $request, $id)
-    {
-        list($page, $limit, $type) = UtilService::getMore([
-            [['page', 'd'], 0], [['limit', 'd'], 0], [['type', 'd'], 0]
-        ], $request, true);
-        if (!$id || !is_numeric($id)) return app('json')->fail('参数错误!');
-        $list = StoreProductReply::getProductReplyList($id, (int)$type, $page, $limit);
-        return app('json')->successful($list);
-    }
-
-}

+ 0 - 1
app/api/controller/user/.WeDrive

@@ -1 +0,0 @@
-/Users/huangjianfeng/WeDrive/六牛科技/源码/CRMEB_PRO_v1.0.0(9)/app/api/controller/user

+ 0 - 50
app/api/controller/user/StoreService.php

@@ -1,50 +0,0 @@
-<?php
-namespace app\api\controller\user;
-
-use app\models\store\StoreServiceLog;
-use app\models\store\StoreService as StoreServiceModel;
-use app\Request;
-use crmeb\services\UtilService;
-
-/**
- * 客服类
- * Class StoreService
- * @package app\api\controller\user
- */
-class StoreService
-{
-
-    /**
-     * 客服列表
-     * @param Request $request
-     * @return mixed
-     */
-    public function lst(Request $request)
-    {
-        list($page, $limit) = UtilService::getMore([['page',0],['limit',0]], $request, true);
-//        if(!$page || !$limit) return app('json')->successful([]);
-        $serviceInfoList = StoreServiceModel::lst($page, $limit);
-        if(!count($serviceInfoList)) return app('json')->successful([]);
-        return app('json')->successful($serviceInfoList->hidden(['notify', 'status', 'mer_id', 'add_time'])->toArray());
-    }
-    /**
-     * 客服聊天记录
-     * @param Request $request
-     * @param $toUid
-     * @return array
-     */
-    public function record(Request $request, $toUid)
-    {
-        list($page, $limit) = UtilService::getMore([['page',0],['limit',0]], $request, true);
-        if(!$toUid) return app('json')->fail('参数错误');
-        $uid = $request->uid();
-        if(!$limit || !$page) return app('json')->successful([]);
-        $serviceLogList = StoreServiceLog::lst($uid, $toUid, $page, $limit);
-        if(!$serviceLogList) return app('json')->successful([]);
-        $serviceLogList = $serviceLogList->hidden(['mer_id'])->toArray();
-        $idArr = array_column($serviceLogList, 'id');
-        array_multisort($idArr,SORT_ASC,$serviceLogList);
-        return app('json')->successful($serviceLogList);
-    }
-
-}

+ 0 - 343
app/api/controller/user/UserBillController.php

@@ -1,343 +0,0 @@
-<?php
-
-namespace app\api\controller\user;
-
-use app\models\system\SystemAttachment;
-use app\models\routine\RoutineCode;
-use app\models\routine\RoutineQrcode;
-use app\models\store\StoreOrder;
-use app\models\user\User;
-use app\models\user\UserBill;
-use app\models\user\UserExtract;
-use app\Request;
-use crmeb\services\GroupDataService;
-use crmeb\services\SystemConfigService;
-use crmeb\services\UploadService;
-use crmeb\services\UtilService;
-
-/**
- * 账单类
- * Class UserBillController
- * @package app\api\controller\user
- */
-class UserBillController
-{
-    /**
-     * 推广数据    昨天的佣金   累计提现金额  当前佣金
-     * @param Request $request
-     * @return mixed
-     */
-    public function commission(Request $request)
-    {
-        $uid = $request->uid();
-        $lastDayCount = UserBill::yesterdayCommissionSum($uid);//昨天的佣金
-        $extractCount = UserExtract::extractSum($uid);//累计提现金额
-        $commissionCount = UserBill::getBrokerage($uid);//获取总佣金
-        if ($commissionCount > 0) {
-            $rechargeCount = UserBill::getRecharge($uid);//累计充值
-            $orderYuePrice = StoreOrder::getOrderStatusYueSum($uid);//余额累计消费
-            $systemAdd = UserBill::getSystemAdd($uid);//后台添加余额
-            $yueCount = bcadd($rechargeCount, $systemAdd, 2);// 后台添加余额 + 累计充值  = 非佣金的总金额
-            $orderYuePrice = $yueCount > $orderYuePrice ? 0 : bcsub($orderYuePrice, $yueCount, 2);// 余额累计消费(使用佣金消费的金额)
-            $commissionCount = bcsub($commissionCount, $extractCount, 2);//减去已提现金额
-            $extractPriceCount = UserExtract::userExtractTotalPrice($uid, 0);
-            $commissionCount = $extractPriceCount < $commissionCount ? bcsub($commissionCount, $extractPriceCount, 2) : 0;//减去审核中的提现金额
-            $commissionCount = $commissionCount > $orderYuePrice ? bcsub($commissionCount, $orderYuePrice, 2) : 0;//减掉余额支付
-        }
-        $data['lastDayCount'] = $lastDayCount;
-        $data['extractCount'] = $extractCount;
-        $data['commissionCount'] = $commissionCount;
-        return app('json')->successful($data);
-    }
-
-
-    /**
-     * 推荐用户
-     * @param Request $request
-     * @return mixed
-     *
-     * grade == 0  获取一级推荐人
-     * grade == 1  获取二级推荐人
-     *
-     * keyword 会员名称查询
-     *
-     * sort  childCount ASC/DESC  团队排序   numberCount ASC/DESC  金额排序  orderCount  ASC/DESC  订单排序
-     */
-    public function spread_people(Request $request)
-    {
-        $spreadInfo = UtilService::postMore([
-            ['page', 1],
-            ['limit', 20],
-            ['grade', 0],
-            ['keyword', ''],
-            ['sort', ''],
-        ], $request);
-        $uid = $request->uid();
-        $data['list'] = User::getUserSpreadGrade($uid, $spreadInfo['grade'], $spreadInfo['sort'], $spreadInfo['keyword'], $spreadInfo['page'], $spreadInfo['limit']);
-        $data['total'] = User::getSpreadCount($uid);
-        $data['totalLevel'] = User::getSpreadLevelCount($uid);
-        return app('json')->successful($data);
-    }
-
-    /**
-     * 推广订单
-     * @param Request $request
-     * @return mixed
-     */
-    public function spread_order(Request $request)
-    {
-        $orderInfo = UtilService::postMore([
-            ['page', 1],
-            ['limit', 20],
-            ['category', 'now_money'],
-            ['type', 'brokerage'],
-        ], $request);
-        $data['list'] = [];
-        $data['count'] = 0;
-        $uid = $request->uid();
-        $data['list'] = UserBill::getRecordList($uid, $orderInfo['page'], $orderInfo['limit'], $orderInfo['category'], $orderInfo['type']);
-        $count = UserBill::getRecordOrderCount($uid, $orderInfo['category'], $orderInfo['type']);
-        $data['count'] = $count ? $count : 0;
-        if (!count($data['list'])) return app('json')->successful($data);
-        foreach ($data['list'] as $key => &$value) {
-            $value['child'] = UserBill::getRecordOrderListDraw($uid, $value['time'], $orderInfo['category'], $orderInfo['type']);
-            $value['count'] = count($value['child']);
-        }
-        return app('json')->successful($data);
-    }
-
-    /**
-     * 推广佣金明细
-     * @param Request $request
-     * @param $type 0 全部  1 消费  2 充值  3 返佣  4 提现
-     * @return mixed
-     */
-    public function spread_commission(Request $request, $type)
-    {
-        list($page, $limit) = UtilService::getMore([
-            ['page', 0],
-            ['limit', 0],
-        ], $request, true);
-        return app('json')->successful(UserBill::getUserBillList($request->uid(), $page, $limit, $type));
-    }
-
-    /**
-     * 推广 佣金/提现 总和
-     * @param Request $request
-     * @param $type 3 佣金  4 提现
-     * @return mixed
-     */
-    public function spread_count(Request $request, $type)
-    {
-        $count = 0;
-        if ($type == 3) {
-            $count1 = UserBill::getRecordCount($request->uid(), 'now_money', 'brokerage');
-            $count2 = UserBill::getRecordCount($request->uid(), 'now_money', 'brokerage', '', true);
-            $count = $count1 - $count2;
-        } else if ($type == 4) {
-            $count = UserExtract::userExtractTotalPrice($request->uid());//累计提现
-        }
-        $count = $count ? $count : 0;
-        return app('json')->successful(['count' => $count]);
-    }
-
-
-    /**
-     * 分销二维码海报生成
-     * @param Request $request
-     * @return mixed
-     * @throws \Exception
-     */
-    public function spread_banner(Request $request)
-    {
-        $mer_id = $request->mer_id();
-        list($type) = UtilService::getMore([
-            ['type', 2],
-        ], $request, true);
-        $user = $request->user();
-        $rootPath = app()->getRootPath();
-        try {
-            $resRoutine = true;//小程序
-            $resWap = true;//公众号
-            $siteUrl = sys_config('site_url', '', $mer_id);
-            $routineSpreadBanner = sys_data('routine_spread_banner', 0, $mer_id);
-            if (!count($routineSpreadBanner)) return app('json')->fail('暂无海报');
-            if ($type == 1) {
-                //小程序
-                $name = $user['uid'] . '_' . $user['is_promoter'] . '_user_routine.jpg';
-                $imageInfo = SystemAttachment::getInfo($name, 'name');
-                //检测远程文件是否存在
-                if (isset($imageInfo['att_dir']) && strstr($imageInfo['att_dir'], 'http') !== false && curl_file_exist($imageInfo['att_dir']) === false) {
-                    $imageInfo = null;
-                    SystemAttachment::where(['name' => $name])->delete();
-                }
-                if (!$imageInfo) {
-                    $res = RoutineCode::getShareCode($user['uid'], 'spread', 'pages/index/index', '', $mer_id);
-                    if (!$res) return app('json')->fail('二维码生成失败');
-                    $uploadType = (int)sys_config('upload_type', 1, $mer_id);
-                    $upload = UploadService::init(null, $mer_id);
-                    $uploadRes = $upload->to('routine/spread/code')->validate()->stream($res['res'], $name);
-                    if ($uploadRes === false) {
-                        return app('json')->fail($upload->getError());
-                    }
-                    $imageInfo = $upload->getUploadInfo();
-                    $imageInfo['image_type'] = $uploadType;
-                    SystemAttachment::attachmentAdd($imageInfo['name'], $imageInfo['size'], $imageInfo['type'], $imageInfo['dir'], $imageInfo['thumb_path'], 1, $imageInfo['image_type'], $imageInfo['time'], 2);
-                    RoutineQrcode::setRoutineQrcodeFind($res['id'], ['status' => 1, 'url_time' => time(), 'qrcode_url' => $imageInfo['dir']]);
-                    $urlCode = $imageInfo['dir'];
-                } else $urlCode = $imageInfo['att_dir'];
-                if ($imageInfo['image_type'] == 1) $urlCode = $siteUrl . $urlCode;
-                $siteUrlHttps = set_http_type($siteUrl, $request->isSsl() ? 0 : 1);
-                $filelink = [
-                    'Bold' => 'statics' . DS . 'font' . DS . 'Alibaba-PuHuiTi-Regular.otf',
-                    'Normal' => 'statics' . DS . 'font' . DS . 'Alibaba-PuHuiTi-Regular.otf',
-                ];
-                if (!file_exists($filelink['Bold'])) return app('json')->fail('缺少字体文件Bold');
-                if (!file_exists($filelink['Normal'])) return app('json')->fail('缺少字体文件Normal');
-                foreach ($routineSpreadBanner as $key => &$item) {
-                    $posterInfo = '海报生成失败:(';
-                    $config = array(
-                        'image' => array(
-                            array(
-                                'url' => $urlCode,     //二维码资源
-                                'stream' => 0,
-                                'left' => 114,
-                                'top' => 790,
-                                'right' => 0,
-                                'bottom' => 0,
-                                'width' => 120,
-                                'height' => 120,
-                                'opacity' => 100
-                            )
-                        ),
-                        'text' => array(
-                            array(
-                                'text' => $user['nickname'],
-                                'left' => 250,
-                                'top' => 840,
-                                'fontPath' => $rootPath . 'public' . DS . $filelink['Bold'],     //字体文件
-                                'fontSize' => 16,             //字号
-                                'fontColor' => '40,40,40',       //字体颜色
-                                'angle' => 0,
-                            ),
-                            array(
-                                'text' => '邀请您加入' . sys_config('site_name', '', $request->mer_id()),
-                                'left' => 250,
-                                'top' => 880,
-                                'fontPath' => $rootPath . 'public' . DS . $filelink['Normal'],     //字体文件
-                                'fontSize' => 16,             //字号
-                                'fontColor' => '40,40,40',       //字体颜色
-                                'angle' => 0,
-                            )
-                        ),
-                        'background' => $item['pic']
-                    );
-                    $resRoutine = $resRoutine && $posterInfo = UtilService::setSharePoster($config, 'routine/spread/poster');
-                    if (!is_array($posterInfo)) return app('json')->fail($posterInfo);
-                    SystemAttachment::attachmentAdd($posterInfo['name'], $posterInfo['size'], $posterInfo['type'], $posterInfo['dir'], $posterInfo['thumb_path'], 1, $posterInfo['image_type'], $posterInfo['time'], 2);
-                    if ($resRoutine) {
-                        if ($posterInfo['image_type'] == 1)
-                            $item['poster'] = $siteUrlHttps . $posterInfo['dir'];
-                        else
-                            $item['poster'] = set_http_type($posterInfo['dir'], $request->isSsl() ? 0 : 1);
-                        $item['poster'] = str_replace('\\', '/', $item['poster']);
-                    }
-                }
-            } else if ($type == 2) {
-                //公众号
-                $name = $user['uid'] . '_' . $user['is_promoter'] . '_user_wap.jpg';
-                $imageInfo = SystemAttachment::getInfo($name, 'name');
-                //检测远程文件是否存在
-                if (isset($imageInfo['att_dir']) && strstr($imageInfo['att_dir'], 'http') !== false && curl_file_exist($imageInfo['att_dir']) === false) {
-                    $imageInfo = null;
-                    SystemAttachment::where(['name' => $name])->delete();
-                }
-                if (!$imageInfo) {
-                    $codeUrl = set_http_type($siteUrl . '?spread=' . $user['uid'], $request->isSsl() ? 0 : 1);//二维码链接
-                    $imageInfo = UtilService::getQRCodePath($codeUrl, $name);
-                    if (is_string($imageInfo)) return app('json')->fail('二维码生成失败', ['error' => $imageInfo]);
-                    SystemAttachment::attachmentAdd($imageInfo['name'], $imageInfo['size'], $imageInfo['type'], $imageInfo['dir'], $imageInfo['thumb_path'], 1, $imageInfo['image_type'], $imageInfo['time'], 2);
-                    $urlCode = $imageInfo['dir'];
-                } else $urlCode = $imageInfo['att_dir'];
-                if ($imageInfo['image_type'] == 1) $urlCode = $siteUrl . $urlCode;
-                $siteUrl = set_http_type($siteUrl, $request->isSsl() ? 0 : 1);
-                $filelink = [
-                    'Bold' => 'statics' . DS . 'font' . DS . 'Alibaba-PuHuiTi-Regular.otf',
-                    'Normal' => 'statics' . DS . 'font' . DS . 'Alibaba-PuHuiTi-Regular.otf',
-                ];
-                if (!file_exists($filelink['Bold'])) return app('json')->fail('缺少字体文件Bold');
-                if (!file_exists($filelink['Normal'])) return app('json')->fail('缺少字体文件Normal');
-                foreach ($routineSpreadBanner as $key => &$item) {
-                    $posterInfo = '海报生成失败:(';
-                    $config = array(
-                        'image' => array(
-                            array(
-                                'url' => $urlCode,     //二维码资源
-                                'stream' => 0,
-                                'left' => 114,
-                                'top' => 790,
-                                'right' => 0,
-                                'bottom' => 0,
-                                'width' => 120,
-                                'height' => 120,
-                                'opacity' => 100
-                            )
-                        ),
-                        'text' => array(
-                            array(
-                                'text' => $user['nickname'],
-                                'left' => 250,
-                                'top' => 840,
-                                'fontPath' => $rootPath . 'public' . DS . $filelink['Bold'],     //字体文件
-                                'fontSize' => 16,             //字号
-                                'fontColor' => '40,40,40',       //字体颜色
-                                'angle' => 0,
-                            ),
-                            array(
-                                'text' => '邀请您加入' . sys_config('site_name', '', $request->mer_id()),
-                                'left' => 250,
-                                'top' => 880,
-                                'fontPath' => $rootPath . 'public' . DS . $filelink['Normal'],     //字体文件
-                                'fontSize' => 16,             //字号
-                                'fontColor' => '40,40,40',       //字体颜色
-                                'angle' => 0,
-                            )
-                        ),
-                        'background' => $item['pic']
-                    );
-                    $resWap = $resWap && $posterInfo = UtilService::setSharePoster($config, 'wap/spread/poster');
-                    if (!is_array($posterInfo)) return app('json')->fail($posterInfo);
-                    SystemAttachment::attachmentAdd($posterInfo['name'], $posterInfo['size'], $posterInfo['type'], $posterInfo['dir'], $posterInfo['thumb_path'], 1, $posterInfo['image_type'], $posterInfo['time'], 2);
-                    if ($resWap) {
-                        if ($posterInfo['image_type'] == 1)
-                            $item['wap_poster'] = $siteUrl . $posterInfo['thumb_path'];
-                        else
-                            $item['wap_poster'] = set_http_type($posterInfo['thumb_path'], 1);
-                    }
-                }
-            }
-            if ($resRoutine && $resWap) return app('json')->successful($routineSpreadBanner);
-            else return app('json')->fail('生成图片失败');
-        } catch (\Exception $e) {
-            return app('json')->fail('生成图片时,系统错误', ['line' => $e->getLine(), 'message' => $e->getMessage(), 'file' => $e->getFile()]);
-        }
-    }
-
-
-    /**
-     * 积分记录
-     * @param Request $request
-     * @return mixed
-     * @throws \think\db\exception\DataNotFoundException
-     * @throws \think\db\exception\ModelNotFoundException
-     * @throws \think\exception\DbException
-     */
-    public function integral_list(Request $request)
-    {
-        list($page, $limit) = UtilService::getMore([
-            ['page', 0], ['limit', 0]
-        ], $request, true);
-        return app('json')->successful(UserBill::userBillList($request->uid(), $page, $limit));
-
-    }
-}

+ 0 - 651
app/api/controller/user/UserController.php

@@ -1,651 +0,0 @@
-<?php
-
-namespace app\api\controller\user;
-
-use app\http\validates\user\AddressValidate;
-use app\models\system\SystemCity;
-use app\models\user\UserVisit;
-use think\db\exception\DataNotFoundException;
-use think\db\exception\DbException;
-use think\db\exception\ModelNotFoundException;
-use think\Exception;
-use think\exception\ValidateException;
-use app\Request;
-use app\models\user\UserLevel;
-use app\models\user\UserSign;
-use app\models\store\StoreBargain;
-use app\models\store\StoreCombination;
-use app\models\store\StoreCouponUser;
-use app\models\store\StoreOrder;
-use app\models\store\StoreProductRelation;
-use app\models\store\StoreSeckill;
-use app\models\user\User;
-use app\models\user\UserAddress;
-use app\models\user\UserBill;
-use app\models\user\UserExtract;
-use app\models\user\UserNotice;
-use crmeb\services\GroupDataService;
-use crmeb\services\UtilService;
-
-/**
- * 用户类
- * Class UserController
- * @package app\api\controller\store
- */
-class UserController
-{
-
-    /**
-     * 获取用户信息
-     * @param Request $request
-     * @return mixed
-     */
-    public function userInfo(Request $request)
-    {
-        $info = $request->user()->toArray();
-        $broken_time = intval(sys_config('extract_time', '', $request->mer_id()));
-        $search_time = time() - 86400 * $broken_time;
-        //返佣 +
-        $brokerage_commission = UserBill::where(['uid' => $info['uid'], 'category' => 'now_money', 'type' => 'brokerage'])
-            ->where('add_time', '>', $search_time)
-            ->where('pm', 1)
-            ->sum('number');
-        //退款退的佣金 -
-        $refund_commission = UserBill::where(['uid' => $info['uid'], 'category' => 'now_money', 'type' => 'brokerage'])
-            ->where('add_time', '>', $search_time)
-            ->where('pm', 0)
-            ->sum('number');
-        $info['broken_commission'] = bcsub($brokerage_commission, $refund_commission, 2);
-        if ($info['broken_commission'] < 0)
-            $info['broken_commission'] = 0;
-        $info['commissionCount'] = bcsub($info['brokerage_price'], $info['broken_commission'], 2);
-        if ($info['commissionCount'] < 0)
-            $info['commissionCount'] = 0;
-        return app('json')->success($info);
-    }
-
-    /**
-     * 用户资金统计
-     * @param Request $request
-     * @return mixed
-     * @throws Exception
-     * @throws DataNotFoundException
-     * @throws ModelNotFoundException
-     * @throws DbException
-     */
-    public function balance(Request $request)
-    {
-        $uid = $request->uid();
-        $user['now_money'] = User::getUserInfo($uid, 'now_money')['now_money'];//当前总资金
-        $user['recharge'] = UserBill::getRecharge($uid);//累计充值
-        $user['orderStatusSum'] = StoreOrder::getOrderStatusSum($uid);//累计消费
-        return app('json')->successful($user);
-    }
-
-    /**
-     * 个人中心
-     * @param Request $request
-     * @return mixed
-     * @throws DataNotFoundException
-     * @throws DbException
-     * @throws ModelNotFoundException
-     */
-    public function user(Request $request)
-    {
-        $user = $request->user()->toArray();
-        $user['couponCount'] = StoreCouponUser::getUserValidCouponCount($user['uid']);
-        $user['like'] = StoreProductRelation::getUserIdCollect($user['uid']);
-        $user['orderStatusNum'] = StoreOrder::getOrderData($user['uid'], $request->mer_id());
-        $user['notice'] = UserNotice::getNotice($user['uid']);
-//        $user['brokerage'] = UserBill::getBrokerage($user['uid']);//获取总佣金
-        $user['recharge'] = UserBill::getRecharge($user['uid']);//累计充值
-        $user['orderStatusSum'] = StoreOrder::getOrderStatusSum($user['uid']);//累计消费
-        $user['extractTotalPrice'] = UserExtract::userExtractTotalPrice($user['uid']);//累计提现
-        $user['extractPrice'] = $user['brokerage_price'];//可提现
-        $user['statu'] = (int)sys_config('store_brokerage_statu', '', $request->mer_id());
-        $broken_time = intval(sys_config('extract_time', '', $request->mer_id()));
-        $search_time = time() - 86400 * $broken_time;
-        if (!$user['is_promoter'] && $user['statu'] == 2) {
-            $price = StoreOrder::merSet($request->mer_id())->where(['paid' => 1, 'refund_status' => 0, 'uid' => $user['uid']])->sum('pay_price');
-            $status = is_brokerage_statu($price, $request->mer_id());
-            if ($status) {
-                User::where('uid', $user['uid'])->update(['is_promoter' => 1]);
-                $user['is_promoter'] = 1;
-            } else {
-                $storeBrokeragePrice = sys_config('store_brokerage_price', 0, $request->mer_id());
-                $user['promoter_price'] = bcsub($storeBrokeragePrice, $price, 2);
-            }
-        }
-        //可提现佣金
-        //返佣 +
-        $brokerage_commission = UserBill::where(['uid' => $user['uid'], 'category' => 'now_money', 'type' => 'brokerage'])
-            ->where('add_time', '>', $search_time)
-            ->where('pm', 1)
-            ->sum('number');
-        //退款退的佣金 -
-        $refund_commission = UserBill::where(['uid' => $user['uid'], 'category' => 'now_money', 'type' => 'brokerage'])
-            ->where('add_time', '>', $search_time)
-            ->where('pm', 0)
-            ->sum('number');
-        $user['broken_commission'] = bcsub($brokerage_commission, $refund_commission, 2);
-        if ($user['broken_commission'] < 0)
-            $user['broken_commission'] = 0;
-        $user['commissionCount'] = bcsub($user['brokerage_price'], $user['broken_commission'], 2);
-        if ($user['commissionCount'] < 0)
-            $user['commissionCount'] = 0;
-        if (!sys_config('vip_open'))
-            $user['vip'] = false;
-        else {
-            $vipId = UserLevel::getUserLevel($user['uid']);
-            $user['vip'] = $vipId !== false ? true : false;
-            if ($user['vip']) {
-                $user['vip_id'] = $vipId;
-                $user['vip_icon'] = UserLevel::getUserLevelInfo($vipId, 'icon');
-                $user['vip_name'] = UserLevel::getUserLevelInfo($vipId, 'name');
-            }
-        }
-        $user['yesterDay'] = UserBill::yesterdayCommissionSum($user['uid']);
-        $user['recharge_switch'] = (int)sys_config('recharge_switch', '', $request->mer_id());//充值开关
-        $user['adminid'] = (boolean)\app\models\store\StoreService::orderServiceStatus($user['uid']);
-        if ($user['phone'] && $user['user_type'] != 'h5') {
-            $user['switchUserInfo'][] = $request->user();
-            if ($h5UserInfo = User::merSet($request->mer_id())->where('account', $user['phone'])->where('user_type', 'h5')->find()) {
-                $user['switchUserInfo'][] = $h5UserInfo;
-            }
-        } else if ($user['phone'] && $user['user_type'] == 'h5') {
-            if ($wechatUserInfo = User::merSet($request->mer_id())->where('phone', $user['phone'])->where('user_type', '<>', 'h5')->find()) {
-                $user['switchUserInfo'][] = $wechatUserInfo;
-            }
-            $user['switchUserInfo'][] = $request->user();
-        } else if (!$user['phone']) {
-            $user['switchUserInfo'][] = $request->user();
-        }
-        $user['broken_day'] = (int)sys_config('extract_time', '', $request->mer_id());//佣金冻结时间
-        return app('json')->successful($user);
-    }
-
-    /**
-     * 地址 获取单个
-     * @param Request $request
-     * @param $id
-     * @return mixed
-     * @throws DataNotFoundException
-     * @throws ModelNotFoundException
-     * @throws DbException
-     */
-    public function address(Request $request, $id)
-    {
-        $addressInfo = [];
-        if ($id && is_numeric($id) && UserAddress::be(['is_del' => 0, 'id' => $id, 'uid' => $request->uid()])) {
-            $addressInfo = UserAddress::find($id)->toArray();
-        }
-        return app('json')->successful($addressInfo);
-    }
-
-    /**
-     * 地址列表
-     * @param Request $request
-     * @param $page
-     * @param $limit
-     * @return mixed
-     * @throws \Exception
-     */
-    public function address_list(Request $request)
-    {
-        list($page, $limit) = UtilService::getMore([['page', 0], ['limit', 20]], $request, true);
-        $list = UserAddress::getUserValidAddressList($request->uid(), $page, $limit, 'id,real_name,phone,province,city,district,detail,is_default');
-        return app('json')->successful($list);
-    }
-
-    /**
-     * 设置默认地址
-     *
-     * @param Request $request
-     * @return mixed
-     * @throws \Exception
-     */
-    public function address_default_set(Request $request)
-    {
-        list($id) = UtilService::getMore([['id', 0]], $request, true);
-        if (!$id || !is_numeric($id)) return app('json')->fail('参数错误!');
-        if (!UserAddress::be(['is_del' => 0, 'id' => $id, 'uid' => $request->uid()]))
-            return app('json')->fail('地址不存在!');
-        $res = UserAddress::setDefaultAddress($id, $request->uid());
-        if (!$res)
-            return app('json')->fail('地址不存在!');
-        else
-            return app('json')->successful();
-    }
-
-    /**
-     * 获取默认地址
-     * @param Request $request
-     * @return mixed
-     */
-    public function address_default(Request $request)
-    {
-        $defaultAddress = UserAddress::getUserDefaultAddress($request->uid(), 'id,real_name,phone,province,city,district,detail,is_default');
-        if ($defaultAddress) {
-            $defaultAddress = $defaultAddress->toArray();
-            return app('json')->successful('ok', $defaultAddress);
-        }
-        return app('json')->successful('empty', []);
-    }
-
-    /**
-     * 修改 添加地址
-     * @param Request $request
-     * @return mixed
-     * @throws \Exception
-     */
-    public function address_edit(Request $request)
-    {
-        $addressInfo = UtilService::postMore([
-            ['address', []],
-            ['is_default', false],
-            ['real_name', ''],
-            ['post_code', ''],
-            ['phone', ''],
-            ['detail', ''],
-            [['id', 'd'], 0],
-            [['type', 'd'], 0]
-        ], $request);
-        if (!isset($addressInfo['address']['province'])) return app('json')->fail('收货地址格式错误!');
-        if (!isset($addressInfo['address']['city'])) return app('json')->fail('收货地址格式错误!');
-        if (!isset($addressInfo['address']['district'])) return app('json')->fail('收货地址格式错误!');
-        if (!isset($addressInfo['address']['city_id']) && $addressInfo['type'] == 0) {
-            return app('json')->fail('收货地址格式错误!请重新选择!');
-        } else if ($addressInfo['type'] == 1) {
-            $city = $addressInfo['address']['city'];
-            $cityId = SystemCity::where('name', $city)->where('parent_id', '<>', 0)->value('city_id');
-            if ($cityId) {
-                $addressInfo['address']['city_id'] = $cityId;
-            } else {
-                if (!($cityId = SystemCity::where('parent_id', '<>', 0)->where('name', 'like', "%$city%")->value('city_id'))) {
-                    return app('json')->fail('收货地址格式错误!修改后请重新导入!');
-                }
-            }
-        }
-
-        $addressInfo['province'] = $addressInfo['address']['province'];
-        $addressInfo['city'] = $addressInfo['address']['city'];
-        $addressInfo['city_id'] = $addressInfo['address']['city_id'] ?? 0;
-        $addressInfo['district'] = $addressInfo['address']['district'];
-        $addressInfo['is_default'] = (int)$addressInfo['is_default'] == true ? 1 : 0;
-        $addressInfo['uid'] = $request->uid();
-        unset($addressInfo['address'], $addressInfo['type']);
-        try {
-            validate(AddressValidate::class)->check($addressInfo);
-        } catch (ValidateException $e) {
-            return app('json')->fail($e->getError());
-        }
-        if ($addressInfo['id'] && UserAddress::be(['id' => $addressInfo['id'], 'uid' => $request->uid(), 'is_del' => 0])) {
-            $id = $addressInfo['id'];
-            unset($addressInfo['id']);
-            if (UserAddress::edit($addressInfo, $id, 'id')) {
-                if ($addressInfo['is_default'])
-                    UserAddress::setDefaultAddress($id, $request->uid());
-                return app('json')->successful();
-            } else
-                return app('json')->fail('编辑收货地址失败!');
-        } else {
-            $addressInfo['add_time'] = time();
-            if ($address = UserAddress::create($addressInfo)) {
-                if ($addressInfo['is_default']) {
-                    UserAddress::setDefaultAddress($address->id, $request->uid());
-                }
-                return app('json')->successful(['id' => $address->id]);
-            } else {
-                return app('json')->fail('添加收货地址失败!');
-            }
-        }
-    }
-
-    /**
-     * 删除地址
-     *
-     * @param Request $request
-     * @return mixed
-     * @throws \Exception
-     */
-    public function address_del(Request $request)
-    {
-        list($id) = UtilService::postMore([['id', 0]], $request, true);
-        if (!$id || !is_numeric($id)) return app('json')->fail('参数错误!');
-        if (!UserAddress::be(['is_del' => 0, 'id' => $id, 'uid' => $request->uid()]))
-            return app('json')->fail('地址不存在!');
-        if (UserAddress::edit(['is_del' => '1'], $id, 'id'))
-            return app('json')->successful();
-        else
-            return app('json')->fail('删除地址失败!');
-    }
-
-
-    /**
-     * 获取收藏商品
-     *
-     * @param Request $request
-     * @return mixed
-     * @throws \Exception
-     */
-    public function collect_user(Request $request)
-    {
-        list($page, $limit) = UtilService::getMore([
-            ['page', 0],
-            ['limit', 0]
-        ], $request, true);
-        if (!(int)$limit) return app('json')->successful([]);
-        $productRelationList = StoreProductRelation::getUserCollectProduct($request->uid(), (int)$page, (int)$limit, $request->mer_id());
-        return app('json')->successful($productRelationList);
-    }
-
-    /**
-     * 添加收藏
-     * @param Request $request
-     * @param $id
-     * @param $category
-     * @return mixed
-     * @throws \Exception
-     */
-    public function collect_add(Request $request)
-    {
-        list($id, $category) = UtilService::postMore([['id', 0], ['category', 'product']], $request, true);
-        if (!$id || !is_numeric($id)) return app('json')->fail('参数错误');
-        $res = StoreProductRelation::productRelation($id, $request->uid(), 'collect', $category);
-        if (!$res) return app('json')->fail(StoreProductRelation::getErrorInfo());
-        else return app('json')->successful();
-    }
-
-    /**
-     * 取消收藏
-     *
-     * @param Request $request
-     * @return mixed
-     * @throws \Exception
-     */
-    public function collect_del(Request $request)
-    {
-        list($id, $category) = UtilService::postMore([['id', 0], ['category', 'product']], $request, true);
-        if (!$id || !is_numeric($id)) return app('json')->fail('参数错误');
-        $res = StoreProductRelation::unProductRelation($id, $request->uid(), 'collect', $category);
-        if (!$res) return app('json')->fail(StoreProductRelation::getErrorInfo());
-        else return app('json')->successful();
-    }
-
-    /**
-     * 批量收藏
-     * @param Request $request
-     * @return mixed
-     * @throws \Exception
-     */
-    public function collect_all(Request $request)
-    {
-        $collectInfo = UtilService::postMore([
-            ['id', []],
-            ['category', 'product'],
-        ], $request);
-        if (!count($collectInfo['id'])) return app('json')->fail('参数错误');
-        $productIdS = $collectInfo['id'];
-        $res = StoreProductRelation::productRelationAll($productIdS, $request->uid(), 'collect', $collectInfo['category']);
-        if (!$res) return app('json')->fail(StoreProductRelation::getErrorInfo());
-        else return app('json')->successful('收藏成功');
-    }
-
-    /**
-     * 添加点赞
-     *
-     * @param Request $request
-     * @return mixed
-     */
-//    public function like_add(Request $request)
-//    {
-//        list($id, $category) = UtilService::postMore([['id',0], ['category','product']], $request, true);
-//        if(!$id || !is_numeric($id))  return app('json')->fail('参数错误');
-//        $res = StoreProductRelation::productRelation($id,$request->uid(),'like',$category);
-//        if(!$res) return  app('json')->fail(StoreProductRelation::getErrorInfo());
-//        else return app('json')->successful();
-//    }
-
-    /**
-     * 取消点赞
-     *
-     * @param Request $request
-     * @return mixed
-     */
-//    public function like_del(Request $request)
-//    {
-//        list($id, $category) = UtilService::postMore([['id',0], ['category','product']], $request, true);
-//        if(!$id || !is_numeric($id)) return app('json')->fail('参数错误');
-//        $res = StoreProductRelation::unProductRelation($id, $request->uid(),'like',$category);
-//        if(!$res) return app('json')->fail(StoreProductRelation::getErrorInfo());
-//        else return app('json')->successful();
-//    }
-
-    /**
-     * 签到 配置
-     * @return mixed
-     * @throws DataNotFoundException
-     * @throws ModelNotFoundException
-     * @throws \think\exception\DbException
-     */
-    public function sign_config(Request $request)
-    {
-        $signConfig = sys_data('sign_day_num', 0, $request->mer_id()) ?? [];
-        return app('json')->successful($signConfig);
-    }
-
-    /**
-     * 签到 列表
-     * @param Request $request
-     * @param $page
-     * @param $limit
-     * @return mixed
-     * @throws \Exception
-     */
-    public function sign_list(Request $request)
-    {
-        list($page, $limit) = UtilService::getMore([
-            ['page', 0],
-            ['limit', 0]
-        ], $request, true);
-        if (!$limit) return app('json')->successful([]);
-        $signList = UserSign::getSignList($request->uid(), (int)$page, (int)$limit);
-        if ($signList) $signList = $signList->toArray();
-        return app('json')->successful($signList);
-    }
-
-    /**
-     * 签到
-     * @param Request $request
-     * @return mixed
-     */
-    public function sign_integral(Request $request)
-    {
-        $signed = UserSign::getIsSign($request->uid());
-        if ($signed) return app('json')->fail('已签到');
-        if (false !== ($integral = UserSign::sign($request->uid(), $request->mer_id())))
-            return app('json')->successful('签到获得' . floatval($integral) . '积分', ['integral' => $integral]);
-        return app('json')->fail(UserSign::getErrorInfo('签到失败'));
-    }
-
-    /**
-     * 签到用户信息
-     * @param Request $request
-     * @return mixed
-     * @throws \Exception
-     */
-    public function sign_user(Request $request)
-    {
-        list($sign, $integral, $all) = UtilService::postMore([
-            ['sign', 0],
-            ['integral', 0],
-            ['all', 0],
-        ], $request, true);
-        $user = $request->user();
-        //是否统计签到
-        if ($sign || $all) {
-            $user['sum_sgin_day'] = UserSign::getSignSumDay($user['uid']);
-            $user['is_day_sgin'] = UserSign::getIsSign($user['uid']);
-            $user['is_YesterDay_sgin'] = UserSign::getIsSign($user['uid'], 'yesterday');
-            if (!$user['is_day_sgin'] && !$user['is_YesterDay_sgin']) {
-                $user['sign_num'] = 0;
-            }
-        }
-        //是否统计积分使用情况
-        if ($integral || $all) {
-            $user['sum_integral'] = (int)UserBill::getRecordCount($user['uid'], 'integral', 'sign,system_add,gain');
-            $user['deduction_integral'] = (int)UserBill::getRecordCount($user['uid'], 'integral', 'deduction', '', true) ?? 0;
-            $user['today_integral'] = (int)UserBill::getRecordCount($user['uid'], 'integral', 'sign,system_add,gain', 'today');
-        }
-        unset($user['pwd']);
-        if (!$user['is_promoter']) {
-            $user['is_promoter'] = (int)sys_config('store_brokerage_statu', '', $request->mer_id()) == 2 ? true : false;
-        }
-        return app('json')->successful($user->hidden(['account', 'real_name', 'birthday', 'card_id', 'mark', 'partner_id', 'group_id', 'add_time', 'add_ip', 'phone', 'last_time', 'last_ip', 'spread_uid', 'spread_time', 'user_type', 'status', 'level', 'clean_time', 'addres'])->toArray());
-    }
-
-    /**
-     * 签到列表(年月)
-     *
-     * @param Request $request
-     * @return mixed
-     */
-    public function sign_month(Request $request)
-    {
-        list($page, $limit) = UtilService::getMore([
-            ['page', 0],
-            ['limit', 0]
-        ], $request, true);
-        if (!$limit) return app('json')->successful([]);
-        $userSignList = UserSign::getSignMonthList($request->uid(), (int)$page, (int)$limit);
-        return app('json')->successful($userSignList);
-    }
-
-    /**
-     * 获取活动状态
-     * @return mixed
-     */
-    public function activity(Request $request)
-    {
-        $mer_id = $request->mer_id();
-        $data['is_bargin'] = StoreBargain::validBargain(0, $mer_id) ? true : false;
-        $data['is_pink'] = StoreCombination::getPinkIsOpen($mer_id) ? true : false;
-        $data['is_seckill'] = StoreSeckill::getSeckillCount($mer_id) ? true : false;
-        return app('json')->successful($data);
-    }
-
-    /**
-     * 用户修改信息
-     * @param Request $request
-     * @return mixed
-     * @throws \Exception
-     */
-    public function edit(Request $request)
-    {
-        list($avatar, $nickname) = UtilService::postMore([
-            ['avatar', ''],
-            ['nickname', ''],
-        ], $request, true);
-        if (User::editUser($avatar, $nickname, $request->uid())) return app('json')->successful('修改成功');
-        return app('json')->fail('修改失败');
-    }
-
-    /**
-     * 推广人排行
-     * @param Request $request
-     * @return mixed
-     * @throws \Exception
-     */
-    public function rank(Request $request)
-    {
-        $data = UtilService::getMore([
-            ['page', ''],
-            ['limit', ''],
-            ['type', '']
-        ], $request);
-        $users = User::getRankList($data, $request->mer_id());
-        return app('json')->success($users);
-    }
-
-    /**
-     * 佣金排行
-     * @param Request $request
-     * @return mixed
-     * @throws \Exception
-     */
-    public function brokerage_rank(Request $request)
-    {
-        $data = UtilService::getMore([
-            ['page', ''],
-            ['limit'],
-            ['type']
-        ], $request);
-        $users = User::brokerageRank($data, $request->mer_id());
-        foreach ($users as $key => $item) {
-            if ($item['brokerage_price'] == '0.00' || $item['brokerage_price'] == 0 || !$item['brokerage_price']) {
-                unset($users[$key]);
-            }
-        }
-        $position_tmp = User::brokerageRank(['type' => $data['type'], 'page' => 0, 'limit' => 99999], $request->mer_id());
-        $position_tmp_one = array_column($position_tmp, 'uid');
-        $position_tmp_two = array_column($position_tmp, 'brokerage_price', 'uid');
-        if (!in_array($request->uid(), $position_tmp_one)) {
-            $position = 0;
-        } else {
-            if ($position_tmp_two[$request->uid()] == 0.00) {
-                $position = 0;
-            } else {
-                $position = array_search($request->uid(), $position_tmp_one) + 1;
-            }
-
-
-        }
-        return app('json')->success([
-            'rank' => $users,
-            'position' => $position
-        ]);
-
-    }
-
-    /**
-     * 添加访问记录
-     * @param Request $request
-     * @return mixed
-     * @throws \Exception
-     */
-    public function set_visit(Request $request)
-    {
-        $data = UtilService::postMore([
-            ['url', ''],
-            ['stay_time', 0]
-        ], $request);
-        if ($data['url'] == '') return app('json')->fail('未获取页面路径');
-        $data['uid'] = $request->uid();
-        $data['ip'] = $request->ip();
-        $data['add_time'] = time();
-        $res = UserVisit::insert($data);
-        if ($res) {
-            return app('json')->success('添加访问记录成功');
-        } else {
-            return app('json')->fail('添加访问记录失败');
-        }
-    }
-
-    /**
-     * 静默绑定推广人
-     * @param Request $request
-     * @return mixed
-     */
-    public function spread(Request $request)
-    {
-        $puid = $request->post('puid/d', 0);
-        if ($puid) {
-            $userInfo = $request->user();
-            $spreadUid = User::where('uid', $puid)->value('spread_uid');
-            if (!$userInfo['spread_uid'] && $puid != $request->uid() && $spreadUid != $userInfo['uid']) {
-                User::where('uid', $request->uid())->update(['spread_uid' => $puid, 'spread_time' => time()]);
-            }
-        }
-        return app('json')->success();
-    }
-}

+ 0 - 99
app/api/controller/user/UserExtractController.php

@@ -1,99 +0,0 @@
-<?php
-
-namespace app\api\controller\user;
-
-use app\models\store\StoreOrder;
-use app\models\user\UserBill;
-use app\models\user\UserExtract;
-use app\Request;
-use crmeb\services\UtilService;
-
-/**
- * 提现类
- * Class UserExtractController
- * @package app\api\controller\user
- */
-class UserExtractController
-{
-    /**
-     * 提现银行
-     * @param Request $request
-     * @return mixed
-     */
-    public function bank(Request $request)
-    {
-        $user = $request->user();
-        $broken_time = intval(sys_config('extract_time', '', $request->mer_id()));
-        $search_time = time() - 86400 * $broken_time;
-        //可提现佣金
-        //返佣 +
-        $brokerage_commission = UserBill::where(['uid' => $user['uid'], 'category' => 'now_money', 'type' => 'brokerage'])
-            ->where('add_time', '>', $search_time)
-            ->where('pm', 1)
-            ->sum('number');
-        //退款退的佣金 -
-        $refund_commission = UserBill::where(['uid' => $user['uid'], 'category' => 'now_money', 'type' => 'brokerage'])
-            ->where('add_time', '>', $search_time)
-            ->where('pm', 0)
-            ->sum('number');
-        $data['broken_commission'] = bcsub($brokerage_commission, $refund_commission, 2);
-        if ($data['broken_commission'] < 0)
-            $data['broken_commission'] = 0;
-//        return $data;
-        $data['brokerage_price'] = $user['brokerage_price'];
-        //可提现佣金
-        $data['commissionCount'] = $data['brokerage_price'] - $data['broken_commission'];
-        $extractBank = sys_config('user_extract_bank', '', $request->mer_id()) ?? []; //提现银行
-        $extractBank = str_replace("\r\n", "\n", $extractBank);//防止不兼容
-        $data['extractBank'] = explode("\n", is_array($extractBank) ? (isset($extractBank[0]) ? $extractBank[0] : $extractBank) : $extractBank);
-        $data['minPrice'] = sys_config('user_extract_min_price', '', $request->mer_id());//提现最低金额
-        return app('json')->successful($data);
-    }
-
-    /**
-     * 提现申请
-     * @param Request $request
-     * @return mixed
-     */
-    public function cash(Request $request)
-    {
-        $extractInfo = UtilService::postMore([
-            ['alipay_code', ''],
-            ['extract_type', ''],
-            ['money', 0],
-            ['name', ''],
-            ['bankname', ''],
-            ['cardnum', ''],
-            ['weixin', ''],
-        ], $request);
-        if (!preg_match('/^(([1-9]\d*)|0)(\.\d{1-2})?$/', $extractInfo['money'])) return app('json')->fail('提现金额输入有误');
-        $user = $request->user();
-        $broken_time = intval(sys_config('extract_time', '', $request->mer_id()));
-        $search_time = time() - 86400 * $broken_time;
-        //可提现佣金
-        //返佣 +
-        $brokerage_commission = UserBill::where(['uid' => $user['uid'], 'category' => 'now_money', 'type' => 'brokerage'])
-            ->where('add_time', '>', $search_time)
-            ->where('pm', 1)
-            ->sum('number');
-        //退款退的佣金 -
-        $refund_commission = UserBill::where(['uid' => $user['uid'], 'category' => 'now_money', 'type' => 'brokerage'])
-            ->where('add_time', '>', $search_time)
-            ->where('pm', 0)
-            ->sum('number');
-        $data['broken_commission'] = bcsub($brokerage_commission, $refund_commission, 2);
-        if ($data['broken_commission'] < 0)
-            $data['broken_commission'] = 0;
-        $data['brokerage_price'] = $user['brokerage_price'];
-        //可提现佣金
-        $commissionCount = $data['brokerage_price'] - $data['broken_commission'];
-        if ($extractInfo['money'] > $commissionCount) return app('json')->fail('可提现佣金不足');
-        if (!$extractInfo['cardnum'] == '')
-            if (!preg_match('/^([1-9]{1})(\d{14}|\d{18})$/', $extractInfo['cardnum']))
-                return app('json')->fail('银行卡号输入有误');
-        if (UserExtract::userExtract($request->user(), $extractInfo, $request->mer_id()))
-            return app('json')->successful('申请提现成功!');
-        else
-            return app('json')->fail(UserExtract::getErrorInfo('提现失败'));
-    }
-}

+ 0 - 61
app/api/controller/user/UserLevelController.php

@@ -1,61 +0,0 @@
-<?php
-
-namespace app\api\controller\user;
-
-use app\models\system\SystemUserLevel;
-use app\models\system\SystemUserTask;
-use app\models\user\UserLevel;
-use app\Request;
-use think\db\exception\DataNotFoundException;
-use think\db\exception\DbException;
-use think\db\exception\ModelNotFoundException;
-
-/**
- * 会员等级类
- * Class UserLevelController
- * @package app\api\controller\user
- */
-class UserLevelController
-{
-
-    /**
-     * 检测用户是否可以成为会员
-     * @param Request $request
-     * @return mixed
-     * @throws DataNotFoundException
-     * @throws ModelNotFoundException
-     * @throws DbException
-     */
-    public function detection(Request $request)
-    {
-        return app('json')->successful(UserLevel::setLevelComplete($request->uid(), false, $request->mer_id()));
-    }
-
-    /**
-     * 会员等级列表
-     * @param Request $request
-     * @return mixed
-     * @throws DataNotFoundException
-     * @throws ModelNotFoundException
-     * @throws DbException
-     */
-    public function grade(Request $request)
-    {
-        return app('json')->successful(SystemUserLevel::getLevelList($request->uid(), $request->mer_id()));
-    }
-
-    /**
-     * 获取等级任务
-     * @param Request $request
-     * @param $id
-     * @return mixed
-     * @throws DataNotFoundException
-     * @throws DbException
-     * @throws ModelNotFoundException
-     */
-    public function task(Request $request, $id)
-    {
-        return app('json')->successful(SystemUserTask::getTashList($id, $request->uid(), null, 1400, $request->mer_id()));
-    }
-
-}

+ 0 - 128
app/api/controller/user/UserRechargeController.php

@@ -1,128 +0,0 @@
-<?php
-
-namespace app\api\controller\user;
-
-use app\models\system\SystemGroupDataMerchant;
-use app\models\user\UserRecharge;
-use app\Request;
-use crmeb\services\GroupDataService;
-use crmeb\services\SystemConfigService;
-use crmeb\services\UtilService;
-
-/**
- * 充值类
- * Class UserRechargeController
- * @package app\api\controller\user
- */
-class UserRechargeController
-{
-
-    /**
-     * 小程序充值
-     *
-     * @param Request $request
-     * @return mixed
-     * @throws \think\Exception
-     * @throws \think\db\exception\DataNotFoundException
-     * @throws \think\db\exception\ModelNotFoundException
-     * @throws \Exception
-     */
-    public function routine(Request $request)
-    {
-        list($price, $recharId, $type) = UtilService::postMore([['price', 0], ['rechar_id', 0], ['type', 0]], $request, true);
-        if (!$price || $price <= 0) return app('json')->fail('参数错误');
-        $storeMinRecharge = sys_config('store_user_min_recharge', '', $request->mer_id());
-        if ($price < $storeMinRecharge) return app('json')->fail('充值金额不能低于' . $storeMinRecharge);
-        switch ((int)$type) {
-            case 0: //支付充值余额
-                $paid_price = 0;
-                if ($recharId) {
-                    $data = SystemGroupDataMerchant::getDateValue($recharId);
-                    if ($data === false) {
-                        return app('json')->fail('您选择的充值方式已下架!');
-                    } else {
-                        $paid_price = $data['give_money'] ?? 0;
-                    }
-                }
-                $rechargeOrder = UserRecharge::addRecharge($request->uid(), $price, 'routine', $paid_price, 0, $request->mer_id());
-                if (!$rechargeOrder) return app('json')->fail('充值订单生成失败!');
-                try {
-                    return app('json')->successful(UserRecharge::jsPay($rechargeOrder, $request->mer_id()));
-                } catch (\Exception $e) {
-                    return app('json')->fail($e->getMessage());
-                }
-                break;
-            case 1: //佣金转入余额
-                if (UserRecharge::importNowMoney($request->uid(), $price, $request->mer_id()))
-                    return app('json')->successful('转入余额成功');
-                else
-                    return app('json')->fail(UserRecharge::getErrorInfo());
-                break;
-            default:
-                return app('json')->fail('缺少参数');
-                break;
-        }
-    }
-
-    /**
-     * 公众号充值
-     *
-     * @param Request $request
-     * @return mixed
-     */
-    public function wechat(Request $request)
-    {
-        list($price, $recharId, $from, $type) = UtilService::postMore([['price', 0], ['rechar_id', 0], ['from', 'weixin'], ['type', 0]], $request, true);
-        if (!$price || $price <= 0) return app('json')->fail('参数错误');
-        $storeMinRecharge = sys_config('store_user_min_recharge');
-        if ($price < $storeMinRecharge) return app('json')->fail('充值金额不能低于' . $storeMinRecharge);
-        switch ((int)$type) {
-            case 0: //支付充值余额
-                $paid_price = 0;
-                if ($recharId) {
-                    $data = SystemGroupDataMerchant::getDateValue($recharId);
-                    if ($data === false) {
-                        return app('json')->fail('您选择的充值方式已下架!');
-                    } else {
-                        $paid_price = $data['give_money'] ?? 0;
-                    }
-                }
-                $rechargeOrder = UserRecharge::addRecharge($request->uid(), $price, 'weixin', $paid_price, 0, $request->mer_id());
-                if (!$rechargeOrder) return app('json')->fail('充值订单生成失败!');
-                try {
-                    if ($from == 'weixinh5') {
-                        $recharge = UserRecharge::wxH5Pay($rechargeOrder);
-                    } else {
-                        $recharge = UserRecharge::wxPay($rechargeOrder);
-                    }
-                } catch (\Exception $e) {
-                    return app('json')->fail($e->getMessage());
-                }
-                return app('json')->successful(['type' => $from, 'data' => $recharge]);
-                break;
-            case 1: //佣金转入余额
-                if (UserRecharge::importNowMoney($request->uid(), $price, $request->mer_id()))
-                    return app('json')->successful('转入余额成功');
-                else
-                    return app('json')->fail(UserRecharge::getErrorInfo());
-                break;
-            default:
-                return app('json')->fail('缺少参数');
-                break;
-        }
-    }
-
-    /**
-     * 充值额度选择
-     * @return mixed
-     */
-    public function index(Request $request)
-    {
-        $rechargeQuota = sys_data('user_recharge_quota', 0, $request->mer_id()) ?? [];
-        $data['recharge_quota'] = $rechargeQuota;
-        $recharge_attention = sys_config('recharge_attention');
-        $recharge_attention = explode("\n", $recharge_attention);
-        $data['recharge_attention'] = $recharge_attention;
-        return app('json')->successful($data);
-    }
-}

+ 1 - 1
app/api/controller/wechat/WechatController.php

@@ -111,7 +111,7 @@ class WechatController
     public function wxAuth(Request $request)
     public function wxAuth(Request $request)
     {
     {
         $mer_id = $request->param('mer_id', '');
         $mer_id = $request->param('mer_id', '');
-        $redirect_uri=urlencode("https://demoapi.boofly.cn/api/wechat/bindPush");
+        $redirect_uri=urlencode("https://auti.boofly.cn/api/wechat/bindPush");
         header('location:https://open.weixin.qq.com/connect/oauth2/authorize?appid='.self::APPID.'&redirect_uri='.$redirect_uri.'&response_type=code&scope=snsapi_userinfo&state='.$mer_id.'#wechat_redirect');
         header('location:https://open.weixin.qq.com/connect/oauth2/authorize?appid='.self::APPID.'&redirect_uri='.$redirect_uri.'&response_type=code&scope=snsapi_userinfo&state='.$mer_id.'#wechat_redirect');
     }
     }
 
 

+ 12 - 273
app/api/route/route.php

@@ -4,281 +4,20 @@ use think\facade\Route;
 use think\facade\Config;
 use think\facade\Config;
 use think\Response;
 use think\Response;
 
 
-
-Route::group(function () {//TODO 分离商户完成
-    //账号密码登录
-    Route::post('login', 'AuthController/login')->name('login');
-// 获取发短信的key
-    Route::get('verify_code', 'AuthController/verifyCode')->name('verifyCode');
-//手机号登录
-    Route::post('login/mobile', 'AuthController/mobile')->name('loginMobile');
-//图片验证码
-    Route::get('sms_captcha', 'AuthController/captcha')->name('captcha');
-//验证码发送
-    Route::post('register/verify', 'AuthController/verify')->name('registerVerify');
-//手机号注册
-    Route::post('register', 'AuthController/register')->name('register');
-//手机号修改密码
-    Route::post('register/reset', 'AuthController/reset')->name('registerReset');
-})->middleware(\app\http\middleware\AllowOriginMiddleware::class)->middleware(\app\api\middleware\AppAuthorizeMiddleware::class);
-
-Route::group(function () {
-//霸屏广告
-    Route::post('assistance/popScreen', 'activity.StoreAssistanceController/popScreen')->name('popScreen');//霸屏广告详情
-    Route::get('wechat/wxAuth', 'wechat.WechatController/wxAuth')->name('wxAuth');//公众号网页授权登陆
-    Route::get('wechat/bindPush', 'wechat.WechatController/bindPush')->name('bindPush');//公众号绑定推送
-    Route::post('wechat/UserInfo', 'wechat.WechatController/addUserInfo')->name('addUserInfo');//用户信息入库
-    Route::get('wechat/reportList', 'wechat.WechatController/getReportList')->name('getReportList');//统计报表列表
-
-    //用户访问
-    Route::post('user/set_visit', 'user.UserController/set_visit')->name('setVisit');// 添加用户访问记录
-    //部门信息
-    Route::get('section/list', 'company.SectionController/list')->name('sectionList');//部门列表
-    Route::get('section/details/:id', 'company.SectionController/details')->name('sectionDetails');//部门详情
-    Route::get('company/list', 'company.CompanyController/list')->name('companyList');//公司列表
-    Route::get('company/details/:id', 'company.CompanyController/details')->name('companyDetails');//公司详情
-})->middleware(\app\http\middleware\AllowOriginMiddleware::class);
-
-Route::any('wechat/serve', 'wechat.WechatController/serve');//公众号服务
-Route::any('wechat/notify', 'wechat.WechatController/notify');//公众号支付回调
-Route::any('routine/notify/:mer_id', 'wechat.AuthController/notify');//小程序支付回调
-Route::get('test', 'PublicController/test')->name('test');//测试接口
-Route::get('order_pay_success', 'PublicController/order_pay_success')->name('test');//订单支付成功接口
-Route::get('profitSharingFinish', 'PublicController/profitSharingFinish')->name('test');//订单支付成功接口
-Route::get('test_profit_sharing_finish', 'PublicController/test_profit_sharing_finish')->name('test');//完结分账接口
-Route::get('test_refund', 'PublicController/test_refund')->name('test');//测试退款接口
-Route::get('wechat_user_recharge', 'PublicController/wechat_user_recharge')->name('test');//测试退款接口
-Route::post('pay_success', 'PublicController/pay_success')->name('test');//测试支付完成接口
-Route::get('test_recharge', 'PublicController/test_recharge')->name('test');//测试退款接口
-Route::get('test2/:id', 'PublicController/test2')->name('test2');//测试接口
-Route::post('test3', 'PublicController/test3')->name('test3');//测试接口
-Route::get('test111', 'PublicController/test111')->name('test111');//测试接口
-Route::get('test222', 'PublicController/test222')->name('test222');//测试接口
-Route::post('clearCache', 'PublicController/clearCache')->name('clearCache');//清除缓存
-
-//管理员订单操作类
-Route::group(function () {//暂不提供
-    Route::get('admin/order/statistics', 'admin.StoreOrderController/statistics')->name('adminOrderStatistics');//订单数据统计
-    Route::get('admin/order/data', 'admin.StoreOrderController/data')->name('adminOrderData');//订单每月统计数据
-    Route::get('admin/order/list', 'admin.StoreOrderController/lst')->name('adminOrderList');//订单列表
-    Route::get('admin/order/detail/:orderId', 'admin.StoreOrderController/detail')->name('adminOrderDetail');//订单详情
-    Route::get('admin/order/delivery/gain/:orderId', 'admin.StoreOrderController/delivery_gain')->name('adminOrderDeliveryGain');//订单发货获取订单信息
-    Route::post('admin/order/delivery/keep', 'admin.StoreOrderController/delivery_keep')->name('adminOrderDeliveryKeep');//订单发货
-    Route::post('admin/order/price', 'admin.StoreOrderController/price')->name('adminOrderPrice');//订单改价
-    Route::post('admin/order/remark', 'admin.StoreOrderController/remark')->name('adminOrderRemark');//订单备注
-    Route::get('admin/order/time', 'admin.StoreOrderController/time')->name('adminOrderTime');//订单交易额时间统计
-    Route::post('admin/order/offline', 'admin.StoreOrderController/offline')->name('adminOrderOffline');//订单支付
-    Route::post('admin/order/refund', 'admin.StoreOrderController/refund')->name('adminOrderRefund');//订单退款
-    Route::post('order/order_verific', 'order.StoreOrderController/order_verific')->name('order');//订单核销
-})->middleware(\app\http\middleware\AllowOriginMiddleware::class)->middleware(\app\api\middleware\AppAuthorizeMiddleware::class)->middleware(\app\api\middleware\AuthTokenMiddleware::class, true)->middleware(\app\api\middleware\CustomerMiddleware::class);
-
-//会员授权接口
 Route::group(function () {
 Route::group(function () {
-
-    Route::get('logout', 'AuthController/logout')->name('logout');// 退出登录
-    Route::post('switch_h5', 'AuthController/switch_h5')->name('switch_h5');// 切换账号
-    Route::post('binding', 'AuthController/binding_phone')->name('bindingPhone');// 绑定手机号
-    //商品类
-    Route::get('product/code/:id', 'store.StoreProductController/code')->name('productCode');//商品分享二维码 推广员
-
-    //公共类
-    Route::post('upload/image', 'PublicController/upload_image')->name('uploadImage');//图片上传
-    //用户类 客服聊天记录(暂未使用客服功能)
-    Route::get('user/service/list', 'user.StoreService/lst')->name('userServiceList');//客服列表
-    Route::get('user/service/record/:toUid', 'user.StoreService/record')->name('userServiceRecord');//客服聊天记录
-
-    //用户类  用户coupons/order
-    Route::get('user', 'user.UserController/user')->name('user');//个人中心
-    Route::post('user/spread', 'user.UserController/spread')->name('userSpread');//静默绑定授权
-    Route::post('user/edit', 'user.UserController/edit')->name('userEdit');//用户修改信息
-    Route::get('user/balance', 'user.UserController/balance')->name('userBalance');//用户资金统计
-    Route::get('userinfo', 'user.UserController/userInfo')->name('userInfo');// 用户信息
-    //用户类  地址
-    Route::get('address/detail/:id', 'user.UserController/address')->name('address');//获取单个地址
-    Route::get('address/list', 'user.UserController/address_list')->name('addressList');//地址列表
-    Route::post('address/default/set', 'user.UserController/address_default_set')->name('addressDefaultSet');//设置默认地址
-    Route::get('address/default', 'user.UserController/address_default')->name('addressDefault');//获取默认地址
-    Route::post('address/edit', 'user.UserController/address_edit')->name('addressEdit');//修改 添加 地址
-    Route::post('address/del', 'user.UserController/address_del')->name('addressDel');//删除地址
-    //用户类 收藏
-    Route::get('collect/user', 'user.UserController/collect_user')->name('collectUser');//收藏商品列表
-    Route::post('collect/add', 'user.UserController/collect_add')->name('collectAdd');//添加收藏
-    Route::post('collect/del', 'user.UserController/collect_del')->name('collectDel');//取消收藏
-    Route::post('collect/all', 'user.UserController/collect_all')->name('collectAll');//批量添加收藏
-
-    Route::get('brokerage_rank', 'user.UserController/brokerage_rank')->name('brokerageRank');//佣金排行
-    Route::get('rank', 'user.UserController/rank')->name('rank');//推广人排行
-    //用戶类 分享
-    Route::post('user/share', 'PublicController/user_share')->name('user_share');//记录用户分享
-    //用户类 点赞
-//    Route::post('like/add', 'user.UserController/like_add')->name('likeAdd');//添加点赞
-//    Route::post('like/del', 'user.UserController/like_del')->name('likeDel');//取消点赞
-    //用户类 签到 //暂未
-    Route::get('sign/config', 'user.UserController/sign_config')->name('signConfig');//签到配置
-    Route::get('sign/list', 'user.UserController/sign_list')->name('signList');//签到列表
-    Route::get('sign/month', 'user.UserController/sign_month')->name('signIntegral');//签到列表(年月)
-    Route::post('sign/user', 'user.UserController/sign_user')->name('signUser');//签到用户信息
-    Route::post('sign/integral', 'user.UserController/sign_integral')->name('signIntegral');//签到
-    //优惠券类(还不太了解业务,暂不处理)
-    Route::post('coupon/receive', 'store.StoreCouponsController/receive')->name('couponReceive'); //领取优惠券
-    Route::post('coupon/receive/batch', 'store.StoreCouponsController/receive_batch')->name('couponReceiveBatch'); //批量领取优惠券
-    Route::get('coupons/user/:types', 'store.StoreCouponsController/user')->name('couponsUser');//用户已领取优惠券
-    Route::get('coupons/order/:price', 'store.StoreCouponsController/order')->name('couponsOrder');//优惠券 订单列表
-    //购物车类
-    Route::get('cart/list', 'store.StoreCartController/lst')->name('cartList'); //购物车列表
-    Route::post('cart/add', 'store.StoreCartController/add')->name('cartAdd'); //购物车添加
-    Route::post('cart/del', 'store.StoreCartController/del')->name('cartDel'); //购物车删除
-    Route::post('order/cancel', 'order.StoreOrderController/cancel')->name('orderCancel'); //订单取消
-    Route::post('cart/num', 'store.StoreCartController/num')->name('cartNum'); //购物车 修改商品数量
-    Route::get('cart/count', 'store.StoreCartController/count')->name('cartCount'); //购物车 获取数量
-    //订单类
-    Route::post('order/confirm', 'order.StoreOrderController/confirm')->name('orderConfirm'); //订单确认
-    Route::post('order/computed/:key', 'order.StoreOrderController/computedOrder')->name('computedOrder'); //计算订单金额
-    Route::post('order/create/:key', 'order.StoreOrderController/create')->name('orderCreate'); //订单创建
-    Route::get('order/data', 'order.StoreOrderController/data')->name('orderData'); //订单统计数据
-    Route::get('order/list', 'order.StoreOrderController/lst')->name('orderList'); //订单列表
-    Route::get('order/detail/:uni', 'order.StoreOrderController/detail')->name('orderDetail'); //订单详情
-    Route::get('order/refund/reason', 'order.StoreOrderController/refund_reason')->name('orderRefundReason'); //订单退款理由
-    Route::post('order/refund/verify', 'order.StoreOrderController/refund_verify')->name('orderRefundVerify'); //订单退款审核
-    Route::post('order/take', 'order.StoreOrderController/take')->name('orderTake'); //订单收货
-    Route::get('order/express/:uni', 'order.StoreOrderController/express')->name('orderExpress'); //订单查看物流
-    Route::post('order/del', 'order.StoreOrderController/del')->name('orderDel'); //订单删除
-    Route::post('order/again', 'order.StoreOrderController/again')->name('orderAgain'); //订单 再次下单
-    Route::post('order/pay', 'order.StoreOrderController/pay')->name('orderPay'); //订单支付
-    Route::post('order/product', 'order.StoreOrderController/product')->name('orderProduct'); //订单商品信息
-    Route::post('order/comment', 'order.StoreOrderController/comment')->name('orderComment'); //订单评价
-    //活动---砍价
-    Route::get('bargain/detail/:id', 'activity.StoreBargainController/detail')->name('bargainDetail');//砍价商品详情
-    Route::post('bargain/start', 'activity.StoreBargainController/start')->name('bargainStart');//砍价开启
-    Route::post('bargain/start/user', 'activity.StoreBargainController/start_user')->name('bargainStartUser');//砍价 开启砍价用户信息
-    Route::post('bargain/share', 'activity.StoreBargainController/share')->name('bargainShare');//砍价 观看/分享/参与次数
-    Route::post('bargain/help', 'activity.StoreBargainController/help')->name('bargainHelp');//砍价 帮助好友砍价
-    Route::post('bargain/help/price', 'activity.StoreBargainController/help_price')->name('bargainHelpPrice');//砍价 砍掉金额
-    Route::post('bargain/help/count', 'activity.StoreBargainController/help_count')->name('bargainHelpCount');//砍价 砍价帮总人数、剩余金额、进度条、已经砍掉的价格
-    Route::post('bargain/help/list', 'activity.StoreBargainController/help_list')->name('bargainHelpList');//砍价 砍价帮
-    Route::post('bargain/poster', 'activity.StoreBargainController/poster')->name('bargainPoster');//砍价海报
-    Route::get('bargain/user/list', 'activity.StoreBargainController/user_list')->name('bargainUserList');//砍价列表(已参与)
-    Route::post('bargain/user/cancel', 'activity.StoreBargainController/user_cancel')->name('bargainUserCancel');//砍价取消
-    //活动---拼团
-    Route::get('combination/pink/:id', 'activity.StoreCombinationController/pink')->name('combinationPink');//拼团开团
-    Route::post('combination/remove', 'activity.StoreCombinationController/remove')->name('combinationRemove');//拼团 取消开团
-    Route::post('combination/poster', 'activity.StoreCombinationController/poster')->name('combinationPoster');//拼团海报
-    //活动---助力
-    Route::get('assistance/active/:id', 'activity.StoreAssistanceController/assistanceActive')->name('assistanceActive');//助力参团
-    Route::post('assistance/remove', 'activity.StoreAssistanceController/remove')->name('assistanceRemove');//取消助力
-    Route::post('assistance/poster', 'activity.StoreAssistanceController/poster')->name('assistancePoster');//助力海报
-    Route::get('assistance/attend/:id', 'activity.StoreAssistanceController/attend')->name('assistanceAttend');//参与助力
-    //账单类
-    Route::get('commission', 'user.UserBillController/commission')->name('commission');//推广数据 昨天的佣金 累计提现金额 当前佣金
-    Route::post('spread/people', 'user.UserBillController/spread_people')->name('spreadPeople');//推荐用户
-    Route::post('spread/order', 'user.UserBillController/spread_order')->name('spreadOrder');//推广订单
-    Route::get('spread/commission/:type', 'user.UserBillController/spread_commission')->name('spreadCommission');//推广佣金明细
-    Route::get('spread/count/:type', 'user.UserBillController/spread_count')->name('spreadCount');//推广 佣金 3/提现 4 总和
-    Route::get('spread/banner', 'user.UserBillController/spread_banner')->name('spreadBanner');//推广分销二维码海报生成
-    Route::get('integral/list', 'user.UserBillController/integral_list')->name('integralList');//积分记录
-    //提现类
-    Route::get('extract/bank', 'user.UserExtractController/bank')->name('extractBank');//提现银行/提现最低金额
-    Route::post('extract/cash', 'user.UserExtractController/cash')->name('extractCash');//提现申请
-    //充值类
-    Route::post('recharge/routine', 'user.UserRechargeController/routine')->name('rechargeRoutine');//小程序充值
-    Route::post('recharge/wechat', 'user.UserRechargeController/wechat')->name('rechargeWechat');//公众号充值
-    Route::get('recharge/index', 'user.UserRechargeController/index')->name('rechargeQuota');//充值余额选择
-    //会员等级类
-    Route::get('menu/user', 'PublicController/menu_user')->name('menuUser');//个人中心菜单
-    Route::get('user/level/detection', 'user.UserLevelController/detection')->name('userLevelDetection');//检测用户是否可以成为会员
-    Route::get('user/level/grade', 'user.UserLevelController/grade')->name('userLevelGrade');//会员等级列表
-    Route::get('user/level/task/:id', 'user.UserLevelController/task')->name('userLevelTask');//获取等级任务
-    //首页获取未支付订单(似乎没这个方法)
-    Route::get('order/nopay', 'order.StoreOrderController/get_noPay')->name('getNoPay');//获取未支付订单
-    //充值卡类
-    Route::get('recharge/card/index', 'activity.StoreRechargeCardController/index')->name('rechargeCardQuota');//充值卡列表选择
-    Route::get('recharge/card/detail/:id', 'activity.StoreRechargeCardController/detail')->name('rechargeCardDetail');//充值卡详情
-    Route::post('recharge/card/buy', 'activity.StoreRechargeCardController/buy_recharge_card')->name('rechargeCardBuy');//充值卡购买
-    Route::get('recharge/card/user_recharge', 'activity.StoreRechargeCardController/get_user_recharge_card_list')->name('rechargeCardUserRecharge');//用户充值记录
-
-    Route::get('seckill/code/:id', 'activity.StoreSeckillController/code')->name('seckillCode');//秒杀商品海报
-    Route::get('combination/code/:id', 'activity.StoreCombinationController/code')->name('combinationCode');//拼团商品海报
-    Route::get('assistance/code/:id', 'activity.StoreAssistanceController/code')->name('assistanceCode');//助力商品海报
-    Route::get('assistance/zhuli_code/:id', 'activity.StoreAssistanceController/zhuli_code')->name('assistanceZhuliCode');//助力商品海报
-
-})->middleware(\app\http\middleware\AllowOriginMiddleware::class)->middleware(\app\api\middleware\AppAuthorizeMiddleware::class)->middleware(\app\api\middleware\AuthTokenMiddleware::class, true);
-//未授权接口
-Route::group(function () {
-    //公共类
     Route::get('index', 'PublicController/index')->name('index');//首页
     Route::get('index', 'PublicController/index')->name('index');//首页
-
-    Route::get('search/keyword', 'PublicController/search')->name('searchKeyword');//热门搜索关键字获取
-
-    //商品分类类
-    Route::get('category', 'store.CategoryController/category')->name('category');
-    Route::get('second_category', 'store.CategoryController/second_category')->name('second_category');//商品二级分类
-    //商品类
-    Route::post('image_base64', 'PublicController/get_image_base64')->name('getImageBase64');// 获取图片base64
-    Route::get('product/detail/:id/[:type]', 'store.StoreProductController/detail')->name('detail');//商品详情
-    Route::get('groom/list/:type', 'store.StoreProductController/groom_list')->name('groomList');//获取首页推荐不同类型商品的轮播图和商品
-    Route::get('products', 'store.StoreProductController/lst')->name('products');//商品列表
-    Route::get('product/hot', 'store.StoreProductController/product_hot')->name('productHot');//为你推荐
-    Route::get('reply/list/:id', 'store.StoreProductController/reply_list')->name('replyList');//商品评价列表
-    Route::get('reply/config/:id', 'store.StoreProductController/reply_config')->name('replyConfig');//商品评价数量和好评度
-    //TODO 文章类暂未分离
-    Route::get('article/category/list', 'publics.ArticleCategoryController/lst')->name('articleCategoryList');//文章分类列表
-    //文章类
-    Route::get('article/list/:cid', 'publics.ArticleController/lst')->name('articleList');//文章列表
-    Route::get('article/details/:id', 'publics.ArticleController/details')->name('articleDetails');//文章详情
-    Route::get('article/hot/list', 'publics.ArticleController/hot')->name('articleHotList');//文章 热门
-    Route::get('article/banner/list', 'publics.ArticleController/banner')->name('articleBannerList');//文章 banner
-    //活动---秒杀
-    Route::get('seckill/index', 'activity.StoreSeckillController/index')->name('seckillIndex');//秒杀商品时间区间
-    Route::get('seckill/list/:time', 'activity.StoreSeckillController/lst')->name('seckillList');//秒杀商品列表
-    Route::get('seckill/detail/:id/[:time]', 'activity.StoreSeckillController/detail')->name('seckillDetail');//秒杀商品详情
-    //活动---砍价
-    Route::get('bargain/config', 'activity.StoreBargainController/config')->name('bargainConfig');//砍价商品列表配置
-    Route::get('bargain/list', 'activity.StoreBargainController/lst')->name('bargainList');//砍价商品列表
-    //活动---拼团
-    Route::get('combination/list', 'activity.StoreCombinationController/lst')->name('combinationList');//拼团商品列表
-    Route::get('combination/detail/:id', 'activity.StoreCombinationController/detail')->name('combinationDetail');//拼团商品详情
-    //活动---助力
-    Route::get('assistance/list', 'activity.StoreAssistanceController/lst')->name('assistanceList');//助力商品列表
-    Route::get('assistance/detail/:id', 'activity.StoreAssistanceController/detail')->name('assistanceDetail');//助力商品详情
-    //用户类
-    Route::get('user/activity', 'user.UserController/activity')->name('userActivity');//活动状态
-
-    //微信(无
-    Route::get('wechat/config', 'wechat.WechatController/config')->name('wechatConfig');//微信 sdk 配置
-    Route::get('wechat/auth', 'wechat.WechatController/auth')->name('wechatAuth');//微信授权
-
-    //小程序登陆
-    Route::post('wechat/mp_auth', 'wechat.AuthController/mp_auth')->name('mpAuth');//小程序登陆
-    Route::get('wechat/get_logo', 'wechat.AuthController/get_logo')->name('getLogo');//小程序登陆授权展示logo
-    Route::post('wechat/set_form_id', 'wechat.AuthController/set_form_id')->name('setFormId');//小程序登陆收集form id
-    Route::get('wechat/teml_ids', 'wechat.AuthController/teml_ids')->name('wechatTemlIds');//小程序订阅消息
-    Route::get('wechat/live', 'wechat.AuthController/live')->name('wechatLive');//小程序直播列表
-
-    //物流公司
-    Route::get('logistics', 'PublicController/logistics')->name('logistics');//物流公司列表
-
-    //分享配置
-    Route::get('share', 'PublicController/share')->name('share');//分享配置
-
-    //TODO 优惠券
-    Route::get('coupons', 'store.StoreCouponsController/lst')->name('couponsList'); //可领取优惠券列表
-
-    //短信购买异步通知
-    Route::post('sms/pay/notify', 'PublicController/sms_pay_notify')->name('smsPayNotify'); //短信购买异步通知
-
-    //获取关注微信公众号海报
-    Route::get('wechat/follow', 'wechat.WechatController/follow')->name('Follow');
-
-    //门店列表
-    Route::get('store_list', 'PublicController/store_list')->name('storeList');
-    //获取门店商品
-    Route::get('store_product', 'PublicController/getStoreProduct')->name('storeProduct');
-    //获取城市列表
-    Route::get('city_list', 'PublicController/city_list')->name('cityList');
-    //拼团数据
-    Route::get('pink', 'PublicController/pink')->name('pinkData');
-
-})->middleware(\app\http\middleware\AllowOriginMiddleware::class)->middleware(\app\api\middleware\AppAuthorizeMiddleware::class)->middleware(\app\api\middleware\AuthTokenMiddleware::class, false);
+    Route::get('page/:unique', 'PublicController/page')->name('pageDetail');//单页详情
+
+    //机构
+    Route::get('organ/list', 'auti.CourseController/organList')->name('organList');//机构列表
+    Route::get('organ/detail/:id', 'auti.CourseController/organ')->name('organDetail');//机构详情
+    //课程
+    Route::get('course/list', 'auti.CourseController/list')->name('courseList');//课程列表
+    Route::get('course/detail/:id', 'auti.CourseController/detail')->name('courseDetail');//课程详情
+    //相关知识
+    Route::get('article/list', 'auti.ArticleController/list')->name('articleList');//文章列表
+    Route::get('article/detail/:id', 'auti.ArticleController/detail')->name('articleDetail');//文章详情
+})->middleware(\app\http\middleware\AllowOriginMiddleware::class);
 
 
 Route::miss(function () {
 Route::miss(function () {
     if (app()->request->isOptions()) {
     if (app()->request->isOptions()) {

+ 1 - 0
app/models/article/ArticleModel.php

@@ -25,6 +25,7 @@ class ArticleModel extends BaseModel
     {
     {
         $model = new self;
         $model = new self;
         if (isset($where['title']) && $where['title'] !== '') $model = $model->where('title', 'LIKE', "%$where[title]%");
         if (isset($where['title']) && $where['title'] !== '') $model = $model->where('title', 'LIKE', "%$where[title]%");
+        if (isset($where['is_show']) && $where['is_show'] !== '') $model = $model->where('is_show', $where['is_show']);
         $model = $model->where('is_del', 0);
         $model = $model->where('is_del', 0);
         $model = $model->order('sort desc,id desc');
         $model = $model->order('sort desc,id desc');
         $count = $model->count();
         $count = $model->count();

+ 1 - 1
crmeb/services/QrcodeService.php

@@ -90,7 +90,7 @@ class QrcodeService
             $imageInfo = SystemAttachment::getInfo($name, 'name');
             $imageInfo = SystemAttachment::getInfo($name, 'name');
             $siteUrl = sys_config('site_url');
             $siteUrl = sys_config('site_url');
             if (!$imageInfo) {
             if (!$imageInfo) {
-                $codeUrl = UtilService::setHttpType('https://demoapi.boofly.cn' . $link, request()->isSsl() ? 0 : 1);//二维码链接
+                $codeUrl = UtilService::setHttpType('https://auti.boofly.cn' . $link, request()->isSsl() ? 0 : 1);//二维码链接
                 $imageInfo = UtilService::getQRCodePath($codeUrl, $name);
                 $imageInfo = UtilService::getQRCodePath($codeUrl, $name);
                 if (is_string($imageInfo) && $force)
                 if (is_string($imageInfo) && $force)
                     return false;
                     return false;