dever 3 years ago
parent
commit
e7e05b96ee

+ 1 - 1
app/goods/database/card_code.php

@@ -75,7 +75,7 @@ return array
             'default'   => '1',
             'desc'      => '使用状态',
             'match'     => 'is_numeric',
-            'option'    => $type,
+            'option'    => $status,
             'search'    => 'select',
             'update'    => 'select',
             'list'      => true,

+ 2 - 2
app/goods/database/coupon.php

@@ -93,9 +93,9 @@ return array
             'desc'      => '分类',
             'match'     => 'is_string',
             'search'    => 'linkage',
-            'update'    => 'linkage',
+            //'update'    => 'linkage',
             'option'    => Dever::url('api.get', 'category'),
-            'list'      => 'Dever::load("category/api.string", "{category}")',
+            //'list'      => 'Dever::load("category/api.string", "{category}")',
         ),
 
         'total'      => array

+ 3 - 13
app/goods/database/info.php

@@ -354,19 +354,9 @@ $config = array
         # 列表里的按钮
         'list_button' => array
         (
-            'add' => array('属性设置', '"info_attr
-                &project=goods
-                &search_option_info_id={id}
-                &search_option_category={category}
-                &oper_parent=info&oper_project=goods
-                &oper_save_jump=info
-                &where_id={id}"', '{price_type} == 2'),
-
-            'list' => array('sku设置', '"info_sku
-                &project=goods
-                &search_option_info_id={id}
-                &oper_parent=info&oper_project=goods
-                &oper_save_jump=info&page_type=1"', '{price_type} == 2'),
+            'add' => array('属性设置', '"info_attr&project=goods&search_option_info_id={id}&search_option_category={category}&oper_parent=info&oper_project=goods&oper_save_jump=info&where_id={id}"', '{price_type} == 2'),
+
+            'list' => array('sku设置', '"info_sku&project=goods&search_option_info_id={id}&oper_parent=info&oper_project=goods&oper_save_jump=info&page_type=1"', '{price_type} == 2'),
             'br1' => array('<br />'),
             'delete' => '删除',
         ),

+ 0 - 1
app/goods/database/info_attr.php

@@ -1,7 +1,6 @@
 <?php
 list($category, $attr, $table, $create) = getInfoAttr();
 
-//print_r($attr);die;
 $config = array
 (
     # 表名

+ 1 - 1
app/goods/database/info_sku.php

@@ -156,7 +156,7 @@ $config = array
         # 自定义快捷新增和编辑
         'button' => array
         (
-            '自定义属性' => array('fast', 1, 'config&where_id=1'),
+            //'自定义属性' => array('fast', 1, 'config&where_id=1'),
         ),
     ),
 

+ 22 - 15
app/goods/lib/Info.php

@@ -242,14 +242,14 @@ class Info
     # 获取支付所需要的信息
     public function getPayInfo($id, $sku, $num = 1, $user = array())
     {
-        $info = Dever::db($this->table_info)->getOne($id);
+        $info = Dever::db($this->table_info)->find($id);
 
         if ($info) {
             $info['sku_id'] = 0;
             if ($sku > 0) {
                 $where['info_id'] = $info['id'];
                 $where['id'] = $sku;
-                $sku = Dever::db('goods/info_sku')->getOne($where);
+                $sku = Dever::db('goods/info_sku')->find($where);
                 if ($sku) {
                     $info['sku_id'] = $sku['id'];
                     $info['price'] = $sku['price'];
@@ -277,7 +277,7 @@ class Info
     # 获取自提信息
     public function storeInfo($goods_id, $area_id = '')
     {
-        $info = Dever::db($this->table_info)->getOne($goods_id);
+        $info = Dever::db($this->table_info)->find($goods_id);
         if (!$info) {
             return array();
         }
@@ -308,14 +308,14 @@ class Info
     # 获取运费信息
     public function getFreight($id, $goods_price, $user, $num)
     {
-        $info = Dever::db($this->table_info)->getOne($id);
+        $info = Dever::db($this->table_info)->find($id);
         return $this->freight($info, $goods_price, $user, $num);
     }
 
     # 获取基本信息
     public function getInfo($id, $attr = true, $order = 'view_reorder', $user = array(), $reward = false)
     {
-        $info = Dever::db($this->table_info)->getOne($id);
+        $info = Dever::db($this->table_info)->find($id);
 
         if ($info && $attr) {
             $info = $this->info($info, $order, false, $user, $reward);
@@ -380,10 +380,11 @@ class Info
                 'price' => $price,
                 's_price' => $s_price
             );
+            $info['price']['value'] = $price;
             $info['price']['max'] = array();
         }
 
-        $info['platform_name'] = Dever::db('goods/info')->config['config_platform'][$info['platform']];
+        //$info['price']['value'] = $info['price']['min']['price'];
        
         if (isset($info['cdate']) && $info['cdate']) {
             $info['cdate_string'] = Dever::mdate($info['cdate'], 2);
@@ -391,15 +392,21 @@ class Info
 
         $info = $this->getInfoLink($info);
 
-        $info['freight'] = 0;
-        if ($info['platform'] == 1 && $user) {
-            # 获取运费
-            $info['freight'] = $this->freight($info, $info['price']['min']['price'], $user);
-        }
-        # 佣金计算
-        if ($reward) {
-            $info['reward'] = $this->reward($info, $info['price']['min']['price']);
-        }
+        //$info['freight'] = 0;
+        unset($info['f_price']);
+        unset($info['cdate']);
+        unset($info['udate']);
+        unset($info['category']);
+        unset($info['top_category_id']);
+        unset($info['second_category_id']);
+        unset($info['category_id']);
+        unset($info['area']);
+        unset($info['mode']);
+        unset($info['top']);
+        unset($info['youhui']);
+        unset($info['status']);
+        unset($info['reorder']);
+        unset($info['state']);
 
         return $info;
     }

+ 14 - 6
app/goods/lib/Manage.php

@@ -204,6 +204,7 @@ class Manage
         $key = Dever::input('key');
         $price = Dever::input('price');
         $s_price = Dever::input('s_price');
+        $f_price = Dever::input('f_price');
         $num = Dever::input('num');
 
         if ($key) {
@@ -215,6 +216,7 @@ class Manage
                     $data['key'] = $v;
                     $data['price'] = $price[$k];
                     $data['s_price'] = $s_price[$k];
+                    $data['f_price'] = $f_price[$k];
                     $data['num'] = $num[$k];
                     if (!$info) {
                         Dever::db('goods/info_sku')->insert($data);
@@ -251,9 +253,10 @@ class Manage
                 }
             }
 
-            $head .= '<th>原价</th>';
-            $head .= '<th>现价</th>';
-            $head .= '<th>库存</th>';
+            $head .= '<th>销售价</th>';
+            $head .= '<th>市场价</th>';
+            $head .= '<th>进货价</th>';
+            //$head .= '<th>库存</th>';
             $head .= '</tr></thead>';
 
             if ($option) {
@@ -274,15 +277,20 @@ class Manage
                         $key[] = $v['info_id'][$k1] . '-' . $v['id'][$k1];
                     }
                     $key = implode('_', $key);
-                    $s_price = $price = $num = '';
+                    $f_price = $s_price = $price = $num = '';
                     if (isset($sku[$key])) {
+                        $f_price = $sku[$key]['f_price'];
                         $s_price = $sku[$key]['s_price'];
                         $price = $sku[$key]['price'];
                         $num = $sku[$key]['num'];
                     }
-                    $body .= '<td width="30"><input type="text" class="layui-input" name="s_price['.$k.']" value="'.$s_price.'"/></td>';
+                    
                     $body .= '<td width="30"><input type="text" class="layui-input" name="price['.$k.']"  value="'.$price.'"/></td>';
-                    $body .= '<td width="30"><input type="text" class="layui-input" name="num['.$k.']"  value="'.$num.'"/><input type="hidden" name="key['.$k.']" value="'.$key.'"/><textarea style="display:none;" name="attr['.$k.']"/>'.json_encode($id).'</textarea></td>';
+                    $body .= '<td width="30"><input type="text" class="layui-input" name="s_price['.$k.']" value="'.$s_price.'"/></td>';
+                    $body .= '<td width="30"><input type="text" class="layui-input" name="f_price['.$k.']"  value="'.$f_price.'"/></td>';
+                    //$body .= '<td width="30"><input type="text" class="layui-input" name="num['.$k.']"  value="'.$num.'"/></td>';
+
+                    $body .= '<input type="hidden" name="key['.$k.']" value="'.$key.'"/><textarea style="display:none;" name="attr['.$k.']"/>'.json_encode($id).'</textarea>';
                     $body .= '</tr>';
                 }
             }

+ 2 - 1
app/shop/database/apply.php

@@ -14,6 +14,7 @@ return array
     'lang' => '申请合作记录',
     # 后台菜单排序
     'order' => 200,
+    'menu' => false,
     # 数据结构
     'struct' => array
     (
@@ -118,7 +119,7 @@ return array
 
     'manage' => array
     (
-        
+        'insert' => false,
     ),
 
     'request' => array

+ 1 - 10
app/shop/database/buy_order.php

@@ -43,7 +43,7 @@ return array
             'default'   => '',
             'desc'      => '所属门店',
             'match'     => 'is_numeric',
-            'list'      => 'Dever::load("shop/info-find#name", {shop_id})';
+            'list'      => 'Dever::load("shop/info-find#name", {shop_id})',
         ),
 
         'mobile'        => array
@@ -235,15 +235,6 @@ return array
         ),
     ),
 
-    'top' => Dever::config('base')->top,
-
-    # 增加这个,为了给当前的list增加一个option
-    'top_option' => array
-    (
-        'value' => $auth,
-        'col' => 'cate_id',
-    ),
-
     'manage' => array
     (
         'delete' => false,

+ 2 - 2
app/shop/database/buy_order_goods.php

@@ -55,7 +55,7 @@ return array
             'default'   => '',
             'desc'      => '所属门店',
             'match'     => 'is_numeric',
-            'list'      => 'Dever::load("shop/info-find#name", {shop_id})';
+            'list'      => 'Dever::load("shop/info-find#name", {shop_id})',
         ),
 
         'order_id'      => array
@@ -74,7 +74,7 @@ return array
             'default'   => '',
             'desc'      => '商品名称',
             'match'     => 'is_numeric',
-            'list'      => 'Dever::load("goods/info-find#name", {goods_id})';
+            'list'      => 'Dever::load("goods/info-find#name", {goods_id})',
         ),
 
         'price'      => array

+ 2 - 2
app/shop/database/cart.php

@@ -54,7 +54,7 @@ return array
             'default'   => '',
             'desc'      => '所属门店',
             'match'     => 'is_numeric',
-            'list'      => 'Dever::load("shop/info-find#name", {shop_id})';
+            'list'      => 'Dever::load("shop/info-find#name", {shop_id})',
         ),
 
         'goods_id'      => array
@@ -64,7 +64,7 @@ return array
             'default'   => '',
             'desc'      => '商品名称',
             'match'     => 'is_numeric',
-            'list'      => 'Dever::load("goods/info-find#name", {goods_id})';
+            'list'      => 'Dever::load("goods/info-find#name", {goods_id})',
         ),
 
         'sku_id'      => array

