12345678910111213141516171819202122232425262728293031323334353637383940414243 |
- <?php
-
- namespace app\admin\model;
-
- use think\Model;
-
- class Zd extends Model
- {
-
- public function getAll($param)
- {
- $result = $this->where($param)->find();
- $result['info'] = json_decode($result['info'], true);
- return ['rows' => $result];
- }
-
- public function getZdSelect($param)
- {
- $result = $this->where($param)->field('info')->select();
- $arr = [];
- foreach ($result as $k => $v) {
- $result[$k]['value'] = json_decode($result[$k]['info'], true);
- foreach ($result[$k]['value'] as $kk => $vv) {
- if (!empty($vv)) {
- $arr[$kk]['label'] = $vv;
- $arr[$kk]['value'] = $vv;
- }
- }
- }
- return ['rows' => $arr];
- }
-
- // public function read($param)
- // {
- // $result = $this->where($this->getPk(), $param[$this->getPk()])->find();
- // if (isset($result[$this->getPk()])) {
- // return $result->toArray();
- // } else {
- // return [];
- // }
- // }
-
- }
|