牟新芬 3 سال پیش
والد
کامیت
76aebf5445

+ 0 - 1
app/adminapi/controller/v1/merchant/.WeDrive

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

+ 0 - 176
app/adminapi/controller/v1/merchant/SystemStore.php

@@ -1,176 +0,0 @@
-<?php
-
-namespace app\adminapi\controller\v1\merchant;
-
-use app\models\system\SystemConfig;
-use think\facade\Route as Url;
-use app\adminapi\controller\AuthController;
-use app\models\system\{SystemStore as SystemStoreModel, SystemStoreStaff, SystemProductStore};
-use crmeb\services\{FormBuilder as Form, UtilService as Util};
-
-/**
- * 门店管理控制器
- * Class SystemAttachment
- * @package app\admin\controller\system
- *
- */
-class SystemStore extends AuthController
-{
-
-    /**
-     * 获取门店列表1
-     * @return mixed
-     */
-    public function index()
-    {
-        $where = Util::getMore([
-            [['page', 'd'], 1],
-            [['limit', 'd'], 15],
-            [['keywords', 's'], ''],
-            [['type', 'd'], 0],
-        ]);
-        $mer_id = $this->merId ?: '';
-        return $this->success(SystemStoreModel::lst(0, 0, $where['page'], $where['limit'], $where['keywords'], $where['type'], $mer_id));
-    }
-
-    /**
-     * 获取门店列表(不分页)
-     */
-    public function get_store_list()
-    {
-        $mer_id = $this->merId ?: '';
-        return $this->success(SystemStoreModel::where('mer_id', $mer_id)->where('is_del', 0)->where('is_show', 1)->select()->toArray());
-    }
-
-    /**
-     * 获取门店头部        
-     * @return mixed
-     */
-    public function get_header()
-    {
-        $count['show']['name'] = '显示中的提货点';
-        $count['hide']['name'] = '隐藏中的提货点';
-        $count['recycle']['name'] = '回收站的提货点';
-        $count['show']['num'] = SystemStoreModel::merSet($this->merId)->where('is_show', 1)->where('is_del', 0)->count('id');//显示中的门店
-        $count['hide']['num'] = SystemStoreModel::merSet($this->merId)->where('is_show', 0)->count('id');//隐藏的门店
-        $count['recycle']['num'] = SystemStoreModel::merSet($this->merId)->where('is_del', 1)->count('id');//删除的门店
-        return $this->success(compact('count'));
-    }
-
-    /*
-     * 门店设置
-     * */
-    public function get_info()
-    {
-        list($id) = Util::getMore([
-            [['id', 'd'], 0],
-        ], $this->request, true);
-        $info = SystemStoreModel::getStoreInfo($id);
-        return $this->success(compact('info'));
-    }
-
-    /*
-     * 位置选择
-     * */
-    public function select_address()
-    {
-        $key = SystemConfig::getConfigValue('tengxun_map_key');
-        if (!$key) return $this->fail('请前往设置->系统设置->物流配置 配置腾讯地图KEY');
-        return $this->success(compact('key'));
-    }
-
-    /**
-     * 设置单个门店是否显示
-     * @param string $is_show
-     * @param string $id
-     * @return json
-     */
-    public function set_show($is_show = '', $id = '')
-    {
-        ($is_show == '' || $id == '') && $this->fail('缺少参数');
-        $res = SystemStoreModel::where(['id' => $id])->update(['is_show' => (int)$is_show]);
-        if ($res) {
-            return $this->success($is_show == 1 ? '设置显示成功' : '设置隐藏成功');
-        } else {
-            return $this->fail($is_show == 1 ? '设置显示失败' : '设置隐藏失败');
-        }
-    }
-
-    /*
-     * 保存修改门店信息
-     * param int $id
-     * */
-    public function save($id = 0)
-    {
-        $data = Util::postMore([
-            ['name', ''],
-            ['introduction', ''],
-            ['image', ''],
-            ['phone', ''],
-            ['address', ''],
-            ['detailed_address', ''],
-            ['latlng', ''],
-            ['day_time', []],
-            ['pids', []]
-        ]);
-        $this->validate($data, \app\adminapi\validates\merchant\SystemStoreValidate::class, 'save');
-        if($this->merId){
-            $data['mer_id'] = $this->merId;
-        }
-        SystemStoreModel::beginTrans();
-        try {
-            $data['address'] = implode(',', $data['address']);
-            $data['latlng'] = explode(',', $data['latlng']);
-            if (!isset($data['latlng'][0]) || !isset($data['latlng'][1])) return $this->fail('请选择门店位置');
-            $data['latitude'] = $data['latlng'][0];
-            $data['longitude'] = $data['latlng'][1];
-            $data['day_time'] = implode(' - ', $data['day_time']);
-            unset($data['latlng']);
-            if ($data['image'] && strstr($data['image'], 'http') === false) {
-                $site_url = SystemConfig::getConfigValue('site_url');
-                $data['image'] = $site_url . $data['image'];
-            }
-            $pids = $data['pids'];
-            unset($data['pids']);
-            if ($id) {
-                SystemStoreModel::where('id', $id)->update($data);
-                SystemProductStore::saveStoreProduct($pids, $id);
-                SystemStoreModel::commitTrans();
-                return $this->success('修改成功');
-            } else {
-                $data['add_time'] = time();
-                $data['is_show'] = 1;
-                $res = SystemStoreModel::create($data);
-                SystemProductStore::saveStoreProduct($pids, $res->id);
-                SystemStoreModel::commitTrans();
-                return $this->success('保存成功', ['id' => $res->id]);
-            }
-        } catch (\Exception $e) {
-            SystemStoreModel::rollbackTrans();
-            return $this->fail($e->getMessage());
-        }
-    }
-
-    /**
-     * 删除恢复门店
-     * @param $id
-     */
-    public function delete($id)
-    {
-        if (!$id) return $this->fail('数据不存在');
-        if (!SystemStoreModel::be(['id' => $id])) return $this->fail('数据不存在');
-        if (SystemStoreModel::be(['id' => $id, 'is_del' => 1])) {
-            $data['is_del'] = 0;
-            if (!SystemStoreModel::edit($data, $id))
-                return $this->fail(SystemStoreModel::getErrorInfo('恢复失败,请稍候再试!'));
-            else
-                return $this->success('恢复门店成功!');
-        } else {
-            $data['is_del'] = 1;
-            if (!SystemStoreModel::edit($data, $id))
-                return $this->fail(SystemStoreModel::getErrorInfo('删除失败,请稍候再试!'));
-            else
-                return $this->success('删除门店成功!');
-        }
-    }
-}