+ 2 - 2
app/shop/database/coupon.php

@@ -44,7 +44,7 @@ return array
             'match'     => 'is_numeric',
             'update'    => 'hidden',
             'value'     => Dever::input('search_option_shop_id'),
-            'list'      => 'Dever::load("shop/info-find#name", {shop_id})';
+            'list'      => 'Dever::load("shop/info-find#name", {shop_id})',
         ),
 
         'coupon_id'      => array
@@ -56,7 +56,7 @@ return array
             'match'     => 'is_numeric',
             'update'    => 'select',
             'option'    => $coupon,
-            'list'      => 'Dever::load("goods/coupon-find#name", {coupon_id})';
+            'list'      => 'Dever::load("goods/coupon-find#name", {coupon_id})',
         ),
 
         'city'      => array

+ 1 - 1
app/shop/database/feedback.php

@@ -56,7 +56,7 @@ return array
             'default'   => '',
             'desc'      => '所属门店',
             'match'     => 'is_numeric',
-            'list'      => 'Dever::load("shop/info-find#name", {shop_id})';
+            'list'      => 'Dever::load("shop/info-find#name", {shop_id})',
         ),
 
 		'mobile'        => array

+ 3 - 0
app/shop/database/focus.php

@@ -80,7 +80,10 @@ return array
             'desc'      => '请选择显示位置',
             'match'     => 'is_numeric',
             'update'    => 'select',
