hrjy 2 years ago
parent
commit
e7559f10f5

+ 0 - 379
app/admin/controller/setting/SystemConfig.php

@@ -1,381 +1,3 @@
-<<<<<<< HEAD
-<?php
-
-namespace app\admin\controller\setting;
-
-use think\facade\Route as Url;
-use app\admin\controller\AuthController;
-use app\admin\model\system\{
-    SystemConfig as ConfigModel, SystemConfigTab as ConfigTabModel
-};
-use crmeb\services\{
-    CacheService,
-    FormBuilder as Form,
-    UtilService as Util,
-    JsonService as Json
-};
-use crmeb\services\upload\Upload;
-
-
-/**
- *  配置列表控制器
- * Class SystemConfig
- * @package app\admin\controller\system
- */
-class SystemConfig extends AuthController
-{
-    /**
-     * 基础配置
-     * */
-    public function index()
-    {
-        [$type, $tab_id, $children_tab_id] = Util::getMore([
-            ['type', 0],//配置类型
-            ['tab_id', 1],//当前分类ID
-            ['children_tab_id', null],//当前子集分类ID
-        ], null, true);
-
-        $config_tab = null;//顶级分类
-        $children_config_tab = null;//二级分类
-
-        if ($type == 3) {//其它分类
-            $config_tab = null;
-        } else {
-            $config_tab = ConfigModel::getConfigTabAll($type);//获取一级tab
-        }
-        $children_config_tab = ConfigModel::getConfigChildrenTabAll($tab_id);//获取二级tab
-
-        if (!$children_tab_id && $children_config_tab) {
-            $children_tab_id = $children_config_tab[0]['id'];
-        }
-
-        if ($children_tab_id) {
-            $tid = $children_tab_id;
-        } else {
-            $tid = $tab_id;
-        }
-
-        //获取分类配置参数
-        $list = ConfigModel::getAll($tid);
-        $formbuider = ConfigModel::builder_config_from_data($list);//生产表单json
-        $form = Form::make_post_form('编辑配置', $formbuider, Url::buildUrl('save_basics'));
-
-        $this->assign('tab_id', $tab_id);
-        $this->assign('children_tab_id', $children_tab_id);
-        $this->assign('config_tab', $config_tab);
-        $this->assign('children_config_tab', $children_config_tab);
-
-        $this->assign(compact('form'));
-        $this->assign('list', $list);
-        return $this->fetch();
-    }
-
-
-
-    /**
-     * 基础配置  单个
-     * @return mixed|void
-     */
-    public function index_alone()
-    {
-        $tab_id = input('tab_id');
-        if (!$tab_id) return $this->failed('参数错误,请重新打开');
-        $this->assign('tab_id', $tab_id);
-        $list = ConfigModel::getAll($tab_id);
-        foreach ($list as $k => $v) {
-            if (!is_null(json_decode($v['value'])))
-                $list[$k]['value'] = json_decode($v['value'], true);
-            if ($v['type'] == 'upload' && !empty($v['value'])) {
-                if ($v['upload_type'] == 1 || $v['upload_type'] == 3) $list[$k]['value'] = explode(',', $v['value']);
-            }
-        }
-        $this->assign('list', $list);
-        return $this->fetch();
-    }
-
-    /**
-     * 添加字段
-     * @return string
-     * @throws \FormBuilder\exception\FormBuilderException
-     */
-    public function create()
-    {
-        $data = Util::getMore(['type',]);//接收参数
-        $tab_id = !empty(request()->param('tab_id')) ? request()->param('tab_id') : 1;
-        //前面通用字段
-        $formbuiderheader = array();
-        $formbuiderheader[] = Form::select('config_tab_id', '分类', 0)->setOptions(function () {
-            $menuList = ConfigTabModel::field(['id', 'pid', 'title'])->select()->toArray();
-            $list = sort_list_tier($menuList, '顶级', 'pid', 'id');
-            $options = [['value' => 0, 'label' => '顶级按钮']];
-            foreach ($list as $option) {
-                $options[] = ['value' => $option['id'], 'label' => $option['html'] . $option['title']];
-            }
-            return $options;
-        })->filterable(1);
-        $formbuiderheader[] = Form::select('input_type', '类型')->setOptions(ConfigModel::texttype());
-        $formbuiderheader[] = Form::input('info', '配置名称')->autofocus(1);
-        $formbuiderheader[] = Form::input('menu_name', '字段变量')->placeholder('例如:site_url');
-        $formbuiderheader[] = Form::input('desc', '配置简介');
-        //不同类型不同字段
-        $formbuider = array();
-        switch ($data['type']) {
-            case 0://文本框
-                $formbuider = ConfigModel::createInputRule($tab_id);
-                break;
-            case 1://多行文本框
-                $formbuider = ConfigModel::createTextAreaRule($tab_id);
-                break;
-            case 2://单选框
-                $formbuider = ConfigModel::createRadioRule($tab_id);
-                break;
-            case 3://文件上传
-                $formbuider = ConfigModel::createUploadRule($tab_id);
-                break;
-            case 4://多选框
-                $formbuider = ConfigModel::createCheckboxRule($tab_id);
-                break;
-            case 5://下拉框
-                $formbuider = ConfigModel::createSelectRule($tab_id);
-                break;
-        }
-        //后面通用字段
-        $formbuiderfoot = array();
-        $formbuiderfoot[] = Form::number('sort', '排序');
-        $formbuiderfoot[] = Form::radio('status', '状态', 1)->options(ConfigModel::formstatus());
-        $formbuiders = array_merge($formbuiderheader, $formbuider, $formbuiderfoot);
-        $form = Form::make_post_form('添加字段', $formbuiders, Url::buildUrl('save'));
-        $this->assign(compact('form'));
-        $this->assign('get', request()->param());
-        return $this->fetch();
-    }
-
-    /**
-     * 保存字段
-     * */
-    public function save()
-    {
-        $data = Util::postMore([
-            'menu_name',
-            'type',
-            'input_type',
-            'config_tab_id',
-            'parameter',
-            'upload_type',
-            'required',
-            'width',
-            'high',
-            'value',
-            'info',
-            'desc',
-            'sort',
-            'status',]);
-        if (!$data['info']) return Json::fail('请输入配置名称');
-        if (!$data['menu_name']) return Json::fail('请输入字段名称');
-        if ($data['menu_name']) {
-            $oneConfig = ConfigModel::getOneConfig('menu_name', $data['menu_name']);
-            if (!empty($oneConfig)) return Json::fail('请重新输入字段名称,之前的已经使用过了');
-        }
-        if (!$data['desc']) return Json::fail('请输入配置简介');
-        if ($data['sort'] < 0) {
-            $data['sort'] = 0;
-        }
-        if ($data['type'] == 'text') {
-            if (!ConfigModel::valiDateTextRole($data)) return Json::fail(ConfigModel::getErrorInfo());
-        }
-        if ($data['type'] == 'textarea') {
-            if (!ConfigModel::valiDateTextareaRole($data)) return Json::fail(ConfigModel::getErrorInfo());
-        }
-        $data['parameter'] = htmlspecialchars_decode($data['parameter']);
-        if ($data['type'] == 'radio' || $data['type'] == 'checkbox') {
-            if (!$data['parameter']) return Json::fail('请输入配置参数');
-            if (!ConfigModel::valiDateRadioAndCheckbox($data)) return Json::fail(ConfigModel::getErrorInfo());
-            $data['value'] = json_encode($data['value']);
-        }
-        ConfigModel::create($data);
-        CacheService::clear();
-        return Json::successful('添加菜单成功!');
-    }
-
-    /**
-     * @param $id
-     */
-    public function update_config($id)
-    {
-        $type = request()->post('type');
-        if ($type == 'text' || $type == 'textarea' || $type == 'radio' || ($type == 'upload' && (request()->post('upload_type') == 1 || request()->post('upload_type') == 3))) {
-            $value = request()->post('value');
-        } else {
-            $value = request()->post('value/a');
-        }
-        $data = Util::postMore(['status', 'info', 'desc', 'sort', 'config_tab_id', 'required', 'parameter', ['value', $value], 'upload_type', 'input_type']);
-        $data['value'] = htmlspecialchars_decode(json_encode($data['value']));
-        $data['parameter'] = htmlspecialchars_decode($data['parameter']);
-        if (!ConfigModel::get($id)) return Json::fail('编辑的记录不存在!');
-        ConfigModel::edit($data, $id);
-        return Json::successful('修改成功!');
-    }
-
-    /**
-     * 修改是否显示子子段
-     * @param $id
-     * @return mixed
-     */
-    public function edit_config($id)
-    {
-        $menu = ConfigModel::get($id)->getData();
-        if (!$menu) return Json::fail('数据不存在!');
-        $formbuider = array();
-        $formbuider[] = Form::input('menu_name', '字段变量', $menu['menu_name'])->disabled(1);
-        $formbuider[] = Form::hidden('type', $menu['type']);
-//        $formbuider[] = Form::select('config_tab_id', '分类', (string)$menu['config_tab_id'])->setOptions(ConfigModel::getConfigTabAll(-1));
-        $formbuider[] = Form::select('config_tab_id', '分类', (string)$menu['config_tab_id'])->setOptions(function () {
-            $menuList = ConfigTabModel::field(['id', 'pid', 'title'])->select()->toArray();
-            $list = sort_list_tier($menuList, '顶级', 'pid', 'id');
-            $options = [['value' => 0, 'label' => '顶级按钮']];
-            foreach ($list as $option) {
-                $options[] = ['value' => $option['id'], 'label' => $option['html'] . $option['title']];
-            }
-            return $options;
-        })->filterable(1);
-        $formbuider[] = Form::input('info', '配置名称', $menu['info'])->autofocus(1);
-        $formbuider[] = Form::input('desc', '配置简介', $menu['desc']);
-        switch ($menu['type']) {
-            case 'text':
-                $menu['value'] = json_decode($menu['value'], true);
-                $formbuider[] = Form::select('input_type', '类型', $menu['input_type'])->setOptions(ConfigModel::texttype());
-                //输入框验证规则
-                $formbuider[] = Form::input('value', '默认值', $menu['value']);
-                if (!empty($menu['required'])) {
-                    $formbuider[] = Form::number('width', '文本框宽(%)', $menu['width']);
-                    $formbuider[] = Form::input('required', '验证规则', $menu['required'])->placeholder('多个请用,隔开例如:required:true,url:true');
-                }
-                break;
-            case 'textarea':
-                $menu['value'] = json_decode($menu['value'], true);
-                //多行文本
-                if (!empty($menu['high'])) {
-                    $formbuider[] = Form::textarea('value', '默认值', $menu['value'])->rows(5);
-                    $formbuider[] = Form::number('width', '文本框宽(%)', $menu['width']);
-                    $formbuider[] = Form::number('high', '多行文本框高(%)', $menu['high']);
-                } else {
-                    $formbuider[] = Form::input('value', '默认值', $menu['value']);
-                }
-                break;
-            case 'radio':
-                $menu['value'] = json_decode($menu['value'], true);
-                $parameter = explode("\n", htmlspecialchars_decode($menu['parameter']));
-                $options = [];
-                if ($parameter) {
-                    foreach ($parameter as $v) {
-                        $data = explode("=>", $v);
-                        $options[] = ['label' => $data[1], 'value' => $data[0]];
-                    }
-                    $formbuider[] = Form::radio('value', '默认值', $menu['value'])->options($options);
-                }
-                //单选和多选参数配置
-                if (!empty($menu['parameter'])) {
-                    $formbuider[] = Form::textarea('parameter', '配置参数', $menu['parameter'])->placeholder("参数方式例如:\n1=白色\n2=红色\n3=黑色");
-                }
-                break;
-            case 'checkbox':
-                $menu['value'] = json_decode($menu['value'], true) ?: [];
-                $parameter = explode("\n", htmlspecialchars_decode($menu['parameter']));
-                $options = [];
-                if ($parameter) {
-                    foreach ($parameter as $v) {
-                        $data = explode("=>", $v);
-                        $options[] = ['label' => $data[1], 'value' => $data[0]];
-                    }
-                    $formbuider[] = Form::checkbox('value', '默认值', $menu['value'])->options($options);
-                }
-                //单选和多选参数配置
-                if (!empty($menu['parameter'])) {
-                    $formbuider[] = Form::textarea('parameter', '配置参数', $menu['parameter'])->placeholder("参数方式例如:\n1=白色\n2=红色\n3=黑色");
-                }
-                break;
-            case 'upload':
-                if ($menu['upload_type'] == 1) {
-                    $menu['value'] = json_decode($menu['value'], true);
-                    $formbuider[] = Form::frameImageOne('value', '图片', Url::buildUrl('admin/widget.images/index', array('fodder' => 'value')), (string)$menu['value'])->icon('image')->width('100%')->height('550px');
-                } elseif ($menu['upload_type'] == 2) {
-                    $menu['value'] = json_decode($menu['value'], true) ?: [];
-                    $formbuider[] = Form::frameImages('value', '多图片', Url::buildUrl('admin/widget.images/index', array('fodder' => 'value')), $menu['value'])->maxLength(5)->icon('images')->width('100%')->height('550px')->spin(0);
-                } else {
-                    $menu['value'] = json_decode($menu['value'], true);
-                    $formbuider[] = Form::uploadFileOne('value', '文件', Url::buildUrl('file_upload'), $menu['value'])->name('file');
-                }
-                //上传类型选择
-                if (!empty($menu['upload_type'])) {
-                    $formbuider[] = Form::radio('upload_type', '上传类型', $menu['upload_type'])->options([['value' => 1, 'label' => '单图'], ['value' => 2, 'label' => '多图'], ['value' => 3, 'label' => '文件']]);
-                }
-                break;
-
-        }
-        $formbuider[] = Form::number('sort', '排序', $menu['sort']);
-        $formbuider[] = Form::radio('status', '状态', $menu['status'])->options([['value' => 1, 'label' => '显示'], ['value' => 2, 'label' => '隐藏']]);
-
-        $form = Form::make_post_form('编辑字段', $formbuider, Url::buildUrl('update_config', array('id' => $id)));
-        $this->assign(compact('form'));
-        return $this->fetch('public/form-builder');
-    }
-
-    /**
-     * 删除子字段
-     * @return \think\response\Json
-     */
-    public function delete_config()
-    {
-        $id = input('id');
-        if (!ConfigModel::del($id)) {
-            return Json::fail(ConfigModel::getErrorInfo('删除失败,请稍候再试!'));
-        } else {
-            CacheService::clear();
-            return Json::successful('删除成功!');
-        }
-    }
-
-    /**
-     * 保存数据    true
-     * */
-    public function save_basics()
-    {
-        $request = app('request');
-        if ($request->isPost()) {
-            $post = $request->post();
-            foreach ($post as $k => $v) {
-                if (is_array($v)) {
-                    $res = ConfigModel::where('menu_name', $k)->column('upload_type', 'type');
-                    foreach ($res as $kk => $vv) {
-                        if ($kk == 'upload') {
-                            if ($vv == 1 || $vv == 3) {
-                                $post[$k] = $v[0];
-                            }
-                        }
-                    }
-                }
-            }
-            foreach ($post as $k => $v) {
-                ConfigModel::edit(['value' => json_encode($v)], $k, 'menu_name');
-            }
-            CacheService::clear();
-            return $this->successful('修改成功');
-        }
-    }
-
-    /**
-     * 文件上传
-     * */
-    public function file_upload()
-    {
-        $upload = new Upload('local');
-        $res = $upload->to('config/file')->move($this->request->param('file', 'file'));
-        if ($res === false) return Json::fail($upload->getError());
-        return Json::successful('上传成功!', ['filePath' => $res->filePath]);
-    }
-
-}
-=======
 <?php
 
 namespace app\admin\controller\setting;
