dever 3 years ago
parent
commit
1cc2a93c80

+ 216 - 34
service/agent/database/member.php

@@ -1,24 +1,49 @@
 <?php
 
-$type = array
+$role = function()
+{
+	$array = array();
+	$data = Dever::load('setting/role-state');
+	if($data)
+	{
+		$array += $data;
+	}
+	return $array;
+};
+
+$status = array
 (
-	1 => '用户',
-    2 => '代理商',
-    3 => '创客',
-    4 => '消客',
+    1 => '申请中',
+    2 => '正常',
+    3 => '驳回',
+    4 => '已删除',
+    5 => '已禁用',
 );
 
-$role = array
+$type = array
 (
-    1 => '用户',
-    2 => '街道',
-    3 => '区县',
-    4 => '城市',
-    5 => '创服',
-    6 => '创客',
-    7 => '消客',
+    1 => '个人',
+    2 => '公司',
 );
 
+$level = function()
+{
+	$array = array
+	(
+		-1 => array
+		(
+			'id' => -1,
+			'name' => '普通',
+		),
+	);
+	$data = Dever::load('setting/level-state');
+	if($data)
+	{
+		$array += $data;
+	}
+	return $array;
+};
+
 return array
 (
     # 表名
@@ -41,30 +66,42 @@ return array
             'list'        => true,
         ),
 
-        'role'      => array
-        (
-            'type'      => 'varchar-500',
-            'name'      => '角色',
-            'default'   => '',
-            'desc'      => '角色',
-            'match'     => 'is_numeric',
-            'update'    => 'checkbox',
-            'option'    => $role,
-            'list'      => true,
-        ),
-
         'name'      => array
         (
-            'type'      => 'varchar-32',
-            'name'      => '名',
+            'type'      => 'varchar-100',
+            'name'      => '姓名',
             'default'   => '',
-            'desc'      => '名',
+            'desc'      => '姓名',
             'match'     => 'is_string',
             'update'    => 'text',
             'search'    => 'fulltext',
             'list'      => true,
         ),
 
+        'rdate'     => array
+        (
+            'type'      => 'int-11',
+            'name'      => '认证时间',
+            'match'     => 'option',
+            'default'   => '0',
+            'desc'      => '',
+            'update'    => 'date',
+            'callback'  => 'maketime',
+            'list'        => '{rdate} > 0 ? date("Y-m-d H:i", {rdate}) : "无"',
+        ),
+
+        'avatar'		=> array
+		(
+			'type' 		=> 'varchar-150',
+			'name' 		=> '头像',
+			'default' 	=> '',
+			'desc' 		=> '请选择头像',
+			'match' 	=> 'option',
+			'update'	=> 'image',
+			'key' 		=> '1',
+			'place'		=> '150',
+		),
+
         'mobile'      => array
         (
             'type'      => 'bigint-11',
@@ -77,16 +114,159 @@ return array
             'list'      => true,
         ),
 