+            'search'    => 'select',
             'option'    => $location,
+            'list'      => true,
+            'edit'      => true,
         ),
 
         'pic'       => array

+ 13 - 7
app/shop/database/goods.php

@@ -31,7 +31,9 @@ return array
             'default'   => '',
             'desc'      => '所属门店',
             'match'     => 'is_numeric',
-            'list'      => 'Dever::load("shop/info-find#name", {shop_id})';
+            'update'    => 'hidden',
+            'value'     => Dever::input('search_option_shop_id'),
+            'list'      => 'Dever::load("shop/info-find#name", {shop_id})',
         ),
 
         'goods_id'      => array
@@ -41,18 +43,22 @@ return array
             'default'   => '',
             'desc'      => '商品名称',
             'match'     => 'is_numeric',
-            'list'      => 'Dever::load("goods/info-find#name", {goods_id})';
+            'update'    => 'select',
+            'update_search' => 'goods/lib/manage.search',
+            'list'      => 'Dever::load("goods/info-find#name", {goods_id})',
         ),
 
         'num'        => array
         (
             'type'      => 'int-11',
-            'name'      => '库存数量',
-            'default'   => '',
-            'desc'      => '库存数量',
+            'name'      => '库存',
+            'default'   => '0',
+            'desc'      => '库存',
             'match'     => 'is_numeric',
+            'update'    => 'text',
             'search'    => 'select',
-            'list'        => true,
+            'list_name' => '当前库存',
+            'list'        => '{num}-{sell_num}',
         ),
 
         'sell_num'      => array