@@ -752,4 +374,3 @@ class SystemConfig extends AuthController
     }
 
 }
->>>>>>> 386b37d33e5ba817cba00df29efaefbd692e4dd1

File diff suppressed because it is too large
+ 0 - 1334
app/admin/model/order/StoreOrder.php


+ 0 - 128
app/admin/view/article/article/index.php

@@ -1,130 +1,3 @@
-<<<<<<< HEAD
-{extend name="public/container"}
-{block name="head_top"}
-<link href="{__MODULE_PATH}wechat/news/css/index.css" type="text/css" rel="stylesheet">
-{/block}
-{block name="content"}
-<style>
-    tr td img{height: 50px;}
-</style>
-<div class="row">
-    <div class="col-sm-3">
-      	<div class="ibox">
-           	<div class="ibox-title">分类</div>
-      		<div class="ibox-content">
-            <ul  class="folder-list m-b-md">
-              	{volist name="tree" id="vo"}
-                   <li class="p-xxs"><a href="{:Url('article.article/index',array('pid'=>$vo.id))}">{$vo.html}{$vo.title}</a></li>
-                {/volist}
-            </ul>
-          	</div>
-        </div>
-    </div>
-    <div class="col-sm-9 m-l-n-md">
-        <div class="ibox">
-            <div class="ibox-title">
-<!--                <button type="button" class="btn btn-w-m btn-primary" onclick="$eb.createModalFrame(this.innerText,'{:Url('create',array('cid'=>$where.cid))}',{w:1100,h:760})">添加文章</button>-->
-                <div style="margin-top: 2rem"></div>
-                <div class="row">
-                    <div class="m-b m-l">
-                        <form action="" class="form-inline">
-
-                            <div class="input-group">
-                                <input type="text" name="title" value="{$where.title}" placeholder="请输入关键词" class="input-sm form-control"> <span class="input-group-btn"><button type="submit" class="btn btn-sm btn-primary"> <i class="fa fa-search" ></i>搜索</button> </span>
-                            </div>
-                        </form>
-                    </div>
-                </div>
-            </div>
-            <div class="ibox-content">
-                <table class="footable table table-striped  table-bordered " data-page-size="20">
-                    <thead>
-                    <tr>
-                        <th class="text-center" width="5%">id</th>
-                        <th class="text-center" width="10%">图片</th>
-                        <th class="text-left" >[分类]标题</th>
-                        <th class="text-center" width="8%">浏览量</th>
-                        <th class="text-center">关联标题</th>
-                        <th class="text-center" width="15%">添加时间</th>
-                        <th class="text-center" width="20%">操作</th>
-                    </tr>
-                    </thead>
-                    <tbody>
-                    {volist name="list" id="vo"}
-                    <tr>
-                        <td>{$vo.id}</td>
-                        <td>
-                            <img src="{$vo.image_input}"/>
-                        </td>
-                        <td>[{$vo.catename}]{$vo.title}</td>
-                        <td>{$vo.visit}</td>
-                        <td>{$vo.store_name}</td>
-                        <td>{$vo.add_time|date="Y-m-d H:i:s"}</td>
-
-                        <td class="text-center">
-                            <button style="margin-top: 5px;" class="btn btn-info btn-xs" type="button"  onclick="$eb.createModalFrame('编辑','{:Url('create',array('id'=>$vo['id'],'cid'=>$where.cid))}',{w:1100,h:760})"><i class="fa fa-edit"></i> 编辑</button>
-<!--                            {if $vo.product_id}-->
-<!--                            <button style="margin-top: 5px;" class="btn btn-warning btn-xs underline" data-id="{$vo.id}" type="button" data-url="{:Url('unrelation',array('id'=>$vo['id']))}" ><i class="fa fa-chain-broken"></i> 取消关联</button>-->
-<!--                            {else}-->
-<!--                            <button style="margin-top: 5px;" class="btn btn-warning btn-xs openWindow" data-id="{$vo.id}" type="button" data-url="{:Url('relation',array('id'=>$vo['id']))}" ><i class="fa fa-chain"></i> 关联产品</button>-->
-<!--                            {/if}-->
-<!--                            <button  style="margin-top: 5px;" class="btn btn-danger btn-xs del_news_one" data-id="{$vo.id}" type="button" data-url="{:Url('delete',array('id'=>$vo['id']))}" ><i class="fa fa-times"></i> 删除</button>-->
-                        </td>
-                    </tr>
-                    {/volist}
-                    </tbody>
-                </table>
-            </div>
-        </div>
-        <div style="margin-left: 10px">
-            {include file="public/inner_page"}
-        </div>
-    </div>
-
-</div>
-
-{/block}
-{block name="script"}
-<script>
-
-    $('.del_news_one').on('click',function(){
-        window.t = $(this);
-        var _this = $(this),url =_this.data('url');
-        $eb.$swal('delete',function(){
-            $eb.axios.get(url).then(function(res){
-                console.log(res);
-                if(res.status == 200 && res.data.code == 200) {
-                    $eb.$swal('success',res.data.msg);
-                    _this.parents('tr').remove();
-                }else
-                    return Promise.reject(res.data.msg || '删除失败')
-            }).catch(function(err){
-                $eb.$swal('error',err);
-            });
-        })
-    });
-
-    $('.openWindow').on('click',function () {
-        return $eb.createModalFrame('选择产品',$(this).data('url'));
-    });
-
-    $('.underline').on('click',function () {
-        var url=$(this).data('url');
-        $eb.$swal('delete',function(){
-            $eb.axios.get(url).then(function(res){
-                if(res.status == 200 && res.data.code == 200) {
-                    $eb.$swal('success',res.data.msg);
-                    window.location.reload();
-                }else
-                    return Promise.reject(res.data.msg || '取消失败')
-            }).catch(function(err){
-                $eb.$swal('error',err);
-            });
-        },{title:'确认取消关联产品?',text:'取消后可再关联页选择产品重新关联',confirm:'确定'})
-    })
-</script>
-{/block}
-=======
 {extend name="public/container"}
 {block name="head_top"}
 <link href="{__MODULE_PATH}wechat/news/css/index.css" type="text/css" rel="stylesheet">
