__('Isrec 0'), '1' => __('Isrec 1')]; } public function getStatusList() { return ['-1' => __('Status -1'), '0' => __('Status 0'), '1' => __('Status 1'), '2' => __('Status 2'), '3' => __('Status 3'), '4' => __('Status 4')]; } public function getIsrecTextAttr($value, $data) { $value = $value ? $value : (isset($data['isrec']) ? $data['isrec'] : ''); $list = $this->getIsrecList(); return isset($list[$value]) ? $list[$value] : ''; } public function getStatusTextAttr($value, $data) { $value = $value ? $value : (isset($data['status']) ? $data['status'] : ''); $list = $this->getStatusList(); return isset($list[$value]) ? $list[$value] : ''; } public static function help_create($where) { self::beginTrans(); try { $res = self::create($where); $where['help_id'] = $res['id']; $res1 = HelpExt::create($where); foreach ($where['family'] as $v) { $v['cid'] = $where['cid']; $v['help_id'] = $res['id']; if(isset($v['full_name']) && isset($v['relation'])) { HelpFamily::create($v); } } self::commitTrans(); return $res; }catch (Exception $e) { self::setErrorInfo($e->getMessage(),true); } } public static function lst($where) { $model = new self; if(isset($where['cid']) && $where['cid']>0) $model->where('cid',$where['cid']); if(isset($where['user_id']) && $where['user_id']>0) $model->where('user_id',$where['user_id']); if(isset($where['category_id']) && $where['category_id']>0) $model->where('category_id',$where['category_id']); if(isset($where['status']) && $where['status']>-2) $model->where('status',$where['status']); if(isset($where['is_rec']) && $where['is_rec']==1) $model->where('is_rec',$where['is_rec']); $data = $model->order('id desc')->page($where['page'],$where['limit'])->select(); return $data; } public static function info($cid,$id) { $info = self::where('cid',$cid)->where('id',$id)->find(); if(!$info)return self::setErrorInfo('非法数据'); $info['ext'] = HelpExt::where('help_id',$info['id'])->find(); $info['family'] = HelpFamily::where('help_id',$info['id'])->select(); $info['lave'] = Lave::lst(['cid'=>$cid,'paid'=>1,'help_id'=>$info['id']]); return $info; } }