@@ -150,7 +156,7 @@ return array
             ),
             'type' => 'all',
             'order' => array('t_2.reorder' => 'desc', 't_2.id' => 'desc'),
-            'col' => 't_2.*,t_1.num-t_1.sell_num as num,t_1.sell_num',
+            'col' => '*,t_2.*,t_1.num-t_1.sell_num as num,t_1.sell_num',
         ),
     ),
 );

+ 2 - 2
app/shop/database/goods_sku.php

@@ -29,7 +29,7 @@ $config = array
             'default'   => '',
             'desc'      => '所属门店',
             'match'     => 'is_numeric',
-            'list'      => 'Dever::load("shop/info-find#name", {shop_id})';
+            'list'      => 'Dever::load("shop/info-find#name", {shop_id})',
         ),
 
         'goods_id'      => array
@@ -39,7 +39,7 @@ $config = array
             'default'   => '',
             'desc'      => '商品名称',
             'match'     => 'is_numeric',
-            'list'      => 'Dever::load("goods/info-find#name", {goods_id})';
+            'list'      => 'Dever::load("goods/info-find#name", {goods_id})',
         ),
 
         'sku_id'      => array

+ 7 - 5
app/shop/database/info.php

@@ -4,6 +4,7 @@ $status = array
 (
     1 => '合作中',
     2 => '已终止合作',
+    3 => '申请合作中',
 );
 
 $yes = array
@@ -105,7 +106,7 @@ return array
 
         'mobile'      => array
         (
-            'type'      => 'int-11',
+            'type'      => 'bigint-11',
             'name'      => '联系人电话',
             'default'   => '',
             'desc'      => '请输入联系人电话',
@@ -271,7 +272,7 @@ return array
             'name'      => '公司名称',
             'default'   => '',
             'desc'      => '公司名称',
-            'match'     => 'is_string',
+            'match'     => 'option',
             'update'    => 'text',
         ),
 
