SystemGroupData.php 851 B

123456789101112131415161718192021222324252627282930313233
  1. <?php
  2. namespace app\models\system;
  3. use crmeb\basic\BaseModel;
  4. use crmeb\traits\ModelTrait;
  5. class SystemGroupData extends BaseModel
  6. {
  7. use ModelTrait;
  8. /**
  9. * 根据id获取当前记录中的数据
  10. * @param $id
  11. * @return mixed
  12. * @throws \think\db\exception\DataNotFoundException
  13. * @throws \think\db\exception\ModelNotFoundException
  14. * @throws \think\exception\DbException
  15. */
  16. public static function getDateValue($id)
  17. {
  18. $value = self::alias('a')->where(array("id" => $id))->find();
  19. if (!$value) {
  20. return false;
  21. }
  22. $data["id"] = $value["id"];
  23. $fields = json_decode($value["value"], true);
  24. foreach ($fields as $index => $field) {
  25. $data[$index] = $field["value"];
  26. }
  27. return $data;
  28. }
  29. }