@@ -250,4 +123,3 @@
     })
 </script>
 {/block}
->>>>>>> 386b37d33e5ba817cba00df29efaefbd692e4dd1

+ 0 - 276
app/admin/view/index/index.php

@@ -1,278 +1,3 @@
-<<<<<<< HEAD
-<!DOCTYPE html>
-<html>
-<head>
-    <meta charset="utf-8">
-    <meta name="viewport" content="width=device-width, initial-scale=1.0">
-    <meta name="renderer" content="webkit">
-    <meta http-equiv="Cache-Control" content="no-siteapp" />
-    <title>宏根蒂集团管理系统</title>
-    <!--[if lt IE 9]>
-    <meta http-equiv="refresh" content="0;ie.html" />
-    <![endif]-->
-    <link rel="shortcut icon" href="/favicon.ico">
-    <link href="{__FRAME_PATH}css/bootstrap.min.css" rel="stylesheet">
-    <link href="{__FRAME_PATH}css/font-awesome.min.css" rel="stylesheet">
-    <link href="{__FRAME_PATH}css/animate.min.css" rel="stylesheet">
-    <link href="{__FRAME_PATH}css/style.min.css" rel="stylesheet">
-    <style>
-        .swal2-container{z-index: 100000000000!important;}
-    </style>
-</head>
-<body class="fixed-sidebar full-height-layout gray-bg" style="overflow:hidden">
-<div id="wrapper">
-    <!--左侧导航开始-->
-    <nav class="navbar-default navbar-static-side" role="navigation">
-        <div class="nav-close"><i class="fa fa-times-circle"></i>
-        </div>
-        <div class="sidebar-collapse">
-            <ul class="nav" id="side-menu">
-                <li class="nav-header">
-                    <div class="dropdown profile-element admin_open">
-                        <span>
-                            <img alt="image" class="imgbox" src="{$site_logo}" onerror="javascript:this.src='{__ADMIN_PATH}images/admin_logo.png';"/>
-                        </span>
-                        <a data-toggle="dropdown" class="dropdown-toggle" href="#">
-                            <span class="clear" style="margin-top: 20px;">
-                               <span class="block m-t-xs"><strong class="font-bold">{$_admin['real_name']}</strong></span>
-                                <span class="text-muted text-xs block">{$role_name.role_name ? $role_name.role_name : '管理员'}<b class="caret"></b></span>
-                            </span>
-                        </a>
-                        <ul class="dropdown-menu animated fadeInRight m-t-xs">
-                            <li><a class="J_menuItem admin_close" href="{:Url('setting.systemAdmin/admin_info')}">个人资料</a>
-                            </li>
-<!--                            <li><a class="admin_close" target="_blank" href="http://www.crmeb.com/">联系我们</a>-->
-<!--                            </li>-->
-                            <li class="divider"></li>
-                            <li><a href="{:Url('login/logout')}">安全退出</a>
-                            </li>
-                        </ul>
-                    </div>
-                    <div class="logo-element">CB
-                    </div>
-                </li>
-                <!--  菜单  -->
-                {volist name="menuList" id="menu"}
-                <?php if(isset($menu['child']) && count($menu['child']) > 0){ ?>
-                    <li>
-                        <a href="#"><i class="fa fa-{$menu.icon}"></i> <span class="nav-label">{$menu.menu_name}</span><span class="fa arrow"></span></a>
-                        <ul class="nav nav-second-level">
-                            {volist name="menu.child" id="child"}
-                            <li>
-                                <?php if(isset($child['child']) && count($child['child']) > 0){ ?>
-                                    <a href="#"><i class="fa fa-{$child.icon}"></i>{$child.menu_name}<span class="fa arrow"></span></a>
-                                    <ul class="nav nav-third-level">
-                                        {volist name="child.child" id="song"}
-                                        <li><a class="J_menuItem" href="{$song.url}"><i class="fa fa-{$song.icon}"></i> {$song.menu_name}</a></li>
-                                        {/volist}
-                                    </ul>
-                                <?php }else{ ?>
-                                    <a class="J_menuItem" href="{$child.url}"><i class="fa fa-{$child.icon}"></i>{$child.menu_name}</a>
-                                <?php } ?>
-                            </li>
-                            {/volist}
-                        </ul>
-                    </li>
-                <?php } ?>
-                {/volist}
-            </ul>
-        </div>
-    </nav>
-    <!--左侧导航结束-->
-    <!--右侧部分开始-->
-    <div id="page-wrapper" class="gray-bg dashbard-1">
-        <div class="row content-tabs" @touchmove.prevent  >
-            <button class="roll-nav roll-left navbar-minimalize" style="padding: 0;margin: 0;"><i class="fa fa-bars"></i></button>
-
-            <nav class="page-tabs J_menuTabs">
-                <div class="page-tabs-content">
-                    <a href="javascript:;" class="active J_menuTab" data-id="{:Url('Index/main')}">首页</a>
-                </div>
-            </nav>
-            <button class="roll-nav roll-right J_tabLeft"><i class="fa fa-backward"></i></button>
-            <button class="roll-nav roll-right J_tabRight"><i class="fa fa-forward"></i></button>
-
-            <a href="javascript:void(0);" class="roll-nav roll-right J_tabReply" title="返回"><i class="fa fa-reply"></i> </a>
-            <a href="javascript:void(0);" class="roll-nav roll-right J_tabRefresh" title="刷新"><i class="fa fa-refresh"></i> </a>
-            <a href="javascript:void(0);" class="roll-nav roll-right J_tabFullScreen" title="全屏"><i class="fa fa-arrows"></i> </a>
-            <a href="javascript:void(0);" class="roll-nav roll-right J_notice" data-toggle="dropdown" aria-expanded="true" title="消息"><i class="fa fa-bell"></i> <span class="badge badge-danger" id="msgcount">0</span></a>
-            <ul class="dropdown-menu dropdown-alerts dropdown-menu-right" >
-                <li>
-                    <a class="J_menuItem" href="{:Url('order.store_order/index')}">
-                        <div>
-                            <i class="fa fa-building-o"></i> 待发货
-                            <span class="pull-right text-muted small" id="ordernum">0个</span>
-                        </div>
-                    </a>
-                </li>
-                <li class="divider"></li>
-                <li>
-                    <a class="J_menuItem" href="{:Url('store.store_product/index',array('type'=>5))}">
-                        <div>
-                            <i class="fa fa-pagelines"></i> 库存预警 <span class="pull-right text-muted small" id="inventory">0个</span>
-                        </div>
-                    </a>
-                </li>
-                <li class="divider"></li>
-                <li>
-                    <a class="J_menuItem" href="{:Url('store.store_product_reply/index')}">
-                        <div>
-                            <i class="fa fa-comments-o"></i> 新评论 <span class="pull-right text-muted small" id="commentnum">0个</span>
-                        </div>
-                    </a>
-                </li>
-                <li class="divider"></li>
-                <li>
-                    <a class="J_menuItem" href="{:Url('finance.user_extract/index')}">
-                        <div>
-                            <i class="fa fa-cny"></i> 申请提现 <span class="pull-right text-muted small" id="reflectnum">0个</span>
-                        </div>
-                    </a>
-                </li>
-            </ul>
-            <a href="javascript:void(0);" class="roll-nav roll-right J_tabSetting right-sidebar-toggle" title="更多"><i class="fa fa-tasks"></i></a>
-            <div class="btn-group roll-nav roll-right">
-                <button class="dropdown J_tabClose" data-toggle="dropdown">关闭<span class="caret"></span>
-                </button>
-                <ul role="menu" class="dropdown-menu dropdown-menu-right">
-                    <li class="J_tabShowActive"><a>定位当前选项卡</a>
-                    </li>
-                    <li class="divider"></li>
-                    <li class="J_tabCloseAll"><a>关闭全部选项卡</a>
-                    </li>
-                    <li class="J_tabCloseOther"><a>关闭其他选项卡</a>
-                    </li>
-                </ul>
-            </div>
-        </div>
-        <!--内容展示模块-->
-        <div class="row J_mainContent" id="content-main">
-            <iframe class="J_iframe" name="iframe_crmeb_main" width="100%" height="100%" src="{:Url('Index/main')}" frameborder="0" data-id="{:Url('Index/main')}" seamless></iframe>
-        </div>
-        <!--底部版权-->
-<!--        <div class="footer"  @touchmove.prevent>-->
-<!--            <div class="pull-right">© 2017-2020 <a href="http://www.crmeb.com/" target="_blank">CRMEB</a>-->
-<!--            </div>-->
-<!--        </div>-->
-    </div>
-    <!--右侧部分结束-->
-    <!--右侧边栏开始-->
-    <div id="right-sidebar">
-        <div class="sidebar-container">
-            <ul class="nav nav-tabs navs-3">
-<!--                <li class="active">-->
-<!--                    <a data-toggle="tab" href="#tab-1">-->
-<!--                        <i class="fa fa-bell"></i>通知-->
-<!--                    </a>-->
-<!--                </li>-->
-                <li class="active">
-                    <a data-toggle="tab" href="#tab-1">
-                        <i class="fa fa-gear"></i> 设置
-                    </a>
-                </li>
-                
-            </ul>
-            <div class="tab-content">
-<!--                <div id="tab-1" class="tab-pane active">-->
-<!--                    <div class="sidebar-title">-->
-<!--                        <h3><i class="fa fa-comments-o"></i> 最新通知</h3>-->
-<!--                        <small><i class="fa fa-tim"></i> 您当前有0条未读信息</small>-->
-<!--                    </div>-->
-<!--                    <div>-->
-<!--                    </div>-->
-<!--                </div>-->
-                <div id="tab-1" class="tab-pane active">
-                    <div class="sidebar-title">
-                        <h3><i class="fa fa-comments-o"></i> 提示</h3>
-                        <small><i class="fa fa-tim"></i> 你可以从这里选择和预览主题的布局和样式,这些设置会被保存在本地,下次打开的时候会直接应用这些设置。</small>
-                    </div>
-                    <div class="skin-setttings">
-                        <div class="title">设置</div>
-                        <div class="setings-item">
-                            <span>收起左侧菜单</span>
-                            <div class="switch">
-                                <div class="onoffswitch">
-                                    <input type="checkbox" name="collapsemenu" class="onoffswitch-checkbox" id="collapsemenu">
-                                    <label class="onoffswitch-label" for="collapsemenu">
-                                        <span class="onoffswitch-inner"></span> <span class="onoffswitch-switch"></span>
-                                    </label>
-                                </div>
-                            </div>
-                        </div>
-
-                        <div class="setings-item">
-                                <span>固定宽度</span>
-                            <div class="switch">
-                                <div class="onoffswitch">
-                                    <input type="checkbox" name="boxedlayout" class="onoffswitch-checkbox" id="boxedlayout">
-                                    <label class="onoffswitch-label" for="boxedlayout">
-                                        <span class="onoffswitch-inner"></span> <span class="onoffswitch-switch"></span>
-                                    </label>
-                                </div>
-                            </div>
-                        </div>
-                        <div class="setings-item">
-                            <span>菜单点击刷新</span>
-                            <div class="switch">
-                                <div class="onoffswitch">
-                                    <input type="checkbox" name="refresh" class="onoffswitch-checkbox" id="refresh">
-                                    <label class="onoffswitch-label" for="refresh">
-                                        <span class="onoffswitch-inner"></span> <span class="onoffswitch-switch"></span>
-                                    </label>
-                                </div>
-                            </div>
-                        </div>
-                        <div class="title">皮肤选择</div>
-                        <div class="setings-item default-skin nb">
-                                <span class="skin-name ">
-                         <a href="#" class="s-skin-0">
-                             默认皮肤
-                         </a>
-                    </span>
-                        </div>
-                        <div class="setings-item blue-skin nb">
-                                <span class="skin-name ">
-                        <a href="#" class="s-skin-1">
-                            蓝色主题
-                        </a>
-                    </span>
-                        </div>
-                        <div class="setings-item yellow-skin nb">
-                                <span class="skin-name ">
-                        <a href="#" class="s-skin-3">
-                            黄色/紫色主题
-                        </a>
-                    </span>
-                        </div>
-                    </div>
-                </div>
-
-            </div>
-        </div>
-    </div>
-
-    <!--右侧边栏结束-->
-</div>
-<!--vue调用不能删除-->
-<div id="vm"></div>
-<script src="{__FRAME_PATH}js/jquery.min.js"></script>
-<script src="{__FRAME_PATH}js/bootstrap.min.js"></script>
-<script src="{__STATIC_PATH}plug/helper.js"></script>
-<script src="{__FRAME_PATH}js/plugins/metisMenu/jquery.metisMenu.js"></script>
-<script src="{__FRAME_PATH}js/plugins/slimscroll/jquery.slimscroll.min.js"></script>
-<script src="{__FRAME_PATH}js/plugins/layer/layer.min.js"></script>
-<script src="{__FRAME_PATH}js/hplus.min.js"></script>
-<script src="{__FRAME_PATH}js/contabs.min.js"></script>
-<script src="{__FRAME_PATH}js/plugins/pace/pace.min.js"></script>
-{include file="public/style"}
-<script>
-    window.newOrderAudioLink= '{$new_order_audio_link}';
-    window.workermanPort = '{$workermanPort}';
-</script>
-<script src="{__FRAME_PATH}js/index.js"></script>
-</body>
-</html>
-=======
 <!DOCTYPE html>
 <html>
 <head>