-        'avatar'        => array
+        'password'		=> array
+		(
+			'type' 		=> 'varchar-50',
+			'name' 		=> '密码',
+			'default' 	=> '',
+			'desc' 		=> '请输入密码',
+			'match' 	=> 'option',
+			'update'	=> 'password',
+			'callback'	=> 'sha1',
+		),
+
+        'mid'      => array
+        (
+            'type'      => 'int-11',
+            'name'      => '邀请人',
+            'default'   => '',
+            'desc'      => '邀请人',
+            'match'     => 'is_string',
+            'update'    => 'text',
+            'search'    => array
+            (
+                'api' => 'agent/member-select',
+                'col' => 'name',
+                'result' => 'id',
+            ),
+            'list'      => 'Dever::load("agent/member-find#name", {mid})',
+        ),
+
+        'code'        => array
+        (
+            'type'      => 'varchar-50',
+            'name'      => '邀请码',
+            'default'   => '',
+            'desc'      => '邀请码',
+            'match'     => 'option',
+            //'update'    => 'text',
+            'list'      => true,
+        ),
+
+        'role'      => array
+        (
+            'type'      => 'varchar-500',
+            'name'      => '代理角色',
+            'default'   => '',
+            'desc'      => '代理角色',
+            'match'     => 'is_string',
+            'update'    => 'checkbox',
+            'option'    => $role,
+            'list'      => true,
+        ),
+
+        'level_id'		=> array
+		(
+			'type' 		=> 'int-11',
+			'name' 		=> '代理商等级',
+			'default' 	=> '-1',
+			'desc' 		=> '代理商等级',
+			'match' 	=> 'is_numeric',
+			'search'	=> 'select',
+			'update'	=> 'select',
+			'option'	=> $level,
+			'list'		=> true,
+		),
+
+		'area'       => array
+        (
+            'type'      => 'varchar-500',
+            'name'      => '区域',
+            'default'   => '',
+            'desc'      => '区域',
+            'match'     => 'option',
+            'search'    => 'linkage',
+            'update'    => 'linkage',
+            'option'    => Dever::url('api.get?level_total=4', 'area'),
+            'list'      => 'Dever::load("area/api.string", "{area}")',
+        ),
+
+        'shop_id'      => array
+        (
+            'type'      => 'int-11',
+            'name'      => '所属门店',
+            'default'   => '',
+            'desc'      => '所属门店',
+            'match'     => 'is_numeric',
+            'update'    => 'text',
+            'list'      => 'Dever::load("shop/info-one#name", {shop_id})',
+        ),
+
+        'type'        => array
+        (
+            'type'      => 'tinyint-1',
+            'name'      => '类型',
+            'default'   => '1',
+            'desc'      => '类型',
+            'match'     => 'is_numeric',
+            'option'    => $type,
+        ),
+
+        'sign'     => array
+        (
+            'type'      => 'varchar-150',
+            'name'      => '手写签名',
+            'default'   => '',
+            'desc'      => '手写签名',
+            'match'     => 'option',
+            'update'    => 'image',
+            'key'       => '7',
+        ),
+
+        'idcard'      => array
+        (
+            'type'      => 'varchar-32',
+            'name'      => '身份证号码',
+            'default'   => '',
+            'desc'      => '身份证号码',
+            'match'     => 'is_string',
+            'update'    => 'text',
+        ),
+
+        'idcard_front'     => array
+        (
+            'type'      => 'varchar-150',
+            'name'      => '身份证正面',
+            'default'   => '',
+            'desc'      => '身份证正面',
+            'match'     => 'option',
+            'update'    => 'image',
+            'key'       => '8',
+            'place'     => '660*660',
+        ),
+
+        'idcard_back'     => array
         (
             'type'      => 'varchar-150',
-            'name'      => '头像',
+            'name'      => '身份证背面',
             'default'   => '',
-            'desc'      => '请选择头像',
+            'desc'      => '身份证背面',
             'match'     => 'option',
             'update'    => 'image',
-            'key'       => '1',
-            'place'     => '150',
+            'key'       => '8',
+            'place'     => '660*660',
+        ),
+
+        'status'        => array
+        (
+            'type'      => 'tinyint-1',
+            'name'      => '状态',
+            'default'   => '1',
+            'desc'      => '状态',
+            'match'     => 'is_numeric',
+            'option'    => $status,
+            'search'    => 'select',
+            'list'      => true,
         ),
 
         'state'     => array
@@ -113,7 +293,9 @@ return array
 
     'manage' => array
     (
-        
+        'insert' => false,
+        'delete' => false,
+        'edit' => false,
     ),
 
     'request' => array

+ 352 - 0
service/agent/database/order.php

