Browse Source

添加几个代码文件

Aaron 4 years ago
parent
commit
a9b6e6db80
4 changed files with 2753 additions and 0 deletions
  1. 73 0
      Admin.php
  2. 417 0
      CBase.php
  3. 2103 0
      Common.php
  4. 160 0
      config.php

+ 73 - 0
Admin.php

@@ -0,0 +1,73 @@
+<?php
+
+namespace app\admins\model;
+
+use think\Db;
+use think\Model;
+
+//封装model工具类
+
+class Admin extends Common
+{
+    public function initialize()
+    {
+        parent::initialize();
+    }
+
+    //添加,更改==
+    public function addUpdate($table, $data = null, $id = null)
+    {
+        if ($id) {
+            return Db::name($table)->where('id', $id)->update($data);
+        }
+        return Db::name($table)->insertGetId($data);
+    }
+
+    //返回管理员信息
+    public function findOne($field, $value)
+    {
+        return Db::name('admin')->where($field, $value)->find();
+    }
+
+    //验证指定字段
+    public function checkUserAdmin($field, $value)
+    {
+        return Db::name('admin')->field('id')->where($field, $value)->find();
+    }
+
+    //管理员列表
+    public function getAllUserAdmins()
+    {
+//        return Db::name('admin')->field('user_name,password')->select();
+        return Db::name('admin')->where('status != -1')->order('id desc')->paginate(1000);
+    }
+
+    //返回注册时间===
+    public function getRegDate($admName)
+    {
+        return Db::name('admin')->field('add_time')->where('account', $admName)->find();
+    }
+
+    //登陆验证==
+    public function getLoginResult($admName, $admPass)
+    {
+        return Db::name('admin')->field(['id','position_name','sto_id','identity','serve','code'])->where(['account' => $admName, 'password' => $admPass, 'status' => 1,'status_del'=>1])->find();
+    }
+
+    //删除
+    public function del($table, $data, $ids = null, $opt = null)
+    {
+        //删除
+        if ($opt) {
+            return Db::name($table)->where("id in ({$ids})")->delete();
+        }
+        return Db::name($table)->where("id in ({$ids})")->update($data);
+    }
+
+    //获取日志
+    public function getLogs($data)
+    {
+        return Db::name('admin_log')->alias('a')->join('admin b', 'a.adm_id = b.id')
+            ->field('a.*, b.account')->where($data)->order('a.id desc')->paginate(15);
+    }
+}

+ 417 - 0
CBase.php