@@ -546,4 +271,3 @@
 <script src="{__FRAME_PATH}js/index.js"></script>
 </body>
 </html>
->>>>>>> 386b37d33e5ba817cba00df29efaefbd692e4dd1

+ 0 - 69
app/admin/view/login/index.php

@@ -1,71 +1,3 @@
-<<<<<<< HEAD
-<!DOCTYPE html>
-<html>
-<head>
-    <meta charset="utf-8">
-    <meta name="viewport" content="width=device-width, initial-scale=1.0">
-    <meta name="robots" content="noindex,nofollow" />
-    <title>登录管理系统</title>
-    <meta name="generator" content="CRMEB! v2.5" />
-    <meta name="author" content="CRMEB! Team and CRMEB UI Team" />
-    <link href="{__FRAME_PATH}css/bootstrap.min.css?v=3.4.0" rel="stylesheet">
-    <link href="{__PLUG_PATH}layui/css/layui.css" rel="stylesheet">
-    <link href="{__FRAME_PATH}css/font-awesome.min.css?v=4.3.0" rel="stylesheet">
-    <link href="{__FRAME_PATH}css/animate.min.css" rel="stylesheet">
-    <link href="{__FRAME_PATH}css/style.min.css?v=3.0.0" rel="stylesheet">
-    <script>
-        top != window && (top.location.href = location.href);
-    </script>
-</head>
-<body class="gray-bg login-bg">
-<!--<canvas id="canvas" width="900" height="300" style="position: fixed;top: -50px;width: 60%;left: 20%"></canvas>-->
-<div class="middle-box text-center loginscreen  animated fadeInDown">
-    <div class="login-group">
-        <h3 class="login-logo">
-            宏根蒂集团
-        </h3>
-        <form role="form" action="{:url('verify')}" method="post" id="form" onsubmit="return false">
-            <div class="form-group">
-                <div class="input-group m-b"><span class="input-group-addon"><i class="fa fa-user"></i> </span>
-                    <input type="text" id="account" name="account" placeholder="用户名" placeholder="用户名" class="form-control">
-                </div>
-            </div>
-            <div class="form-group">
-                <div class="input-group m-b"><span class="input-group-addon"><i class="fa fa-unlock-alt"></i> </span>
-                    <input type="password" class="form-control" id="pwd" name="pwd" placeholder="密码" required="">
-                </div>
-
-            </div>
-            <div class="form-group">
-                <div class="input-group">
-                    <input type="text" class="form-control" id="verify" name="verify" placeholder="验证码" required="">
-                    <span class="input-group-btn" style="padding: 0;margin: 0;">
-                        <img id="verify_img" src="{:Url('captcha')}" alt="验证码" style="padding: 0;height: 34px;margin: 0;">
-                    </span>
-                </div>
-            </div>
-            <button type="submit" class="btn btn-primary block full-width m-b">登 录</button>
-            <?php /*  <p class="text-muted text-center"> <a href="{:url('./forgetpwd')}"><small>忘记密码了?</small></a> | <a href="{:url('./register')}">注册一个新账号</a>
-              </p>  */ ?>
-        </form>
-    </div>
-</div>
-<!--<div class="footer" style=" position: fixed;bottom: 0;width: 100%;left: 0;margin: 0;opacity: 0.8;">-->
-<!--    <div class="pull-right">© 2017-2020 <a href="http://www.crmeb.com/" target="_blank">CRMEB</a>-->
-<!--    </div>-->
-<!--</div>-->
-
-<!-- 全局js -->
-<script src="{__PLUG_PATH}jquery-1.10.2.min.js"></script>
-<script src="{__FRAME_PATH}js/bootstrap.min.js?v=3.4.0"></script>
-<script src="{__MODULE_PATH}login/flaotfont.js"></script>
-<script src="{__MODULE_PATH}login/ios-parallax.js"></script>
-<script src="{__PLUG_PATH}layui/layui.all.js"></script>
-<script src="{__MODULE_PATH}login/index.js"></script>
-<!--统计代码,可删除-->
-<!--点击刷新验证码-->
-</body>
-=======
 <!DOCTYPE html>
 <html>
 <head>
@@ -132,5 +64,4 @@
 <!--统计代码,可删除-->
 <!--点击刷新验证码-->
 </body>
->>>>>>> 386b37d33e5ba817cba00df29efaefbd692e4dd1
 </html>

+ 0 - 1
app/api/common.php

@@ -24,4 +24,3 @@ function string2hex($string){
     }
     return $hex;
 }
-

+ 1 - 366
app/api/controller/PublicController.php

