作者 刘锟

合并分支 'akun' 到 'master'

Akun



查看合并请求 !46
@@ -149,11 +149,16 @@ class ProjectUpdate extends Command @@ -149,11 +149,16 @@ class ProjectUpdate extends Command
149 if ($v_phone) { 149 if ($v_phone) {
150 $receiving_phones = $model->read(['type' => 2, 'values' => $v_phone]); 150 $receiving_phones = $model->read(['type' => 2, 'values' => $v_phone]);
151 if (!$receiving_phones) { 151 if (!$receiving_phones) {
152 - $model->add([  
153 - 'type' => 1,  
154 - 'values' => $v_phone,  
155 - 'project_id' => $project_id  
156 - ]); 152 + try {
  153 + $model->add([
  154 + 'type' => 2,
  155 + 'values' => $v_phone,
  156 + 'project_id' => $project_id
  157 + ]);
  158 + } catch (\Exception $e) {
  159 + echo 'date:' . date('Y-m-d H:i:s') . ', task_id: ' . $task->id . ', error: ' . $e->getMessage() . PHP_EOL;
  160 + continue;
  161 + }
157 } 162 }
158 } 163 }
159 } 164 }
@@ -164,11 +169,16 @@ class ProjectUpdate extends Command @@ -164,11 +169,16 @@ class ProjectUpdate extends Command
164 if ($v_email) { 169 if ($v_email) {
165 $receiving_emails = $model->read(['type' => 1, 'values' => $v_email]); 170 $receiving_emails = $model->read(['type' => 1, 'values' => $v_email]);
166 if (!$receiving_emails) { 171 if (!$receiving_emails) {
167 - $model->add([  
168 - 'type' => 2,  
169 - 'values' => $v_email,  
170 - 'project_id' => $project_id  
171 - ]); 172 + try {
  173 + $model->add([
  174 + 'type' => 1,
  175 + 'values' => $v_email,
  176 + 'project_id' => $project_id
  177 + ]);
  178 + } catch (\Exception $e) {
  179 + echo 'date:' . date('Y-m-d H:i:s') . ', task_id: ' . $task->id . ', error: ' . $e->getMessage() . PHP_EOL;
  180 + continue;
  181 + }
172 } 182 }
173 } 183 }
174 } 184 }
@@ -207,7 +217,7 @@ class ProjectUpdate extends Command @@ -207,7 +217,7 @@ class ProjectUpdate extends Command
207 $category_id = ''; 217 $category_id = '';
208 if ($item['category'] ?? []) { 218 if ($item['category'] ?? []) {
209 $category_arr = []; 219 $category_arr = [];
210 - 220 +
211 $pid = 0; 221 $pid = 0;
212 for ($i = 0; $i < count($item['category']); $i++) { 222 for ($i = 0; $i < count($item['category']); $i++) {
213 $return = $this->get_category_name_arr($item['category'], $pid); 223 $return = $this->get_category_name_arr($item['category'], $pid);
@@ -408,15 +418,20 @@ class ProjectUpdate extends Command @@ -408,15 +418,20 @@ class ProjectUpdate extends Command
408 if ($item['name'] ?? '') { 418 if ($item['name'] ?? '') {
409 $parent = $model->read(['pid' => $pid, 'title' => $item['name']], 'id'); 419 $parent = $model->read(['pid' => $pid, 'title' => $item['name']], 'id');
410 if (!$parent) { 420 if (!$parent) {
411 - $parent_id = $model->addReturnId([  
412 - 'project_id' => $project_id,  
413 - 'title' => $item['name'],  
414 - 'pid' => $pid,  
415 - 'keywords' => $item['keywords'] ?? '',  
416 - 'describe' => $item['description'] ?? ''  
417 - ]);  
418 - $route = RouteMap::setRoute($item['url'] ? $this->get_url_route($item['url']) : $item['name'], RouteMap::SOURCE_PRODUCT_CATE, $parent_id, $project_id);  
419 - $model->edit(['route' => $route], ['id' => $parent_id]); 421 + try {
  422 + $parent_id = $model->addReturnId([
  423 + 'project_id' => $project_id,
  424 + 'title' => $item['name'],
  425 + 'pid' => $pid,
  426 + 'keywords' => $item['keywords'] ?? '',
  427 + 'describe' => $item['description'] ?? ''
  428 + ]);
  429 + $route = RouteMap::setRoute($item['url'] ? $this->get_url_route($item['url']) : $item['name'], RouteMap::SOURCE_PRODUCT_CATE, $parent_id, $project_id);
  430 + $model->edit(['route' => $route], ['id' => $parent_id]);
  431 + } catch (\Exception $e) {
  432 + echo 'date:' . date('Y-m-d H:i:s') . ', category_insert error: ' . $e->getMessage() . PHP_EOL;
  433 + continue;
  434 + }
420 } else { 435 } else {
421 $parent_id = $parent['id']; 436 $parent_id = $parent['id'];
422 } 437 }