@@ -339,7 +340,7 @@ return array
             'match'     => 'is_numeric',
             'update'    => 'radio',
             'option'    => $yes,
-            'search'    => 'select',
+            //'search'    => 'select',
         ),
 
         'coupon_share'        => array
@@ -351,7 +352,7 @@ return array
             'match'     => 'is_numeric',
             'update'    => 'radio',
             'option'    => $yes,
-            'search'    => 'select',
+            //'search'    => 'select',
         ),
 
         'coupon_tg'        => array
@@ -363,7 +364,7 @@ return array
             'match'     => 'is_numeric',
             'update'    => 'radio',
             'option'    => $yes,
-            'search'    => 'select',
+            //'search'    => 'select',
         ),
 
         'status'        => array
@@ -405,6 +406,7 @@ return array
     (
         'list_button' => array
         (
+            'list22' => array('商品管理', '"goods&search_option_shop_id={id}&oper_table=info"'),
             'list' => array('优惠券管理', '"coupon&search_option_shop_id={id}&oper_table=info"'),
             'list1' => array('账号管理', '"member&search_option_shop_id={id}&oper_table=info"'),
             'list2' => array('打印机管理', '"print&search_option_shop_id={id}&oper_table=info"'),

+ 1 - 1
app/shop/database/member.php

@@ -57,7 +57,7 @@ return array
             'default'   => '',
             'desc'      => '所属门店',
             'match'     => 'is_numeric',
-            'list'      => 'Dever::load("shop/info-find#name", {shop_id})';
+            'list'      => 'Dever::load("shop/info-find#name", {shop_id})',
         ),
 
         'role_id'      => array

+ 10 - 0
app/shop/database/print.php

@@ -30,6 +30,16 @@ return array
             'list'      => true,
             'order'     => 'desc',
         ),
+
+        'shop_id'      => array
+        (
+            'type'      => 'int-11',
+            'name'      => '所属门店',
+            'default'   => '',
+            'desc'      => '所属门店',
+            'match'     => 'is_numeric',
+            'list'      => 'Dever::load("shop/info-find#name", {shop_id})',
+        ),
         
         'name'      => array
         (

+ 2 - 11
app/shop/database/sell_order.php

@@ -50,7 +50,7 @@ return array
     'status' => $status,
     'ps_status' => $ps_status,
     'code_status' => $code_status,
-    'pay_method' = $pay_method,
+    'pay_method' => $pay_method,
     'method' => $method,
     'menu' => false,
     # 数据结构
@@ -75,7 +75,7 @@ return array
             'default'   => '',
             'desc'      => '所属门店',
             'match'     => 'is_numeric',
-            'list'      => 'Dever::load("shop/info-find#name", {shop_id})';
+            'list'      => 'Dever::load("shop/info-find#name", {shop_id})',
         ),
 
         'uid'       => array
@@ -405,15 +405,6 @@ return array
         ),
     ),
 
-    'top' => Dever::config('base')->top,
-
-    # 增加这个,为了给当前的list增加一个option
-    'top_option' => array
-    (
-        'value' => $auth,
-        'col' => 'cate_id',
-    ),
-
     'manage' => array
     (
         'delete' => false,

+ 2 - 2
app/shop/database/sell_order_goods.php

@@ -55,7 +55,7 @@ return array
             'default'   => '',
             'desc'      => '所属门店',
             'match'     => 'is_numeric',
-            'list'      => 'Dever::load("shop/info-find#name", {shop_id})';
+            'list'      => 'Dever::load("shop/info-find#name", {shop_id})',
         ),
 
         'order_id'      => array
@@ -74,7 +74,7 @@ return array
             'default'   => '',
             'desc'      => '商品名称',
             'match'     => 'is_numeric',
