Esempio n. 1
0
 public function mod()
 {
     $configKey = 'settingConfig';
     // $cachePath = Doo::conf()->CACHE_PATH;
     // Doo::conf()->CACHE_PATH = Doo::conf()->SITE_PATH.'protect/confCache/';
     array_push($this->_includeJsFileList, 'js/ueditor/ueditor.config.js');
     array_push($this->_includeJsFileList, 'js/ueditor/ueditor.all.min.js');
     array_push($this->_includeJsFileList, 'js/ueditor/lang/zh-cn/zh-cn.js');
     array_push($this->_includeJsFileList, 'js/ueditor/ueditor.use.js');
     $shopNameList = DBproxy::getProcedure('Manage')->setDimension(2)->getShopName();
     $shopNameOpt = '<select class="m-wrap" name="shopname" id="city-element">';
     foreach ($shopNameList as $key => $value) {
         $selected = $this->getUrlVar('shopname') == $value['cityid'] . ',' . $value['shopname'] ? 'selected=selected' : '';
         $shopNameOpt .= '<option ' . $selected . ' value="' . $value['cityid'] . ',' . $value['shopname'] . '">' . $value['cityNshopname'] . '</option>';
     }
     $shopNameOpt .= '</select>';
     if ($this->isAjax() && $_POST) {
         $v = Doo::loadHelper('DooValidator', true);
         $success = true;
         $errors = array();
         DOO::cache('php')->set($configKey, json_encode($_POST), 3600 * 24 * 365 * 100);
         // 处理返回路径
         if ($success) {
             $errors = ConfigController::$dataTableUrl;
         }
         $this->ajaxFormResult($success, $errors);
     } else {
         $infoCache = DOO::cache('php')->get($configKey);
         $info = json_decode($infoCache, true);
         // echo Doo::conf()->CACHE_PATH = $cachePath;
         Doo::loadClassAt('html/DooFormExt', 'default');
         $form = new DooFormExt(array('method' => 'post', 'renderFormat' => 'html', 'action' => '', 'attributes' => array('id' => 'js-form', 'class' => 'form-horizontal'), 'elements' => array('errors' => array('display', array('div' => false, 'label' => false, 'content' => '<div id="js-form-errors" class=""></div><div style="clear:both"></div>')), 'peiSwitch' => array('select', array('label' => L('菜品调剂发送开关:'), 'attributes' => array('class' => "m-wrap"), 'multioptions' => array(0 => '关', 1 => '开'), 'value' => isset($info['peiSwitch']) ? $info['peiSwitch'] : '0')), 'waimaiSum' => array('text', array('label' => '外卖起送份数', 'attributes' => array('class' => "m-wrap"), 'value' => isset($info['waimaiSum']) ? $info['waimaiSum'] : '1')), 'aboutTxt' => array('display', array('label' => '关于我们', 'attributes' => array('class' => "m-wrap"), 'content' => '<script id="about" type="text/plain" style="width:1024px;height:500px;">' . $info['editorValue'] . '</script>')), 'saveAndSee' => array('button', array('div' => false, 'left' => ' ', 'label' => '保存&查看<i class="icon-arrow-right"></i>', 'attributes' => array('class' => "btn blue"), 'value' => 1)), 'cancelAndReturn' => array('display', array('div' => false, 'left' => ' ', 'right' => '</div>', 'content' => '<a class="btn" href="' . ConfigController::$dataTableUrl . '"><i class="icon-arrow-left"></i>取消&返回</a>')))));
         $this->contentlayoutRender($form->render());
     }
 }