@@ -0,0 +1,352 @@
+<?php
+
+$role = function()
+{
+	$array = array();
+	$data = Dever::load('setting/role-state');
+	if($data)
+	{
+		$array += $data;
+	}
+	return $array;
+};
+
+$status = array
+(
+    1 => '待业务初审',
+    2 => '待财务终审',
+    3 => '待权益发放',
+    4 => '已完成',
+);
+
+$goods_status = array
+(
+    1 => '未发放',
+    2 => '无权益',
+    3 => '已发放',
+);
+
+$type = array
+(
+    1 => '个人',
+    2 => '公司',
+);
+
+$pay_type = array
+(
+	1 => '在线支付',
+    2 => '汇款',
+    3 => '个人转账',
+);
+
+$level = function()
+{
+	$array = array
+	(
+		-1 => array
+		(
+			'id' => -1,
+			'name' => '普通',
+		),
+	);
+	$data = Dever::load('setting/level-state');
+	if($data)
+	{
+		$array += $data;
+	}
+	return $array;
+};
+
+return array
+(
+    # 表名
+    'name' => 'order',
+    # 显示给用户看的名称
+    'lang' => '代理商订单',
+    'set' => array
+    (
+    	'status' => $status,
+    	'goods_status' => $goods_status,
+    	'type' => $type,
+    	'pay_type' => $pay_type,
+    ),
+    'order' => 99,
+    # 数据结构
+    'struct' => array
+    (
+    
+        'id'        => array
+        (
+            'type'      => 'int-11',
+            'name'      => 'ID',
+            'default'   => '',
+            'desc'      => '',
+            'match'     => 'is_numeric',
+            'search'    => 'order',
+            'list'        => true,
+        ),
+
+        'mid'      => array
+        (
+            'type'      => 'int-11',
+            'name'      => '代理商',
+            'default'   => '-1',
+            'desc'      => '代理商',
+            'match'     => 'is_string',
+            'update'    => 'text',
+            'searchs'    => array
+            (
+                'api' => 'agent/member-select',
+                'col' => 'name',
+                'result' => 'id',
+            ),
+            //'list'      => 'Dever::load("agent/member-find#name", {mid})',
+        ),
+
+        'order_num'      => array
+        (
+            'type'      => 'varchar-100',
+            'name'      => '订单号',
+            'default'   => '',
+            'desc'      => '订单号',
+            'match'     => 'is_string',
+            'update'    => 'text',
+            'search'    => 'fulltext',
+            'list'      => true,
+        ),
+
+        'mobile'      => array
+        (
+            'type'      => 'bigint-11',
+            'name'      => '手机号',
+            'default'   => '',
+            'desc'      => '请输入手机号',
+            'match'     => Dever::rule('mobile'),
+            'update'    => 'text',
+            'search'    => 'fulltext',
+            'list'      => true,
+        ),
+
+        'parent_mid'      => array
+        (
+            'type'      => 'int-11',
+            'name'      => '邀请人',
+            'default'   => '',
+            'desc'      => '邀请人',
+            'match'     => 'is_string',
+            'update'    => 'text',
+            'search'    => array
+            (
+                'api' => 'agent/member-select',
+                'col' => 'name',
+                'result' => 'id',
+            ),
+            'list'      => 'Dever::load("agent/member-find#name", {mid})',
+        ),
+
+        'name'      => array
+        (
+            'type'      => 'varchar-100',
+            'name'      => '姓名',
+            'default'   => '',
+            'desc'      => '姓名',
+            'match'     => 'is_string',
+            'update'    => 'text',
+            'search'    => 'fulltext',
+            'list'      => true,
+        ),
+
+        'role'      => array
+        (
+            'type'      => 'int-11',
+            'name'      => '代理角色',
+            'default'   => '',
+            'desc'      => '代理角色',
+            'match'     => 'is_numeric',
+            'search'	=> 'select',
+            'update'    => 'checkbox',
+            'option'    => $role,
+            'list'      => true,
+        ),
+
+        'area'       => array
+        (
+            'type'      => 'varchar-500',
+            'name'      => '区域',
+            'default'   => '',
+            'desc'      => '区域',
+            'match'     => 'option',
+            'search'    => 'linkage',
+            'update'    => 'linkage',
+            'option'    => Dever::url('api.get?level_total=4', 'area'),
+            //'list'      => 'Dever::load("area/api.string", "{area}")',
+        ),
+
+        'price'      => array
+        (
+            'type'      => 'varchar-50',
+            'name'      => '金额',
+            'default'   => '0',
+            'desc'      => '金额',
+            'match'     => 'option',
+            'update'    => 'text',
+            'list'		=> true,
+        ),
+
+        'pay_type'		=> array
+		(
+			'type' 		=> 'tinyint-1',
+			'name' 		=> '支付方式',
+			'default' 	=> '1',
+			'desc' 		=> '支付方式',
+			'match' 	=> 'is_numeric',
+			'search'	=> 'select',
+			'update'	=> 'select',
+			'option'	=> $pay_type,
+			'list'		=> true,
+		),
+
+		'pay_pic'		=> array
+		(
+			'type' 		=> 'varchar-150',
+			'name' 		=> '打款凭证',
+			'default' 	=> '',
+			'desc' 		=> '打款凭证',
+			'match' 	=> 'option',
+			'update'	=> 'image',
+			'key' 		=> '1',
+			'place'		=> '150',
+		),
+
+		'bank_id'		=> array
+		(
+			'type' 		=> 'int-11',
+			'name' 		=> '所属银行',
+			'default' 	=> '',
+			'desc' 		=> '所属银行',
+			'match' 	=> 'is_numeric',
+		),
+
+		'bank_card'		=> array
+		(
+			'type' 		=> 'int-11',
+			'name' 		=> '银行卡号',
+			'default' 	=> '',
+			'desc' 		=> '银行卡号',
+			'match' 	=> 'is_numeric',
+		),
+
+        'type'        => array
+        (
+            'type'      => 'tinyint-1',
+            'name'      => '类型',
+            'default'   => '1',
+            'desc'      => '类型',
+            'match'     => 'is_numeric',
+            'option'    => $type,
+        ),
+
+        'sign'     => array
+        (
+            'type'      => 'varchar-150',
+            'name'      => '手写签名',
+            'default'   => '',
+            'desc'      => '手写签名',
+            'match'     => 'option',
+            'update'    => 'image',
+            'key'       => '7',
+        ),
+
+        'idcard'      => array
+        (
+            'type'      => 'varchar-100',
+            'name'      => '身份证号码/营业执照号码',
+            'default'   => '',
+            'desc'      => '身份证号码',
+            'match'     => 'is_string',
+            'update'    => 'text',
+            'search'	=> 'fulltext',
+        ),
+
+        'idcard_front'     => array
+        (
+            'type'      => 'varchar-150',
+            'name'      => '身份证正面',
+            'default'   => '',
+            'desc'      => '身份证正面',
+            'match'     => 'option',
+            'update'    => 'image',
+            'key'       => '8',
+            'place'     => '660*660',
+        ),
+
+        'idcard_back'     => array
+        (
+            'type'      => 'varchar-150',
+            'name'      => '身份证背面',
+            'default'   => '',
+            'desc'      => '身份证背面',
+            'match'     => 'option',
+            'update'    => 'image',
+            'key'       => '8',
+            'place'     => '660*660',
+        ),
+
+        'status'        => array
+        (
+            'type'      => 'tinyint-1',
+            'name'      => '订单状态',
+            'default'   => '1',
+            'desc'      => '状态',
+            'match'     => 'is_numeric',
+            'option'    => $status,
+            'search'    => 'select',
+            'list'      => true,
+        ),
+
+        'goods_status'        => array
+        (
+            'type'      => 'tinyint-1',
+            'name'      => '权益状态',
+            'default'   => '1',
+            'desc'      => '权益状态',
+            'match'     => 'is_numeric',
+            'option'    => $goods_status,
+            'search'    => 'select',
+            'list'      => true,
+        ),
+
+        'state'     => array
+        (
+            'type'      => 'tinyint-1',
+            'name'      => '状态',
+            'default'   => '1',
+            'desc'      => '请选择状态',
+            'match'     => 'is_numeric',
+        ),
+        
+        'cdate'     => array
+        (
+            'type'      => 'int-11',
+            'name'      => '申请时间',
+            'match'     => array('is_numeric', time()),
+            'desc'      => '',
+            # 只有insert时才生效
+            //'insert'    => true,
+            'search'    => 'date',
+            'list'      => 'date("Y-m-d H:i:s", {cdate})',
+        ),
+    ),
+
+    'manage' => array
+    (
+        'insert' => false,
+        'delete' => false,
+        'edit' => false,
+    ),
+
+    'request' => array
+    (
+        
+    ),
+);