+ 0 - 177
app/adminapi/controller/v1/merchant/SystemStoreStaff.php

@@ -1,177 +0,0 @@
-<?php
-
-namespace app\adminapi\controller\v1\merchant;
-
-use think\facade\Route as Url;
-use app\adminapi\controller\AuthController;
-use app\models\system\{
-    SystemStore, SystemStoreStaff as StoreStaffModel
-};
-use crmeb\services\{
-    FormBuilder as Form, UtilService as Util
-};
-
-class SystemStoreStaff extends AuthController
-{
-    /**
-     * 获取店员列表
-     * @return mixed
-     */
-    public function index()
-    {
-        $where = Util::getMore([
-            [['page', 'd'], 1],
-            [['limit', 'd'], 15],
-            [['store_id', 'd'], 0],
-        ]);
-        $where['mer_id'] = $this->merId ?: '';
-        return $this->success(StoreStaffModel::getList($where));
-    }
-
-    /**
-     * 门店列表
-     * @return mixed
-     * @throws \think\db\exception\DataNotFoundException
-     * @throws \think\db\exception\DbException
-     * @throws \think\db\exception\ModelNotFoundException
-     */
-    public function store_list()
-    {
-        return $this->success(SystemStore::verificWhere($this->merId)->field(['id', 'name'])->select()->toArray());
-    }
-
-    /**
-     * 店员新增表单
-     * @return mixed
-     * @throws \FormBuilder\exception\FormBuilderException
-     */
-    public function create()
-    {
-        $field = [
-            Form::frameImageOne('image', '商城用户', Url::buildUrl('admin/system.User/list', array('fodder' => 'image')))->icon('ios-add')->width('50%')->height('500px')->setProps(['srcKey'=>'image']),
-            Form::hidden('uid', 0),
-            Form::hidden('avatar', ''),
-            Form::select('store_id', '所属提货点')->setOptions(function () {
-                $mer_id = $this->merId ?: '';
-                $list = SystemStore::dropList($mer_id);
-                $menus = [];
-                foreach ($list as $menu) {
-                    $menus[] = ['value' => $menu['id'], 'label' => $menu['name']];
-                }
-                return $menus;
-            })->filterable(1),
-            Form::input('staff_name', '核销员名称')->col(Form::col(24)),
-            Form::input('phone', '手机号码')->col(Form::col(24)),
-            Form::radio('verify_status', '核销开关', 1)->options([['value' => 1, 'label' => '开启'], ['value' => 0, 'label' => '关闭']]),
-            Form::radio('status', '状态', 1)->options([['value' => 1, 'label' => '开启'], ['value' => 0, 'label' => '关闭']])
-        ];
-        return $this->makePostForm('添加核销员', $field, Url::buildUrl('/merchant/store_staff/save/0')->suffix(false));
-    }
-
-    /**
-     * 店员修改表单
-     * @return mixed
-     * @throws \FormBuilder\exception\FormBuilderException
-     */
-    public function edit()
-    {
-        list($id) = Util::getMore([
-            [['id', 'd'], 0],
-        ], $this->request, true);
-        $info = StoreStaffModel::get($id);
-        if (!$info) return $this->fail('参数错误');
-        $field = [
-            Form::frameImageOne('image', '商城用户', Url::buildUrl('admin/system.User/list'), $info['avatar'])->icon('ios-add')->width('50%')->height('500px')->allowRemove(false),
-            Form::hidden('uid', $info['uid']),
-            Form::hidden('avatar', $info['avatar']),
-            Form::select('store_id', '所属提货点', (string)$info->getData('store_id'))->setOptions(function () {
-                $mer_id = $this->merId ?: '';
-                $list = SystemStore::dropList($mer_id);
-                $menus = [];
-                foreach ($list as $menu) {
-                    $menus[] = ['value' => $menu['id'], 'label' => $menu['name']];
-                }
-                return $menus;
-            })->filterable(1),
-            Form::input('staff_name', '核销员名称', $info['staff_name'])->col(Form::col(24)),
-            Form::input('phone', '手机号码', $info['phone'])->col(Form::col(24)),
-            Form::radio('verify_status', '核销开关', $info['verify_status'])->options([['value' => 1, 'label' => '开启'], ['value' => 0, 'label' => '关闭']]),
-            Form::radio('status', '状态', $info['status'])->options([['value' => 1, 'label' => '开启'], ['value' => 0, 'label' => '关闭']])
-        ];
-        return $this->makePostForm('修改核销员', $field, Url::buildUrl('/merchant/store_staff/save/' . $info['id'])->suffix(false));
-    }
-
-    /**
-     * 保存店员信息
-     */
-    public function save($id = 0)
-    {
-        $data = Util::postMore([
-            ['image',''],
-            ['uid', 0],
-            ['avatar', ''],
-            ['store_id', ''],
-            ['staff_name', ''],
-            ['phone', ''],
-            ['verify_status', 1],
-            ['status', 1],
-        ]);
-        if (!$id) {
-            if($data['image']=='') return $this->fail('请选择用户');
-            if (StoreStaffModel::where('uid', $data['uid'])->count()) return $this->fail('添加的核销员用户已存在!');
-            $data['uid'] = $data['image']['uid'];
-            $data['avatar'] = $data['image']['image'];
-        }
-        if ($data['uid'] == 0) return $this->fail('请选择用户');
-        if ($data['store_id'] == '') return $this->fail('请选择所属提货点');
-        $data['mer_id'] = $this->merId ?: '';
-        unset($data['image']);
-        if ($id) {
-            $res = StoreStaffModel::edit($data, $id);
-            if ($res) {
-                return $this->success('编辑成功');
-            } else {
-                return $this->fail('编辑失败');
-            }
-        } else {
-            $data['add_time'] = time();
-            $res = StoreStaffModel::create($data);
-            if ($res) {
-                return $this->success('核销员添加成功');
-            } else {
-                return $this->fail('核销员添加失败,请稍后再试');
-            }
-        }
-    }
-
-    /**
-     * 设置单个店员是否开启
-     * @param string $is_show
-     * @param string $id
-     * @return mixed
-     */
-    public function set_show($is_show = '', $id = '')
-    {
-        ($is_show == '' || $id == '') && $this->fail('缺少参数');
-        $res = StoreStaffModel::where(['id' => $id])->update(['status' => (int)$is_show]);
-        if ($res) {
-            return $this->success($is_show == 1 ? '开启成功' : '关闭成功');
-        } else {
-            return $this->fail($is_show == 1 ? '开启失败' : '关闭失败');
-        }
-    }
-
-    /**
-     * 删除店员
-     * @param $id
-     */
-    public function delete($id)
-    {
-        if (!$id) return $this->fail('数据不存在');
-        if (!StoreStaffModel::be(['id' => $id])) return $this->failed('数据不存在');
-        if (!StoreStaffModel::del($id))
-            return $this->fail(StoreStaffModel::getErrorInfo('删除失败,请稍候再试!'));
-        else
-            return $this->success('删除成功!');
-    }
-}