Esempio n. 2
0
 public function dataTable()
 {
     Doo::loadClassAt('html/DataTable', 'default');
     Doo::loadClassAt('html/DooFormExt', 'default');
     $dt = new DataTable();
     $param['starttime'] = $this->getUrlVar('starttime', NULL);
     $param['endtime'] = $this->getUrlVar('endtime', NULL);
     //$param['bookid'] = $this->getUrlVar('bookid',NULL);
     $param['order'] = $this->getUrlVar('order', NULL);
     $param['bookname'] = $this->getUrlVar('bookname', NULL);
     //$param['booktypeid'] = $this->getUrlVar('booktypeid',0);
     $param['waimai'] = $this->getUrlVar('waimai', '2');
     $param['shopname'] = $this->getUrlVar('shopname', '');
     $export = $this->getUrlVar('export');
     // 表头
     $header = array('bookid' => array('name' => '菜品ID'), 'title' => array('name' => '菜品名称'), 'sum' => array('name' => '销量'), 'price' => array('name' => '微信单价'), 'totle' => array('name' => '总价'));
     //所有店列表
     $shopNameList = DBproxy::getProcedure('Manage')->setDimension(2)->getShopName();
     $shopNameOpt = '<select class="m-wrap" name="shopname" id="city-element"><option>全部门店</option>';
     foreach ($shopNameList as $key => $value) {
         $selected = $this->getUrlVar('shopname') == $value['cityid'] . ',' . $value['shopname'] ? 'selected=selected' : '';
         $shopNameOpt .= '<option ' . $selected . ' value="' . $value['cityid'] . ',' . $value['shopname'] . '">' . $value['cityNshopname'] . '</option>';
     }
     $shopNameOpt .= '</select>';
     $res = DBproxy::getProcedure('Manage')->setDimension(2)->queryOrderHit($param);
     $sum = 0;
     foreach ($res['data'] as $key => $value) {
         $sum += $value['sum'];
         $res['data'][$key]['totle'] = $value['sum'] * $value['price'];
     }
     // 生产表格
     $content = $dt->setTitle('')->setAttr(array('class' => 'table table-hover  ', 'id' => 'js-queryTable '))->setHeader($header)->setData($res['data'])->setTopContent('')->setBottomContent('')->setDefaultValue('unkown')->render(false);
     //查询表单
     $form = new DooFormExt(array('method' => 'get', 'renderFormat' => 'html', 'action' => '', 'attributes' => array('id' => 'js-get-form', 'class' => 'form-horizontal'), 'elements' => array('starttime' => array('text', array('left' => ' ', 'hide-label' => true, 'div' => false, 'placeholder' => '开始日期', 'attributes' => array('class' => "m-wrap", "onClick" => "WdatePicker()"), 'value' => $this->getUrlVar('starttime'))), 'endtime' => array('text', array('left' => ' ', 'hide-label' => true, 'div' => false, 'placeholder' => '结束日期', 'attributes' => array('class' => "m-wrap", "onClick" => "WdatePicker({maxDate:'%y-%M-%d'})"), 'value' => $this->getUrlVar('endtime'))), 'shopname' => array('display', array('left' => '', 'hide-label' => true, 'div' => false, 'attributes' => array('class' => 'small m-wrap'), 'content' => $shopNameOpt)), 'bookname' => array('text', array('left' => ' ', 'hide-label' => true, 'div' => false, 'placeholder' => '菜品名称', 'attributes' => array('class' => "m-wrap"), 'value' => $this->getUrlVar('bookname'))), 'waimai' => array('select', array('left' => ' 是否外卖', 'hide-label' => true, 'div' => false, 'attributes' => array('class' => 'small m-wrap'), 'multioptions' => array('2' => '全部', '1' => '是', '0' => '否'), 'value' => $this->getUrlVar('waimai'))), 'order' => array('select', array('left' => ' 点击量排序', 'hide-label' => true, 'div' => false, 'attributes' => array('class' => 'small m-wrap'), 'multioptions' => array('desc' => '多', 'asc' => '少'), 'value' => $this->getUrlVar('order'))), 'search' => array('button', array('div' => false, 'label' => '<i class="icon-search"></i>查询', 'attributes' => array('class' => "btn blue"), 'value' => 1)), 'export' => array('button', array('div' => false, 'label' => ' <i class="icon-export"></i> 导出', 'attributes' => array('class' => "btn black"), 'value' => 1)))));
     $sumDiv = '销售总数量:' . $sum;
     $content .= $sumDiv;
     //export
     if (trim($export) == 1) {
         exportExcel($content);
         exit;
     }
     // 显示模版
     $this->contentlayoutRender($form->render() . $content);
 }
