/** * 执行登录的动作 */ public function doLogin(ZOL_Request $input, ZOL_Response $output) { $phone = $input->post("phone"); $passwd = $input->post("passwd"); if (empty($phone) || empty($passwd)) { $this->showRegErrorMsg("请输入完整"); } if (!preg_match("#^1\\d{10}\$#", $phone, $mt)) { $this->showRegErrorMsg("手机号输入错误"); } //获得登录信息 $loginInfo = Helper_Yun_Member::getLoginInfo(array('phone' => $phone)); if (!$loginInfo) { //已经注册过了 $this->showLoginErrorMsg("<a href='?c=M_Member&a=RegShow'>该手机号还没有注册过,请注册</a>"); } $passwd = Helper_Yun_Member::mkLoginPasswd(array('passwd' => $passwd, 'salt' => $phone)); if ($passwd == $loginInfo["passwd"]) { $output->message = "恭喜您,登录成功"; $this->showMessage($input, $output); } else { $this->showLoginErrorMsg("用户名或密码错误"); } exit; }
/** * 获得数据列表 */ public function doDefault(ZOL_Request $input, ZOL_Response $output) { $wArr = array(); #搜索字段 $whereSql = ""; $page = (int) $input->get('page') < 1 ? 1 : (int) $input->get('page'); $output->sername = $wArr['name'] = $input->get('name'); $output->serphone = $wArr['phone'] = $input->get('phone'); $output->sercardno = $wArr['cardno'] = $input->get('cardno'); $output->sercateId = $wArr['cateId'] = $input->get('cateId'); if (!empty($wArr)) { foreach ($wArr as $k => $v) { if (gettype($v) == 'string') { $whereSql .= !empty($v) ? ' AND ' . $k . ' like binary "%' . $v . '%" ' : ''; } else { $whereSql .= !empty($v) ? ' AND ' . $k . '=' . $v : ''; } } } $pageUrl = "?c={$output->ctlName}&a={$output->actName}&page={$page}&name={$wArr['name']}&phone={$wArr['phone']}&cardno={$wArr['cardno']}&cateId={$wArr['cateId']}"; $pageSize = 30; $orderSql = "order by id desc"; $data = Helper_Dao::getList(array('dbName' => "Db_AndyouYun", 'tblName' => "member", 'cols' => "*", 'pageSize' => $pageSize, 'page' => $page, 'pageUrl' => $pageUrl, 'whereSql' => $whereSql, 'orderSql' => $orderSql, 'iswrite' => true, 'pageTpl' => 9)); if ($data) { $output->pageBar = $data['pageBar']; $output->allCnt = $data['allCnt']; $output->data = $data['data']; $output->pageUrl = $pageUrl; } $output->memberCate = Helper_Yun_Member::getMemberCatePairs(); //获得所有的员工 $output->staffArr = Helper_Yun_Staff::getStaffPairs(); $output->setTemplate('Member'); }
public function doLogin(ZOL_Request $input, ZOL_Response $output) { $userId = $input->post("userId"); $passWd = $input->post("passwd"); $rtnFlag = Helper_Yun_Member::login(array('userId' => $userId, 'password' => $passWd)); if ($rtnFlag == 1) { #µÇ¼OK header("Location:?c=Member"); exit; } else { #µÇ¼ʧ°Ü Helper_Front::JumpToLogin(array('msg' => 'Óû§Ãû»òÃÜÂë´íÎó')); } }
/** * 父类的Validate */ public function baseValidate(ZOL_Request $input, ZOL_Response $output) { $output->execName = $input->execName = $input->getExecName(); $output->actName = $input->actName = $input->getActionName(); $output->ctlName = $input->ctlName = $input->getControllerName(); $output->admin = $input->cookie(Helper_Yun_Member::$strUid); $output->userId = $input->cookie(Helper_Yun_Member::$strUid); #用户名 $cipher = $input->cookie(Helper_Yun_Member::$strCipher); $output->sysCfg = Helper_Yun_Option::getAllOptions(); $output->sysName = empty($output->sysCfg['SysName']) ? "" : $output->sysCfg['SysName']["value"]; if (!$output->noLoginCheck) { #验证登录 $output->isLogin = Helper_Yun_Member::checkLogin(array('userid' => $output->userId, 'cipher' => $cipher)); if (!$output->isLogin) { #如果登录不OK $backUrl = isset($_SERVER['REQUEST_URI']) ? 'http://' . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'] : ''; if (strpos($backUrl, "Login")) { $backUrl = ""; } Helper_Front::JumpToLogin(array('backUrl' => $backUrl)); } } #获得管理员身份 $output->adminInfo = Helper_Yun_AdminUser::getAdminUserInfo(array('userId' => $output->userId)); $output->adminType = (int) $output->adminInfo["isAdmin"]; //管理员类型,用于权限判断 if ($output->permission && !in_array($output->adminType, $output->permission)) { echo "Permission denied"; exit; } //所有站点的名字 $output->siteNames = ZOL_Config::get("Yun_Sites", "NAMES"); #头尾html $output->header = $output->fetchCol("Part/Header"); //左侧 $output->navi = $output->fetchCol("Part/Navi"); $output->footer = $output->fetchCol("Part/Footer"); return true; return true; }
if (!$isAddUser) { ?> <th>会员</th> <?php } ?> <th>备注</th><th>站点</th> </tr> </thead> <tbody> <?php if ($data) { foreach ($data as $v) { $memName = "-"; if ($v['phone']) { $memInfo = Helper_Yun_Member::getMemberInfo(array("phone" => $v['phone'])); $memName = $memInfo["name"]; } $outStr = '<tr>'; $bno = $v['isBuyScore'] ? "<font color='blue'>S" . $v['bno'] . '</font>' : $v['bno']; $outStr .= '<td>' . $bno . '</td>'; //$outStr.='<td style="text-align:left;">'.$v['useScore'].($v['useScore'] ? " <span style='color:#999999'>(".$v['useScoreAsMoney']."元)</span>" : "").'</td>';// $outStr .= '<td>' . round($v['orgPrice'] / 100, 2) . '</td>'; $outStr .= '<td>' . $v['discount'] . '</td>'; if (!$isAddUser) { $outStr .= '<td>' . $v['useScore'] . '</td>'; $outStr .= '<td>' . $v['useCard'] . '</td>'; } if ($v['priceTrue']) { //如果销售员修改了价格,记录 $outStr .= '<td style="color:red;font-weight:bold" title="销售员修改了价格,原价:' . round($v['priceTrue'] / 100) . '">' . round($v['price'] / 100) . '</td>';
/** * 获得一条会员信息 */ public static function getMemberInfo($params) { $options = array('id' => false, 'phone' => false, 'cardno' => false, 'phoneOrCardno' => false, 'name' => false); if (is_array($params)) { $options = array_merge($options, $params); } extract($options); $whereSql = ''; if (!$id && !$phone && !$name && !$phoneOrCardno) { return false; } if ($id) { $whereSql .= "and id = '{$id}' "; } if ($phone) { $whereSql .= "and phone = '{$phone}' "; } if ($cardno) { $whereSql .= "and cardno = '{$cardno}' "; } if ($phoneOrCardno) { $whereSql .= "and (cardno = '{$phoneOrCardno}' or phone = '{$phoneOrCardno}') "; } if ($name) { $whereSql .= "and name like '%{$name}%' "; } $data = Helper_Dao::getRow(array('dbName' => 'Db_AndyouYun', 'tblName' => 'member', 'cols' => '*', 'whereSql' => $whereSql)); //获得会员类型 $memberCate = Helper_Yun_Member::getMemberCateInfoPairs(); if ($data) { if (isset($memberCate[$data["cateId"]])) { $data['cateName'] = $memberCate[$data["cateId"]]["name"]; $data['discount'] = $memberCate[$data["cateId"]]["discount"]; if ($memberCate[$data["cateId"]]['discountStr']) { //折扣的分类 $data['discountArr'] = json_decode($memberCate[$data["cateId"]]['discountStr'], true); } } else { $data['cateName'] = "未分类"; $data['discount'] = 1; } } return $data; }