@@ -0,0 +1,417 @@
+<?php
+namespace app\base;
+
+use think\Controller;
+use think\Cookie;
+
+//公用配置文件
+class CBase extends Controller
+{
+    protected function _initialize()
+    {
+        header("Content-type: text/html; charset=utf-8");
+        parent::_initialize();
+    }
+
+    //显示范围
+    protected function showScope(){
+        return [
+            1 => '全部',
+            2 => '线上',
+            3 => '线下',
+        ];
+    }
+
+    //海媚门店地址
+    protected function hmApiUrl()
+    {
+        return [
+            //西门店
+            0 => '111.111.111.111:808',
+        ];
+    }
+
+    //商品销售范围
+    protected function salesScope(){
+        return [
+            '1' => '全部',
+            '2' => '微信',
+            '3' => '线下',
+        ];
+    }
+
+    //包厢类型备注
+    protected function boxTypeText()
+    {
+        return [
+            '1' => '免费WIFI+专业无线麦克风,可容纳8~10人',
+            '2' => '免费WIFI+专业无线麦克风,可容纳10~12人',
+            '3' => '免费WIFI+专业无线麦克风,可容纳12~15人',
+            '4' => '免费WIFI+专业无线麦克风,可容纳15~20人',
+        ];
+    }
+
+    //包厢可容纳人数
+    protected function boxAcceptNum()
+    {
+        return [
+            '1' => '3-5人',
+            '2' => '8-10人',
+            '3' => '12-15人',
+            '4' => '15-20人',
+            '5' => '20-30人',
+            '6' => '50-60人'
+        ];
+    }
+
+    //时间排序
+    protected function orderByTime()
+    {
+        return [
+            '0' => '默认',
+            '1' => '由近到远',
+            '2' => '由远到近',
+        ];
+    }
+
+    //价格排序
+    protected function ordByPrice()
+    {
+        return [
+            '0' => '默认',
+            '1' => '由低到高',
+            '2' => '由高到低',
+        ];
+    }
+
+    //是否积分抵扣
+    protected function using_integral()
+    {
+        return [
+            '0' => '否',
+            '1' => '是',
+        ];
+    }
+
+    //是否支持存取
+    protected function save()
+    {
+        return [
+            '1' => '支持',
+            '0' => '不支持',
+        ];
+    }
+
+    //出入库类型
+    protected function type()
+    {
+        return [
+            '1' => '出库',
+            '2' => '入库',
+        ];
+    }
+
+    //存取状态
+    protected function cunqu()
+    {
+        return [
+            '1' => '存酒',
+            '2' => '取酒',
+        ];
+    }
+
+    //分类归属
+    protected function catalog()
+    {
+        return [
+            '1' => '归属商品',
+//            '2' => '归属增值',
+//            '3' => '归属套餐',
+        ];
+    }
+
+    //对内对外
+    protected function supply()
+    {
+        return [
+            '0' => '内耗',
+            '1' => '对外',
+        ];
+    }
+
+    //商品归属
+    protected function affiliation()
+    {
+        return [
+            '1' => '厨房',
+            '2' => '超市',
+        ];
+    }
+
+    //线上预定设置 断电
+    protected function predetermine()
+    {
+        return [
+            '1' => '可预定',
+            '2' => '不可预定',
+        ];
+    }
+
+    //存取订单状态
+    protected function access()
+    {
+        return [
+            '1' => '待确认',
+            '2' => '已完成',
+            '3' => '被驳回',
+        ];
+    }
+
+    //订单类型
+    protected function ordType()
+    {
+        return [
+            '1' => '正常',
+            '2' => '续时',
+            '3' => '换包前',
+            '30' => '换包后',
+            '31' => '换包前',
+            '32' => '换包后',
+            '4' => '退包',
+        ];
+    }
+
+    //订单状态
+    protected function ordStatText()
+    {
+        return [
+            '-1' => '已取消',
+            '0' => '<span style="color: red">待付款</span>',
+            '1' => '已付款',
+            '11' => '退款中',
+            '12' => '退款成功',
+            '2' => '进行中',
+            '3' => '已完成',
+            '4' => '电话预订',
+        ];
+    }
+
+    //套餐种类
+    protected function sort()
+    {
+        return [
+            '1' => '普通套餐',
+            '2' => '包厢套餐'
+        ];
+    }
+
+    //包厢空闲状态
+    protected function idleState()
+    {
+        return [
+            '1' => '空闲',
+            '2' => '使用中..',
+            '3' => '被预定',
+            '4' => '清理中..',
+            '5' => '维修中',
+        ];
+    }
+
+    //包厢显示类型
+    protected function  showType()
+    {
+        return [
+            '1' => '可订包厢',
+            '2' => '禁订包厢',
+            '3' => '所有包厢',
+        ];
+    }
+
+    //订单来源
+    protected function ordSource()
+    {
+        return [
+            '1' => '在线下单',
+            '2' => '客服下单',
+            '3' => '线下下单',
+        ];
+    }
+
+    //订单来源
+    protected function ordSources()
+    {
+        return [
+            '1' => '微信',
+            '2' => '微信',
+            '3' => '线下'
+        ];
+    }
+
+    //支付方式
+    protected function linePayWay()
+    {
+        return [
+            '1' => '现金',
+            '2' => '刷卡',
+            '3' => '微信',
+            '4' => '会员后台扣款',
+            '5' => '会员卡',
+            '6' => '其它',
+            '7' => '美团',
+            '8' => '积分兑换',
+            '9' => '抵用券',
+            '10' => '抹零',
+            '11' => '八折',
+            '12' => '优惠',
+            '13' => '扫码',
+            '14' => '恒程支付',
+            '15' => '接待',
+            '16' => '云POS',
+            '17' => '口碑',
+            '18' => '电子券',
+            '19' => '挂账',
+            '20' => '消费'
+        ];
+    }
+
+    //列表控制
+    protected function listHtml($ulClass, $liClass, $fzClass)
+    {
+        $str = $this->fetch('public/leftList');
+        $str = str_replace($ulClass, 'db', $str);
+        $str = str_replace($liClass, 'cor', $str);
+        $str = str_replace($fzClass, 'fz', $str);
+        return $str;
+    }
+
+    //系统消息类型
+    protected function sysMsgType()
+    {
+        return [
+            '1' => '换房申请',
+            '2' => '退款申请',
+            '3' => '订单配送'
+        ];
+    }
+
+    //获取短信验证码
+    public function sendSMS($tel)
+    {
+        if (is_numeric($tel) && strlen($tel) == 11) {
+            $random = rand(1000, 9999);
+            $num = iconv("UTF-8", "GB2312//IGNORE", "短信验证码".$random);
+            $zn = iconv("UTF-8", "GB2312//IGNORE", '盛世欢唱提醒您:');
+
+            Cookie::set('no_time', $random, 90);
+            $url = 'http://111.111.111.111:9050/cgi-bin/sendsms?username=sshc@sshc&password=******' . $tel . '&text=' . $zn . $num . '&subid=&msgtype=4';
+            $this->curl($url);
+        }
+
+        return true;
+    }
+
+    //万能curl
+    public function curl($url, $data = null)
+    {
+        $ch = curl_init();
+        curl_setopt($ch, CURLOPT_URL, $url);
+        curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
+        curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
+        if (!empty($data)) {
+            curl_setopt($ch, CURLOPT_POST, 1);
+            curl_setopt($ch, CURLOPT_POSTFIELDS, $data);
+        }
+        $out = curl_exec($ch);
+        curl_close($ch);
+        return json_decode($out, true);
+    }
+
+    //消息读取状态
+    public function msgReadState()
+    {
+        return [
+            '0' => '未读',
+            '1' => '已读',
+        ];
+    }
+
+
+//    模板列表(盛世公司模板-曦尚测试)
+    public function template_list()
+    {
+        $data = array(
+            //寄存成功通知
+            "deposit" => array(
+                "template_id" => "dG2lTfmcqxQAzM9m-FMgAoni_x9OiW6iviW-47GgEGI",
+                "data" => array(
+                    "first" => array('value' => '', 'color' => ''),    //开头语
+                    "keyword1" => array('value' => '', 'color' => ''),    //物品名称
+                    'keyword2' => array('value' => '', 'color' => ''),    //物品数量
+                    'keyword3' => array('value' => '', 'color' => ''),    //物品单位
+                    'keyword4' => array('value' => '', 'color' => ''),    //特殊说明
+                    'keyword5' => array('value' => '', 'color' => ''),    //到期时间
+                    'remark' => array('value' => '', 'color' => ''),    //结尾语
+                ),
+            ),
+            //支取成功通知
+            "draw" => array(
+                "template_id" => "Adtzv7Z7bMmo5fbruKbwH3aOLe_Rv7ltmb0tTsPF8KA",
+                "data" => array(
+                    "first" => array('value' => '', 'color' => ''),    //开头语
+                    "keyword1" => array('value' => '', 'color' => ''),    //物品名称
+                    'keyword2' => array('value' => '', 'color' => ''),    //物品数量
+                    'keyword3' => array('value' => '', 'color' => ''),    //物品单位
+                    'remark' => array('value' => '', 'color' => ''),    //结尾语
+                ),
+            ),
+            //会员卡消费通知
+            "card_consume" => array(
+                "template_id" => "H8SWgAi7X3roaLeL6DY5TuWsr-YNIYrcHdM-ZGTW4BY",
+                "data" => array(
+                    "first" => array('value' => '', 'color' => ''),    //开头语
+                    "keyword1" => array('value' => '', 'color' => ''),    //消费时间
+                    'keyword2' => array('value' => '', 'color' => ''),    //消费金额
+                    'keyword3' => array('value' => '', 'color' => ''),    //储值减扣
+                    'keyword4' => array('value' => '', 'color' => ''),    //卡上余额
+                    'remark' => array('value' => '', 'color' => ''),    //结尾语
+                ),
+            ),
+            
+            "remind" => array(
+                "template_id" => "Gtgr-UEEDRNe4hCom8YNZJkRQr47lGdMV9XCWxIwk40",
+                "data" => array(
+                    "first" => array('value' => '', 'color' => ''),    //开头语
+                    "keyword1" => array('value' => '', 'color' => ''),    //消费时间
+                    'keyword2' => array('value' => '', 'color' => ''),    //消费金额
+                    'remark' => array('value' => '', 'color' => ''),    //结尾语
+                ),
+            ),
+            //寄存到期提醒
+            "deposit_maturity" => array(
+                "template_id" => "9iMI92uq2_KKEVT092l4ZRUUg9Jd3hBeJ4BlULTjd0A",
+                "data" => array(
+                    "first" => array('value' => '', 'color' => ''),    //开头语
+                    "keyword1" => array('value' => '', 'color' => ''),    //物品名称
+                    "keyword2" => array('value' => '', 'color' => ''),    //物品数量
+                    "keyword3" => array('value' => '', 'color' => ''),     //物品单位
+                    "keyword4" => array('value' => '', 'color' => ''),     //特殊说明
+                    "keyword5" => array('value' => '', 'color' => ''),      //到期时间
+                    'remark' => array('value' => '', 'color' => ''),    //结尾语
+                ),
+            ),
+        );
+        return $data;
+    }
+
+    public function pay_type()
+    {
+//        1 2刷卡 3微信 4支付宝 5会员卡 6其它',
+        return array(
+            'xianjin' => 1, 'yinlianka' => 2, 'weixin' => 3, 'zhifubao' => 4, 'huiyuanka' => 5,
+            'meituan' => 7, 'jifenduihuan' => 8, 'diyongjuan' => 9, 'moling' => 10, 'bazhe' => 11,
+            'youhui' => 12, 'saoma' => 13, 'hengcheng' => 14, 'jiedai' => 15, 'yunPOS' => 16,
+            'koubei' => 17, 'dianzijuan' => 18, 'guazhang' => 19
+        );
+    }
+
+}