Esempio n. 3
0
 public static function cateToOption($id = 0, $child = true, $type = 'html', $data = array())
 {
     //所有分类转成按父类排序的数组
     if (empty($data)) {
         $category = DBproxy::getProcedure('Manage')->setDimension(2)->getCategory();
     } else {
         $category = $data;
     }
     self::cateToArr($category['data'], 0, 0, $type);
     //输出的数据类型
     $option = $type == 'html' ? '' : array();
     foreach (self::$cateVal as $key => $value) {
         $selected = '';
         $attr = '';
         //有子类的时候不可以选上
         if ($value['child'] == '1' && $child) {
             $attr = 'disabled="disabled"';
         } else {
             $attr = ' style="color:#000"';
         }
         if ($key == $id) {
             $selected = 'selected="selected"';
         }
         //输出的数据类型
         if ($type == 'array') {
             $option[$key] = array('id' => $key, 'name' => $value['name'], 'parentid' => $value['parentid']);
             //找子类
             self::findArrChild($category['data'], $key);
             Category::$arrchildids[] = $key;
             $option[$key]['arrchildid'] = implode(',', Category::$arrchildids);
             Category::$arrchildids = array();
             //找父类
             self::findArrParent($category['data'], $value['parentid']);
             $option[$key]['arrparentid'] = implode(',', Category::$arrparentids);
             Category::$arrparentids = array();
             //child
             $option[$key]['child'] = count($option[$key]['arrchildid']) == 1 && $option[$key]['arrchildid'] == $key ? 0 : 1;
         } else {
             $option .= '<option value="' . $key . '" ' . $attr . $selected . ' >' . $value['name'] . '</option>';
         }
     }
     return $option;
 }
Esempio n. 4
0
 public function del()
 {
     $success = true;
     $errors = '删除成功';
     $id = (int) $this->getUrlVar('id', 0);
     // 删除数据
     $return = DBproxy::getProcedure('Manage')->setDimension(2)->bookDel($id);
     if ($return['status'] != 0) {
         $errors = '操作失败';
     }
     $this->alert($errors, $success ? 'success' : 'error');
 }
Esempio n. 5
0
 public function checkBook($id)
 {
     $params['id'] = intval($id);
     $book = DBproxy::getProcedure('Manage')->setDimension(2)->getBook($params);
     if (isset($book['data']) && !empty($book['data']) && $book['total'] > 0 && isset($book['data'][0]['endSaleTime']) && time() < strtotime($book['data'][0]['endSaleTime'])) {
         return true;
     } else {
         return false;
     }
 }