@@ -1,366 +1,3 @@
-<<<<<<< HEAD
-<?php
-
-namespace app\api\controller;
-
-use app\admin\model\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\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\UserLevel;
-use app\models\user\WechatUser;
-use app\Request;
-use crmeb\services\CacheService;
-use crmeb\services\SystemConfigService;
-use crmeb\services\UtilService;
-use crmeb\services\workerman\ChannelService;
-use think\db\exception\DataNotFoundException;
-use think\db\exception\DbException;
-use think\db\exception\ModelNotFoundException;
-use think\facade\Cache;
-use crmeb\services\upload\Upload;
-
-/**
- * 公共类
- * Class PublicController
- * @package app\api\controller
- */
-class PublicController
-{
-
-    public function test()
-    {
-        UserLevel::setLevelComplete(9);
-    }
-
-    /**
-     * @param Request $request
-     * @return mixed
-     * @throws DataNotFoundException
-     * @throws ModelNotFoundException
-     * @throws \think\exception\DbException
-     */
-    public function index(Request $request)
-    {
-        $banner = sys_data('routine_home_banner') ?: [];//TODO 首页banner图
-        $menus = sys_data('routine_home_menus') ?: [];//TODO 首页按钮
-        $roll = sys_data('routine_home_roll_news') ?: [];//TODO 首页滚动新闻
-        $activity = sys_data('routine_home_activity', 3) ?: [];//TODO 首页活动区域图片
-        $site_name = sys_config('site_name');
-        $routine_index_page = sys_data('routine_index_page');
-        $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');//TODO 促销单品简介
-        if (strstr($logoUrl, 'http') === false && $logoUrl) $logoUrl = sys_config('site_url') . $logoUrl;
-        $logoUrl = str_replace('\\', '/', $logoUrl);
-        $fastNumber = sys_config('fast_number', 0);//TODO 快速选择分类个数
-        $bastNumber = sys_config('bast_number', 0);//TODO 精品推荐个数
-        $firstNumber = sys_config('first_number', 0);//TODO 首发新品个数
-        $promotionNumber = sys_config('promotion_number', 0);//TODO 首发新品个数
-        $info['fastList'] = StoreCategory::byIndexList((int)$fastNumber, false);//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);//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);//TODO 首发新品个数
-        $info['bastBanner'] = sys_data('routine_home_bast_banner') ?? [];//TODO 首页精品推荐图片
-        $benefit = StoreProduct::getBenefitProduct('id,image,store_name,cate_id,price,ot_price,stock,unit_name', $promotionNumber);//TODO 首页促销单品
-        $lovely = sys_data('routine_home_new_banner') ?: [];//TODO 首发新品顶部图
-        $likeInfo = StoreProduct::getHotProduct('id,image,store_name,cate_id,price,ot_price,unit_name', 3);//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');
-        $tengxun_map_key = sys_config('tengxun_map_key');
-        return app('json')->successful(compact('banner', 'menus', 'roll', 'info', 'activity', 'lovely', 'benefit', 'likeInfo', 'logoUrl', 'couponList', 'site_name', 'subscribe', 'newGoodsBananr', 'tengxun_map_key'));
-    }
-
-    /**
-     * @param Request $request
-     * @return mixed
-     * @throws DataNotFoundException
-     * @throws DbException
-     * @throws ModelNotFoundException
-     */
-    public function cityArea(Request $request)
-    {
-        $province = SystemCity::where('level', 0)->where('parent_id', 0)->field('name,city_id')->select()->each(function ($item) {
-            $item['city'] = SystemCity::where('level', 1)
-                ->where('parent_id', $item['city_id'])
-                ->field('name,city_id')
-                ->select()->each(function ($sub_item) {
-                    $sub_item['area'] = SystemCity::where('level', 2)
-                        ->where('parent_id', $sub_item['city_id'])
-                        ->column('name');
-                    unset($sub_item['city_id']);
-                })->toArray();
-            unset($item['city_id']);
-        });
-        return app('json')->success('ok', $province->toArray());
-    }
-
-    /**
-     * 获取分享配置
-     * @return mixed
-     */
-    public function share()
-    {
-        $data['img'] = sys_config('wechat_share_img');
-        if (strstr($data['img'], 'http') === false) $data['img'] = sys_config('site_url') . $data['img'];
-        $data['img'] = str_replace('\\', '/', $data['img']);
-        $data['title'] = sys_config('wechat_share_title');
-        $data['synopsis'] = sys_config('wechat_share_synopsis');
-        return app('json')->successful(compact('data'));
-    }
-
-
-    /**
-     * 获取个人中心菜单
-     * @param Request $request
-     * @return mixed
-     * @throws DataNotFoundException
-     * @throws ModelNotFoundException
-     * @throws \think\exception\DbException
-     */
-    public function menu_user(Request $request)
-    {
-        $menusInfo = sys_data('routine_my_menus') ?? [];
-        $user = $request->user();
-        $vipOpen = sys_config('vip_open');
-        $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')) == 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['wap_url'] === '/order/order_cancellation')
-                unset($menusInfo[$key]);
-            if (((!StoreService::orderServiceStatus($user->uid)) && (!SystemStoreStaff::verifyStatus($user->uid))) && $value['wap_url'] === '/admin/order_cancellation/index')
-                unset($menusInfo[$key]);
-            if ((!StoreService::orderServiceStatus($user->uid)) && $value['wap_url'] === '/admin/order/index')
-                unset($menusInfo[$key]);
-            if ($value['wap_url'] == '/user/vip' && !$vipOpen)
-                unset($menusInfo[$key]);
-            if ($value['wap_url'] == '/customer/index' && !StoreService::orderServiceStatus($user->uid))
-                unset($menusInfo[$key]);
-        }
-        return app('json')->successful(['routine_my_menus' => $menusInfo]);
-    }
-
-    /**
-     * 热门搜索关键字获取
-     * @return mixed
-     * @throws DataNotFoundException
-     * @throws ModelNotFoundException
-     * @throws \think\exception\DbException
-     */
-    public function search()
-    {
-        $routineHotSearch = sys_data('routine_hot_search') ?? [];
-        $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 \Psr\SimpleCache\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_type = sys_config('upload_type', 1);
-        $upload = new Upload((int)$upload_type, [
-            'accessKey' => sys_config('accessKey'),
-            'secretKey' => sys_config('secretKey'),
-            'uploadUrl' => sys_config('uploadUrl'),
-            'storageName' => sys_config('storage_name'),
-            'storageRegion' => sys_config('storage_region'),
-        ]);
-        $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, $upload_type, $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
-     */
-    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) {
-            ChannelService::instance()->send('PAY_SMS_SUCCESS', ['price' => $price, 'number' => $num], [$attach]);
-            return app('json')->successful();
-        }
-        return app('json')->fail();
-    }
-
-    /**
-     * 记录用户分享
-     * @param Request $request
-     * @return mixed
-     */
-    public function user_share(Request $request)
-    {
-        return app('json')->successful(UserBill::setUserShare($request->uid()));
-    }
-
-    /**
-     * 获取图片base64
-     * @param Request $request
-     * @return mixed
-     */
-    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());
-        }
-    }
-
-    /**
-     * 门店列表
-     * @return mixed
-     */
-    public function store_list(Request $request)
-    {
-        list($latitude, $longitude, $page, $limit) = UtilService::getMore([
-            ['latitude', ''],
-            ['longitude', ''],
-            ['page', 1],
-            ['limit', 10]
-        ], $request, true);
-        $list = SystemStore::lst($latitude, $longitude, $page, $limit);
-        if (!$list) $list = [];
-        $data['list'] = $list;
-        $data['tengxun_map_key'] = sys_config('tengxun_map_key');
-        return app('json')->successful($data);
-    }
-
-    /**
-     * 查找城市数据
-     * @param Request $request
-     * @return mixed
-     */
-    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);
-    }
-
-    /**
-     * 版本更新
-     * @param Request $request
-     * @return void
-     */
-    public function version(Request $request)
-    {
-        $config = SystemConfigService::more(['version', 'apk']);
-        $data = [
-            'version' => $config['version'],
-            'url' =>   $request->domain().'/'.$config['apk'],
-        ];
-        $msg = [
-            'status' => 200,
-            'msg' => 'ok',
-            'data' => $data
-        ];
-        return app('json')->successful($data);
-
-    }
-
-=======
 <?php
 
 namespace app\api\controller;
@@ -712,7 +349,7 @@ class PublicController
         $config = SystemConfigService::more(['version', 'apk']);
         $data = [
             'version' => $config['version'],
-            'url' => $request->domain() . '/' . $config['apk'],
+            'url' =>   $request->domain().'/'.$config['apk'],
         ];
         $msg = [
             'status' => 200,
@@ -722,6 +359,4 @@ class PublicController
         return app('json')->successful($data);
 
     }
-
->>>>>>> 386b37d33e5ba817cba00df29efaefbd692e4dd1
 }

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

