solve some bugs and improve codes

pull/21/head
azizi 4 years ago
parent 5dd699e1b1
commit 711b28ed56

@ -243,12 +243,27 @@ class ConvertUser extends Command
$cellPhone = null; $cellPhone = null;
foreach ($phones as $phone)
{
$phone->tel = str_replace(' ','',$phone->tel);
}
for( $i=0; $i <= count($phones)-1 ; $i++ ) for( $i=0; $i <= count($phones)-1 ; $i++ )
{ {
if($phones[$i]->label == 'Mobile')
$regex = '/^09[0,1,2,3,9]{1}[0-9]{8}$/';
$match = preg_match($regex,$phones[$i]->tel);
if ($match == 1)
{ {
$cellPhone = $phones[$i]->tel; $cellPhone = $phones[$i]->tel;
break;
} }
} }
@ -263,6 +278,7 @@ class ConvertUser extends Command
$userTableData = [ $userTableData = [
'name' => $userData->brand_fa, 'name' => $userData->brand_fa,
'name_en' => $userData->brand_en,
'business_id' => 3, 'business_id' => 3,
'cell_number' => $cellPhone, 'cell_number' => $cellPhone,
'detail' => json_encode($userTableDedails), 'detail' => json_encode($userTableDedails),
@ -283,7 +299,7 @@ class ConvertUser extends Command
$newUserId = $this->insertRowToUsers($userTableData); $newUserId = $this->insertRowToUsers($userTableData);
$this->categoriesConfig($userData->category_id, $newUserId); $this->categoriesConfig($userData->category_id, $newUserId);
$this->InsertAddress($userAddress, $userData->id,$newUserId); $this->InsertAddress($userAddress, $userData->id,$newUserId);
$this->insertPhone($userData->phones , $newUserId); $this->insertPhone($phones , $newUserId);
$lastStatusId = $this->insertToClientStatuses($userData->status); $lastStatusId = $this->insertToClientStatuses($userData->status);
$this->updateToUserStatus($newUserId,$lastStatusId); $this->updateToUserStatus($newUserId,$lastStatusId);
$count ++; $count ++;

Loading…
Cancel
Save