+ 0 - 56
app/adminapi/controller/v1/merchant/SystemVerifyOrder.php

@@ -1,56 +0,0 @@
-<?php
-
-namespace app\adminapi\controller\v1\merchant;
-
-use app\adminapi\controller\AuthController;
-use app\models\store\StoreOrder;
-use crmeb\services\UtilService as Util;
-
-class SystemVerifyOrder extends AuthController
-{
-    /**
-     * 获取核销订单列表
-     * return json
-     */
-    public function list()
-    {
-        $where = Util::getMore([
-            ['data', ''],
-            ['real_name', ''],
-            ['store_id', ''],
-            ['page', 1],
-            ['limit', 20],
-        ]);
-        $where['mer_id'] = $this->merId ?: '';
-        return $this->success(StoreOrder::VerifyOrder($where));
-    }
-
-    /**
-     * 获取核销订单头部
-     * @return mixed
-     */
-    public function getVerifyBadge()
-    {
-        $where = Util::postMore([
-            ['real_name', ''],
-            ['is_del', 0],
-            ['data', ''],
-            ['store_id', ''],
-        ]);
-        $where['mer_id'] = $this->merId ?: '';
-        return $this->success(StoreOrder::getVerifyBadge($where));
-    }
-
-    /**
-     * 订单列表推荐人详细
-     * @param $uid
-     * @return mixed
-     * @throws \think\db\exception\DataNotFoundException
-     * @throws \think\db\exception\DbException
-     * @throws \think\db\exception\ModelNotFoundException
-     */
-    public function order_spread_user($uid)
-    {
-        return $this->success(StoreOrder::order_spread_user($uid));
-    }
-}

+ 0 - 1
app/adminapi/controller/v1/user/User.php

@@ -89,7 +89,6 @@ class User extends AuthController
             [['group_id', 'd'], 0],
             [['label_id', 'd'], 0]
         ]);
-        $where['mer_id'] = $this->merId;
         return $this->success(UserModel::getUserList($where));
     }
 

+ 0 - 18
app/adminapi/route/company.php

@@ -1,18 +0,0 @@
-<?php
-
-use think\facade\Route;
-
-/**
- * 公司管理 相关路由
- */
-Route::group('company', function () {
-    //公司资源路由
-    Route::resource('company', 'v1.company.Company')->name('CompanyResource');
-    //修改状态
-    Route::put('company/set_status/:id/:status', 'v1.company.Company/set_status')->name('CompanyStatus');
-
-})->middleware([
-    \app\http\middleware\AllowOriginMiddleware::class,
-    \app\adminapi\middleware\AdminAuthTokenMiddleware::class,
-    \app\adminapi\middleware\AdminCkeckRole::class
-]);