+ 208 - 0
service/agent/src/Auth.php

@@ -0,0 +1,208 @@
+<?php
+
+namespace Agent\Src;
+
+use Dever;
+
+class Auth
+{
+	/**
+     * 登录
+     *
+     * @return mixed
+     */
+    public function login()
+    {
+        $where['mobile'] = $this->checkMobile();
+        $this->checkMcode($where['mobile']);
+        $user = Dever::db('agent/member')->find($where);
+
+        if (!$user) {
+            Dever::alert('登录失败,手机号错误,请重新输入');
+        }
+
+        if ($user) {
+        	$data = Dever::load('passport/reg')->getSign($user['id']);
+            return $data;
+        } else {
+            Dever::alert('登录失败');
+        }
+    }
+
+    /**
+     * 注册
+     *
+     * @return mixed
+     */
+    public function reg()
+    {
+        $where['mobile'] = $this->checkMobile();
+        $user = Dever::db('agent/member')->find($where);
+
+        if ($user) {
+            Dever::alert('注册失败,手机号已存在');
+        }
+
+        $this->checkMcode($where['mobile']);
+
+        $user = $this->checkCode();
+
+        $data['mobile'] = $where['mobile'];
+        $data['parent_mid'] = $user['id'];
+        $data['type'] = Dever::input('type', 1);
+        $data['name'] = Dever::input('name');
+        $data['idcard'] = Dever::input('idcard');
+        $data['idcard_front'] = Dever::input('idcard_front');
+        $data['idcard_back'] = Dever::input('idcard_back');
+        if ($data['type'] == 1) {
+        	$name = '姓名';
+        	$idcard_name = '身份证号';
+
+        	if (!$data['idcard_front']) {
+	            Dever::alert('身份证正面不能为空');
+	        }
+	        if (!$data['idcard_back']) {
+	            Dever::alert('身份证反面不能为空');
+	        }
+
+        } else {
+        	$name = '公司名称';
+        	$idcard_name = '营业执照号码';
+
+        	if (!$data['idcard_front']) {
+	            Dever::alert('营业执照不能为空');
+	        }
+        }
+        if (!$data['name']) {
+            Dever::alert($name . '不能为空');
+        }
+        if (!$data['idcard']) {
+            Dever::alert($idcard_name . '不能为空');
+        }
+
+        $data['role'] = Dever::input('role');
+        if (!$data['role']) {
+            Dever::alert('代理类型不能为空');
+        }
+        $role = Dever::db('setting/role')->find($data['role']);
+        if (!$role) {
+        	Dever::alert('代理类型不正确');
+        }
+        $data['area'] = Dever::input('area');
+        if (!$data['area']) {
+            Dever::alert('代理区域不能为空');
+        }
+
+        # 计算支付金额
+        if ($role['type'] == 1) {
+        	$data['price'] = $role['price'];
+        } elseif ($role['type'] == 2) {
+        	$data['price'] = Dever::load('area/api')->getPrice($data['area'], $role['area']);
+        	if ($data['price'] <= 0) {
+        		Dever::alert('代理区域的代理价格为空,请联系客服');
+        	}
+        } else {
+        	Dever::alert('代理类型不正确');
+        }
+
+        $data['sign'] = Dever::input('sign');
+        if (!$data['sign']) {
+            Dever::alert('手写签名不能为空');
+        }
+
+        # 付款信息
+        $data['pay_type'] = Dever::input('pay_type', 1);
+
+        if ($data['pay_type'] == 3) {
+        	$data['bank_id'] = Dever::input('bank_id');
+        	if (!$data['bank_id']) {
+        		Dever::alert('请选择银行');
+        	}
+        	$data['bank_card'] = Dever::input('bank_card');
+        	if (!$data['bank_card']) {
+        		Dever::alert('请输入银行卡号');
+        	}
+        } elseif ($data['pay_type'] == 2) {
+        	# 汇款
+        	$data['pay_pic'] = Dever::input('pay_pic');
+        	if (!$data['pay_pic']) {
+        		Dever::alert('请上传打款凭证');
+        	}
+        } elseif ($data['pay_type'] == 1) {
+        	# 在线支付
+        } else {
+        	Dever::alert('付款方式不正确');
+        }
+
+        if ($user) {
+        	$data = Dever::load('passport/reg')->getSign($user['id']);
+            return $data;
+        } else {
+            Dever::alert('登录失败');
+        }
+    }
+
+    /**
+     * 检测邀请码
+     *
+     * @return mixed
+     */
+    public function checkCode()
+    {
+        $code = Dever::input('code');
+        if (!$code) {
+        	Dever::alert('请输入邀请码');
+        }
+        $uid = Dever::load('invite/api')->getUid($code);
+        if (!$uid) {
+        	Dever::alert('邀请码错误');
+        }
+
+        $user = Dever::db('agent/member')->find($where);
+        if (!$user) {
+        	Dever::alert('邀请码错误');
+        }
+
+        if ($user['status'] == 2) {
+        	return $user;
+        }
+
+        Dever::alert('邀请人状态不正常');
+    }
+
+	/**
+     * 验证手机号
+     * @return mixed
+     */
+    private function checkMobile()
+    {
+        $rule = Dever::rule('mobile');
+
+        $mobile = Dever::input('mobile');
+
+        if (!$mobile) {
+            Dever::alert('手机号不能为空');
+        }
+        if (!preg_match($rule, $mobile)) {
+            Dever::alert('手机号码格式错误');
+        }
+
+        return $mobile;
+    }
+
+    /**
+     * 验证验证码
+     * @return mixed
+     */
+    private function checkMcode($mobile)
+    {
+        $code = Dever::input('mcode');
+        if (!$code) {
+            Dever::alert('请输入验证码');
+        }
+        $code = Dever::load('passport/reg')->mcode($mobile, $code);
+        if (!$code) {
+            Dever::alert('验证码输入错误');
+        }
+    }
+}

