CompanyinfoController.php 2.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  1. <?php
  2. // +----------------------------------------------------------------------
  3. // | ThinkCMF [ WE CAN DO IT MORE SIMPLE ]
  4. // +----------------------------------------------------------------------
  5. // | Copyright (c) 2013-2019 http://www.thinkcmf.com All rights reserved.
  6. // +----------------------------------------------------------------------
  7. // | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )
  8. // +----------------------------------------------------------------------
  9. // | Author: 老猫 <thinkcmf@126.com>
  10. // +----------------------------------------------------------------------
  11. namespace app\portal\controller;
  12. use app\portal\model\EnterpriseApplyJoinPlatformModel;
  13. use app\portal\model\WcCompayApplyModel;
  14. use cmf\controller\HomeBaseController;
  15. use app\user\model\UserModel;
  16. class CompanyinfoController extends HomeBaseController {
  17. public function index() {
  18. $user = cmf_get_current_user();
  19. $this->assign($user);
  20. $userId = cmf_get_current_user_id();
  21. $userModel = new UserModel();
  22. $user = $userModel->where('id', $userId)->find();
  23. $this->assign('user', $user);
  24. $m_wcca = new WcCompayApplyModel();
  25. $wccainfo = $m_wcca->find(['userid' => $userId]);
  26. if ($wccainfo) {
  27. $m_ea = new EnterpriseApplyJoinPlatformModel();
  28. $edinfo = $m_ea->find(['id' => $wccainfo['wc_compay_apply_id']]);
  29. $edinfo = $edinfo->toArray();
  30. } else {
  31. $edinfo = [
  32. 'companyname' => '',
  33. 'contactname' => '',
  34. 'telno' => '',
  35. 'licensephoto' => '',
  36. ];
  37. }
  38. $this->assign($edinfo);
  39. return $this->fetch(':company/index');
  40. }
  41. /**
  42. * 增加企业申请信息
  43. *
  44. * @return void
  45. * @author wj
  46. * @date 2025-09-08
  47. */
  48. public function addenterpriseapplyjoinplatform() {
  49. if ($this->request->isPost()) {
  50. $postData = $this->request->post();
  51. $userid = $postData['userid'];
  52. $m_wcca = new WcCompayApplyModel();
  53. $wccainfo = $m_wcca->find(['userid' => $userid]);
  54. $m_ea = new EnterpriseApplyJoinPlatformModel();
  55. if ($wccainfo) {
  56. //修改
  57. $postData['id'] = $wccainfo['wc_compay_apply_id'];
  58. $m_ea->updateinfo($postData);
  59. } else {
  60. //新增
  61. unset($postData['userid']);
  62. $id = $m_ea->addinfo($postData);
  63. $data = [
  64. 'wc_compay_apply_id' => $id,
  65. 'userid' => $userid,
  66. ];
  67. $id = $m_wcca->insertGetId($data);
  68. }
  69. $this->success('保存成功!');
  70. }
  71. }
  72. }