File diff suppressed because it is too large
+ 2103 - 0
Common.php


+ 160 - 0
config.php

@@ -0,0 +1,160 @@
+<?php
+
+return [
+
+    //登录有效时间24小时
+    'FAILURE_TIME' => 3600 * 24,
+
+    //模板样式前缀地址
+    'view_replace_str' => [
+        '__TMP_SOURCE__' => '/static/h-ui/'
+    ],
+
+    //网站域名
+    'APP_URL' => 'http://'.$_SERVER['HTTP_HOST'] . '/admins/',
+
+
+    //菜单一级类目
+    'MENU_LIST' => [
+        [
+            '资讯管理' => [
+                [
+                    'menu_name' => '资讯管理',
+                    'display' => true,
+                    'url' => '',
+                    'id' => 11,
+                ]
+            ],
+            'display' => true,
+            'identity' => 'menu-article',
+            'id' => 1
+        ],
+        [
+            '图片管理' => [
+                [
+                    'menu_name' => '图片管理',
+                    'display' => true,
+                    'url' => '',
+                    'id' => 21,
+                ]
+            ],
+            'display' => true,
+            'identity' => 'menu-picture',
+            'id' => 2
+        ],
+        [
+            '企业管理' => [
+                [
+                    'menu_name' => '品牌管理',
+                    'display' => true,
+                    'url' => '',
+                    'id' => 31,
+                ],
+                [
+                    'menu_name' => '分类管理',
+                    'display' => true,
+                    'url' => '',
+                    'id' => 32,
+                ],
+                [
+                    'menu_name' => '企业管理',
+                    'display' => true,
+                    'url' => '',
+                    'id' => 33,
+                ],
+            ],
+            'display' => true,
+            'identity' => 'menu-product',
+            'id' => 3
+        ],
+        [
+            '评论管理' => [
+                [
+                    'menu_name' => '评论列表',
+                    'display' => true,
+                    'url' => '',
+                    'id' => 41,
+                ],
+                [
+                    'menu_name' => '意见反馈',
+                    'display' => true,
+                    'url' => '',
+                    'id' => 42,
+                ]
+            ],
+            'display' => true,
+            'identity' => 'menu-comments',
+            'id' => 4
+        ],
+        [
+            '会员管理' => [
+                [
+                    'menu_name' => '会员列表',
+                    'display' => true,
+                    'url' => '',
+                    'id' => 51,
+                ],
+            ],
+            'display' => true,
+            'identity' => 'menu-member',
+            'id' => 5
+        ],
+        [
+            '管理员管理' => [
+                [
+                    'menu_name' => '角色管理',
+                    'display' => true,
+                    'url' => '',
+                    'id' => 51,
+                ],
+                [
+                    'menu_name' => '权限管理',
+                    'display' => true,
+                    'url' => '',
+                    'id' => 52,
+                ],
+                [
+                    'menu_name' => '管理员列表',
+                    'display' => true,
+                    'url' => '',
+                    'id' => 53,
+                ],
+            ],
+            'display' => true,
+            'identity' => 'menu-admin',
+            'id' => 6
+        ],
+        [
+            '系统统计' => [
+            ],
+            'display' => true,
+            'identity' => 'menu-tongji',
+            'id' => 7
+        ],
+        [
+            '系统管理' => [
+                [
+                    'menu_name' => '系统设置',
+                    'display' => true,
+                    'url' => '',
+                    'id' => 81,
+                ],
+                [
+                    'menu_name' => '系统日志',
+                    'display' => true,
+                    'url' => '',
+                    'id' => 82,
+                ],
+            ],
+            'display' => true,
+            'identity' => 'menu-system',
+            'id' => 8
+        ],
+    ],
+
+    //商品类型goodTypeArr
+    'GOODS_TYPE_ARR' => ['其他','套餐','水果拼盘','啤酒','洋酒','红酒','饮品','零食小吃','增值服务'],
+
+    //商品单位goodUnitArr
+    'GOODS_UNIT_ARR' => ['其他','瓶','听','袋','g','盘','包','扎','箱','个']
+];