@@ -1,735 +1,3 @@
-<<<<<<< HEAD
-<?php
-
-namespace app\api\controller\order;
-
-use app\api\controller\Gmdemo;
-use app\admin\model\system\{
-    SystemAttachment, ShippingTemplates
-};
-use app\admin\model\user\User;
-use app\models\routine\RoutineFormId;
-use crmeb\repositories\OrderRepository;
-use app\models\store\{
-    StoreBargainUser,
-    StoreCart,
-    StoreCoupon,
-    StoreCouponIssue,
-    StoreCouponUser,
-    StoreOrder,
-    StoreOrderCartInfo,
-    StoreOrderStatus,
-    StorePink,
-    StoreProductReply
-};
-use app\models\system\SystemStore;
-use app\models\user\UserAddress;
-use app\models\user\UserLevel;
-use app\Request;
-use crmeb\services\{
-    CacheService,
-    ExpressService,
-    SystemConfigService,
-    UtilService
-};
-
-/**
- * 订单类
- * Class StoreOrderController
- * @package app\api\controller\order
- */
-class StoreOrderController
-{
-    /**
-     * 订单确认
-     * @param Request $request
-     * @return mixed
-     */
-    public function confirm(Request $request)
-    {
-        $temp = ShippingTemplates::get(1);
-        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::getUserProductCartList($uid, $cartId, 1);
-        if (count($cartGroup['invalid'])) return app('json')->fail($cartGroup['invalid'][0]['productInfo']['store_name'] . '已失效!');
-        if (!$cartGroup['valid']) 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'),
-            'integralRatio' => sys_config('integral_ratio')
-        ];
-        $usableCoupons = StoreCouponUser::getUsableCouponList($uid, $cartGroup, $priceGroup['totalPrice']);
-        $usableCoupon = isset($usableCoupons[0]) ? $usableCoupons[0] : null;
-        $cartIdA = explode(',', $cartId);
-        $seckill_id = 0;
-        $combination_id = 0;
-        $bargain_id = 0;
-        if (count($cartIdA) == 1) {
-            $seckill_id = StoreCart::where('id', $cartId)->value('seckill_id');
-            $combination_id = StoreCart::where('id', $cartId)->value('combination_id');
-            $bargain_id = StoreCart::where('id', $cartId)->value('bargain_id');
-        }
-        $data['deduction'] = $seckill_id || $combination_id || $bargain_id;
-        $data['usableCoupon'] = $usableCoupon;
-        $data['addressInfo'] = UserAddress::getUserDefaultAddress($uid);
-        $data['seckill_id'] = $seckill_id;
-        $data['combination_id'] = $combination_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') ?? (int)2;
-        $data['store_self_mention'] = (int)sys_config('store_self_mention') ?? 0;//门店自提是否开启
-        $data['system_store'] = ($res = SystemStore::getStoreDispose()) ? $res : [];//门店信息
-        return app('json')->successful($data);
-    }
-
-    /**
-     * 计算订单金额
-     * @param Request $request
-     * @param $key
-     * @return mixed
-     * @throws \think\Exception
-     * @throws \think\db\exception\DataNotFoundException
-     * @throws \think\db\exception\ModelNotFoundException
-     * @throws \think\exception\DbException
-     */
-    public function computedOrder(Request $request, $key)
-    {
-
-//        $priceGroup = StoreOrder::getOrderPriceGroup($cartInfo);
-        if (!$key) return app('json')->fail('参数错误!');
-        $uid = $request->uid();
-        if (StoreOrder::be(['order_id|unique' => $key, 'uid' => $uid, 'is_del' => 0]))
-            return app('json')->status('extend_order', '订单已生成', ['orderId' => $key, 'key' => $key]);
-        list($addressId, $couponId, $payType, $useIntegral, $mark, $combinationId, $pinkId, $seckill_id, $formId, $bargainId, $shipping_type) = UtilService::postMore([
-            'addressId', 'couponId', ['payType', 'yue'], ['useIntegral', 0], 'mark', ['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, $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())]);
-        }
-        $priceGroup = StoreOrder::cacheKeyCreateOrder($request->uid(), $key, $addressId, $payType, (int)$useIntegral, $couponId, $mark, $combinationId, $pinkId, $seckill_id, $bargainId, true, 0, $shipping_type);
-        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 \think\db\exception\DataNotFoundException
-     * @throws \think\db\exception\ModelNotFoundException
-     * @throws \think\exception\DbException
-     */
-    public function create(Request $request, $key)
-    {
-        if (!$key) return app('json')->fail('参数错误!');
-        $uid = $request->uid();
-        if (StoreOrder::be(['order_id|unique' => $key, 'uid' => $uid, 'is_del' => 0]))
-            return app('json')->status('extend_order', '订单已生成', ['orderId' => $key, 'key' => $key]);
-        list($addressId, $couponId, $payType, $useIntegral, $mark, $combinationId, $pinkId, $seckill_id, $formId, $bargainId, $from, $shipping_type, $real_name, $phone, $storeId) = UtilService::postMore([
-            'addressId', 'couponId', 'payType', ['useIntegral', 0], 'mark', ['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, $combinationId, $pinkId, $seckill_id, $bargainId, false, $isChannel, $shipping_type, $real_name, $phone, $storeId);
-        if ($order === false) return app('json')->fail(StoreOrder::getErrorInfo('订单生成失败'));
-        $orderId = $order['order_id'];
-        $info = compact('orderId', 'key');
-        if ($orderId) {
-            event('OrderCreated', [$order]); //订单创建成功事件
-            event('ShortMssageSend', [$orderId, 'AdminPlaceAnOrder']);//发送管理员通知
-            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);
-                        if ($payPriceStatus)//0元支付成功
-                            return app('json')->status('success', '微信支付成功', $info);
-                        else
-                            return app('json')->status('pay_error', StoreOrder::getErrorInfo());
-                    } else {
-                        try {
-                            if ($from == 'routine') {
-                                $jsConfig = OrderRepository::jsPay($orderId); //创建订单jspay
-                            } else if ($from == 'weixinh5') {
-                                $jsConfig = OrderRepository::h5Pay($orderId);
-                            } else {
-                                $jsConfig = OrderRepository::wxPay($orderId);
-                            }
-                        } 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 "ali":
-                    $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, $request->uid());
-                        if ($payPriceStatus)//0元支付成功
-                            return app('json')->status('success', '支付成功');
-                        else
-                            return app('json')->status('pay_error', StoreOrder::getErrorInfo());
-                    } else {
-                        try {
-                            $jsConfig = OrderRepository::aliPay($orderId); //创建订单jspay
-                        } catch (\Exception $e) {
-                            return app('json')->status('pay_error', $e->getMessage());
-                        }
-                        $info['jsConfig'] = $jsConfig;
-                        return app('json')->status('ali_pay', '订单创建成功', $info);
-                    }
-                    break;
-                case 'yue':
-                    if (StoreOrder::yuePay($orderId, $request->uid(), $formId))
-                        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
-     */
-    public function again(Request $request)
-    {
-        list($uni) = UtilService::postMore([
-            ['uni', ''],
-        ], $request, true);
-        if (!$uni) return app('json')->fail('参数错误!');
-        $order = StoreOrder::getUserOrderDetail($request->uid(), $uni);
-        if (!$order) return app('json')->fail('订单不存在!');
-        $order = StoreOrder::tidyOrder($order, true);
-        $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', 0, 0);
-        }
-        $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
-     */
-    public function pay(Request $request)
-    {
-        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);
-        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 = OrderRepository::jsPay($order); //订单列表发起支付
-                    } else if ($from == 'weixinh5') {
-                        $jsConfig = OrderRepository::h5Pay($order);
-                    } else {
-                        $jsConfig = OrderRepository::wxPay($order);
-                    }
-                } 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()))
-                    return app('json')->status('success', '余额支付成功');
-                else {
-                    $error = StoreOrder::getErrorInfo();
-                    return app('json')->fail(is_array($error) && isset($error['msg']) ? $error['msg'] : $error);
-                }
-                break;
-            case 'ztpay':
-                $gm = new Gmdemo();
-                $data = [
-                    'mechNo' => 123456,// 商户号
-                    'inetNo' => $order['order_id'],//订单号
-                    'sndTmstmp' => date('YmdHis', time()),
-                    'pdDsc' => '=商品购买',
-                    'pymntAmt' => $order['pay_price'] * 100, // 交 易 单 位 为 分
-                    'ccy' => 156,
-                    'channelCode' => ''//渠道号
-                ];
-                $res = $gm->scanPaymentCode($data);
-                halt($res);
-
-            case 'offline':
-                StoreOrder::createOrderTemplate($order);
-                if (StoreOrder::setOrderTypePayOffline($order['order_id']))
-                    return app('json')->status('success', '订单创建成功');
-                else
-                    return app('json')->status('success', '支付失败');
-                break;
-            case "ali":
-                $orderInfo = StoreOrder::where('order_id', $order['order_id'])->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($order['order_id'], $request->uid());
-                    if ($payPriceStatus)//0元支付成功
-                        return app('json')->status('success', '支付成功');
-                    else
-                        return app('json')->status('pay_error', StoreOrder::getErrorInfo());
-                } else {
-                    try {
-                        $jsConfig = OrderRepository::aliPay($order['order_id']); //创建订单jspay
-                    } catch (\Exception $e) {
-                        return app('json')->status('pay_error', $e->getMessage());
-                    }
-                    $info['jsConfig'] = $jsConfig;
-                    return app('json')->status('ali_pay', '订单创建成功', $info);
-                }
-                break;
-        }
-        return app('json')->fail('支付方式错误');
-    }
-
-    /**
-     * 订单列表
-     * @param Request $request
-     * @return mixed
-     */
-    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));
-    }
-
-    /**
-     * 订单详情
-     * @param Request $request
-     * @param $uni
-     * @return mixed
-     */
-    public function detail(Request $request, $uni)
-    {
-        if (!strlen(trim($uni))) return app('json')->fail('参数错误');
-        $order = StoreOrder::getUserOrderDetail($request->uid(), $uni);
-        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));
-    }
-
-    /**
-     * 订单删除
-     * @param Request $request
-     * @return mixed
-     */
-    public function del(Request $request)
-    {
-        list($uni) = UtilService::postMore([
-            ['uni', ''],
-        ], $request, true);
-        if (!$uni) return app('json')->fail('参数错误!');
-        $res = StoreOrder::removeOrder($uni, $request->uid());
-        if ($res)
-            return app('json')->successful();
-        else
-            return app('json')->fail(StoreOrder::getErrorInfo());
-    }
-
-    /**
-     * 订单收货
-     * @param Request $request
-     * @return mixed
-     */
-    public function take(Request $request)
-    {
-        list($uni) = UtilService::postMore([
-            ['uni', ''],
-        ], $request, true);
-        if (!$uni) return app('json')->fail('参数错误!');
-        $res = StoreOrder::takeOrder($uni, $request->uid());
-        if ($res) {
-            $order_info = StoreOrder::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
-     */
-    public function express(Request $request, $uni)
-    {
-        if (!$uni || !($order = StoreOrder::getUserOrderDetail($request->uid(), $uni))) 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']);
-            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 \think\db\exception\DataNotFoundException
-     * @throws \think\db\exception\ModelNotFoundException
-     * @throws \think\exception\DbException
-     */
-    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::get($uid);
-        $group['nickname'] = $user_info['nickname'];
-        $group['avatar'] = $user_info['avatar'];
-        if (!$cartInfo) return app('json')->fail('评价产品不存在!');
-        $orderUid = StoreOrder::getOrderInfo($cartInfo['oid'], 'uid')['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 $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()));
-    }
-
-    /**
-     * 订单退款理由
-     * @return mixed
-     */
-    public function refund_reason()
-    {
-        $reason = sys_config('stor_reason') ?: [];//退款理由
-        $reason = str_replace("\r\n", "\n", $reason);//防止不兼容
-        $reason = explode("\n", $reason);
-        return app('json')->successful($reason);
-    }
-
-    /**
-     * 订单退款审核
-     * @param Request $request
-     * @return mixed
-     */
-    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']);
-        if ($res)
-            return app('json')->successful('提交申请成功');
-        else
-            return app('json')->fail(StoreOrder::getErrorInfo());
-    }
-
-
-    /**
-     * 订单取消   未支付的订单回退积分,回退优惠券,回退库存
-     * @param Request $request
-     * @return mixed
-     * @throws \think\db\exception\DataNotFoundException
-     * @throws \think\db\exception\ModelNotFoundException
-     * @throws \think\exception\DbException
-     */
-    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 \think\db\exception\DataNotFoundException
-     * @throws \think\db\exception\ModelNotFoundException
-     * @throws \think\exception\DbException
-     */
-    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);
-    }
-
-    /**
-     * 首页获取未支付订单
-     */
-    public function get_noPay(Request $request)
-    {
-        return app('json')->successful(StoreOrder::getUserOrderSearchList($request->uid(), 0, 0, 0, ''));
-    }
-=======
 <?php
 
 namespace app\api\controller\order;
@@ -1460,5 +728,4 @@ class StoreOrderController
     {
         return app('json')->successful(StoreOrder::getUserOrderSearchList($request->uid(), 0, 0, 0, ''));
     }
->>>>>>> 386b37d33e5ba817cba00df29efaefbd692e4dd1
 }

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