Esempio n. 6
0
    private function orderPrintPaySUCCESS($orderid = 0)
    {
        // $params['orderid'] = '12413237022015092911210327222';
        $params['orderid'] = $orderid;
        $params['pagesize'] = $this->getCurPage() . ',' . Doo::conf()->pagesize;
        //验证此订单是本人的,店长打印则跳开
        if ($this->shopMaster() == false) {
            $params['uid'] = $_SESSION['uid'];
        }
        if (!isset($params['orderid']) || trim($params['orderid']) == '') {
            $this->alert('data null2');
            exit;
        }
        $order = DBproxy::getProcedure('Manage')->setDimension(2)->getOrder($params);
        if ($order['total'] < '1') {
            $this->alert('data null2');
            exit;
        }
        //打印处理
        if ($order['data'][$params['orderid']]['0']['printStatus'] > 0 && $this->shopMaster() == false) {
            $this->alert('已经打印过了');
            exit;
        }
        //订单的状态是否能打印,在微信接口验证
        $orderStatus = $this->queryOrder($params['orderid'], $order['data'][$params['orderid']][0]['status']);
        if ($orderStatus != 'SUCCESS') {
            $this->alert('未支付成功,order status err ');
            exit;
        }
        //D($order['data'][$params['orderid']]);
        foreach ($order['data'][$params['orderid']] as $key => $value) {
            $title[] = $value['title'] . '   ' . $value['wxprice'] . '   (' . $value['sum'] . ')';
        }
        $msgNo = time() + rand(1, 9999);
        /*
         自由格式的打印内容
        */
        if ($order['data'][$params['orderid']]['0']['waimai'] == '1') {
            $waimai = '外卖单 ';
            $sb = '  ******';
            $addr = "\r\n" . '送货地址:' . $order['data'][$params['orderid']]['0']['addr'] . "\r\n";
        } else {
            $waimai = '堂食单';
            $addr = '';
            $sb = '';
        }
        $freeMessage = array('memberCode' => MEMBER_CODE, 'msgDetail' => '
微微乐餐饮欢迎您订购
' . $waimai . ': 序号:' . $order['data'][$params['orderid']]['0']['oid'] . $sb . '

条目   单价(元)   数量
-----------------
' . implode("\r\n", $title) . '

-----------------
合计:' . $order['data'][$params['orderid']]['0']['allPrice'] . '元 

店名:' . $order['data'][$params['orderid']]['0']['shopname'] . $addr . '
联系电话:' . $order['data'][$params['orderid']]['0']['phone'] . '
订购时间:' . date('Y-m-d H:i:s', $order['data'][$params['orderid']]['0']['addtime']) . '
', 'deviceNo' => DEVICE_NO, 'msgNo' => $msgNo);
        $order = DBproxy::getProcedure('Manage')->setDimension(2)->upOrderPrint($order['data'][$params['orderid']]['0']['oid']);
        $printStatus = $this->sendFreeMessage($freeMessage);
        Doo::logger()->info('time:' . date("Y-m-d H:i:s", time()) . "\tip:" . getIP() . "\tprintStatus:" . $printStatus, 'print');
        if ($printStatus == 0) {
            echo '打印请求/任务中队列中,等待打印';
            $order = DBproxy::getProcedure('Manage')->setDimension(2)->upOrderPrint($order['data'][$params['orderid']]['0']['oid']);
        } elseif ($printStatus == 1) {
            echo '打印任务已完成/请求数据已打印';
            $order = DBproxy::getProcedure('Manage')->setDimension(2)->upOrderPrint($order['data'][$params['orderid']]['0']['oid']);
        } elseif ($printStatus == 2) {
            echo '打印任务/请求失败';
        } else {
            echo $printStatus;
        }
        return $msgNo;
    }
Esempio n. 7
0
File: User.php Progetto: aising/ding
 /**
  * 取用户所属角色
  * @param int $uid
  * @return array
  */
 public function get_user_roles($uid)
 {
     $param = array('uid' => $uid);
     // $result = $this->db->execute('sp_sys_user_role_s', $param);
     $result = DBproxy::getProcedure('Manage')->setDimension(2)->spSysUserRoleS($param);
     $roleids = array();
     if (!empty($result)) {
         foreach ($result as $v) {
             $roleids[] = $v['role_id'];
         }
     }
     return $roleids;
 }
Esempio n. 8
0
 public function callBack()
 {
     $file = '/ding/protected/module/default/cache/callback-' . date("Y-m--d") . '.php';
     $xml = $GLOBALS['HTTP_RAW_POST_DATA'];
     $result = WxPayResults::Init($xml);
     file_put_contents($file, var_export($result, true), FILE_APPEND);
     if ($result['result_code'] == 'SUCCESS') {
         $callBackOrderid = $result['out_trade_no'];
         $orderStatus = $result['result_code'];
         $order = DBproxy::getProcedure('Manage')->setDimension(2)->orderUp($orderStatus, 0, $callBackOrderid);
         if ($order['status'] == 0) {
             echo 'SUCCESS';
         }
     }
 }
Esempio n. 9
0
File: Role.php Progetto: aising/ding
 /**
  * 取角色权限
  * @param int $roleid
  * @return array
  */
 public function get_role_perm($roleid)
 {
     $result = DBproxy::getProcedure('manage')->spSysRolePermS($roleid);
     //db权限和菜单拆分
     $permids = explode('),', $result[0]['perm_id']);
     foreach ($permids as $key => $value) {
         $perms_menu_peridArr = explode(',', $value);
         $perms_menu_perid[] = array('menu_id' => $perms_menu_peridArr[1], 'perm_id' => $perms_menu_peridArr[2]);
     }
     $perms = array();
     if (!empty($perms_menu_perid)) {
         foreach ($perms_menu_perid as $k => $v) {
             $perms[$v['menu_id']] = $v['perm_id'];
         }
     }
     return $perms;
 }