wang jun 3 gadi atpakaļ
vecāks
revīzija
c622812de3

+ 15 - 0
application/index/controller/Resume.php

@@ -131,4 +131,19 @@ class Resume extends Base
         }
         return backjson(200, $result['data']);
     }
+    /**
+     * 根据openid修改简历数据
+     * 20220211
+     * wj
+     * */
+    public function editbyopenid()
+    {
+        $param = request()->param();
+        $l_r = new resumelogic();
+        $result = $l_r->editbyopenid($param);
+        if (1 != $result['status']) {
+            return backjson(0, $result['msg']);
+        }
+        return backjson(200, $result['data']);
+    }
 }

+ 43 - 0
application/index/logic/resumelogic.php

@@ -64,6 +64,9 @@ class resumelogic extends baselogic
                 ['name' => 'sendid', 'title' => 'sendid', 'require' => true, 'type' => 'numeric'],
                 ['name' => 'status', 'title' => 'status', 'require' => true, 'type' => 'numeric', 'regex' => '/[0|1|2]{1}/'],
             ],
+            'editbyopenid' => [
+                ['name' => 'openid', 'title' => 'openid', 'require' => true, 'type' => 'string'],
+            ],
         ];
         return $list;
     }
@@ -404,5 +407,45 @@ class resumelogic extends baselogic
         $row = $m_s->updatestatusbyid($info['id'], $status);
         return backarr(1, "修改成功", ['id' => $info['id']]);
     }
+    /**
+     * 根据openid修改简历数据
+     * 20220211
+     * wj
+     * */
+    public function editbyopenid($arr)
+    {
+        $result = $this->checkparam(__FUNCTION__, $arr);
+        if (1 != $result['status']) {
+            return $result;
+        }
+        $openid = $arr['openid'];
+        $m_u = new usermodel();
+        $uinfo = $m_u->getinfobyopenid($openid);
+        if (empty($uinfo)) {
+            return backarr(0, "用户信息不存在");
+        }
+        $m_r = new resumemodel();
+        $userid = $uinfo['id'];
+        $rinfo = $m_r->getinfobyuserid($userid);
+        if (empty($rinfo)) {
+            return backarr(0, "简历不存在");
+        }
+        $fields = ['education', 'work_type', 'working_years', 'personal_description'];
+        $updateData = [];
+        foreach ($arr as $key => $value) {
+            if (in_array($key, $fields)) {
+                if (!empty($value) && $value != $rinfo[$key]) {
+                    $updateData[$key] = $value;
+                }
+            }
+        }
+        if (!empty($updateData)) {
+            $row = $m_r->updatebyid($rinfo['id'], $updateData);
+            if (empty($row)) {
+                return backarr(1, "操作失败");
+            }
+        }
+        return backarr(1, "操作成功", ['id' => $rinfo['id']]);
+    }
 
 }