@@ -1,624 +1,3 @@
-<<<<<<< HEAD
-<?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\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'));
-        $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;
-        $uids = User::where('spread_uid', $request->uid())->column('uid');
-        $info['pay_price'] = StoreOrder::where('uid', 'in', $uids)
-            ->where('paid', 1)
-            ->where('is_participate', 0)
-            ->sum('pay_price');
-
-        return app('json')->success($info);
-    }
-
-    /**
-     * 用户资金统计
-     * @param Request $request
-     * @return mixed
-     * @throws \think\Exception
-     * @throws DataNotFoundException
-     * @throws ModelNotFoundException
-     * @throws \think\exception\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
-     */
-    public function user(Request $request)
-    {
-        $user = $request->user();
-        $user = $user->toArray();
-        $user['couponCount'] = StoreCouponUser::getUserValidCouponCount($user['uid']);
-        $user['like'] = StoreProductRelation::getUserIdCollect($user['uid']);
-        $user['orderStatusNum'] = StoreOrder::getOrderData($user['uid']);
-        $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');
-        $broken_time = intval(sys_config('extract_time'));
-        $search_time = time() - 86400 * $broken_time;
-        if (!$user['is_promoter'] && $user['statu'] == 2) {
-            $price = StoreOrder::where(['paid' => 1, 'refund_status' => 0, 'uid' => $user['uid']])->sum('pay_price');
-            $status = is_brokerage_statu($price);
-            if ($status) {
-                User::where('uid', $user['uid'])->update(['is_promoter' => 1]);
-                $user['is_promoter'] = 1;
-            } else {
-                $storeBrokeragePrice = sys_config('store_brokerage_price', 0);
-                $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');//充值开关
-        $user['adminid'] = (boolean)\app\models\store\StoreService::orderServiceStatus($user['uid']);
-        if ($user['phone'] && $user['user_type'] != 'h5') {
-            $user['switchUserInfo'][] = $request->user();
-            if ($h5UserInfo = User::where('account', $user['phone'])->where('user_type', 'h5')->find()) {
-                $user['switchUserInfo'][] = $h5UserInfo;
-            }
-        } else if ($user['phone'] && $user['user_type'] == 'h5') {
-            if ($wechatUserInfo = User::where('phone', $user['phone'])->where('user_type', '<>', 'h5')->find()) {
-                $user['switchUserInfo'][] = $wechatUserInfo;
-            }
-            $user['switchUserInfo'][] = $request->user();
-        } else if (!$user['phone']) {
-            $user['switchUserInfo'][] = $request->user();
-        }
-
-        return app('json')->successful($user);
-    }
-
-    /**
-     * 地址 获取单个
-     * @param Request $request
-     * @param $id
-     * @return mixed
-     * @throws DataNotFoundException
-     * @throws ModelNotFoundException
-     * @throws \think\exception\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
-     */
-    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
-     */
-    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
-     */
-    public function address_edit(Request $request)
-    {
-        $addressInfo = UtilService::postMore([
-            ['address', []],
-            ['is_default', false],
-            ['real_name', ''],
-            ['post_code', ''],
-            ['phone', ''],
-            ['detail', ''],
-            ['id', 0],
-            ['type', 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['address']['city_id'] = $cityId;
-            }
-        }
-
-        $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
-     */
-    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
-     */
-    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);
-        return app('json')->successful($productRelationList);
-    }
-
-    /**
-     * 添加收藏
-     * @param Request $request
-     * @param $id
-     * @param $category
-     * @return mixed
-     */
-    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
-     */
-    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
-     */
-    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()
-    {
-        $signConfig = sys_data('sign_day_num') ?? [];
-        return app('json')->successful($signConfig);
-    }
-
-    /**
-     * 签到 列表
-     * @param Request $request
-     * @param $page
-     * @param $limit
-     * @return mixed
-     */
-    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())))
-            return app('json')->successful('签到获得' . floatval($integral) . '积分', ['integral' => $integral]);
-        return app('json')->fail(UserSign::getErrorInfo('签到失败'));
-    }
-
-    /**
-     * 签到用户信息
-     * @param Request $request
-     * @return mixed
-     */
-    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') == 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()
-    {
-        $data['is_bargin'] = StoreBargain::validBargain() ? true : false;
-        $data['is_pink'] = StoreCombination::getPinkIsOpen() ? true : false;
-        $data['is_seckill'] = StoreSeckill::getSeckillCount() ? true : false;
-        return app('json')->successful($data);
-    }
-
-    /**
-     * 用户修改信息
-     * @param Request $request
-     * @return mixed
-     */
-    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 DataNotFoundException
-     * @throws ModelNotFoundException
-     * @throws \think\exception\DbException
-     */
-    public function rank(Request $request)
-    {
-        $data = UtilService::getMore([
-            ['page', ''],
-            ['limit', ''],
-            ['type', '']
-        ], $request);
-        $users = User::getRankList($data);
-        return app('json')->success($users);
-    }
-
-    /**
-     * 佣金排行
-     * @param Request $request
-     * @return mixed
-     */
-    public function brokerage_rank(Request $request)
-    {
-        $data = UtilService::getMore([
-            ['page', ''],
-            ['limit'],
-            ['type']
-        ], $request);
-        return app('json')->success([
-            'rank' => User::brokerageRank($data),
-            'position' => User::currentUserRank($data['type'], $request->user()['brokerage_price'])
-        ]);
-
-    }
-
-    /**
-     * 添加访问记录
-     * @param Request $request
-     * @return mixed
-     */
-    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
-     * @throws DataNotFoundException
-     * @throws DbException
-     * @throws ModelNotFoundException
-     */
-    public function spread(Request $request)
-    {
-        $puid = $request->post('puid/d', 0);
-        return app('json')->success(User::setSpread($puid, $request->uid()));
-    }
-=======
 <?php
 
 namespace app\api\controller\user;
@@ -1238,5 +617,4 @@ class UserController
         $puid = $request->post('puid/d', 0);
         return app('json')->success(User::setSpread($puid, $request->uid()));
     }
->>>>>>> 386b37d33e5ba817cba00df29efaefbd692e4dd1
 }

File diff suppressed because it is too large
+ 0 - 2248
app/models/store/StoreOrder.php


+ 0 - 216
crmeb/repositories/OrderRepository.php

@@ -1,218 +1,3 @@
-<<<<<<< HEAD
-<?php
-
-namespace crmeb\repositories;
-
-use app\models\store\StoreOrder;
-use app\models\user\User;
-use app\models\user\WechatUser;
-use app\admin\model\order\StoreOrder as AdminStoreOrder;
-use crmeb\services\AlipayService;
-use crmeb\services\MiniProgramService;
-use crmeb\services\SystemConfigService;
-use crmeb\services\WechatService;
-
-/**
- * Class OrderRepository
- * @package crmeb\repositories
- */
-class OrderRepository
-{
-
-    /**
-     * TODO 小程序JS支付
-     * @param $orderId
-     * @param string $field
-     * @return array|string
-     * @throws \think\db\exception\DataNotFoundException
-     * @throws \think\db\exception\ModelNotFoundException
-     * @throws \think\exception\DbException
-     */
-    public static function jsPay($orderId, $field = 'order_id')
-    {
-        if (is_string($orderId))
-            $orderInfo = StoreOrder::where($field, $orderId)->find();
-        else
-            $orderInfo = $orderId;
-        if (!$orderInfo || !isset($orderInfo['paid'])) exception('支付订单不存在!');
-        if ($orderInfo['paid']) exception('支付已支付!');
-        if ($orderInfo['pay_price'] <= 0) exception('该支付无需支付!');
-        $openid = WechatUser::getOpenId($orderInfo['uid']);
-        $bodyContent = StoreOrder::getProductTitle($orderInfo['cart_id']);
-        $site_name = sys_config('site_name');
-        if (!$bodyContent && !$site_name) exception('支付参数缺少:请前往后台设置->系统设置-> 填写 网站名称');
-        return MiniProgramService::jsPay($openid, $orderInfo['order_id'], $orderInfo['pay_price'], 'product', StoreOrder::getSubstrUTf8($site_name . ' - ' . $bodyContent, 30));
-    }
-
-    /**
-     * 微信公众号JS支付
-     * @param $orderId
-     * @param string $field
-     * @return array|string
-     * @throws \think\db\exception\DataNotFoundException
-     * @throws \think\db\exception\ModelNotFoundException
-     * @throws \think\exception\DbException
-     */
-    public static function wxPay($orderId, $field = 'order_id')
-    {
-        if (is_string($orderId))
-            $orderInfo = StoreOrder::where($field, $orderId)->find();
-        else
-            $orderInfo = $orderId;
-        if (!$orderInfo || !isset($orderInfo['paid'])) exception('支付订单不存在!');
-        if ($orderInfo['paid']) exception('支付已支付!');
-        if ($orderInfo['pay_price'] <= 0) exception('该支付无需支付!');
-        $openid = WechatUser::uidToOpenid($orderInfo['uid'], 'openid');
-        $bodyContent = StoreOrder::getProductTitle($orderInfo['cart_id']);
-        $site_name = sys_config('site_name');
-        if (!$bodyContent && !$site_name) exception('支付参数缺少:请前往后台设置->系统设置-> 填写 网站名称');
-        return WechatService::jsPay($openid, $orderInfo['order_id'], $orderInfo['pay_price'], 'product', StoreOrder::getSubstrUTf8($site_name . ' - ' . $bodyContent, 30));
-    }
-
-    /**
-     * 微信h5支付
-     * @param $orderId
-     * @param string $field
-     * @return array|string
-     * @throws \think\db\exception\DataNotFoundException
-     * @throws \think\db\exception\ModelNotFoundException
-     * @throws \think\exception\DbException
-     */
-    public static function h5Pay($orderId, $field = 'order_id')
-    {
-        if (is_string($orderId))
-            $orderInfo = StoreOrder::where($field, $orderId)->find();
-        else
-            $orderInfo = $orderId;
-        if (!$orderInfo || !isset($orderInfo['paid'])) exception('支付订单不存在!');
-        if ($orderInfo['paid']) exception('支付已支付!');
-        if ($orderInfo['pay_price'] <= 0) exception('该支付无需支付!');
-        $bodyContent = StoreOrder::getProductTitle($orderInfo['cart_id']);
-        $site_name = sys_config('site_name');
-        if (!$bodyContent && !$site_name) exception('支付参数缺少:请前往后台设置->系统设置-> 填写 网站名称');
-        return WechatService::paymentPrepare(null, $orderInfo['order_id'], $orderInfo['pay_price'], 'product', StoreOrder::getSubstrUTf8($site_name . ' - ' . $bodyContent, 30), '', 'MWEB');
-    }
-
-    public static function aliPay($orderId, $field = 'order_id')
-    {
-        if (is_string($orderId))
-            $orderInfo = StoreOrder::where($field, $orderId)->where('is_del', 0)->find();
-        else
-            $orderInfo = $orderId;
-        if (!$orderInfo || !isset($orderInfo['paid'])) exception('支付订单不存在!');
-        if ($orderInfo['paid']) exception('支付已支付!');
-        if ($orderInfo['pay_price'] <= 0) exception('该支付无需支付!');
-        $bodyContent = StoreOrder::getProductTitle($orderInfo['cart_id']);
-        $site_name = sys_config('site_name');
-        if (!$site_name || !$bodyContent) exception('支付参数缺少:请前往后台设置->系统设置-> 填写 网站名称');
-        $alipay = SystemConfigService::more(['alipay_app_id', 'alipay_pub_key', 'alipay_private_key', 'alipay_key']);
-        $notifyUrl = sys_config('site_url') . '/api/alipay/notify';
-        $aliPay = new AlipayService();
-        $aliPay->setAppid($alipay['alipay_app_id']);
-        $aliPay->setNotifyUrl($notifyUrl);
-        $aliPay->setRsaPrivateKey($alipay['alipay_private_key']);
-        $aliPay->setTotalFee($orderInfo['pay_price']);
-        $aliPay->setOutTradeNo($orderInfo['order_id']);
-        $aliPay->setOrderName(StoreOrder::getSubstrUTf8($site_name . ' - ' . $bodyContent, 30));
-        $aliPay->setPassbackParams(['attach' => 'product']);
-        $orderStr = $aliPay->getOrderStr();
-        return $orderStr;
-    }
-
-    /**
-     * 用户确认收货
-     * @param $order
-     * @param $uid
-     * @throws \think\Exception
-     * @throws \think\db\exception\DataNotFoundException
-     * @throws \think\db\exception\ModelNotFoundException
-     * @throws \think\exception\DbException
-     * @throws \think\db\exception\DbException
-     * @throws \Exception
-     */
-    public static function storeProductOrderUserTakeDelivery($order, $uid)
-    {
-        $res1 = StoreOrder::gainUserIntegral($order);
-//        $res2 = User::backOrderBrokerage($order);
-        $res2 = User::sendBackOrderBrokerage($order);
-        StoreOrder::orderTakeAfter($order);
-        //满赠优惠券
-        WechatUser::userTakeOrderGiveCoupon($uid, $order['total_price']);
-        if (!($res1 && $res2)) exception('收货失败!');
-    }
-
-    /**
-     * 修改状态 为已收货  admin模块
-     * @param $order
-     * @throws \Exception
-     */
-    public static function storeProductOrderTakeDeliveryAdmin($order)
-    {
-
-        $res1 = AdminStoreOrder::gainUserIntegral($order);
-//        $res2 = User::backOrderBrokerage($order);
-        $res2 = User::sendBackOrderBrokerage($order);
-        AdminStoreOrder::orderTakeAfter($order);
-        if (!($res1 && $res2)) exception('收货失败!');
-    }
-
-    /**
-     * 修改状态 为已收货  定时任务使用
-     * @param $order
-     * @throws \Exception
-     */
-    public static function storeProductOrderTakeDeliveryTimer($order)
-    {
-
-        $res1 = AdminStoreOrder::gainUserIntegral($order, false);
-        $res2 = User::sendBackOrderBrokerage($order);
-        AdminStoreOrder::orderTakeAfter($order);
-        if (!($res1 && $res2)) exception('收货失败!');
-    }
-
-
-    /**
-     * 修改状态为  已退款  admin模块
-     * @param $data
-     * @param $oid
-     * @return bool|mixed
-     * @throws \think\db\exception\DataNotFoundException
-     * @throws \think\db\exception\ModelNotFoundException
-     * @throws \think\exception\DbException
-     */
-    public static function storeProductOrderRefundY($data, $oid)
-    {
-        $order = AdminStoreOrder::where('id', $oid)->find();
-        if ($order['is_channel'] == 1)
-            return AdminStoreOrder::refundRoutineTemplate($oid); //TODO 小程序余额退款模板消息
-        else
-            return AdminStoreOrder::refundTemplate($data, $oid);//TODO 公众号余额退款模板消息
-    }
-
-
-    /**
-     * TODO  后台余额退款
-     * @param $product
-     * @param $refund_data
-     * @throws \Exception
-     */
-    public static function storeOrderYueRefund($product, $refund_data)
-    {
-        $res = AdminStoreOrder::integralBack($product['id']);
-        if (!$res) exception('退积分失败!');
-    }
-
-    /**
-     * 订单退积分
-     * @param $product $product 商品信息
-     * @param $back_integral $back_integral 退多少积分
-     */
-    public static function storeOrderIntegralBack($product, $back_integral)
-    {
-
-    }
-
-=======
 <?php
 
 namespace crmeb\repositories;
@@ -426,5 +211,4 @@ class OrderRepository
 
     }
 