-            'list'      => 'Dever::load("goods/info-find#name", {goods_id})';
+            'list'      => 'Dever::load("goods/info-find#name", {goods_id})',
         ),
 
         'sku_id'      => array

+ 2 - 2
app/shop/database/user_coupon.php

@@ -52,7 +52,7 @@ return array
             'default'   => '',
             'desc'      => '所属门店',
             'match'     => 'is_numeric',
-            'list'      => 'Dever::load("shop/info-find#name", {shop_id})';
+            'list'      => 'Dever::load("shop/info-find#name", {shop_id})',
         ),
 
         'coupon_id'      => array
@@ -62,7 +62,7 @@ return array
             'default'   => '',
             'desc'      => '优惠券id',
             'match'     => 'is_numeric',
-            'list'      => 'Dever::load("goods/coupon-find#name", {coupon_id})';
+            'list'      => 'Dever::load("goods/coupon-find#name", {coupon_id})',
         ),
 
         'shop_coupon_id'      => array

+ 8 - 1
app/shop/lib/Manage.php

@@ -16,11 +16,18 @@ class Manage
         $update = array();
         $area = Dever::param('area', $data);
         if ($area) {
-            $temp = explode(',', $area);
+            $temp = is_string($area) ? explode(',', $area) : $area;
             $update['province'] = $temp[0];
             $update['city'] = $temp[1];
         }
 
+        $map = Dever::param('map', $data);
+        if ($map) {
+            $temp = is_string($map) ? explode(',', $map) : $map;
+            $update['lng'] = $temp[1];
+            $update['lat'] = $temp[2];
+        }
+
         if (isset($update) && $update) {
             $update['where_id'] = $id;
             Dever::db('shop/info')->update($update);

+ 22 - 7
app/shop/src/Buy.php

@@ -28,21 +28,36 @@ class Buy extends Core
         }
     }
 
