|
@@ -24,6 +24,8 @@ class companylogic extends baselogic
|
|
|
$list = [
|
|
|
'newinfo' => [
|
|
|
['name' => 'openid', 'title' => 'openid', 'require' => true, 'type' => 'string'],
|
|
|
+ ['name' => 'organization_code', 'title' => 'organization_code', 'type' => 'string'],
|
|
|
+ ['name' => 'companyname', 'title' => 'companyname', 'type' => 'string'],
|
|
|
],
|
|
|
'getinfobyid' => [
|
|
|
['name' => 'id', 'title' => 'id', 'require' => true, 'type' => 'numeric'],
|
|
@@ -60,7 +62,22 @@ class companylogic extends baselogic
|
|
|
return backarr(0, "非企业用户");
|
|
|
}
|
|
|
unset($arr['openid']);
|
|
|
- $id = $m_c->insertData($arr);
|
|
|
+ $where = [];
|
|
|
+ $cinfo = [];
|
|
|
+ if (isset($arr['organization_code'])) {
|
|
|
+ $where['organization_code'] = $arr['organization_code'];
|
|
|
+ }
|
|
|
+ if (isset($arr['companyname'])) {
|
|
|
+ $where['companyname'] = $arr['companyname'];
|
|
|
+ }
|
|
|
+ if (empty(!$where)) {
|
|
|
+ $cinfo = $m_c->getinfo($where, ['id']);
|
|
|
+ }
|
|
|
+ if (empty($cinfo)) {
|
|
|
+ $id = $m_c->insertData($arr);
|
|
|
+ } else {
|
|
|
+ $id = $cinfo['id'];
|
|
|
+ }
|
|
|
$updateDate = ['company_id' => $id];
|
|
|
$row = $m_u->updatebyid($info['id'], $updateDate);
|
|
|
return backarr(1, "新增成功", ['id' => $id]);
|