Эх сурвалжийг харах

【Mod】优化客户同步的信息

liuxiangxin 7 сар өмнө
parent
commit
81c24aced2

+ 2 - 0
app/Http/Controllers/Admin/Product.php

@@ -86,6 +86,7 @@ class Product extends Auth{
 			$data['producer_id']	= request('producer_id',0);
 			$data['business_id']	= request('business_id',0);
 			$data['stock']			= request('stock',0);
+			$data['status']			= 1;
 			$data['admin_uid']		= admin('uid');
 			$description			= request('description','');
 			$attr					= request('attr',[]);
@@ -222,6 +223,7 @@ class Product extends Auth{
 			$data['producer_id']	= request('producer_id',0);
 			$data['business_id']	= request('business_id',0);
 			$data['stock']			= request('stock',0);
+			$data['status']			= 1;
 			$description			= request('description','');
 			$attr					= request('attr',[]);
 			$skuList				= request('sku',[]);

+ 3 - 3
app/Jobs/WeiBanSync.php

@@ -108,8 +108,8 @@ class WeiBanSync implements ShouldQueue
         $oldExtUser                     = $External->query()->find($extUser['id'],['custom_uid']);
         // 如果存在账号的话获取客户UID
         if( $oldExtUser )               $extUser['custom_uid'] = ($oldExtUser->custom_uid);
-        // 不存在账号又存在手机号,才创建账号
-        if( !$extUser['custom_uid'] && $phone ) $extUser['custom_uid'] = $this->customHandle($phone,$extUser,$Custom);
+        // 存在手机号,才创建账号
+        if( $phone )                    $extUser['custom_uid'] = $this->customHandle($phone,$extUser,$Custom);
         // 新增或者修改
         $External->query()->upsert($extUser,'id',['name','avatar','gender','type','corp_name','corp_full_name','status','custom_uid','update_time']);
     }
@@ -152,7 +152,7 @@ class WeiBanSync implements ShouldQueue
         // 是否已经注册
         $custom                     = $Custom->getOneByPhone($phone);
         // 如果已经注册
-        $uid                        = $custom ? $custom['uid'] : $Custom->add(['phone'=>$phone,'username'=>$extUser['name'],'userpic'=>$extUser['avatar'],'sex'=>$extUser['gender'],'weiban_extid'=>$extUser['id']]);
+        $uid                        = $custom ? $Custom->edit($custom['uid'],['username'=>$extUser['name'],'userpic'=>$extUser['avatar'],'sex'=>$extUser['gender'],'weiban_extid'=>$extUser['id']]) : $Custom->add(['phone'=>$phone,'username'=>$extUser['name'],'userpic'=>$extUser['avatar'],'sex'=>$extUser['gender'],'weiban_extid'=>$extUser['id']]);
         // 成功,赋值
         return                      $uid;
     }

+ 2 - 0
resources/views/admin/custom/index.blade.php

@@ -41,6 +41,7 @@ style="margin: 0 auto;width: 96%;padding: 30px 0px;"
 						<th>微伴ID</th>
 						<th>客户状态</th>
 						<th>创建时间</th>
+						<th>更新时间</th>
 						<th>操作</th>
 					</tr>
 				</thead>
@@ -55,6 +56,7 @@ style="margin: 0 auto;width: 96%;padding: 30px 0px;"
 							<td> {{$a['weiban_extid']}} </td>
 							<td> {{$a['status']?'禁用':'正常'}} </td>
 							<td> {{date('Y/m/d H:i:s',$a['insert_time'])}}</td>
+							<td> {{date('Y/m/d H:i:s',$a['update_time'])}}</td>
 							<td>
 								@if(check_auth('admin/custom/edit'))
 								<a href="{{url('admin/custom/edit?'.http_build_query(['uid'=>$a['uid']]))}}" class="btn btn-sm btn-warning" >编辑</a>

+ 2 - 0
resources/views/admin/weiban_external/index.blade.php

@@ -34,6 +34,7 @@ style="margin: 0 auto;width: 96%;padding: 30px 0px;"
 						<th>客服标签</th>
 						<th>系统用户</th>
 						<th>创建时间</th>
+						<th>修改时间</th>
 						<th>操作</th>
 					</tr>
 				</thead>
@@ -52,6 +53,7 @@ style="margin: 0 auto;width: 96%;padding: 30px 0px;"
 							</td>
 							<td> {{$a['custom_code']}} </td>
 							<td> {{date('Y/m/d H:i:s',$a['insert_time'])}}</td>
+							<td> {{date('Y/m/d H:i:s',$a['update_time'])}}</td>
 							<td> </td>
 						</tr>  
 						@endforeach