+ 43 - 0
service/agent/src/Core.php

@@ -0,0 +1,43 @@
+<?php
+
+namespace Agent\Lib;
+
+use Dever;
+
+class Core
+{
+    protected $uid = -1;
+    protected $use = array();
+    public $data = array();
+
+    public function __construct()
+    {
+        $this->uid = Dever::load('passport/user')->check(false);
+        if ($this->uid <= 0) {
+            $this->uid = 1;
+        }
+        if ($this->uid) {
+            $this->user = Dever::db('agent/member')->find($this->uid);
+        }
+
+        if ($this->user) {
+            $this->user['uid'] = $this->user['id'];
+        }
+    }
+
+    public function checkLogin()
+    {
+        if (!$this->uid || $this->uid <= 0) {
+            Dever::alert('请先登录', -2);
+        }
+    }
+
+    public function alert($state)
+    {
+        if ($state) {
+            return array('msg' => 'ok');
+        } else {
+            Dever::alert('操作失败');
+        }
+    }
+}

+ 0 - 194
service/setting/database/area.php

@@ -1,194 +0,0 @@
-<?php
-$type = array
-(
-    1 => '普通代理',
-    2 => '区域门店代理',
-    3 => '特殊代理',
-);
-
-$area = array
-(
-	1 => '城市',
-	2 => '区县',
-	3 => '街道',
-);
-
-$opset = array
-(
-	1 => '是',
-	2 => '否',
-);
-
-return array
-(
-    # 表名
-    'name' => 'role',
-    # 显示给用户看的名称
-    'lang' => '代理商角色',
-    # 后台菜单排序
-    'order' => 2,
-    # 数据结构
-    'struct' => array
-    (
-        'id'        => array
-        (
-            'type'      => 'int-11',
-            'name'      => 'ID',
-            'default'   => '',
-            'desc'      => '',
-            'match'     => 'is_numeric',
-            'search'    => 'order',
-            'list'      => true,
-            'order'     => 'desc',
-        ),
-        
-        'name'      => array
-        (
-            'type'      => 'varchar-200',
-            'name'      => '名称',
-            'default'   => '',
-            'desc'      => '名称',
-            'match'     => 'is_string',
-            'update'    => 'text',
-            'search'    => 'fulltext',
-            'list'      => true,
-        ),
-
-        'short_name'      => array
-        (
-            'type'      => 'varchar-100',
-            'name'      => '简称',
-            'default'   => '',
-            'desc'      => '简称',
-            'match'     => 'is_string',
-            'update'    => 'text',
-            'search'    => 'fulltext',
-            'list'      => true,
-        ),
-
-        'desc'      => array
-        (
-            'type'      => 'varchar-500',
-            'name'      => '描述',
-            'default'   => '',
-            'desc'      => '描述',
-            'match'     => 'is_string',
-            'update'    => 'textarea',
-            //'search'    => 'fulltext',
-            //'list'      => true,
-        ),
-
-        'type'        => array
-        (
-            'type'      => 'tinyint-1',
-            'name'      => '代理类型',
-            'default'   => '1',
-            'desc'      => '代理类型',
-            'match'     => 'is_numeric',
-            //'update'  	=> 'radio',
-            'option'    => $type,
-            'search'    => 'select',
-            'list'      => true,
-            'control'	=> 'type',
-        ),
-
-        'area'        => array
-        (
-            'type'      => 'tinyint-1',
-            'name'      => '区域',
-            'default'   => '-1',
-            'desc'      => '区域',
-            'match'     => 'is_numeric',
-            //'update'  	=> 'radio',
-            'option'    => $area,
-            'show'		=> 'type=2',
-        ),
-
-        'profit'      => array
-        (
-            'type'      => 'varchar-15',
-            'name'      => '收益-区域内门店利润百分比,这里直接输入数字即可,如输入10,就是10%',
-            'default'   => '0',
-            'desc'      => '收益',
-            'match'     => 'is_string',
-            'update'    => Dever::input('area') > 0 ? 'text' : false,
-            'show'		=> 'type=2',
-        ),
-
-        'opset'        => array
-        (
-            'type'      => 'tinyint-1',
-            'name'      => '用户可升级-是否允许用户升级该角色',
-            'default'   => '1',
-            'desc'      => '用户可升级',
-            'match'     => 'is_numeric',
-            //'update'  	=> 'radio',
-            'option'    => $opset,
-        ),
-
-        'state'     => array
-        (
-            'type'      => 'tinyint-1',
-            'name'      => '状态',
-            'default'   => '1',
-            'desc'      => '请选择状态',
-            'match'     => 'is_numeric',
-        ),
-        
-        'cdate'     => array
-        (
-            'type'      => 'int-11',
-            'name'      => '创建时间',
-            'match'     => array('is_numeric', time()),
-            'desc'      => '',
-            # 只有insert时才生效
-            'insert'    => true,
-            'list'      => 'date("Y-m-d H:i:s", {cdate})',
-        ),
-    ),
-
-    'default' => array
-	(
-		'col' => 'id,name,short_name,`desc`,type,area,opset,state,cdate',
-		'value' => array
-		(
-			'1,"普通用户", "用户", "注册但未注册成功代理商角色的用户", 1, -1, 2, 1,' . DEVER_TIME,
-			'2,"街道代理商", "街道", "一个街道区域的代理商。获得区域内门店利润5%收益。", 2, 1, 1, 1,' . DEVER_TIME,
-			'3,"区县代理商", "区县", "一线城市的区,与二三线城市的县级代理商。获得区域内门店利润3%收益。", 2, 2, 1, 1,' . DEVER_TIME,
-			'4,"城市代理商", "城市", "一个城市代理商,有一二三线城市的区分。获得区域内门店利润1%收益。", 2, 3, 1, 1,' . DEVER_TIME,
-			'5,"创服代理商", "创服", "在开创本系统时的一个代理商角色,以后此角色不新增,要保留,因为其中还有一些权益未兑换。", 3, -1, 2, 1,' . DEVER_TIME,
-			'6,"创客会员", "创客", "有分销能力的会员,但不产生代理商收益。", 1, -1, 1, 1,' . DEVER_TIME,
-			'7,"消客会员", "消客", "能带动产品销售量的会员。", 1, -1, 1, 1,' . DEVER_TIME,
-		),
-	),
-
-    'manage' => array
-    (
-    	'insert' => false,
-        'delete' => false,
-        'edit' => false,
-        'list_button' => array
-        (
-        	'fast' => array('编辑', '"role&where_id={id}&oper_save_jump=role&oper_table=role&oper_parent=role&area={area}"'),
-
-        	'list1' => array('奖励', '"role_reward&search_option_role_id={id}&oper_table=role"'),
-
-        	//'list2' => array('权益', '"role_goods&search_option_role_id={id}&oper_table=role"'),
-        )
-    ),
-
-    'request' => array
-    (
-        'getAll' => array
-        (
-            # 匹配的正则或函数 选填项
-            'option' => array
-            (
-                'type' => array('yes', 'in'),
-                //'state' => 1,
-            ),
-            'type' => 'all',
-            'col' => '*|id',
-        ),
-    ),
-);