+    # 获取商品详细信息
+    public function getGoodsInfo()
+    {
+        $id = Dever::input('goods_id');
+        if (!$id) {
+            Dever::alert('错误的商品');
+        }
+
+        $this->data['goods'] = Dever::load('goods/lib/info')->getInfo($id);
+
+        //$this->data['shop'] = $this->shop;
+
+        return $this->data;
+    }
+
     # 获取购物车的数据
     public function getCart()
     {
         $where['uid'] = $this->uid;
         $where['shop_id'] = $this->shop_id;
 
-        $data = Dever::db('shop/cart')->select($where);
+        $this->data['card'] = Dever::db('shop/cart')->select($where);
 
-        if ($data) {
-            foreach ($data as $k => $v) {
-                $data[$k]['goods'] = Dever::load('goods/lib/info')->getPayInfo($v['goods_id'], $v['sku_id']);
+        if ($this->data['card']) {
+            foreach ($this->data['card'] as $k => $v) {
+                $this->data['card'][$k]['goods'] = Dever::load('goods/lib/info')->getPayInfo($v['goods_id'], $v['sku_id']);
             }
         }
 
-        return $data;
+        return $this->data['card'];
     }
 
     # 加入到购物车
@@ -117,7 +132,7 @@ class Buy extends Core
                     }
                     $coupon_info = Dever::db('goods/coupon')->find($v['coupon_id']);
                     if ($coupon_info && ($coupon_info['method'] == $method || $coupon_info['method'] == 3)) {
-                        $kou = false
+                        $kou = false;
                         if ($coupon_info['type'] == 1) {
                             # 满减券
                             if ($price >= $coupon_info['total']) {
@@ -168,7 +183,7 @@ class Buy extends Core
             if ($goods_coupon['type'] == 2 && $this->data['price'] < $goods_coupon['total']) {
                 Dever::alert('优惠券不可用');
             }
-            if ($goods_coupon['method'] != $method || $goods_coupon['method'] != 3)) {
+            if ($goods_coupon['method'] != $method || $goods_coupon['method'] != 3) {
                 Dever::alert('优惠券不可用');
             }
 

+ 39 - 22
app/shop/src/Main.php

@@ -39,6 +39,7 @@ class Main extends Core
     public function user()
     {
         $this->data['user'] = $this->user;
+        $this->data['config'] = Dever::db('main/config')->find();
         return $this->data;
     }
 
@@ -47,26 +48,55 @@ class Main extends Core
     {
         $data['name'] = Dever::input('name');
         $data['mobile'] = Dever::input('mobile');
-        $data['city'] = Dever::input('area');
-
+        $data['city'] = Dever::input('city');
         $data['uid'] = $this->uid;
 
-        $where['city'] = $data['city'];
-        $where['mobile'] = $data['mobile'];
-        $info = Dever::db('shop/apply')->find($where);
+        if (!$data['name']) {
+            Dever::alert('请输入姓名');
+        }
+        if (!$data['mobile']) {
+            Dever::alert('请输入手机号');
+        }
+        if (!$data['city']) {
+            Dever::alert('请选择城市');
+        }
+
+        $info = Dever::db('shop/info')->find($data);
 
         if (!$info) {
-            Dever::db('shop/apply')->insert($data);
+            $data['truename'] = $data['name'];
+            # 根据城市查找省份
+            $city = Dever::db('area/city')->find($data['city']);
+            $data['province'] = $city['province_id'];
+            $data['area'] = $data['province'] . ',' . $data['city'];
+
+            # 获取经纬度
+            $url = 'https://restapi.amap.com/v3/geocode/geo';
+            $param['key'] = 'f18cb42560b8aa54e3b53a6265bfd764';
+            $param['city'] = $data['city'];
+            $param['address'] = $city['name'];
+            $result = json_decode(Dever::curl($url, $param), true);
+
+            if (isset($result['geocodes'][0]['location']) && $result['geocodes'][0]['location']) {
+                $data['map'] = $city['name'] . ',' . $result['geocodes'][0]['location'] . ',11';
+                $temp = explode(',', $result['geocodes'][0]['location']);
+                $data['lng'] = $temp[0];
+                $data['lat'] = $temp[1];
+            }
+
+            $data['status'] = 3;
+            Dever::db('shop/info')->insert($data);
         }
 
-        return '提交成功,我们会在3个工作日内与您联系,感谢您的信任。';
+        $this->data['msg'] = '提交成功,我们会在3个工作日内与您联系,感谢您的信任。';
+        return $this->data;
     }
 
     # 根据坐标,获取距离用户最近的店
     public function getShop()
     {
         $config = Dever::db('main/config')->find(1);
-        $km = $config['km'];
+        $km = $config['km'] ? $config['km'] : 5;
 
         $lng = Dever::input('lng');
         $lat = Dever::input('lat');
@@ -76,7 +106,7 @@ class Main extends Core
         }
         $page['template'] = 'list';
         $page['num'] = 10;
-        $sql = 'select *, (st_distance(point(lng, lat),point('.$lng.', '.$lat.'))*111195) as distance from {table} where status = 1 and state = 1 order by distance asc';
+        $sql = 'select *, round((st_distance(point(lng, lat), point('.$lng.', '.$lat.'))*111195)/1000, 2) as distance from {table} where status = 1 and state = 1 order by distance asc';
         $data = Dever::db('shop/info')->fetchAll($sql, array(), $page);
 
         $result = array();
@@ -133,17 +163,4 @@ class Main extends Core
 
         return $data;
     }
-
-    # 获取商品详细信息
-    public function getGoodsInfo()
-    {
-        $id = Dever::input('goods_id');
-        if (!$id) {
-            Dever::alert('错误的商品');
-        }
-
-        $data = Dever::load('goods/lib/info')->getInfo($id);
-
-        return $data;
-    }
 }

+ 2 - 2
config/env/localhost/default.php

@@ -10,9 +10,9 @@ if (is_file($dc_file)) {
 $config['base'] = array
 (
     # api文档生成是否开启,开启后,将会根据访问来生成文档。生产环境建议禁止
-    'apiDoc' => false,
+    'apiDoc' => true,
     # api日志是否开启,开启后,将会记录所有带有_api后缀方法的请求参数和响应参数
-    'apiLog' => false,
+    'apiLog' => true,
 
     # 定义自动转为api的目录,可以将该目录下的所有类的公共方法,都转为可以访问的api,开启该功能可能有安全性问题。
     'apiOpenPath' => 'src',

+ 15 - 6
main/database/config.php

@@ -77,7 +77,7 @@ return array
             'name'      => '推荐门店公里数-单位是公里,如5公里,填写5即可',
             'default'   => '5',
             'desc'      => '推荐门店公里数',
-            'match'     => 'is_string',
+            'match'     => 'option',
             'update'    => 'text',
         ),
 
@@ -87,7 +87,7 @@ return array
             'name'      => '视频宣传片-视频格式mp4,上传大小不能超过4G',
             'default'   => '',
             'desc'      => '视频宣传片',
-            'match'     => 'is_string',
+            'match'     => 'option',
             'update'    => 'video',
             'key'       => '3',
             'place'     => '150',
@@ -131,7 +131,7 @@ return array
             'name'      => 'SEO标题',
             'default'   => '',
             'desc'      => '请输入SEO标题',
-            'match'     => 'is_string',
+            'match'     => 'option',
             'update'    => 'text',
         ),
         
@@ -168,7 +168,7 @@ return array
             'name'      => '客服电话',
             'default'   => '',
             'desc'      => '请输入客服电话',
-            'match'     => 'is_string',
+            'match'     => 'option',
             'update'    => 'text',
         ),
 
@@ -178,7 +178,7 @@ return array
             'name'      => '工作时间',
             'default'   => '',
             'desc'      => '请输入工作时间',
-            'match'     => 'is_string',
+            'match'     => 'option',
             'update'    => 'text',
         ),
 
