| | |
| | | use app\api\model\plus\live\Room as RoomModel; |
| | | use app\common\model\supplier\Service as ServiceModel; |
| | | use app\api\model\plus\chat\Chat as ChatModel; |
| | | use app\api\model\supplier\Category as CategoryModel; // 主营分类 by lyzflash |
| | | use app\api\model\user\Card as CardrModel; // 会员卡 by lyzflash |
| | | use app\api\model\supplier\User as UserModel; // by lyzflash |
| | | use app\api\model\supplier\Category as CategoryModel; |
| | | |
| | | // 主营分类 by lyzflash |
| | | use app\api\model\user\Card as CardrModel; |
| | | |
| | | // 会员卡 by lyzflash |
| | | use app\api\model\supplier\User as UserModel; |
| | | |
| | | // by lyzflash |
| | | use app\api\model\plus\work\Setting as PlusSettingModel; |
| | | use app\api\model\supplier\Group as GroupModel; // by yj |
| | | use app\api\model\supplier\Group as GroupModel; |
| | | |
| | | // by yj |
| | | use app\common\model\app\App as AppModel; |
| | | use app\common\enum\order\OrderTypeEnum; |
| | | use app\api\model\store\Store as StoreModel; |
| | | use app\api\model\supplier\member\Member as MemberModel; |
| | | |
| | | /** |
| | | * 供应商 |
| | | */ |
| | |
| | | $list = $SupplierModel->supplierList($param); |
| | | |
| | | $store_open = SettingModel::getStoreOpen(); |
| | | return $this->renderSuccess('', compact('list','store_open')); |
| | | return $this->renderSuccess('', compact('list', 'store_open')); |
| | | } |
| | | |
| | | //店铺列表 |
| | |
| | | $is_add = 0;//默认未添加群 |
| | | // 当前用户信息 |
| | | $user = $this->getUser(); |
| | | if(!empty($param["source"]) && $param["source"] == 1){ |
| | | if (!empty($param["source"]) && $param["source"] == 1) { |
| | | //来自于点击企业微信客服的链接 |
| | | $save_data=[ |
| | | "shop_supplier_id"=>$param["shop_supplier_id"], |
| | | "user_id"=>$user["user_id"], |
| | | "app_id"=>$user["app_id"], |
| | | $save_data = [ |
| | | "shop_supplier_id" => $param["shop_supplier_id"], |
| | | "user_id" => $user["user_id"], |
| | | "app_id" => $user["app_id"], |
| | | ]; |
| | | $model = new GroupModel; |
| | | $user_group = $model->add($save_data); |
| | | if($user_group){ |
| | | if ($user_group) { |
| | | $is_add = 1; |
| | | } |
| | | }else{ |
| | | } else { |
| | | //来自于扫码 |
| | | $where=[ |
| | | "shop_supplier_id"=>$param["shop_supplier_id"], |
| | | "user_id"=>$user["user_id"] |
| | | $where = [ |
| | | "shop_supplier_id" => $param["shop_supplier_id"], |
| | | "user_id" => $user["user_id"] |
| | | ]; |
| | | $user_group = GroupModel::detailByCondition($where); |
| | | if(!empty($user_group)){ |
| | | if (!empty($user_group)) { |
| | | $is_add = 1; |
| | | } |
| | | } |
| | | |
| | | $SupplierModel = new SupplierModel; |
| | | $result = $SupplierModel->getLists($param["shop_supplier_id"]); |
| | | $list=$result["list"]; |
| | | $index=$result["index"]; |
| | | $list = $result["list"]; |
| | | $index = $result["index"]; |
| | | |
| | | $data = PlusSettingModel::getItem('basic'); |
| | | |
| | | return $this->renderSuccess('', compact('list','index','data','is_add')); |
| | | return $this->renderSuccess('', compact('list', 'index', 'data', 'is_add')); |
| | | } |
| | | |
| | | //店铺列表 |
| | | public function category() |
| | | { |
| | | $category = CategoryModel::getALL()->toArray(); |
| | | $param = request()->param(); |
| | | $category = CategoryModel::getALL($param)->toArray(); |
| | | $category = array_merge([['category_id' => 0, 'name' => '全部']], $category); |
| | | return $this->renderSuccess('', compact('category')); |
| | | } |
| | | |
| | | public function getGroupBuyList() |
| | | { |
| | | $param = request()->param(); |
| | | $model = new SupplierModel(); |
| | | $param['product_num'] = isset($param['product_num']) ? $param['product_num'] : 3; |
| | | |
| | | // 获取用户位置信息 |
| | | $param['longitude'] = isset($param['longitude']) ? $param['longitude'] : 0; |
| | | $param['latitude'] = isset($param['latitude']) ? $param['latitude'] : 0; |
| | | |
| | | // 处理筛选参数 |
| | | if (isset($param['sortType'])) { |
| | | $sortMap = [ |
| | | 'smart' => 'all', |
| | | 'distance' => 'distance', |
| | | 'score' => 'score', |
| | | 'price_low' => 'price_asc', |
| | | 'price_high' => 'price_desc' |
| | | ]; |
| | | if (isset($sortMap[$param['sortType']])) { |
| | | $param['sortType'] = $sortMap[$param['sortType']]; |
| | | } |
| | | } |
| | | |
| | | $list = $model->getGroupBuyList($param); |
| | | return $this->renderSuccess('', compact('list')); |
| | | } |
| | | |
| | | public function getGroupBuyCondition() |
| | | { |
| | | $sortOptions = [ |
| | | ['text' => '智能排序', 'value' => 'smart'], |
| | | ['text' => '距离最近', 'value' => 'distance'], |
| | | ['text' => '评分最高', 'value' => 'score'], |
| | | ['text' => '价格最低', 'value' => 'price_low'], |
| | | ['text' => '价格最高', 'value' => 'price_high'] |
| | | ]; |
| | | |
| | | $distanceOptions = [ |
| | | ['label' => '不限', 'value' => -1], |
| | | ['label' => '500m以内', 'value' => 0.5], |
| | | ['label' => '1km以内', 'value' => 1], |
| | | ['label' => '2km以内', 'value' => 2], |
| | | ['label' => '3km以内', 'value' => 3], |
| | | ['label' => '5km以内', 'value' => 5] |
| | | ]; |
| | | $priceOptions = [ |
| | | ['label' => '不限', 'value' => -1], |
| | | ['label' => '50元以下', 'value' => ['min' => 0, 'max' => 50]], |
| | | ['label' => '50-100元', 'value' => ['min' => 50, 'max' => 100]], |
| | | ['label' => '100-200元', 'value' => ['min' => 100, 'max' => 200]], |
| | | ['label' => '200元以上', 'value' => ['min' => 200, 'max' => -1]] |
| | | ]; |
| | | $scoreOptions = [ |
| | | ['label' => '不限', 'value' => -1], |
| | | ['label' => '4.0分以上', 'value' => 4.0], |
| | | ['label' => '4.5分以上', 'value' => 4.5], |
| | | ['label' => '4.8分以上', 'value' => 4.8] |
| | | ]; |
| | | $category = CategoryModel::getALL(['category_type'=>20])->toArray(); |
| | | $category = array_merge([['category_id' => 0, 'name' => '全部']], $category); |
| | | return $this->renderSuccess('', compact('sortOptions', 'distanceOptions', 'priceOptions', 'scoreOptions','category')); |
| | | } |
| | | |
| | | /** |
| | |
| | | $store_setting = SettingModel::getItem("store"); |
| | | $store_id = ''; |
| | | //展示门店的信息 |
| | | if(!empty($store_setting) &&!empty($store_setting["store_type"]) && $store_setting["store_type"] == 1){ |
| | | $store_id = storeModel::getStoreIdBySupplierId($data['shop_supplier_id']); |
| | | if (!empty($store_setting) && !empty($store_setting["store_type"]) && $store_setting["store_type"] == 1) { |
| | | $store_id = storeModel::getStoreIdBySupplierId($data['shop_supplier_id']); |
| | | } |
| | | |
| | | return $this->renderSuccess('', compact('detail', 'couponList', 'adList', 'liveList', 'liv_status', 'service_open', 'mp_service', 'card_num', 'store_id')); |
| | |
| | | $supplier = SupplierModel::detail($data['shop_supplier_id']); |
| | | // 客服消息 |
| | | $msg_count = ChatModel::getNoReadCount($this->getSupplierUser($user)['supplier_user_id']); |
| | | $member=MemberModel::supplierDetail([ |
| | | 'shop_supplier_id'=>$data['shop_supplier_id'], |
| | | 'is_expire'=>0 |
| | | $member = MemberModel::supplierDetail([ |
| | | 'shop_supplier_id' => $data['shop_supplier_id'], |
| | | 'is_expire' => 0 |
| | | ]); |
| | | return $this->renderSuccess('', compact('totalCount', 'todayCount', 'supplier', 'is_open', 'msg_count','member')); |
| | | return $this->renderSuccess('', compact('totalCount', 'todayCount', 'supplier', 'is_open', 'msg_count', 'member')); |
| | | } |
| | | |
| | | /** |
| | |
| | | return $this->renderSuccess('', compact('category')); |
| | | } |
| | | $params = $this->request->param(); |
| | | $result = ['data' => ['order_id' => 0]]; |
| | | if (!empty($params['plan_id'])){ |
| | | $plans = (new MemberPlanModel())->detail($params['plan_id']); |
| | | if ($plans['price'] > 0) { |
| | | $memberService = new MemberService(); |
| | | $result = $memberService->createOrder($supplier['shop_supplier_id'], $params['plan_id'], $user); |
| | | if (!$result['status']) { |
| | | return $this->renderError($result['msg'] ?: '创建订单失败'); |
| | | } |
| | | } |
| | | } |
| | | |
| | | $plans = (new MemberPlanModel())->detail($params['plan_id']); |
| | | $result=['data'=>['order_id'=>0]]; |
| | | if ($plans['price'] > 0){ |
| | | $memberService = new MemberService(); |
| | | $result = $memberService->createOrder($supplier['shop_supplier_id'], $params['plan_id'], $user); |
| | | if (!$result['status']){ |
| | | return $this->renderError($result['msg'] ?: '创建订单失败'); |
| | | } |
| | | } |
| | | // 生成订单 |
| | | $model = new DepositOrderModel; |
| | | $order_id = $model->createOrder($user, $supplier,$result); |
| | | $order_id = $model->createOrder($user, $supplier, $result); |
| | | |
| | | if (!$order_id) { |
| | | return $this->renderError($model->getError() ?: '创建订单失败'); |
| | |
| | | return $this->renderError($model->getError() ?: '修改失败'); |
| | | } |
| | | } |
| | | |
| | | public function refundDeposit() |
| | | { |
| | | $data = $this->postData(); |
| | | $model = new DepositRefundModel; |
| | | $shop_supplier=SupplierModel::detail($data['shop_supplier_id']); |
| | | if(!$shop_supplier){ |
| | | $shop_supplier = SupplierModel::detail($data['shop_supplier_id']); |
| | | if (!$shop_supplier) { |
| | | return $this->renderError('店铺不存在'); |
| | | } |
| | | if ($shop_supplier['status']==10){ |
| | | if ($shop_supplier['status'] == 10) { |
| | | return $this->renderError('退还押金申请中,不能重复申请'); |
| | | } |
| | | $data['deposit_money']=$shop_supplier['deposit_money']; |
| | | if($model->add($data)){ |
| | | $data['deposit_money'] = $shop_supplier['deposit_money']; |
| | | if ($model->add($data)) { |
| | | return $this->renderSuccess('提交成功'); |
| | | }else{ |
| | | } else { |
| | | return $this->renderError($model->getError() ?: '提交失败'); |
| | | } |
| | | } |