EnterpriseApplyJoinPlatformModel.php 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  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\model;
  12. use app\admin\model\RouteModel;
  13. use think\Model;
  14. use tree\Tree;
  15. use think\db\Query;
  16. class EnterpriseApplyJoinPlatformModel extends Model {
  17. /**
  18. * 模型名称
  19. * @var string
  20. */
  21. protected $name = 't_enterprise_apply_join_platform';
  22. protected $connection = 'watercat';
  23. protected $type = [
  24. 'more' => 'array',
  25. ];
  26. public function addinfo($data) {
  27. $id = $this->insertGetId($data);
  28. return $id;
  29. }
  30. public function updateinfo($data) {
  31. $id = $data['id'];
  32. unset($data['id']);
  33. $info = $this->find(['id' => $id]);
  34. $fields = ['contactname', 'companyname', 'licensephoto'];
  35. $updateData = [];
  36. foreach ($fields as $key => $value) {
  37. if (!empty($data[$value]) && $data[$value] != $info[$info]) {
  38. $updateData[$value] = $data[$value];
  39. }
  40. }
  41. if (!empty($updateData)) {
  42. $where = ['id', $data['id']];
  43. $this->update($updateData, $where);
  44. }
  45. }
  46. }