+ 100 - 0
service/setting/database/bank.php

@@ -0,0 +1,100 @@
+<?php
+
+return array
+(
+    # 表名
+    'name' => 'bank',
+    # 显示给用户看的名称
+    'lang' => '银行列表',
+    # 后台菜单排序
+    'order' => 4,
+    # 数据结构
+    'struct' => array
+    (
+        'id'        => array
+        (
+            'type'      => 'int-11',
+            'name'      => 'ID',
+            'default'   => '',
+            'desc'      => '',
+            'match'     => 'is_numeric',
+            'search'    => 'order',
+            //'list'      => true,
+            'order'     => 'desc',
+        ),
+        
+        'name'      => array
+        (
+            'type'      => 'varchar-200',
+            'name'      => '银行名称',
+            'default'   => '',
+            'desc'      => '银行名称',
+            'match'     => 'is_string',
+            'update'    => 'text',
+            'search'    => 'fulltext',
+            'list'      => true,
+        ),
+
+        'logo'     => array
+        (
+            'type'      => 'varchar-150',
+            'name'      => '银行logo',
+            'default'   => '',
+            'desc'      => '银行logo',
+            'match'     => 'option',
+            'update'    => 'image',
+            'key'       => '1',
+            'place'     => '300*300',
+        ),
+
+        'reorder'       => array
+        (
+            'type'      => 'int-11',
+            'name'      => '排序-数值越大越靠前',
+            'default'   => '1',
+            'desc'      => '请输入排序',
+            'match'     => 'option',
+            //'update'  => 'text',
+            'search'    => 'order',
+            'list'      => true,
+            'order'     => 'desc',
+            'edit'      => true,
+        ),
+
+        'state'     => array
+        (
+            'type'      => 'tinyint-1',
+            'name'      => '状态',
+            'default'   => '1',
+            'desc'      => '请选择状态',
+            'match'     => 'is_numeric',
+        ),
+        
+        'cdate'     => array
+        (
+            'type'      => 'int-11',
+            'name'      => '创建时间',
+            'match'     => array('is_numeric', time()),
+            'desc'      => '',
+            # 只有insert时才生效
+            'insert'    => true,
+            'list'      => 'date("Y-m-d H:i:s", {cdate})',
+        ),
+    ),
+
+    'manage' => array
+    (
+    	//'insert' => false,
+        //'delete' => false,
+        'edit' => false,
+        'list_button' => array
+        (
+        	'fast' => array('编辑', '"bank&where_id={id}&oper_save_jump=bank&oper_table=bank&oper_parent=bank"'),
+        )
+    ),
+
+    'request' => array
+    (
+        
+    ),
+);