+ 7 - 37
app/adminapi/route/merchant.php

@@ -3,45 +3,15 @@
 use think\facade\Route;
 
 /**
- * 运费模板 相关路由
+ * 商户 相关路由
  */
 Route::group('merchant', function () {
-    //门店设置详情
-    Route::get('store', 'v1.merchant.SystemStore/index');
-    //获取门店列表(不分页)
-    Route::get('store/get_list', 'v1.merchant.SystemStore/get_store_list');
-    //门店列表数量
-    Route::get('store/get_header', 'v1.merchant.SystemStore/get_header');
-    //门店列表数量
-    Route::put('store/set_show/:id/:is_show', 'v1.merchant.SystemStore/set_show');
-    //门店列表数量
-    Route::delete('store/del/:id', 'v1.merchant.SystemStore/delete');
-    //位置选择
-    Route::get('store/address', 'v1.merchant.SystemStore/select_address');
-    //门店设置详情
-    Route::get('store/get_info/:id', 'v1.merchant.SystemStore/get_info');
-    //保存修改门店信息
-    Route::post('store/:id', 'v1.merchant.SystemStore/save');
-    //获取店员列表
-    Route::get('store_staff', 'v1.merchant.SystemStoreStaff/index');
-    //添加店员表单
-    Route::get('store_staff/create', 'v1.merchant.SystemStoreStaff/create');
-    //门店搜索列表
-    Route::get('store_list', 'v1.merchant.SystemStoreStaff/store_list');
-    //修改店员状态
-    Route::put('store_staff/set_show/:id/:is_show', 'v1.merchant.SystemStoreStaff/set_show');
-    //修改店员表单
-    Route::get('store_staff/:id/edit', 'v1.merchant.SystemStoreStaff/edit');
-    //保存店员
-    Route::post('store_staff/save/:id', 'v1.merchant.SystemStoreStaff/save');
-    //删除店员
-    Route::delete('store_staff/del/:id', 'v1.merchant.SystemStoreStaff/delete');
-    //获取核销订单列表
-    Route::get('verify_order', 'v1.merchant.SystemVerifyOrder/list');
-    //获取核销订单头部
-    Route::get('verify_badge', 'v1.merchant.SystemVerifyOrder/getVerifyBadge');
-    //获取核销订单头部
-    Route::get('verify/spread_info/:uid', 'v1.merchant.SystemVerifyOrder/order_spread_user');
+	Route::post('register', 'v1.merchant.Merchant/registerMerchant')->name('registerMerchant');//注册商户
+    Route::post('edit/:mer_id', 'v1.merchant.Merchant/editMerchant')->name('editMerchant');//编辑商户
+    Route::get('list', 'v1.merchant.Merchant/getMerchantList')->name('getMerchantList');//获取商户列表
+    Route::get('detail/:mer_id', 'v1.merchant.Merchant/getMerchantDetail')->name('getMerchantDetail');//获取商户详情
+    Route::post('del/:mer_id', 'v1.merchant.Merchant/delete')->name('deleteMerchantMiniprogram');//删除商户小程序绑定记录
+    Route::post('edit_pay/:mer_id', 'v1.merchant.Merchant/editMerchantPay')->name('editMerchantPay');//编辑商户支付信息
 })->middleware([
     \app\http\middleware\AllowOriginMiddleware::class,
     \app\adminapi\middleware\AdminAuthTokenMiddleware::class,

+ 0 - 228
app/models/article/Article.php

@@ -1,228 +0,0 @@
-<?php
-
-namespace app\models\article;
-
-use app\models\store\StoreProduct;
-use app\models\system\SystemAdmin;
-use crmeb\services\SystemConfigService;
-use think\facade\Db;
-use crmeb\traits\ModelTrait;
-use crmeb\basic\BaseModel;
-
-/**
- * TODO 文章Model
- * Class Article
- * @package app\models\article
- */
-class Article extends BaseModel
-{
-    /**
-     * 数据表主键
-     * @var string
-     */
-    protected $pk = 'id';
-
-    /**
-     * 模型名称
-     * @var string
-     */
-    protected $name = 'article';
-
-    use ModelTrait;
-
-    public function profile()
-    {
-        return $this->hasOne(StoreProduct::class, 'id', 'product_id')->field('store_name,image,price,id,ot_price');
-    }
-
-    protected function getImageInputAttr($value)
-    {
-        return explode(',', $value) ?: [];
-    }
-
-
-    /**
-     * TODO 获取一条新闻
-     * @param int $id
-     * @return array|null|\think\Model
-     * @throws \think\db\exception\DataNotFoundException
-     * @throws \think\db\exception\ModelNotFoundException
-     * @throws \think\exception\DbException
-     */
-    public static function getArticleOne($id = 0)
-    {
-        if (!$id) return [];
-        $list = self::where('status', 1)->where('hide', 0)->where('id', $id)->order('id desc')->find();
-        if ($list) {
-            $list->store_info = $list->profile ? $list->profile->toArray() : null;
-            $list = $list->hidden(['hide', 'status', 'admin_id', 'mer_id'])->toArray();
-            $list["content"] = Db::name('articleContent')->where('nid', $id)->value('content');
-            $list["content"] = htmlspecialchars_decode($list["content"]);
-            return $list;
-        } else return [];
-    }
-
-    /**
-     * TODO 获取某个分类底下的文章
-     * @param $cid
-     * @param $page
-     * @param $limit
-     * @param string $field
-     * @return mixed
-     */
-    public static function cidByArticleList($cid, $page, $limit, $field = 'id,title,image_input,visit,add_time,synopsis,url', $mer_id = '')
-    {
-        $model = new self();
-//        if ($cid) $model->where("`cid` LIKE '$cid,%' OR `cid` LIKE '%,$cid,%' OR `cid` LIKE '%,$cid' OR `cid`=$cid ");
-        if ((int)$cid) $model = $model->where("CONCAT(',',cid,',')  LIKE '%,$cid,%'");
-        if ($mer_id) $model = $model->where('mer_id', $mer_id);
-        $model = $model->field($field);
-        $model = $model->where('status', 1);
-        $model = $model->where('hide', 0);
-        $model = $model->order('sort DESC,add_time DESC');
-        if ($page) $model = $model->page($page, $limit);
-        return $model->select();
-    }
-
-    /**
-     * TODO 获取热门文章
-     * @param string $field
-     * @return mixed]
-     */
-    public static function getArticleListHot($field = 'id,title,image_input,visit,add_time,synopsis,url', $mer_id = '')
-    {
-        $model = new self();
-        if ($mer_id) $model = $model->where('mer_id', $mer_id);
-        $model = $model->field($field);
-        $model = $model->where('status', 1);
-        $model = $model->where('hide', 0);
-        $model = $model->where('is_hot', 1);
-        $model = $model->order('sort DESC,add_time DESC');
-        return $model->select();
-    }
-
-    /**
-     * TODO 获取轮播文章
-     * @param string $field
-     * @return mixed
-     */
-    public static function getArticleListBanner($field = 'id,title,image_input,visit,add_time,synopsis,url', $mer_id = '')
-    {
-        $model = new self();
-        if ($mer_id) $model = $model->where('mer_id', $mer_id);
-        $model = $model->field($field);
-        $model = $model->where('status', 1);
-        $model = $model->where('hide', 0);
-        $model = $model->where('is_banner', 1);
-        $model = $model->order('sort DESC,add_time DESC');
-        $model = $model->limit(sys_config('news_slides_limit') ?? 3);
-        return $model->select();
-    }
-
-    //后台模型
-
-    /**
-     * 获取配置分类
-     * @param array $where
-     * @return array
-     */
-    public static function getAll($where = array())
-    {
-        $model = new self;
-//        if($where['status'] !== '') $model = $model->where('status',$where['status']);
-//        if($where['access'] !== '') $model = $model->where('access',$where['access']);
-        if ($where['title'] !== '') $model = $model->where('title', 'LIKE', "%$where[title]%");
-        if ($where['mer_id'] != '') $model = $model->where('mer_id', $where['mer_id']);
-        if ($where['cid'] !== '')
-            $model = $model->where('cid', 'in', $where['cid']);
-        $model = $model->where('status', 1)->where('hide', 0);
-        $model = $model->order('sort desc,id desc');
-//        return self::page($model,function($item){
-//            if(!$item['mer_id']) $item['admin_name'] = '总后台管理员---》'.SystemAdmin::where('id',$item['admin_id'])->value('real_name');
-//            else $item['admin_name'] = Merchant::where('id',$item['mer_id'])->value('mer_name').'---》'.MerchantAdmin::where('id',$item['admin_id'])->value('real_name');
-//            $item['content'] = ArticleContent::where('nid',$item['id'])->value('content');
-//            $item['catename'] = ArticleCategory::where('id',$item['cid'])->value('title');
-//            $item['store_name'] = $item->profile->store_name ?? '';
-//        },$where);
-        $list = $model->page((int)$where['page'], (int)$where['limit'])
-            ->select()
-            ->each(function ($item) {
-                $item['content'] = ArticleContent::where('nid', $item['id'])->value('content');
-                $item['catename'] = ArticleCategory::where('id', $item['cid'])->value('title');
-                $item['store_name'] = $item->profile->store_name ?? '';
-            });
-        $count = $model->count();
-        return compact('count', 'list');
-    }
-
-    /**
-     * 获取指定字段的值
-     * @return array
-     */
-    public static function getNews()
-    {
-        return self::where('status', 1)->where('hide', 0)->order('id desc')->column('title', 'id');
-    }
-
-    /**
-     * 新增或修改文章内容
-     * @param $id
-     * @param $content
-     * @return bool|int|string
-     * @throws \think\Exception
-     * @throws \think\exception\PDOException
-     */
-    public static function setContent($id, $content)
-    {
-        $count = ArticleContent::where('nid', $id)->count();
-        $data['nid'] = $id;
-        $data['content'] = $content;
-        if ($count) {
-            $contentSql = ArticleContent::where('nid', $id)->value('content');
-            if ($contentSql == $content) $res = true;
-            else $res = ArticleContent::where('nid', $id)->update(['content' => $content]);
-            if ($res !== false) $res = true;
-        } else {
-            $res = ArticleContent::insert($data);
-        }
-        return $res;
-    }
-
-    /**
-     * 给表中的字符串类型追加值
-     * 删除所有有当前分类的id之后重新添加
-     * @param $cid
-     * @param $id
-     * @return bool
-     */
-    public static function saveBatchCid($cid, $id)
-    {
-        $res_all = self::where('cid', 'LIKE', "%$cid%")->select();//获取所有有当前分类的图文
-        foreach ($res_all as $k => $v) {
-            $cid_arr = explode(',', $v['cid']);
-            if (in_array($cid, $cid_arr)) {
-                $key = array_search($cid, $cid_arr);
-                array_splice($cid_arr, $key, 1);
-            }
-            if (empty($cid_arr)) {
-                $data['cid'] = 0;
-                self::edit($data, $v['id']);
-            } else {
-                $data['cid'] = implode(',', $cid_arr);
-                self::edit($data, $v['id']);
-            }
-        }
-        $res = self::where('id', 'IN', $id)->select();
-        foreach ($res as $k => $v) {
-            if (!in_array($cid, explode(',', $v['cid']))) {
-                if (!$v['cid']) {
-                    $data['cid'] = $cid;
-                } else {
-                    $data['cid'] = $v['cid'] . ',' . $cid;
-                }
-                self::edit($data, $v['id']);
-            }
-        }
-        return true;
-    }
-}

+ 0 - 204
app/models/article/ArticleCategory.php

@@ -1,204 +0,0 @@
-<?php
-
-namespace app\models\article;
-
-use crmeb\traits\ModelTrait;
-use crmeb\basic\BaseModel;
-use crmeb\services\UtilService as Util;
-use app\models\article\Article as ArticleModel;
-use PDOStatement;
-use think\Collection;
-use think\db\exception\DataNotFoundException;
-use think\db\exception\DbException;
-use think\db\exception\ModelNotFoundException;
-
-/**
- * TODO 文章分类Model
- * Class ArticleCategory
- * @package app\models\article
- */
-class ArticleCategory extends BaseModel
-{
-    /**
-     * 数据表主键
-     * @var string
-     */
-    protected $pk = 'id';
-
-    /**
-     * 模型名称
-     * @var string
-     */
-    protected $name = 'article_category';
-
-    use ModelTrait;
-
-    /**
-     * TODO 获取文章分类
-     * @return false|PDOStatement|string|Collection
-     * @throws DataNotFoundException
-     * @throws ModelNotFoundException
-     * @throws DbException
-     */
-    public static function getArticleCategory($mer_id)
-    {
-        return self::merSet($mer_id)->where('hidden', 0)->where('is_del', 0)->where('status', 1)->where('pid', 0)->order('sort DESC')->field('id,title')->select();
-    }
-
-    /**
-     * TODO  获取分类字段
-     * @param $id $id 编号
-     * @param string $field $field 字段
-     * @return mixed|string
-     */
-    public static function getArticleCategoryField($id, $field = 'title')
-    {
-        if (!$id) return '';
-        return self::where('id', $id)->value($field);
-    }
-
-    /**
-     * @param $cid
-     * @param $first
-     * @param $limit
-     * @param string $field
-     * @return Collection
-     * @throws DataNotFoundException
-     * @throws ModelNotFoundException
-     * @throws \think\exception\DbException
-     */
-    public static function cidByArticleList($cid, $first, $limit, $field = '*')
-    {
-        $model = new Article();
-        if ($cid) $model->where('cid', $cid);
-        return $model->field($field)->where('status', 1)->where('hide', 0)->order('sort DESC,add_time DESC')->limit($first, $limit)->select();
-    }
-
-    //后台模型
-
-    /**
-     * TODO 获取文章分类
-     * @return array
-     * @throws DataNotFoundException
-     * @throws ModelNotFoundException
-     * @throws \think\exception\DbException
-     */
-    public static function getArticleCategoryList($mer_id = '')
-    {
-        $list = self::merSet($mer_id)->where('is_del', 0)->order('sort desc,id desc')->select();
-        if ($list) return $list->toArray();
-        return [];
-    }
-
-    /**
-     * TODO 获取文章分类信息
-     * @param $id
-     * @param string $field
-     * @return mixed
-     */
-    public static function getArticleCategoryInfo($id, $field = 'title')
-    {
-        $model = new self;
-        if ($id) $model = $model->where('id', $id);
-        $model = $model->where('is_del', 0);
-        $model = $model->where('status', 1);
-        return $model->column($field, 'id');
-    }
-
-    /**
-     * 分级排序列表
-     * @param null $model
-     * @return array
-     */
-    public static function getTierList($model = null)
-    {
-        if ($model === null) $model = new self();
-        return sort_list_tier($model->where('is_del', 0)->where('status', 1)->select()->toArray());
-    }
-
-    /**
-     * 获取系统分页数据   分类
-     * @param array $where
-     * @return array
-     */
-    public static function systemPage($where = array())
-    {
-        $model = new self;
-        if ($where['title'] !== '') $model = $model->where('title', 'LIKE', "%$where[title]%");
-        if ($where['status'] !== '') $model = $model->where('status', $where['status']);
-        if ($where['mer_id'] !== '') $model = $model->where('mer_id', $where['mer_id']);
-        $model = $model->where('is_del', 0);
-        $model = $model->where('hidden', 0);
-        $model = $model->order('sort desc,id desc');
-//        $model = $model->where('pid', 0);
-        $count = $model->count();
-        $list = $model->page((int)$where['page'], (int)$where['limit'])->select()->toArray();
-        return compact('count', 'list');
-    }
-
-    /**
-     * 格式化分类
-     * @param $menusList
-     * @param int $pid
-     * @param array $navList
-     * @return array
-     */
-    public static function tidyTree($menusList, $pid = 0, $navList = [])
-    {
-        foreach ($menusList as $k => $menu) {
-//            $menu = $menu->getData();
-//            $menu['title']=$menu['name'];
-            if ($menu['pid'] == $pid) {
-                unset($menusList[$k]);
-                $menu['children'] = self::tidyTree($menusList, $menu['id']);
-                if ($menu['children']) $menu['expand'] = true;
-                $navList[] = $menu;
-            }
-        }
-        return $navList;
-    }
-
-    /**
-     * 删除分类
-     * @param $id
-     * @return bool
-     */
-    public static function delArticleCategory($id)
-    {
-        if (count(self::getArticle($id, '*')) > 0)
-            return self::setErrorInfo('请先删除改分类下的文章!');
-        return self::edit(['is_del' => 1], $id, 'id');
-    }
-
-    /**
-     * 获取分类底下的文章
-     * id  分类表中的分类id
-     * return array
-     * */
-    public static function getArticle($id, $field)
-    {
-        $res = ArticleModel::where('status', 1)->where('hide', 0)->column($field, 'id');
-        $new_res = array();
-        foreach ($res as $k => $v) {
-            $cid_arr = explode(',', $v['cid']);
-            if (in_array($id, $cid_arr)) {
-                $new_res[$k] = $res[$k];
-            }
-        }
-        return $new_res;
-    }
-
-    public static function getSonCate($arr, $where)
-    {
-        $model = new self;
-        if ($where['title'] !== '') $model = $model->where('title', 'LIKE', "%$where[title]%");
-        if ($where['status'] !== '') $model = $model->where('status', $where['status']);
-        $model = $model->where('is_del', 0);
-        $model = $model->where('hidden', 0);
-        foreach ($arr as $key => $value) {
-            $son_class = $model->where('pid', $value['id'])->select()->toArray();
-            if ($son_class) array_splice($arr, $key, 0, $son_class);
-        }
-        return $arr;
-    }
-}

+ 0 - 13
app/models/article/ArticleContent.php

@@ -1,13 +0,0 @@
-<?php
-
-namespace app\models\article;
-
-use crmeb\basic\BaseModel;
-
-/**
- * @mixin think\Model
- */
-class ArticleContent extends BaseModel
-{
-    //
-}

+ 0 - 130
app/models/merchant/Industry.php

@@ -1,130 +0,0 @@
-<?php
-
-
-namespace app\models\merchant;
-
-
-use crmeb\basic\BaseModel;
-use crmeb\traits\ModelTrait;
-use think\db\exception\DataNotFoundException;
-use think\db\exception\DbException;
-use think\db\exception\ModelNotFoundException;
-
-class Industry extends BaseModel
-{
-    /**
-     * 数据表主键
-     * @var string
-     */
-    protected $pk = 'id';
-
-    /**
-     * 模型名称
-     * @var string
-     */
-    protected $name = 'industry';
-
-    use ModelTrait;
-
-    public static function vaildWhere()
-    {
-        return self::where('is_del', 0);
-    }
-
-    /**
-     * @param null $where
-     * @return array
-     * @throws DataNotFoundException
-     * @throws DbException
-     * @throws ModelNotFoundException
-     */
-    public static function getList($where = null)
-    {
-        $data = ($data = self::setWhere($where)->order('sort desc,id desc')->select()) && count($data) ? $data->toArray() : [];
-        $count = self::setWhere($where)->where('id|pid', isset($where['pid']) && $where['pid'] != '' ? $where['pid'] : 0)->count();
-        return ['count' => $count, 'list' => $data];
-    }
-
-    public static function setWhere($where)
-    {
-        $model = (new self)::vaildWhere();
-        if ($where['name']) {
-            $model = $model->where('name', 'like', '%' . $where['name'] . '%');
-        }
-        if ($where['pid'] != '') {
-            $model = $model->where('id|pid', $where['pid']);
-        }
-        if ($where['is_show'] != '') {
-            $model = $model->where('is_show', $where['is_show']);
-        }
-        return $model;
-    }
-
-    /**
-     * 删除行业
-     * @param $id
-     * @return bool
-     */
-    public static function delIndustry($id)
-    {
-        try {
-            if (!self::vaildWhere()->where(['id' => $id])->find()) {
-                return self::setErrorInfo('行业未找到或已删除');
-            }
-        } catch (DbException $e) {
-            return self::setErrorInfo($e->getMessage());
-        }
-        $count = self::where('pid', $id)->count();
-        if ($count)
-            return self::setErrorInfo('请先删除下级子行业');
-        else {
-            $res = self::where('id', $id)->update(['is_del' => 1, 'update' => time()]);
-            if ($res) {
-                return true;
-            } else {
-                return self::setErrorInfo('删除失败');
-            }
-        }
-    }
-
-    public static function setIndustryShow($id, $show)
-    {
-        $count = self::where('id', $id)->count();
-        if (!$count) return self::setErrorInfo('参数错误');
-        $count = self::where('id', $id)->where('is_show', $show)->count();
-        if ($count) return true;
-        $pid = self::where('id', $id)->value('pid');
-        self::beginTrans();
-        $res1 = true;
-        $res2 = self::where('id', $id)->update(['is_show' => $show, 'update' => time()]);
-        if (!$pid) {//一级分类隐藏
-            $count = self::where('pid', $id)->count();
-            if ($count) {
-                $count = self::where('pid', $id)->where('is_show', $show)->count();
-                $countWhole = self::where('pid', $id)->count();
-                if (!$count || $countWhole > $count) {
-                    $res1 = self::where('pid', $id)->update(['is_show' => $show]);
-                }
-            }
-        }
-        $res = $res1 && $res2;
-        self::checkTrans($res);
-        return $res;
-    }
-
-    /**
-     * 分级排序列表
-     * @param null $model
-     * @param int $type
-     * @return array
-     * @throws \think\db\exception\DataNotFoundException
-     * @throws \think\db\exception\ModelNotFoundException
-     * @throws DbException
-     */
-    public static function getTierList($model = null, $type = 0)
-    {
-        if ($model === null) $model = new self();
-        if (!$type) return sort_list_tier($model->order('sort desc,id desc')->where('pid', 0)->where('is_del', 0)->select()->toArray());
-        return sort_list_tier($model->order('sort desc,id desc')->where('is_del', 0)->select()->toArray());
-    }
-}

+ 2 - 19
app/models/merchant/Merchant.php

@@ -26,14 +26,6 @@ class Merchant extends BaseModel
     public static function getList($where = null)
     {
         $data = ($data = self::setWhere($where)->select()) && count($data) ? $data->toArray() : [];
-        foreach ($data as &$item) {
-            $item['industry_name'] = Industry::where('id', 'IN', $item['industry_id'])->column('name');
-            $item['industry_name'] = $item['industry_name'] ? implode(',', $item['industry_name']) : [];
-            $item['industry_id'] = $item['industry_id'] ? explode(',', $item['industry_id']) : [];
-            // $item['address'] = $item['address'] ? explode(',', $item['address']) : [];
-            // $item['facilities'] = $item['facilities'] ? explode(',', $item['facilities']) : [];
-            // $item['day_time'] = $item['day_time'] ? explode(' - ', $item['day_time']) : [];
-        }
         $count = self::setWhere($where)->count();
         return ['count' => $count, 'list' => $data];
     }
@@ -41,17 +33,8 @@ class Merchant extends BaseModel
     public static function setWhere($where)
     {
         $model = (new self);
-        if ($where['key_word']) {
-            $model = $model->where('name|phone', 'like', '%' . $where['key_word'] . '%');
-        }
-        if ($where['industry_id']) {
-            $model = $model->where('industry_id', $where['industry_id']);
-        }
-        if ($where['version']) {
-            $model = $model->where('version', $where['version']);
-        }
-        if ($where['data']) {
-            $model = self::getModelTime($where, $model, 'add_time');
+        if ($where['name']) {
+            $model = $model->where('name', 'like', '%' . $where['name'] . '%');
         }
         return $model;
     }

+ 1 - 1
app/models/system/SystemGroupData.php

@@ -186,7 +186,7 @@ class SystemGroupData extends BaseModel
 
         }
         array_unshift($header, ['key' => 'id', 'title' => '编号', 'minWidth' => 35]);
-        array_push($header, ['slot' => 'status', 'title' => '是否可用', 'minWidth' => 80], ['slot' => 'action', 'fixed' => 'right', 'title' => '操作', 'minWidth' => 120]);
+        array_push($header, ['slot' => 'status', 'title' => '是否显示', 'minWidth' => 80], ['slot' => 'action', 'fixed' => 'right', 'title' => '操作', 'minWidth' => 120]);
         return compact('header');
     }
 }

