修改数据同步

This commit is contained in:
巴掌 committed 2021-02-23 13:56:04 +08:00
1 parent 0e08bf2400
commit 079af8cd0c
9 files changed
+56 -12

No files matched your search

+6 -4
View File
@@ -82,13 +82,14 @@ class Tongbu extends BaseController
$ad = new \app\admin\model\Admin;
$tc = new \app\teacher\model\Teacher;
$tclist = $tc::withTrashed()->select();
$i = 0;
foreach ($tclist as $key => $value) {
$temp = $ad::withTrashed()
->where('teacher_id', $value->id)
->find();
if($temp)
{
$arr['id'] = $value->id;
$arr['id'] = $temp->id;
$arr['xingming'] = $value->xingming;
$arr['sex'] = $value->getData("sex");
$arr['shengri'] = $value->shengri;
@@ -142,10 +143,11 @@ class Tongbu extends BaseController
unset($data['update_time']);
$data = $ad->create($data);
}
$i = $i+1;
}
// 根据更新结果设置返回提示信息
$data ? $data = ['msg' => '教师信息同步成功', 'val' => 1]
$data ? $data = ['msg' => '教师信息同步成功,共' . $i . '条记录', 'val' => 1]
: $data = ['msg' => '数据处理错误', 'val' => 0];
return json($data);
@@ -281,13 +283,12 @@ class Tongbu extends BaseController
$data = false;
if(isset($kaoshiList[0]['user_id']))
{
dump('aa');
$arr = array();
foreach ($kaoshiList as $key => $value) {
if($value->user_id > 0){
$arr[] = [
'id' => $value->id
,'user_id' => ad::newId($value->user_id)
,'user_id' => ad::newId($value->teacher_id)
];
}
}
@@ -316,6 +317,7 @@ class Tongbu extends BaseController
foreach ($ktcyList as $key => $value) {
$arr[] = [
'id' => $value->id
,'oldid' => $value->teacher_id
,'teacher_id' => ad::newId($value->teacher_id)
];
}
+1 -1
View File
@@ -327,7 +327,7 @@ class Admin extends BaseModel
static function newId($oldId)
{
$id = self::withTrashed()->whereTeacherId($oldId)->value('id');
$id = self::withTrashed()->where('teacher_id', $oldId)->value('id');
return $id;
}
+2 -2
View File
@@ -43,7 +43,7 @@
<div class="layui-input-block">
<input type="text" id="username" name="username" lay-verify="required"
autocomplete="off" class="layui-input" value="{$list.data.username|default=''}" placeholder="由字母、数字-_组成 6-12个字符"
{eq name="$list.set.formpost" value="PUT1" }
{eq name="$list.set.formpost" value="PUT" }
disabled
{/eq}>
</div>
@@ -166,7 +166,7 @@
$('#teacher_id').bind({
keyup:function(){
var val = $.trim($(this).val());
cjgl.searchTeacher(this, val, 'teacher_id', 'addTeacherID');
cjgl.searchTeacherOld(this, val, 'teacher_id', 'addTeacherID');
},
});
</script>
Loaded 3 of 9 files, more files were not shown because too many files have changed in this diff. Show more