+ 135 - 0
service/setting/database/level.php

@@ -0,0 +1,135 @@
+<?php
+
+return array
+(
+    # 表名
+    'name' => 'level',
+    # 显示给用户看的名称
+    'lang' => '代理商等级',
+    # 后台菜单排序
+    'order' => 3,
+    # 数据结构
+    'struct' => array
+    (
+        'id'        => array
+        (
+            'type'      => 'int-11',
+            'name'      => 'ID',
+            'default'   => '',
+            'desc'      => '',
+            'match'     => 'is_numeric',
+            'search'    => 'order',
+            //'list'      => true,
+            'order'     => 'desc',
+        ),
+        
+        'name'      => array
+        (
+            'type'      => 'varchar-200',
+            'name'      => '名称',
+            'default'   => '',
+            'desc'      => '名称',
+            'match'     => 'is_string',
+            'update'    => 'text',
+            'search'    => 'fulltext',
+            'list'      => true,
+        ),
+
+        'level'      => array
+        (
+            'type'      => 'int-11',
+            'name'      => '等级数字',
+            'default'   => '1',
+            'desc'      => '等级数字',
+            'match'     => 'is_numeric',
+            'update'    => 'text',
+            //'list'      => true,
+            'order'     => 'asc',
+        ),
+
+        'target'      => array
+        (
+            'type'      => 'varchar-15',
+            'name'      => '目标额-成为该等级的目标额,以万为单位',
+            'default'   => '0',
+            'desc'      => '目标额',
+            'match'     => 'is_string',
+            'update'    => 'text',
+            'list'      => true,
+        ),
+
+        'value'      => array
+        (
+            'type'      => 'varchar-15',
+            'name'      => '奖励额-这里以百分比为单位,如输入10,就是10%',
+            'default'   => '0',
+            'desc'      => '奖励额',
+            'match'     => 'is_string',
+            'update'    => 'text',
+            'list'      => true,
+        ),
+
+        'state'     => array
+        (
+            'type'      => 'tinyint-1',
+            'name'      => '状态',
+            'default'   => '1',
+            'desc'      => '请选择状态',
+            'match'     => 'is_numeric',
+        ),
+        
+        'cdate'     => array
+        (
+            'type'      => 'int-11',
+            'name'      => '创建时间',
+            'match'     => array('is_numeric', time()),
+            'desc'      => '',
+            # 只有insert时才生效
+            'insert'    => true,
+            'list'      => 'date("Y-m-d H:i:s", {cdate})',
+        ),
+    ),
+
+    'default' => array
+	(
+		'col' => 'id,name,level,target,value,state,cdate',
+		'value' => array
+		(
+			'1,"合伙人", 1, "30", "3", 1,' . DEVER_TIME,
+
+			'2,"初级合伙人", 2, "60", "6", 1,' . DEVER_TIME,
+
+			'3,"中级合伙人", 3, "100", "9", 1,' . DEVER_TIME,
+
+			'4,"高级合伙人", 4, "300", "12", 1,' . DEVER_TIME,
+
+			'5,"事业合伙人", 5, "500", "15", 1,' . DEVER_TIME,
+		),
+	),
+
+    'manage' => array
+    (
+    	//'insert' => false,
+        'delete' => false,
+        'edit' => false,
+        'list_button' => array
+        (
+        	'fast' => array('编辑', '"level&where_id={id}&oper_save_jump=level&oper_table=level&oper_parent=level"'),
+        )
+    ),
+
+    'request' => array
+    (
+        'getAll' => array
+        (
+            # 匹配的正则或函数 选填项
+            'option' => array
+            (
+                'type' => array('yes', 'in'),
+                //'state' => 1,
+            ),
+            'type' => 'all',
+            'col' => '*|id',
+        ),
+    ),
+);

+ 12 - 0
service/setting/database/role.php

@@ -104,6 +104,18 @@ return array
             'show'		=> 'type=2',
         ),
 
+        'price'      => array
+        (
+            'type'      => 'varchar-50',
+            'name'      => '代理价格-以元为单位',
+            'default'   => '0',
+            'desc'      => '代理价格',
+            'match'     => 'option',
+            'update'    => 'text',
+            //'list'      => true,
+            'show'      => 'type=1',
+        ),
+
         'profit'      => array
         (
             'type'      => 'varchar-15',

+ 10 - 0
service/setting/lib/Manage.php

@@ -0,0 +1,10 @@
+<?php
+
+namespace Setting\Lib;
+
+use Dever;
+
+class Manage
+{
+
+}