rabin 2 年之前
父节点
当前提交
9bf7824860

+ 3 - 1
app/goods/lib/Info.php

@@ -541,9 +541,11 @@ class Info
                         if (isset($attr_data['attr_' . $v['id']])) {
                             $v['value'] = $attr_data['attr_' . $v['id']];
                         } else {
-                            continue;
                             $v['value'] = '';
                         }
+                        if (!$v['value']) {
+                            continue;
+                        }
 
                         $v['value_string'] = Dever::load('attr/api')->getValue($v);
                         

+ 3 - 3
app/goods/lib/Sku.php

@@ -413,7 +413,7 @@ class Sku
 
         if (isset($info['group_attr']) && $info['group_attr']) {
             foreach ($info['group_attr'] as $k => $v) {
-                if (isset($info['attr'][$v]['option'])) {
+                if (isset($info['attr'][$v]['option']) && $info['attr'][$v]['option']) {
                     $group_attr[$k] = $info['attr'][$v]['option'];
                     $head .= '<th>'.$info['attr'][$v]['name'].'</th>';
                 }
@@ -423,7 +423,7 @@ class Sku
         if (isset($info['single_attr']) && $info['single_attr']) {
             $single_head .= '<th>属性名称</th>';
             foreach ($info['single_attr'] as $k => $v) {
-                if (isset($info['attr'][$v]['option'])) {
+                if (isset($info['attr'][$v]['option']) && $info['attr'][$v]['option']) {
                     $single_attr = array_merge($single_attr, $info['attr'][$v]['option']);
                 }
             }
@@ -433,7 +433,7 @@ class Sku
             $input_head .= '<th>属性名称</th>';
             $input_head .= '<th>起算</th>';
             foreach ($info['input_attr'] as $k => $v) {
-                if (isset($info['attr'][$v]['option'])) {
+                if (isset($info['attr'][$v]['option']) && $info['attr'][$v]['option']) {
                     $input_attr[$k] = $info['attr'][$v];
                 }
             }

+ 4 - 4
app/shop/database/info.php

@@ -72,8 +72,8 @@ $method = array
 );
 
 $stat_type = Dever::db('cash/shop')->config['config_type'];
-$add = array();
-$add = array('自主签约','"sign&search_option_shop_id={id}&oper_table=info&where_id={id}"', '"{mid}" == ""');
+$add = false;
+//$add = array('银联签约','"sign&search_option_shop_id={id}&oper_table=info&where_id={id}"', '"{mid}" == ""');
 
 return array
 (
@@ -719,8 +719,8 @@ return array
             'list1' => array('账号管理', '"member&search_option_shop_id={id}&oper_table=info"'),
             'list2' => array('打印机管理', '"print&search_option_shop_id={id}&oper_table=info"'),
 
-            'br31' => array('<br /><br />'),
-            'add' => $add,
+            //'br31' => array('<br /><br />'),
+            //'add' => $add,
 
             //'list3' => array('销售订单', '"sell_order&search_option_shop_id={id}&oper_table=info"'),
             //'list4' => array('采购订单', '"buy_order&search_option_shop_id={id}&oper_table=info"'),

+ 57 - 28
app/shop/database/sign.php

@@ -10,13 +10,8 @@ $mer_type = array
     1 => '企业商户',
     //3 => '小微商户',
 );
-$id = Dever::input('search_option_shop_id');
 $shop = array();
 $desc = '';
-if ($id && $id > 0) {
-	$shop = Dever::db('shop/info')->one($id);
-    $desc = Dever::load('shop/lib/sign')->getLog($shop);
-}
 
 $step = array
 (
@@ -24,12 +19,15 @@ $step = array
     1 => '入网:资料提交',//3.2
     2 => '入网:对公账户打款',//3.7
     3 => '入网:对公账户验证',//3.6
-    4 => '入网:前台签约',//3.3
-    5 => '入网:签约成功',//3.4
+
+    4 => '入网:前台签约中',//3.3
+    5 => '入网:签约审核中',//3.4
+    6 => '入网:签约成功',//3.4
 
     11 => '变更:资料提交',//3.9
-    14 => '变更:前台签约',//3.10
-    15 => '变更:签约成功',//3.11
+    14 => '变更:前台签约中',//3.10
+    15 => '变更:签约审核中',//3.11
+    16 => '变更:签约成功',//3.11
 );
 
 return array
@@ -37,10 +35,10 @@ return array
     # 表名
     'name' => 'sign',
     # 显示给用户看的名称
-    'lang' => '自主签约',
+    'lang' => '银联签约',
     # 后台菜单排序
-    'order' => 99,
-    'menu' => false,
+    'order' => -100,
+    'step' => $step,
     # 数据结构
     'struct' => array
     (
@@ -86,17 +84,6 @@ return array
             // 'update'    => 'text',
         ),
 
-        'step'      => array
-        (
-            'type'      => 'int-11',
-            'name'      => '当前要进行的步骤',
-            'default'   => '-1',
-            'desc'      => '当前步骤',
-            'match'     => 'option',
-            'option'    => $step,
-            // 'update'    => 'text',
-        ),
-
         'shop_id'       => array
         (
             'type'      => 'int-11',
@@ -120,10 +107,25 @@ return array
             'update'    => 'text',
             'search'    => 'fulltext',
             'list'      => true,
+            'list_order' => -10,
             'value'     => $shop ? $shop['name'] : false,
             'tab'       => 0,
         ),
 
+        'shop_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}")',
+            'tab'       => 0,
+        ),
+
         'mccCode'      => array
         (
             'type'      => 'varchar-200',
@@ -131,7 +133,7 @@ return array
             'default'   => '5499',
             'desc'      => '行业类别编码',
             'match'     => 'option',
-            'update'    => 'text',
+            //'update'    => 'text',
             'tab'       => 0,
         ),
 
@@ -184,6 +186,7 @@ return array
             'update'    => 'text',
             'search'    => 'fulltext',
             'list'      => true,
+            'list_order' => -9,
             'tab'       => 1,
         ),
 
@@ -197,6 +200,7 @@ return array
             'update'    => 'text',
             'search'    => 'fulltext',
             'list'      => true,
+            'list_order' => -8,
             'tab'       => 1,
         ),
 
@@ -233,7 +237,7 @@ return array
             'desc'      => '',
             'match'     => 'is_numeric',
             'update'    => 'day',
-            'search'    => 'date',
+            //'search'    => 'date',
             'callback'  => 'maketime',
             'tab'       => 1,
         ),
@@ -288,6 +292,8 @@ return array
             'match'     => 'option',
             'update'    => 'radio',
             'option'    => $mer_type,
+            'search'    => 'select',
+            'list'      => true,
             'tab'       => 2,
         ),
 