@@ -212,11 +212,20 @@ return array
             'name'      => '底部信息',
             'default'   => '',
             'desc'      => '底部信息',
-            'match'     => 'is_string',
+            'match'     => 'option',
             'update'    => 'editor',
             'key'       => '1',
         ),
 		
+        'state'     => array
+        (
+            'type'      => 'tinyint-1',
+            'name'      => '状态',
+            'default'   => '1',
+            'desc'      => '请选择状态',
+            'match'     => 'is_numeric',
+        ),
+
 		'cdate'		=> array
 		(
 			'type' 		=> 'int-11',

+ 1 - 1
main/database/help.php

@@ -6,7 +6,7 @@ $type = array
     2 => '门店管理',
     3 => '工厂管理',
     4 => '仓库管理',
-),
+);
 
 $config = array
 (

+ 21 - 1
main/database/page.php

@@ -1,5 +1,12 @@
 <?php
 
+$type = array
+(
+    1 => '门店销售',
+    2 => '门店管理',
+    3 => '工厂管理',
+    4 => '仓库管理',
+);
 
 $config = array
 (
@@ -9,7 +16,7 @@ $config = array
     'lang' => '单页管理',
     # 后台菜单排序
     'order' => 2,
-    'check' => 'key',
+    'check' => 'key,type',
     # 数据结构
     'struct' => array
     (
@@ -37,6 +44,19 @@ $config = array
             'list'      => true,
         ),
 
+        'type'        => array
+        (
+            'type'      => 'int-11',
+            'name'      => '类型',
+            'default'   => '1',
+            'desc'      => '类型',
+            'match'     => 'is_numeric',
+            'update'    => 'radio',
+            'option'    => $type,
+            'search'    => 'select',
+            'list'      => true,
+        ),
+
         'key'      => array
         (
             'type'      => 'varchar-80',

+ 2 - 1
main/lib/Core.php

@@ -13,8 +13,9 @@ class Core
     public function __construct()
     {
         $this->uid = Dever::load('passport/user')->check(false);
+        $this->uid = 1;
         if ($this->uid) {
-            $this->user = Dever::load('passport/user')->info($this->uid);
+            $this->user = Dever::load('passport/api')->info($this->uid);
         } else {
             $this->user = Dever::load('passport/user')->init();
             $this->uid = $this->user['id'];