|
@@ -1034,7 +1034,7 @@ class merchantControl extends SystemControl
|
|
|
|
|
|
$match = function ($all,$cur)
|
|
|
{
|
|
|
- $inserts = [];
|
|
|
+ $inserts = $updates = [];
|
|
|
foreach ($all as $key => $value)
|
|
|
{
|
|
|
|
|
@@ -1043,11 +1043,27 @@ class merchantControl extends SystemControl
|
|
|
$insert['store_id'] = $value['cfg']['store_id'];
|
|
|
$insert['qualitys'] = $value['cfg']['qualitys'];
|
|
|
$inserts[] = $insert;
|
|
|
+ }else{
|
|
|
+ if($value['cfg']['qualitys'] != $cur[$key]['qualitys']){
|
|
|
+ $update['provider_id'] = $cur[$key]['provider_id'];
|
|
|
+ $update['qualitys'] = $value['cfg']['qualitys'];
|
|
|
+ $updates[] = $update;
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
- return $inserts;
|
|
|
+ return [$inserts,$updates];
|
|
|
};
|
|
|
|
|
|
+ $updater = function ($mod,$updates)
|
|
|
+ {
|
|
|
+ if(empty($updates)) return;
|
|
|
+ foreach ($updates as $update) {
|
|
|
+ $provider_id = $update['provider_id'];
|
|
|
+
|
|
|
+ $data = ['qualitys' => $update['qualitys']];
|
|
|
+ $mod->editProvider($data, ['provider_id' => $provider_id]);
|
|
|
+ }
|
|
|
+ };
|
|
|
$inserter = function ($mod,$type,$names)
|
|
|
{
|
|
|
foreach ($names as $name) {
|
|
@@ -1065,13 +1081,15 @@ class merchantControl extends SystemControl
|
|
|
|
|
|
$oil_items = $mod_prov->getProviderList(['type' => 1]);
|
|
|
$oil_items = $name_val($oil_items);
|
|
|
- $oil_inserts = $match($oils,$oil_items);
|
|
|
+ [$oil_inserts,$oil_updates] = $match($oils,$oil_items);
|
|
|
|
|
|
$phone_items = $mod_prov->getProviderList(['type' => 2]);
|
|
|
$phone_items = $name_val($phone_items);
|
|
|
- $phone_inserts = $match($phones,$phone_items);
|
|
|
+ [$phone_inserts,$phone_updates] = $match($phones,$phone_items);
|
|
|
$inserter($mod_prov,1,$oil_inserts);
|
|
|
$inserter($mod_prov,2,$phone_inserts);
|
|
|
+ $updater($mod_prov,$oil_updates);
|
|
|
+ $updater($mod_prov,$phone_updates);
|
|
|
}
|
|
|
|
|
|
public function changeProviderStateOp()
|