@@ -381,7 +387,7 @@ return array
             'default'   => '',
             'desc'      => '开户所在地',
             'match'     => 'option',
-            'search'    => 'linkage',
+            //'search'    => 'linkage',
             'update'    => 'linkage',
             'value'     => $shop ? $shop['area'] : false,
             'option'    => Dever::url('api.get?level_total=2', 'area'),
@@ -439,6 +445,19 @@ return array
             'tab'       => 3,
         ),
 
+        'step'      => array
+        (
+            'type'      => 'int-11',
+            'name'      => '状态',
+            'default'   => '-1',
+            'desc'      => '当前步骤',
+            'match'     => 'option',
+            'option'    => $step,
+            // 'update'    => 'text',
+            'search'    => 'select',
+            'list'      => true,
+        ),
+
         'state'     => array
         (
             'type'      => 'tinyint-1',
@@ -461,12 +480,22 @@ return array
     ),
 	'manage' => array
     (
+        'edit' => false,
+        'delete' => false,
         # 图片上传后调用的接口
-        'upload' => 'shop/lib/sign.upload?shop_id=' . $id,
+        'upload' => 'shop/lib/sign.upload?sign=1',
         # 更新页面顶部描述
         'desc' => $desc,
         # 更新页面tab切换
         'tab' => array('门店信息', '法人信息', '企业信息', '银行信息'),
-        'list' => 'update',
+        //'list' => 'update',
+        'list_button' => array
+        (
+            'add' => array('编辑', '', '{step} == -1'),
+            'delete' => array('删除', '', '{step} == -1'),
+            'oper' => array('提交资料', 'shop/lib/sign.handle?sign_id={id}', '{step} == -1'),
+            'oper2' => array('提交资料', 'shop/lib/sign.handle?sign_id={id}', '{step} == -1'),
+            'list' => array('查看日志', '"sign_log&search_option_sign_id={id}&oper_table=sign"'),
+        )
     ),
 );

+ 11 - 26
app/shop/database/sign_log.php

@@ -16,19 +16,7 @@ if ($id) {
 	$shop = Dever::db('shop/info')->one($id);
 }
 
-$step = array
-(
-    -1 => '待提交资料',
-    1 => '入网:资料提交',//3.2
-    2 => '入网:对公账户打款',//3.7
-    3 => '入网:对公账户验证',//3.6
-    4 => '入网:前台签约',//3.3
-    5 => '入网:签约成功',//3.4
-
-    11 => '变更:资料提交',//3.9
-    14 => '变更:前台签约',//3.10
-    15 => '变更:签约成功',//3.11
-);
+$step = Dever::db('shop/sign')->config['step'];
 
 return array
 (
@@ -54,16 +42,6 @@ return array
             'order'     => 'desc',
         ),
 
