public function balance() { $userinfo = session('P'); $info = M('Addonseduinfo')->where(array('fromusername' => $userinfo['fromusername']))->field('xuehao,headimg')->find(); Amango_Addons_Import('Xitlibrary.php', 'Xitedu'); //导入 $Jmuedu = new \Xitlibrary(); $moneylist = $Jmuedu->ykt_login($info['xuehao'], $info['headimg']); $this->assign('yue', str_replace('¥', '', $moneylist['list'][0][3])); $this->assign('total', str_replace('¥', '', $moneylist['total']['total'])); $this->assign('list', $moneylist['list']); $this->display(); }
public function ykt_model() { global $_P; $info = $this->has_xuehao($_P['fromusername']); Amango_Addons_Import('Xitlibrary.php', 'Xitedu'); //导入 $Jmuedu = new \Xitlibrary(); $group = $Jmuedu->ykt_login($info['xuehao'], $info['headimg']); if (empty($group['total']['name'])) { $autolink = $this->create_loginurl('profile'); $errmsg = "❶.未绑定通行证?点击本图文进入绑定"; $errurl = array($autolink, '出错'); $this->error($errmsg, $errurl, 'dantw', '未绑定学号!点击绑定'); } $article[0] = array('Title' => $group['total']['name'] . " 一卡通记录", 'Description' => "-", 'PicUrl' => ADDON_PUBLIC . 'img/logo.jpg', 'Url' => $this->create_loginurl('balance')); $totalnums = count($group['other']); if ($totalnums <= 3) { $other = "\n【餐费支出】:" . $this->is_nomoney($group['other'][0]) . "\n【购物支出】:" . $this->is_nomoney($group['other'][1]) . "\n【用电支出】:0\n【其他支出】:" . $this->is_nomoney($group['other'][2]); } else { $other = "\n【餐费支出】:" . $this->is_nomoney($group['other'][0]) . "\n【购物支出】:" . $this->is_nomoney($group['other'][1]) . "\n【用电支出】:" . $this->is_nomoney($group['other'][2]) . "\n【其他支出】:" . $this->is_nomoney($group['other'][3]); } $article[1] = array('Title' => "可用余额 | " . str_replace('-', '', $group['list'][0][3]) . "\n累计消费 | ¥" . $group['total']['total'] . "\n" . $other, 'Description' => "-222-", 'PicUrl' => "", 'Url' => $this->create_loginurl('balance')); $list = $group['list']; $str = ''; $i = 0; foreach ($list as $key => $value) { if ($i > 2) { break; } else { $str .= "\n--------------------\n时间:" . $value[0] . "\n类型:" . $value[1] . "\n消费:" . $value[2] . "\n地点:" . $value[4]; } $i++; } if (empty($str)) { $str = "\n暂无消费记录"; } $article[2] = array('Title' => "【消费记录】" . $str, 'Description' => "-222-", 'PicUrl' => "", 'Url' => $this->create_loginurl('balance')); $this->assign('Duotw', $article); $this->display(); }