->>>>>>> 386b37d33e5ba817cba00df29efaefbd692e4dd1
 }

+ 0 - 92
crmeb/repositories/PaymentRepositories.php

@@ -1,94 +1,3 @@
-<<<<<<< HEAD
-<?php
-
-namespace crmeb\repositories;
-
-use app\models\store\StoreOrder;
-use app\models\user\UserRecharge;
-
-/**
- * Class PaymentRepositories
- * @package crmeb\repositories
- */
-class PaymentRepositories
-{
-
-    /**
-     * 公众号下单成功之后
-     * @param $order
-     * @param $prepay_id
-     */
-    public static function wechatPaymentPrepare($order, $prepay_id)
-    {
-
-    }
-
-    /**
-     * 小程序下单成功之后
-     * @param $order
-     * @param $prepay_id
-     */
-    public static function wechatPaymentPrepareProgram($order, $prepay_id)
-    {
-
-    }
-
-    /**
-     * 使用余额支付订单时
-     * @param $userInfo
-     * @param $orderInfo
-     */
-    public static function yuePayProduct($userInfo, $orderInfo)
-    {
-
-
-    }
-
-    /**
-     * 订单支付成功之后
-     * @param string|null $order_id 订单id
-     * @return bool
-     */
-    public static function wechatProduct(string $order_id = null)
-    {
-        try {
-            if (StoreOrder::be(['order_id' => $order_id, 'paid' => 1])) return true;
-            return StoreOrder::paySuccess($order_id);
-        } catch (\Exception $e) {
-            return false;
-        }
-    }
-    /**
-     * 订单支付成功之后
-     * @param string|null $order_id 订单id
-     * @return bool
-     */
-    public static function aliProduct(string $order_id = null)
-    {
-        try {
-            if (StoreOrder::be(['order_id' => $order_id, 'paid' => 1])) return true;
-            return StoreOrder::paySuccess($order_id, 'ali');
-        } catch (\Exception $e) {
-            return false;
-        }
-    }
-
-
-    /**
-     * 充值成功后
-     * @param string|null $order_id 订单id
-     * @return bool
-     */
-    public static function wechatUserRecharge(string $order_id = null)
-    {
-        try {
-            if (UserRecharge::be(['order_id' => $order_id, 'paid' => 1])) return true;
-            return UserRecharge::rechargeSuccess($order_id);
-        } catch (\Exception $e) {
-            return false;
-        }
-    }
-=======
 <?php
 
 namespace crmeb\repositories;
@@ -178,5 +87,4 @@ class PaymentRepositories
             return false;
         }
     }
->>>>>>> 386b37d33e5ba817cba00df29efaefbd692e4dd1
 }

+ 0 - 260
route/api/route.php

@@ -1,262 +1,3 @@
-<<<<<<< HEAD
-<?php
-
-use think\facade\Route;
-
-//账号密码登录
-Route::post('login', 'AuthController/login')->name('login')
-    ->middleware(\app\http\middleware\AllowOriginMiddleware::class);
-
-// 获取发短信的key
-Route::get('verify_code', 'AuthController/verifyCode')->name('verifyCode')
-    ->middleware(\app\http\middleware\AllowOriginMiddleware::class);
-
-//手机号登录
-Route::post('login/mobile', 'AuthController/mobile')->name('loginMobile')
-    ->middleware(\app\http\middleware\AllowOriginMiddleware::class);
-
-//图片验证码
-Route::get('sms_captcha', 'AuthController/captcha')->name('captcha')
-    ->middleware(\app\http\middleware\AllowOriginMiddleware::class);
-//验证码发送
-Route::post('register/verify', 'AuthController/verify')->name('registerVerify')
-    ->middleware(\app\http\middleware\AllowOriginMiddleware::class);
-//手机号注册
-Route::post('register', 'AuthController/register')->name('register')
-    ->middleware(\app\http\middleware\AllowOriginMiddleware::class);
-
-//手机号修改密码
-Route::post('register/reset', 'AuthController/reset')->name('registerReset')
-    ->middleware(\app\http\middleware\AllowOriginMiddleware::class);
-
-Route::any('wechat/serve', 'wechat.WechatController/serve');//公众号服务
-Route::any('wechat/notify', 'wechat.WechatController/notify');//公众号支付回调
-Route::any('routine/notify', 'wechat.AuthController/notify');//小程序支付回调
-Route::any('test', 'PublicController/test');//小程序支付回调
-Route::any('alipay/notify', 'AlipayController/notify');//支付支付回调
-
-Route::get('h5Key', 'AuthController/h5Key');//授权登录Key
-Route::get('h5Token/:key', 'AuthController/h5Token');//授权登录Token
-
-//管理员订单操作类
-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', 'admin.StoreOrderController/order_verific')->name('order');//订单核销
-})->middleware(\app\http\middleware\AllowOriginMiddleware::class)->middleware(\app\http\middleware\AuthTokenMiddleware::class, true)->middleware(\app\http\middleware\CustomerMiddleware::class);
-
-//会员授权接口
-Route::group(function () {
-    Route::post('h5Auth/:key', 'AuthController/h5Auth');//小程序支付回调
-    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('product/poster', 'store.StoreProductController/poster')->name('productPost');//产品分享海报
-    //公共类
-    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/:cartId', '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('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('partake/out', 'user.UserPartakeController/out_list')->name('outList');//出局奖励列表
-    Route::get('partake/out/:id', 'user.UserPartakeController/out_detail')->name('outList');//出局奖励列表
-    Route::post('partake/participate_in', 'user.UserPartakeController/participate_in')->name('participate_in');//参与
-    Route::get('partake/partake', 'user.UserPartakeController/partake')->name('partake');//参与记录
-    Route::get('partake/user_push_list', 'user.UserPartakeController/user_push_list')->name('user_push_list');//下级消费记录
-})->middleware(\app\http\middleware\AllowOriginMiddleware::class)->middleware(\app\http\middleware\AuthTokenMiddleware::class, true);
-//未授权接口
-Route::group(function () {
-    //公共类
-    Route::get('index', 'PublicController/index')->name('index');//首页
-    Route::get('city_area', 'PublicController/cityArea')->name('city_area');
-    Route::get('search/keyword', 'PublicController/search')->name('searchKeyword');//热门搜索关键字获取
-    //产品分类类
-    Route::get('category', 'store.CategoryController/category')->name('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');//产品评价数量和好评度
-    //文章分类类
-    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('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');//分享配置
-
-    //优惠券
-    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('city_list', 'PublicController/city_list')->name('cityList');
-
-    Route::get('version', 'PublicController/version')->name('version'); // 版本更新
-
-})->middleware(\app\http\middleware\AllowOriginMiddleware::class)->middleware(\app\http\middleware\AuthTokenMiddleware::class, false);
-
-
-Route::miss(function () {
-    if (app()->request->isOptions())
-        return \think\Response::create('ok')->code(200)->header([
-            'Access-Control-Allow-Origin' => '*',
-            'Access-Control-Allow-Headers' => 'Authori-zation,Authorization, Content-Type, If-Match, If-Modified-Since, If-None-Match, If-Unmodified-Since, X-Requested-With',
-            'Access-Control-Allow-Methods' => 'GET,POST,PATCH,PUT,DELETE,OPTIONS,DELETE',
-        ]);
-    else
-        return \think\Response::create()->code(404);
-=======
 <?php
 
 use think\facade\Route;
@@ -514,5 +255,4 @@ Route::miss(function () {
         ]);
     else
         return \think\Response::create()->code(404);
->>>>>>> 386b37d33e5ba817cba00df29efaefbd692e4dd1
 });

Some files were not shown because too many files changed in this diff