-        'shop_id'       => array
-        (
-            'type'      => 'int-11',
-            'name'      => '店铺id',
-            'default'   => '0',
-            'desc'      => '请选择用户',
-            'match'     => 'is_numeric',
-            'update'    => 'hidden',
-        ),
-
         'sign_id'       => array
         (
             'type'      => 'int-11',
@@ -83,6 +61,7 @@ return array
             'match'     => 'option',
             'update'    => 'text',
             'option'    => $step,
+            'list'      => true,
         ),
 
         'desc'     => array
@@ -93,6 +72,8 @@ return array
             'desc'      => '日志描述',
             'match'     => 'option',
             'update'    => 'text',
+            'search'    => 'fulltext',
+            'list'      => true,
         ),
 
         'request_seq'     => array
@@ -103,6 +84,8 @@ return array
             'desc'      => '请求流水号',
             'match'     => 'option',
             'update'    => 'text',
+            'search'    => 'fulltext',
+            'list'      => true,
         ),
 
         'request'     => array
@@ -147,16 +130,18 @@ return array
         'cdate'     => array
         (
             'type'      => 'int-11',
-            'name'      => '录入时间',
+            'name'      => '请求时间',
             'match'     => array('is_numeric', time()),
             'desc'      => '',
             # 只有insert时才生效
             'insert'    => true,
-            //'list'      => 'date("Y-m-d H:i:s", {cdate})',
+            'list'      => 'date("Y-m-d H:i:s", {cdate})',
         ),
     ),
 	'manage' => array
     (
-        
+        'insert' => false,
+        'edit' => false,
+        'delete' => false,
     ),
 );

+ 0 - 13
app/shop/database/sign_pic.php

@@ -34,19 +34,6 @@ return array
             'order'     => 'desc',
         ),
 
-        'shop_id'       => array
-        (
-            'type'      => 'int-11',
-            'name'      => '店铺id',
-            'default'   => '0',
-            'desc'      => '请选择用户',
-            'match'     => 'is_numeric',
-            'update'    => 'text',
-            // 'search'  => 'select',
-            'value'     => Dever::input('search_option_shop_id'),
-            //'list'      => '{uid} > 0 ? Dever::load("passport/user-find#username", {uid}) : "匿名用户"',
-        ),
-
         'key'      => array
         (
             'type'      => 'varchar-32',

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

@@ -278,6 +278,7 @@ class Manage
                         $id = $v;
                         $info = Dever::db('shop/sell_order')->one($id);
                     }
+                    $info['status'] = 4;
                     Dever::load('shop/lib/sell')->finish($info, $info['shop_id']);
                 }
             }

+ 47 - 32
app/shop/lib/Sign.php

@@ -24,11 +24,16 @@ Class Sign {
 		'house_pic' => ['document_type' => '0015','document_name' => '室内照片'],
 	);
 
+	# 计划任务
+	public function cron()
+	{
+		# 对已签约的
+	}
+
 	# 获取日志