+ 5 - 5
app/models/user/User.php

@@ -949,9 +949,9 @@ class User extends BaseModel
         if ($where['group_id'] != '') {
             $model = $model->where('group_id', $where['group_id']);
         }
-        if ($where['mer_id'] != '') {
-            $model = $model->where('mer_id', 'in', [0, $where['mer_id']]);
-        }
+//        if ($where['mer_id'] != '') {
+//            $model = $model->where('mer_id', 'in', [0, $where['mer_id']]);
+//        }
         if ($where['label_id'] != '') {
             $model = $model->whereIn('u.uid', function ($query) use ($where) {
                 $query->name('user_label_relation')->where('label_id', $where['label_id'])->field('uid')->select();
@@ -979,8 +979,8 @@ class User extends BaseModel
                 $item['add_time'] = date('Y-m-d H:i:s', $item['add_time']);
                 if ($item['last_time']) $item['last_time'] = date('Y-m-d H:i:s', $item['last_time']);//最近一次访问日期
                 else $item['last_time'] = '无访问';//最近一次访问日期
-                self::edit(['pay_count' => StoreOrder::getUserCountPay($item['uid'])], $item['uid']);
-                $item['extract_count_price'] = UserExtract::getUserCountPrice($item['uid']);//累计提现
+                //self::edit(['pay_count' => StoreOrder::getUserCountPay($item['uid'])], $item['uid']);
+                //$item['extract_count_price'] = UserExtract::getUserCountPrice($item['uid']);//累计提现
                 if ($item['spread_uid']) {
                     $item['spread_uid_nickname'] = self::where('uid', $item['spread_uid'])->value('nickname') . '/' . $item['spread_uid'];
                 } else {

+ 0 - 1
env

@@ -1 +0,0 @@
-APP_DEBUG = true

[APP]
DEFAULT_TIMEZONE = Asia/Shanghai

[DATABASE]
TYPE = mysql
HOSTNAME = 47.99.37.176
HOSTPORT = 3306
USERNAME = feibo
PASSWORD = dTSSZ8ajE8527YcT
DATABASE = feibo
PREFIX = eb_
CHARSET = utf8
DEBUG = true

[LANG]
default_lang = zh-cn

[REDIS]
HOSTNAME = 127.0.0.1
PORT = 6379
PASSWORD = boofly
SELECT = 0