-	public function getLog($shop)
+	public function getLog($sign_id)
 	{
-		Dever::setInput('search_option_shop_id', -1);
-		$sign = Dever::db('shop/sign')->find(array('shop_id' => $shop['id']));
+		$sign = Dever::db('shop/sign')->find($sign_id);
 		if (!$sign) {
 			return Dever::timeline('填写资料');
 		}
@@ -38,8 +43,9 @@ Class Sign {
 		if ($log) {
 			foreach ($log as $k => $v) {
 				if ($v['step'] == 4) {
-					$v['response'] = Dever::json_decode($v['response']);
-					$v['desc'] .= '  <a href="'.$v['response']['url'].'" target="_blank">点此打开</a>  <a style="cursor:pointer" data-clipboard-text="'.$v['response']['url'].'" class="clipboard">复制链接</a>';
+					//$v['response'] = Dever::json_decode($v['response']);
+					$url = $this->agreement($sign, false);
+					$v['desc'] .= '  <a href="'.$url.'" target="_blank">点此打开</a>  <a style="cursor:pointer" data-clipboard-text="'.$url.'" class="clipboard">复制链接</a>';
 				}
 				$date = date('Y-m-d H:i', $v['cdate']);
 				$name = '';
@@ -54,20 +60,18 @@ Class Sign {
 		}
 
 		if ($sign['step'] == -1) {
-			$url = Dever::url('shop/lib/sign.handle?shop_id=' . $sign['shop_id'] . '&json=1');
+			$url = Dever::url('shop/lib/sign.handle?sign_id=' . $sign['id'] . '&json=1');
 			$result[] = '<a href="javascript:;" onclick="load(\''.$url.'\')">点此上传资料</a>';
 		}
 
 		$result = Dever::timeline('签约记录', $result);
-		Dever::setInput('search_option_shop_id', $shop['id']);
 		return $result;
 	}
 
 	# 统一处理接口
-	public function handle_api($shop_id)
+	public function handle_api($sign_id)
 	{
-		$shop = Dever::db('shop/info')->find($shop_id);
-		$sign = Dever::db('shop/sign')->find(array('shop_id' => $shop_id));
+		$sign = Dever::db('shop/sign')->find($sign_id);
 		if (!$sign) {
 			Dever::alert('档案资料未上传');
 		}
@@ -75,7 +79,7 @@ Class Sign {
 		switch($sign['step']) {
 			case -1;
 				# 提交资料
-				return $this->up($shop, $sign);
+				return $this->up($sign);
 				break;
 			case 1;
 			case 6;
@@ -108,17 +112,15 @@ Class Sign {
 	public function upload_api()
 	{
 		$document_type = $this->document_type;
-		$shop_id = Dever::input('shop_id');
 		$key = Dever::input('key');
 		$upload = Dever::json_decode(Dever::input('upload'));
 		if ($upload && isset($document_type[$key]) && isset($upload['url'])) {
 			$url = md5($upload['url']);
-			$sign_pic = Dever::db('shop/sign_pic')->find(array('shop_id' => $shop_id, 'key' => $key, 'url' => $url));
+			$sign_pic = Dever::db('shop/sign_pic')->find(array('key' => $key, 'url' => $url));
 			if (!$sign_pic) {
 				$pic = $this->pic($upload['url']);
 				if ($pic && isset($pic['data']['file_path']) && $pic['data']['file_path']) {
 					$insert = array();
-					$insert['shop_id'] = $shop_id;
 					$insert['url'] = $url;
 					$insert['document_type'] = $document_type[$key]['document_type'];
 					$insert['document_name'] = $document_type[$key]['document_name'];
@@ -132,10 +134,11 @@ Class Sign {
 	}
 
 	#3.2  详细采集档案资料上传接口
-	private function up($shop, $sign)
+	private function up($sign)
 	{
 		$service = 'complex_upload';
-		$data['accesser_user_id'] = $shop['id'];
+		$data['remark'] = '线上支付商户';
+		$data['accesser_user_id'] = $sign['id'];
 		if ($sign['reg_mer_type'] == 1) {
 			$sign['reg_mer_type'] = '00';
 		} elseif ($sign['reg_mer_type'] == 2) {
@@ -147,28 +150,25 @@ Class Sign {
 		$data['legal_name'] = $sign['name'];#法人姓名
 		$data['legal_idcard_no'] = $sign['idcard'];#法人身份证号
 		$data['legal_mobile'] = $sign['mobile'];#法人手机号
-		$data['legal_card_deadline'] = date('Y-m-d',$sign['card_deadline']);#证件截止代表日期
-		$data['shop_name'] = $shop['name'];#店铺名称
+		$data['legal_card_deadline'] = $sign['card_deadline'] == '长期' ? '9999-12-31' : date('Y-m-d',$sign['card_deadline']);#证件截止代表日期
+		$data['shop_name'] = $sign['shop_name'];#店铺名称
 		if ($sign['bank_acct_type'] == -1) {
 			$data['bank_acct_type'] = 0;
+			$data['bank_acct_name'] = $sign['name'];#开户账号名称
 		} else {
 			$data['bank_acct_type'] = 1;
+			$data['bank_acct_name'] = $sign['company_name'];#开户账号名称
 		}
 
 		$data['bank_acct_no'] = $sign['bank_acct_no'];#开户行账号
-		if ($sign['bank_acct_type'] == 1) {
-			$data['bank_acct_name'] = $sign['company_name'];#开户账号名称
-		} else {
-			$data['bank_acct_name'] = $sign['name'];#开户账号名称
-		}
 		$data['mccCode'] = $sign['mccCode'];
 
-		$area = explode(',', $shop['area']);
+		$area = explode(',', $sign['shop_area']);
 		$data['shop_province_id'] = $area[0]/10000;
 		$data['shop_city_id'] = $area[1]/100;
 		$data['shop_country_id'] = $area[2];
 		$sign_area = explode(',',$sign['area']);
-		$data['shop_lic'] = $shop['license_number'];#营业执照号
+		$data['shop_lic'] = $sign['license_number'];#营业执照号
 		$bank = $this->bank_list($sign_area[0]/10000, $sign['bank_acct_noname']);
 		if($bank && isset($bank['branchBankList']) && $bank['branchBankList']){
 			$bank['branchBankList'] = $bank['branchBankList'][0];
@@ -193,12 +193,11 @@ Class Sign {
 			if (isset($sign[$k]) && $sign[$k]) {
 				$sign[$k] = Dever::pic($sign[$k]);
 				$url = md5($sign[$k]);
-				$sign_pic = Dever::db('shop/sign_pic')->find(array('sign_id' => $sign['id'], 'key' => $k, 'url' => $url));
+				$sign_pic = Dever::db('shop/sign_pic')->find(array('key' => $k, 'url' => $url));
 				if (!$sign_pic) {
 					$pic = $this->pic($sign[$k]);
 					if ($pic && isset($pic['data']['file_path']) && $pic['data']['file_path']) {
 						$insert = array();
-						$insert['shop_id'] = $shop['id'];
 						$insert['url'] = $url;
 						$insert['document_type'] = $v['document_type'];
 						$insert['document_name'] = $v['document_name'];
@@ -282,7 +281,7 @@ Class Sign {
 	}
 
 	# 3.3  前台签约接口
-	public function agreement($sign)
+	public function agreement($sign, $log = true)
 	{
 		$step = 4;
 		$service = 'agreement_sign';
@@ -290,13 +289,18 @@ Class Sign {
 		$data['pcOrH5'] = 'H5';
 		$result = $this->get($service, $data);
 		if ($result && $result['code'] == 1 && isset($result['data']['url']) && $result['data']['url']) {
+			
 			$update = array();
 			$update['where_id'] = $sign['id'];
 			$update['step'] = $step;
 			$update['url'] = $result['data']['url'];
 			$update['clear'] = true;
 			Dever::db('shop/sign')->update($update);
-			$this->log($update['step'], $sign, '获取前台签约合同链接', $data, $result['data'], $result['request_seq']);
+			if ($log) {
+				$this->log($update['step'], $sign, '获取前台签约合同链接', $data, $result['data'], $result['request_seq']);
+			} else {
+				return $update['url'];
+			}
 		} else {
 			$this->log($step, $sign, $result['msg'], $data, $result['data'], $result['request_seq']);
 		}
@@ -310,13 +314,25 @@ Class Sign {
 		$service = 'apply_qry';
 		$data['ums_reg_id'] = $sign['ums_reg_id'];
 		$result = $this->get($service, $data, $sign['ums_reg_id']);
-		if ($result && $result['code'] == 1 && isset($result['data']['apply_status']) && $result['data']['apply_status'] == '03') {
+		print_r($result);die;
+		if ($result && $result['code'] == 1 && isset($result['data']['apply_status'])) {
+			if ($result['data']['apply_status'] == '01') {
+				$step = 5;
+			} elseif ($result['data']['apply_status'] == '03') {
+				$step = 6;
+			}
 			$update = array();
 			$update['where_id'] = $sign['id'];
 			$update['step'] = $step;
 			$update['clear'] = true;
+			if ($result['data']['apply_status'] == '03' && isset($result['data']['mer_no']) && $result['data']['mer_no']) {
+				$update['mid'] = $result['data']['mer_no'];
+				if (isset($sign['shop_id']) && $sign['shop_id']) {
+					Dever::db('shop/info')->update(array('where_id' => $sign['shop_id'], 'mid' => $update['mid']));
+				}
+			}
 			Dever::db('shop/sign')->update($update);
-			$this->log($update['step'], $sign, '签约成功', $data, $result['data'], $result['request_seq']);
+			$this->log($update['step'], $sign, $result['data']['apply_status_msg'], $data, $result['data'], $result['request_seq']);
 		} else {
 			$this->log($step, $sign, $result['data']['apply_status_msg'], $data, $result['data'], $result['request_seq']);
 		}
@@ -455,7 +471,6 @@ Class Sign {
 			return $msg;
 		}
 		$data['step'] = $step;
-		$data['shop_id'] = $sign['shop_id'];
 		$data['sign_id'] = $sign['id'];
 		$data['desc'] = $msg;
 		$admin = Dever::load('manage/auth.info');

+ 1 - 0
service/agent/lib/Manage.php

@@ -986,6 +986,7 @@ class Manage
                         $id = $v;
                         $info = Dever::db('agent/dh_order')->one($id);
                     }
+                    $info['status'] = 4;
                     Dever::load('agent/lib/dhorder')->finish($info, $info['shop_id']);
                 }
             }