コード例 #1
0
ファイル: StaffCate.php プロジェクト: dalinhuang/andyou
 /**
  * 获得数据列表
  */
 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');
     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']}";
     $pageSize = 30;
     $orderSql = "order by id desc";
     $data = Helper_Dao::getList(array('dbName' => "Db_Andyou", 'tblName' => "staffcate", '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->setTemplate('StaffCate');
 }
コード例 #2
0
ファイル: MemeberOtherPro.php プロジェクト: dalinhuang/andyou
 /**
  * 获得数据列表
  */
 public function doDefault(ZOL_Request $input, ZOL_Response $output)
 {
     $wArr = array();
     #搜索字段
     $whereSql = "";
     $page = (int) $input->get('page') < 1 ? 1 : (int) $input->get('page');
     $member = $input->get('member');
     if ($member) {
         $memInfo = Helper_Member::getMemberInfo(array('phoneOrCardno' => $member));
         if ($memInfo) {
             $output->memberId = $memInfo["id"];
         }
     }
     if ($output->serctype) {
         $whereSql .= " AND ctype = " . $output->serctype;
     }
     if ($output->memberId) {
         $whereSql .= " AND memberId = " . $output->memberId;
     }
     $pageUrl = "?c={$output->ctlName}&a={$output->actName}&page={$page}&memberId={$output->memberId}&ctype={$wArr['ctype']}";
     $pageSize = 30;
     $orderSql = "order by id desc";
     $data = Helper_Dao::getList(array('dbName' => "Db_Andyou", 'tblName' => "memeberotherpro", '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->member = $member;
     $output->proCtypeArr = ZOL_Config::get("GLOBAL", "PRO_CTYPE");
     $output->setTemplate('MemeberOtherPro');
 }
コード例 #3
0
ファイル: LogScoreChange.php プロジェクト: dalinhuang/andyou
 /**
  * 获得数据列表
  */
 public function doDefault(ZOL_Request $input, ZOL_Response $output)
 {
     $wArr = array();
     #搜索字段
     $whereSql = "";
     $page = (int) $input->get('page') < 1 ? 1 : (int) $input->get('page');
     $output->memberPhone = $input->get("memberPhone");
     //会员电话
     $output->memberNm = $input->get("memberNm");
     //会员姓名
     //获得会员信息
     $memInfo = Helper_Member::getMemberInfo(array('phone' => $output->memberPhone, 'name' => $output->memberNm));
     if ($memInfo) {
         $whereSql = " and memberId = {$memInfo['id']} ";
     }
     $pageUrl = "?c={$output->ctlName}&a={$output->actName}&page={$page}&memberPhone={$output->memberPhone}&memberNm={$output->memberNm}";
     $pageSize = 30;
     $orderSql = "order by id desc";
     $data = Helper_Dao::getList(array('dbName' => "Db_Andyou", 'tblName' => "log_scorechange", '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->setTemplate('LogScoreChange');
 }
コード例 #4
0
ファイル: Default.php プロジェクト: dalinhuang/andyou
 /**
  * 默认方法
  */
 public function doDefault(ZOL_Request $input, ZOL_Response $output)
 {
     //获得今天的收入情况
     $output->todayBillInfo = Helper_Bill::getDayIncome();
     //月度曲线
     $output->monthBillInfo = Helper_Bill::getDayIncome(array('startTm' => strtotime(date("Y-m-d 00:00:00", SYSTEM_TIME - 30 * 86400)), 'groupDay' => 1));
     $output->setTemplate('Default');
 }
コード例 #5
0
ファイル: Bills.php プロジェクト: dalinhuang/andyou
 /**
  * 获得数据列表
  */
 public function doDefault(ZOL_Request $input, ZOL_Response $output)
 {
     $wArr = array();
     #搜索字段
     $output->isAddUser = (int) $input->get("isAddUser");
     $whereSql = "";
     $page = (int) $input->get('page') < 1 ? 1 : (int) $input->get('page');
     $output->serbno = $wArr['bno'] = $input->get('bno');
     $output->serstaffid = $wArr['staffid'] = $input->get('staffid');
     $output->sermemberId = $wArr['memberId'] = $input->get('memberId');
     $output->sermemberPhone = $input->get('memberPhone');
     $output->isBuyScore = $input->get('isBuyScore');
     $output->hasChangePrice = (int) $input->get("hasChangePrice");
     //销售员修改过的订单
     //如果传入了会员电话
     if ($output->sermemberPhone) {
         $wArr['phone'] = $output->sermemberPhone;
     }
     if ($output->isBuyScore == 1) {
         $whereSql .= " and  isBuyScore = 1";
     }
     if ($output->isBuyScore == 2) {
         $whereSql .= " and  isBuyScore = 0";
     }
     //销售员修改了价格
     if ($output->hasChangePrice) {
         $whereSql .= " and  priceTrue > 0 ";
     }
     if (!empty($wArr)) {
         foreach ($wArr as $k => $v) {
             if (gettype($v) == 'string') {
                 if ($k == "phone") {
                     $whereSql .= !empty($v) ? ' AND ' . $k . '=' . $v : '';
                 } else {
                     $whereSql .= !empty($v) ? ' AND ' . $k . ' like binary "%' . $v . '%" ' : '';
                 }
             } else {
                 $whereSql .= !empty($v) ? ' AND ' . $k . '=' . $v : '';
             }
         }
     }
     if ($output->isAddUser) {
         $whereSql .= " AND memberId = 0 ";
     }
     $pageUrl = "?c={$output->ctlName}&a={$output->actName}&page={$page}&bno={$wArr['bno']}&isAddUser={$output->isAddUser}&staffid={$wArr['staffid']}&memberPhone={$output->sermemberPhone}&hasChangePrice={$output->hasChangePrice}";
     $pageSize = 30;
     $orderSql = "order by id desc";
     $data = Helper_Dao::getList(array('dbName' => "Db_AndyouYun", 'tblName' => "bills", '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->staffInfo = Helper_Yun_Staff::getSiteStaffPairs();
     $output->setTemplate('Bills');
 }
コード例 #6
0
ファイル: LogInStorage.php プロジェクト: dalinhuang/andyou
 /**
  * 获得数据列表
  */
 public function doDefault(ZOL_Request $input, ZOL_Response $output)
 {
     $wArr = array();
     #搜索字段
     $whereSql = "";
     $page = (int) $input->get('page') < 1 ? 1 : (int) $input->get('page');
     $output->serproId = $wArr['proId'] = $input->get('proId');
     $output->sercateId = $wArr['cateId'] = $input->get('cateId');
     $output->sername = $wArr['name'] = $input->get('name');
     $output->sercode = $wArr['code'] = $input->get('code');
     $output->startTime = $wArr['startTime'] = $input->get('startTime');
     $output->endTime = $wArr['endTime'] = $input->get('endTime');
     if ($output->sercateId) {
         $whereSql .= ' AND cateId =' . $output->sercateId;
     }
     if ($output->sercode) {
         $whereSql .= ' AND cateId =\'' . $output->sercode . '\'';
     }
     if ($output->sername) {
         $whereSql .= ' AND name like \'%' . $output->sername . '%\'';
     }
     if ($output->startTime) {
         $stm = strtotime($output->startTime . "00:00:00");
         $whereSql .= " AND dateTm > {$stm}";
     }
     if ($output->endTime) {
         $stm = strtotime($output->endTime . "23:59:59");
         $whereSql .= " AND dateTm < {$stm}";
     }
     $pageUrl = "?c={$output->ctlName}&a={$output->actName}&page={$page}&proId={$wArr['proId']}&cateId={$wArr['cateId']}&name={$wArr['name']}&code={$wArr['code']}&startTime={$wArr['startTime']}&endTime={$wArr['endTime']}";
     $pageSize = 30;
     $orderSql = "order by id desc";
     $data = Helper_Dao::getList(array('dbName' => "Db_Andyou", 'tblName' => "log_productinstorage", '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->proCateArr = Helper_Product::getProductCatePairs();
     $output->setTemplate('LogInStorage');
 }
コード例 #7
0
ファイル: Abstract.php プロジェクト: dalinhuang/andyou
 /**
  * 父类的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;
 }
コード例 #8
0
 public function doDone(ZOL_Request $input, ZOL_Response $output)
 {
     $otherProIdArr = $input->post("otherProId");
     //所有商品
     $staffid = (int) $input->post("staffid");
     //员工
     $remark = $input->post("remark");
     //填写的备注
     $memberId = (int) $input->post("memberId");
     //会员ID
     if (!$staffid || empty($otherProIdArr)) {
         $this->showErrMsg();
     }
     //获得会员信息
     $memberInfo = Helper_Member::getMemberInfo(array("id" => $memberId));
     if (!$memberInfo) {
         $this->showErrMsg();
     }
     //获得商品列表
     $proInfoArr = array();
     foreach ($otherProIdArr as $id) {
         $info = Helper_Product::getMemberOtherPro(array('id' => $id, 'memberId' => $memberId));
         if ($info && $info["num"] > 0) {
             //筛选一下商品
             $proInfoArr[] = $info;
         }
     }
     //生成一个单号
     $bno = Helper_Bill::getCommonMaxBno();
     $db = Db_Andyou::instance();
     if ($proInfoArr) {
         foreach ($proInfoArr as $info) {
             //数量减少
             $sql = "update memeberotherpro set num = num - 1 where id = " . $info["id"];
             $db->query($sql);
             //记录消费日志
             $tmpLogRow = array('memberId' => $memberId, 'phone' => $memberInfo["phone"], 'otherproId' => $info["id"], 'name' => $info["name"], 'direction' => 1, 'cvalue' => 1, 'orgcvalue' => $info["num"], 'ctype' => $info["ctype"], 'dateTm' => SYSTEM_TIME, 'staffid' => $staffid, 'bno' => $bno, 'remark' => $remark);
             Helper_Dao::insertItem(array('addItem' => $tmpLogRow, 'dbName' => 'Db_Andyou', 'tblName' => 'log_useotherpro'));
         }
     }
     $staffArr = Helper_Staff::getStaffPairs();
     //准备进入打印页面
     $output->proInfoArr = $proInfoArr;
     $output->bno = $bno;
     $output->memberId = $memberId;
     $output->memberInfo = $memberInfo;
     //会员信息
     $output->staffid = $staffid;
     $output->staffName = $staffArr[$staffid];
     Helper_Bill::createOneCommonBno();
     //生成一个通用订单号
     $output->setTemplate('OtherProPrint');
 }
コード例 #9
0
ファイル: ProductSm.php プロジェクト: dalinhuang/andyou
 /**
  * 获得数据列表
  */
 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->sercode = $wArr['code'] = $input->get('code');
     $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']}&code={$wArr['code']}&cateId={$wArr['cateId']}";
     $pageSize = 30;
     $orderSql = "order by id desc";
     $data = Helper_Dao::getList(array('dbName' => "Db_Andyou", 'tblName' => "product", 'cols' => "*", 'pageSize' => $pageSize, 'page' => $page, 'pageUrl' => $pageUrl, 'whereSql' => $whereSql, 'orderSql' => $orderSql, 'iswrite' => true, 'pageTpl' => 9));
     //获得符合条件的库存总量
     $db = Db_Andyou::instance();
     $sql = "select sum(stock) sumstock,sum(stock*price) sumprice from product where ctype = 1 {$whereSql}";
     $tmp = $db->getRow($sql);
     $output->sumstock = $tmp["sumstock"];
     $output->sumprice = $tmp["sumprice"];
     if ($data) {
         $output->pageBar = $data['pageBar'];
         $output->allCnt = $data['allCnt'];
         $output->data = $data['data'];
         $output->pageUrl = $pageUrl;
     }
     $output->cateInfo = Helper_Product::getProductCatePairs();
     $output->setTemplate('ProductSm');
 }
コード例 #10
0
ファイル: Product.php プロジェクト: dalinhuang/andyou
 /**
  * 获得数据列表
  */
 public function doSendTable(ZOL_Request $input, ZOL_Response $output)
 {
     header("Pragma: no-cache");
     header('Content-type: application/x-msexcel;charset=utf-8');
     header("Content-Disposition: attachment; filename=商品数据_" . date('Y-m-d H:i:s') . ".xls");
     $wArr = array();
     #搜索字段
     $whereSql = "";
     $output->sername = $wArr['name'] = $input->get('name');
     $output->sercode = $wArr['code'] = $input->get('code');
     $output->sercateId = $wArr['cateId'] = $input->get('cateId');
     if (!empty($wArr)) {
         foreach ($wArr as $k => $v) {
             if ($k == 'cateId' && $v) {
                 $whereSql .= ' AND cateId =' . $v;
             } elseif ($k == 'code' && $v) {
                 $whereSql .= ' AND code =\'' . $v . "'";
             } else {
                 if (gettype($v) == 'string') {
                     $whereSql .= !empty($v) ? ' AND ' . $k . ' like binary "%' . $v . '%" ' : '';
                 } else {
                     $whereSql .= !empty($v) ? ' AND ' . $k . '=' . $v : '';
                 }
             }
         }
     }
     $pageSize = 100000;
     $orderSql = "order by id desc";
     $data = Helper_Dao::getList(array('dbName' => "Db_AndyouYun", 'tblName' => "product", 'cols' => "*", 'pageSize' => $pageSize, 'page' => 1, '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->cateInfo = Helper_Product::getProductCatePairs();
     //获得所有的种类
     $output->proCtype = ZOL_Config::get("GLOBAL", "PRO_CTYPE");
     $html = $output->fetchCol('ProductToExcel');
     echo mb_convert_encoding($html, "utf-8", "gbk");
     exit;
 }
コード例 #11
0
ファイル: Abstract.php プロジェクト: dalinhuang/andyou
 protected function showMessage(ZOL_Request $input, ZOL_Response $output)
 {
     echo $output->fetchCol("M/Message");
     exit;
 }
コード例 #12
0
ファイル: Checkout.php プロジェクト: dalinhuang/andyou
 public function doDone(ZOL_Request $input, ZOL_Response $output)
 {
     $billInfo = $input->post("bill");
     $itemIdArr = $input->post("item_id");
     //所有产品ID
     $itemDiscArr = $input->post("item_disc");
     //所有产品折扣
     $itemNumArr = $input->post("item_num");
     //所有产品产品数量
     $staffid = (int) $input->post("staffid");
     //员工
     $isBuyScore = (int) $input->post("isBuyScore");
     //是否是从积分兑换页面的提交
     $remark = $input->post("remark");
     //填写的备注
     $endSumModifyFlag = (int) $input->post("endSumModifyFlag");
     //是否手工调整了最总价格
     $endBillPrice = $billInfo["bill_end_sum"];
     //最终的价格,这个价格是可以修改的
     $db = Db_Andyou::instance();
     //----------------------
     //获得会员信息
     //----------------------
     $memberId = (int) $input->post("memberId");
     //会员ID
     $memberInfo = Helper_Member::getMemberInfo(array("id" => $memberId));
     if ($memberInfo) {
         $memberScore = $memberInfo["score"];
         //会员的积分
         $memberCard = $memberInfo["balance"];
         //会员的卡内余额
     } else {
         //如果没有这个会员
         $memberScore = $memberCard = 0;
         $billInfo["bill_member_card"] = 0;
         //传递过来的会员扣费,强制失效掉
         $billInfo["bill_member_score"] = 0;
     }
     //----------------------
     //获得说有的商品信息
     //----------------------
     $proInfoArr = array();
     $sumPrice = 0;
     //原价总金额
     $orgSumPrice = 0;
     //商品总额
     //折扣获得的金额
     $discGetMoney = 0;
     //记录所有商品的总价格
     $itemSumPrice = 0;
     //判断是否购买了其他的服务,如次卡
     $hasBuyOtherPro = false;
     $otherProItemArr = array();
     if ($itemIdArr) {
         foreach ($itemIdArr as $idx => $pid) {
             $proInfo = Helper_Product::getProductInfo(array('id' => $pid));
             $num = (int) $itemNumArr[$idx];
             $price = $num * $proInfo["oprice"] * $itemDiscArr[$idx];
             $orgSumPrice += $num * $proInfo["oprice"];
             $sumPrice += $price;
             $itemSumPrice += $price;
             $proInfoArr[] = array('proId' => $pid, 'num' => $num, 'discount' => $itemDiscArr[$idx], 'price' => $price, 'staffid' => $staffid);
             if ($proInfo["ctype"] != 1) {
                 //购买非商品类的服务
                 $hasBuyOtherPro = true;
                 $otherProItemArr[] = array('info' => $proInfo, 'num' => $num);
             }
         }
     }
     //生成一个单号
     #$bno = Helper_Bill::getMaxBno();
     $bno = Helper_Bill::getCommonMaxBno();
     //----------------------
     //计算总金额
     //----------------------
     $billDisc = $billInfo["bill_disc"];
     //总折扣
     $sumPriceAftDisc = $sumPrice;
     //$orgSumPrice * $billDisc;//总折扣的价格  $sumPrice * $billDisc; //不可以给商品设置单价了
     $discGetMoney = $orgSumPrice - $sumPriceAftDisc;
     //折扣省下来的金额
     //扣除会员卡内余额
     $leftCard = $memberCard;
     //扣除后,卡内还有的余额
     $useCardFlag = false;
     $useCardMoney = 0;
     if ($sumPriceAftDisc && $memberCard && $billInfo["bill_member_card"]) {
         $useCard = min($memberCard, $billInfo["bill_member_card"]);
         $useCard = $useCard * 100;
         $useCard = min($useCard, $sumPriceAftDisc);
         //卡余额和收费的金额比较
         $leftCard = $memberCard - $useCard / 100;
         $useCardMoney = $useCard / 100;
         //记录用了多少卡的金额
         $sumPriceAftDisc = $sumPriceAftDisc - $useCard;
         $useCardFlag = true;
     }
     //会员积分计算
     $sysOptions = Helper_Option::getAllOptions();
     $scoreRatio = !empty($sysOptions["ScoreRatio"]) ? $sysOptions["ScoreRatio"]["value"] : 0;
     $useScore = (int) $billInfo["bill_member_score"];
     if ($useScore && $memberScore > 0) {
         $duihuanRatio = !empty($sysOptions["DuihuanRatio"]) ? $sysOptions["DuihuanRatio"]["value"] : 0;
         $sumPriceAftDisc = $sumPriceAftDisc - round($useScore / $duihuanRatio) * 100;
     }
     /*
              * 先不用会员积分了
             if($sumPriceAftDisc && $memberScore && $billInfo["bill_member_score"]){
                 $useScore = min($memberScore,$billInfo["bill_member_score"]);//需要花多少积分,避免比用户的积分还多
                 
                 //将用户的积分转换成钱
                 $scoreMoney = round($useScore / $scoreRatio,2);// 9 = 270 /30
                 $scoreMoney = $scoreMoney * 100;             // 900 = 9 * 100
                 $scoreMoney = min($scoreMoney,$sumPriceAftDisc); //避免花费的积分比剩余金额还多 
                 
                 $sumPriceAftDisc = $sumPriceAftDisc - $scoreMoney;
                 
             }*/
     //获得订单的信息
     $sumPriceAftDisc = round($sumPriceAftDisc / 100) * 100;
     //金额的四舍五入
     $billDetail = array('useScore' => $useScore, 'useScoreAsMoney' => round($scoreMoney / 100, 2), 'useCard' => $billInfo["bill_member_card"], 'price' => $sumPriceAftDisc, 'discount' => $billDisc, 'orgPrice' => $orgSumPrice, 'staffid' => $staffid, 'memberId' => $memberId, 'bno' => $bno, 'tm' => SYSTEM_TIME, 'dateDay' => date("Ymd"), 'memberScore' => $memberScore, 'memberCard' => $memberCard, 'remark' => $remark, 'isBuyScore' => $isBuyScore);
     if ($memberInfo) {
         $billDetail["phone"] = $memberInfo["phone"];
     }
     //如果销售眼前台修改了应收款,不是计算出来的,就记录
     if ($endSumModifyFlag) {
         if ($sumPriceAftDisc != $endBillPrice) {
             $billDetail["priceTrue"] = $billDetail["price"];
             $billDetail["price"] = $endBillPrice * 100;
             //使用销售员修改的
         }
     }
     //积分的重新计算
     //         =  积分剩余额                                    +  实际消费产品的积分
     $leftScore = $memberScore - (int) $billDetail["useScore"] + ($billDetail["price"] / 100 + $billDetail["useCard"]) * $scoreRatio;
     $memLeftInfo = array();
     $memLeftInfo['score'] = round($leftScore);
     if ($useCardFlag) {
         //使用了会员卡
         $memLeftInfo['balance'] = $leftCard;
     }
     //计算用户的总消费额
     $memLeftInfo['allsum'] = $memberInfo['allsum'] + $endBillPrice + $billInfo["bill_member_card"];
     //记入订单库
     $output->newScore = (int) (($billDetail['useCard'] + $billDetail['price'] / 100) * $scoreRatio);
     //获得的积分
     $billDetail["getScore"] = $output->newScore;
     $bid = Helper_Dao::insertItem(array('addItem' => $billDetail, 'dbName' => 'Db_Andyou', 'tblName' => 'bills'));
     //记入订单详情
     if ($proInfoArr) {
         foreach ($proInfoArr as $item) {
             //补充信息
             $item["bid"] = $bid;
             $item["bno"] = $bno;
             $item["memberId"] = $memberId;
             $item["tm"] = SYSTEM_TIME;
             Helper_Dao::insertItem(array('addItem' => $item, 'dbName' => 'Db_Andyou', 'tblName' => 'billsitem'));
         }
     }
     //更新用户详情信息
     Helper_Dao::updateItem(array('editItem' => $memLeftInfo, 'dbName' => 'Db_Andyou', 'tblName' => 'member', 'where' => ' id=' . $memberId));
     $staffArr = Helper_Staff::getStaffPairs();
     //更新商品的库存情况
     if ($itemIdArr) {
         foreach ($itemIdArr as $idx => $pid) {
             $num = (int) $itemNumArr[$idx];
             $db->query("update product set stock = stock - {$num} where id =  {$pid} ");
             /*
                            $proInfo = Helper_Product::getProductInfo(array('id'=>$pid));
                            $stock   = (int)$proInfo["stock"];
                            if($stock){
                $num = (int)$itemNumArr[$idx];
                $stock = $stock - $num;
                //if($stock < 0)$stock = 0; 不限制负数了,一直减下去
                
                 Helper_Dao::updateItem(array(
                         'editItem'       =>  array("stock"=>$stock),
                         'dbName'         =>  'Db_Andyou',
                         'tblName'        =>  'product',
                         'where'          =>  ' id=' . $pid, 
                 ));
                
                            }
             */
         }
     }
     //记录积分历史
     if ($output->newScore && $memberId) {
         //记录自己的积分历史
         Helper_Member::addScoreLog(array('memberId' => $memberId, 'direction' => 0, 'score' => $output->newScore, 'orgScore' => $memberInfo["score"], 'bno' => $bno, 'remark' => '消费'));
         //给介绍人增加积分
         if ($sysOptions && !empty($sysOptions["MemberParentRatio"]) && !empty($sysOptions["MemberParentRatio"]["value"])) {
             $introducerId = $memberInfo["introducerId"];
             $introducer = $memberInfo["introducer"];
             if (empty($memberInfo["allsum"])) {
                 //如果用户从来没有消费过,也就是第一次消费才给介绍人增加积分
                 if (!$introducerId || !$introducer) {
                     #如果没有ID,就尝试活儿
                     $introInfo = Helper_Member::getMemberInfo(array('phone' => $introducer, 'id' => $introducerId));
                     $introducerId = $introInfo["id"];
                     $iscore = $output->newScore * $sysOptions["MemberParentRatio"]["value"];
                     //更新积分
                     $sql = "update member set score = score + {$iscore}  where id = {$introducerId}";
                     $db->query($sql);
                     //记录积分
                     Helper_Member::addScoreLog(array('memberId' => $introducerId, 'direction' => 0, 'score' => $iscore, 'orgScore' => $introInfo["score"], 'bno' => $bno, 'remark' => '介绍【' . $memberInfo["phone"] . "-" . $memberInfo["name"] . '】消费得积分' . $output->newScore . '*' . $sysOptions["MemberParentRatio"]["value"]));
                 }
             }
         }
     }
     //记录会员会员卡使用记录
     if ($memberId && $billDetail["useCard"]) {
         Helper_Member::addCardLog(array('memberId' => $memberId, 'direction' => 1, 'card' => $billDetail["useCard"], 'orgCard' => $memberInfo["balance"], 'bno' => $bno, 'remark' => '消费'));
     }
     //记录会员会员卡使用记录
     if ($memberId && $billDetail["useScore"]) {
         Helper_Member::addScoreLog(array('memberId' => $memberId, 'direction' => 1, 'score' => $billDetail["useScore"], 'orgScore' => $memberInfo["score"], 'bno' => $bno, 'remark' => '积分兑换'));
     }
     //记录订单的一些额外的信息,但是不记录到数据库
     $billDetail['itemSumPrice'] = $itemSumPrice;
     //所有商品折扣后的累计金额
     //购买了其他商品的服务,如次卡
     if ($hasBuyOtherPro && $memberId) {
         foreach ($otherProItemArr as $re) {
             $info = $re["info"];
             $num = (int) $re["num"];
             $tmpRow = array('memberId' => $memberId, 'phone' => $memberInfo["phone"], 'proId' => $info["id"], 'name' => $info["othername"], 'proName' => $info["name"], 'num' => $info["num"], 'ctype' => $info["ctype"], 'buytm' => SYSTEM_TIME);
             $tmpLogRow = array('memberId' => $memberId, 'phone' => $memberInfo["phone"], 'otherproId' => $info["id"], 'name' => $info["othername"], 'direction' => 0, 'cvalue' => $info["num"], 'orgcvalue' => 0, 'ctype' => $info["ctype"], 'dateTm' => SYSTEM_TIME, 'staffid' => $staffid, 'bno' => $bno);
             //记录用户的所有服务
             for ($i = 0; $i < $num; $i++) {
                 Helper_Dao::insertItem(array('addItem' => $tmpRow, 'dbName' => 'Db_Andyou', 'tblName' => 'memeberotherpro'));
                 //数据变化日志
                 Helper_Dao::insertItem(array('addItem' => $tmpLogRow, 'dbName' => 'Db_Andyou', 'tblName' => 'log_useotherpro'));
             }
         }
     }
     //准备进入打印页面
     $output->bno = $bno;
     $output->bid = $bid;
     $output->bsn = substr(md5($bid . "HOOHAHA"), 0, 10);
     $output->billDetail = $billDetail;
     $output->proInfoArr = $proInfoArr;
     $output->memLeftInfo = $memLeftInfo;
     $output->staffid = $staffid;
     $output->staffName = $staffArr[$staffid];
     $output->memberInfo = $memberInfo;
     //会员信息
     $output->discGetMoney = $discGetMoney;
     //折扣省下的钱
     $output->orgSumPrice = $orgSumPrice;
     //原始总价
     $output->isBuyScore = $isBuyScore;
     Helper_Bill::createOneCommonBno();
     //生成一个通用订单号
     $output->setTemplate('BillPrint');
 }
コード例 #13
0
ファイル: Login.php プロジェクト: dalinhuang/andyou
 public function doToLogin(ZOL_Request $input, ZOL_Response $output)
 {
     $output->msg = $input->get("msg");
     $output->setTemplate('ToLogin');
 }
コード例 #14
0
ファイル: Default.php プロジェクト: dalinhuang/andyou
 /**
  * 默认方法
  */
 public function doDefault(ZOL_Request $input, ZOL_Response $output)
 {
     $output->setTemplate('Default');
 }
コード例 #15
0
ファイル: Select.php プロジェクト: dalinhuang/andyou
 /**
  * 产品线选择
  */
 public function doSelectSubcate(ZOL_Request $input, ZOL_Response $output)
 {
     $manuId = (int) $input->get('manuId');
     $subcateIdStr = $input->get('subcateIdStr');
     if ($subcateIdStr) {
         $subcateIdArr = explode(',', $subcateIdStr);
     }
     #取得所有品牌数据
     //        $dataArr = ZOL_Api::run("Pro.Cate.getSubcateByDb" , array(
     //            'manuId'  => $manuId, #品牌ID
     //            'noSecond'=> 1
     //        ));
     #数据源数组配置
     $dataArr = Helper_Pro_Pro::getSubcateTemp(array());
     if ($dataArr) {
         foreach ($dataArr as $key => $val) {
             if (isset($subcateIdArr) && in_array($val['subcateId'], $subcateIdArr)) {
                 continue;
             }
             $manuName = ZOL_String::trimWhitespace($val['name']);
             #获得首字母
             $tfl = API_Item_Base_String::getFirstLetter(array('input' => $manuName));
             if (!isset($outArr[$tfl])) {
                 $outArr[$tfl] = array('name' => $tfl, 'cons' => array());
             }
             $outArr[$tfl]['cons'][] = $val;
         }
         sort($outArr);
         $output->outArr = $outArr;
     }
     $output->setTemplate('Ajax/SelectSubcate');
 }
コード例 #16
0
ファイル: Index.php プロジェクト: suhanyujie/myFavorite
    /**
     * 接收表单 生成订单,并显示支付二维码
     * @param ZOL_Request $input
     * @param ZOL_Response $output
     */
    public function doDefault(ZOL_Request $input, ZOL_Response $output)
    {
        #队列异步回调的url的域名部分
        $baseUrl = 'http://reward.suhy.test.zol.com.cn';
        #支付的baseurl
        $payBaseUrl = 'http://10.19.38.115:8990';
        # 报错模板的html
        $errorHtml = $output->fetchCol('ShowPayError');
        # token验证
        if (!Helper_Reward_RewardFunc::verityRewardToken($input, $output)) {
            # 显示报错模板
            $errorArr = array('flag' => 'error', 'msg' => '请不要重复提交!', 'errorCode' => 8001, 'toLog' => 1, 'showHtml' => $errorHtml);
            Helper_Reward_RewardFunc::ajaxExit($errorArr);
        } else {
            # 重置该用户的token
            //验证的时候就已经重置了
        }
        if (!$output->url || !$output->money || !$output->articleId) {
            # 显示报错模板
            Helper_Reward_RewardFunc::ajaxExit(array('flag' => 'error', 'msg' => '金额不合法或缺少文章id', 'showHtml' => $errorHtml));
        }
        # 文章页的话的收款人是文章作者,其他业务的不同
        if ($output->ext1 <= 0) {
            $output->payee = Helper_Reward_RewardFunc::getArticleAuthor(array('articleId' => $output->articleId));
        } else {
        }
        $output->orderNo = Helper_Reward_RewardFunc::getOrderNumber();
        $output->userIp = ZOL_Api::run("Service.Area.getClientIp", array());
        /*
            	# 订单入库
            	$id = Helper_Reward_RewardModel::insertData(array(
            			'order_name'	=> $output->orderName,
            			'order_number'	=> $output->orderNo,
            			'article_id' 	=> $output->articleId,
            			'url'			=> $output->url,
            			'insert_date'  	=> SYSTEM_DATE,
            			'pay_time'		=> NULL,
            			'custmer'  		=> $output->userId,
            			'money'    		=> $output->money,
            			'message'		=> $output->message,
            			'payment'  		=> $output->payment,
            			'order_status'  => 0,
            			'payee'   		=> $output->payee,#
            			'service_type'  => 1,# 1资讯文章打赏 2.论坛(暂不支持)
            			#'debug'			=> 1,
            	));*/
        # 消息体/数据体
        $putQueueBody = array('order_name' => $output->orderName, 'order_number' => $output->orderNo, 'article_id' => $output->articleId, 'ext1' => $output->ext1, 'ext2' => $output->ext2, 'url' => $output->url, 'insert_date' => SYSTEM_DATE, 'pay_time' => NULL, 'custmer' => $output->userId, 'money' => $output->money, 'message' => $output->message, 'payment' => $output->payment, 'order_status' => 0, 'payee' => $output->payee, 'service_type' => $output->serviceType);
        $putQueueData = array('queue' => 'ArticleReward', 'producer' => iconv('GB2312', 'UTF-8//IGNORE', '媒体平台-打赏'), 'consumerUrls' => 'http://reward.suhy.test.zol.com.cn/?c=Queue_DealQueue&a=DealQueueOrder', 'msgType' => 'json', 'charset' => 'utf-8', 'priority' => 0, 'persistent' => true, 'version' => '1.0', 'content' => iconv('GBK', 'UTF-8//IGNORE', $output->message), 'flag' => 1, 'id' => 123, 'body' => api_json_encode($putQueueBody));
        #var_dump($putQueueData);exit();
        # 将订单数据推入队列,进行异步插入数据库
        $result = Libs_Reward_CurlRequest::curlPostMethod(array('url' => 'http://10.19.38.115:8990/queue/putmessage?queuename=ArticleReward&token=8951f7339caee44b23383cdded9a3d2b66', 'pull_data' => json_encode($putQueueData), 'data_type' => 'json'));
        $result = json_decode($result, true);
        # 如果800,则入队成功
        if ($result['resultCode'] != 800) {
            Helper_Reward_RewardFunc::ajaxExit(array('flag' => 'error', 'errorCode' => 8002, 'queueErrorCode' => $result['resultCode'], 'msg' => '[8002]生成订单失败!,加入队列失败!', 'toLog' => 1, 'showHtml' => $errorHtml));
        }
        # 此时已经是“分”作为单位
        $moneyCents = $output->money;
        # 默认支付宝
        $payType = 'alipay';
        switch ($output->payment) {
            case 1:
                $payType = 'alipay';
                break;
            case 2:
                $payType = 'wxpay';
                break;
        }
        $notifyUrl = 'http://reward.suhy.test.zol.com.cn/?c=Queue_DealQueue&amp;a=DealPayNotice&amp;sign=';
        $callbackUrl = 'http://reward.suhy.test.zol.com.cn/?c=FormHtml&amp;a=ShowPaySuccess';
        # 处理支付事宜,给支付网关发送xml
        $xmlStr = Libs_Reward_SimpleXML::getXmlStr(array('root_node' => 'xml', 'data_array' => array('partnerId' => 101, 'userId' => $output->userId, 'orderId' => $output->orderNo, 'goodsDesc' => $output->message, 'payType' => $payType, 'goodsName' => $output->orderName, 'goodsUrl' => $output->url, 'fee' => $moneyCents, 'clientType' => 'PC', 'clientIp' => $output->userIp, 'attach' => '', 'signType' => 'md5', 'notifyUrl' => $notifyUrl, 'callbackUrl' => $callbackUrl)));
        #var_dump($xmlStr);exit();
        #$xmlStr = '<xml><partnerId>101</partnerId><orderId>2015122312123</orderId><goodsDesc>测试订单</goodsDesc><payType>WXPAY</payType><goodsName>龙芯一号</goodsName><goodsUrl>http://www.zol.com/detail/diy_host/ZXDN/25544595.html</goodsUrl><fee>6999</fee><clientType>PC</clientType><clientIp>10.16.38.115</clientIp><attach>附件</attach><signType>md5</signType></xml>';
        #$xmlStr =  '<xml><partnerId>101</partnerId><orderId>2015122312123</orderId><goodsDesc>打赏文章</goodsDesc><payType>WXPAY</payType><goodsName>龙芯一号</goodsName><goodsUrl>http://www.zol.com/detail/diy_host/ZXDN/25544595.html</goodsUrl><fee>69119</fee><clientType>PC</clientType><clientIp>10.16.38.115</clientIp><attach>附件</attach><signType>md5</signType></xml>';
        #$xmlStrGBK = $xmlStr;
        $xmlStr = iconv('GBK', 'UTF-8//IGNORE', $xmlStr);
        $xmlStr = base64_encode($xmlStr);
        # Crypt3Des加密
        $rep = new Libs_Reward_Crypt3Des('@!@!@');
        $sign = md5($rep->encrypt($xmlStr));
        #var_dump($xmlStr,$sign);exit();
        /* # 请求ZOL支付网关
          	$data = Libs_Reward_CurlRequest::curlPostMethod(array(
          		'url'		=> 'http://10.19.37.162:8080/paygate/payment/scan/prepay?sign='.$sign,
          		'pull_data'	=> $xmlStr,
          		'data_type'	=>'xml',
          	));
          	if(!$data){
          		# 异常,记录日志
          		Helper_Reward_RewardFunc::ajaxExit(array(
           		'flag'		=> 'error',
           		'errorCode'	=> 8004,
           		'msg'		=> '[8004]xml捕获失败,请求支付网关的xml,返回异常!',
           		'toLog'		=> 1,
           		'showHtml'	=> $errorHtml,
          		));
          	}
          	# ZOL支付接口状态码
          	$payStatusCode = array(
          		'800'=>'正常',
          		'801'=>'XML报文为NULL',
          		'802'=>'签名验证错误',
          		'803'=>'XML解析失败',
          		'805'=>'支付类型错误',
          		'806'=>'没有找到接入方ID',
          	);
          	# 解析xml
          	$xml = new SimpleXMLElement($data);
          	$xmlArr = array();
          	foreach($xml as $k=>$v){
          		$xmlArr[$k] = $v;
          	}
          	#var_dump($xmlArr);exit();
          	$statusCode = (array)$xml->resultCode;
          	if($statusCode[0] != 800){
          		$errorMsg = isset($payStatusCode[$statusCode[0]]) ? $payStatusCode[$statusCode[0]] : '';
          		Helper_Reward_RewardFunc::ajaxExit(array(
           		'flag'		=> 'error',
           		'errorCode'	=> 8003,
           		'payErrorCode'=>$statusCode[0],
           		'msg'		=> '[8003]支付发生异常!请求支付网关后,返回的xml状态码异常!'.$errorMsg."$statusCode[0]",
           		'toLog'		=> 1,
           		'showHtml'	=> $errorHtml,
          		));
          	}
          	$src = $output->src = isset($xmlArr['payUrl']) ? $xmlArr['payUrl'] : ''; */
        # 如果是支付宝,则进行跳转新页面  1表示支付宝
        if ($output->payment == 1) {
            #$src = $output->src = 'http://10.19.38.115:8080'.$src;
            #header('Location:'.$src);
        }
        $targetStr = $output->payment == 1 ? '' : 'target="iframeQCode"';
        # 方案2 Start  20160104  http://localhost/www/class_of_me/www/reward/test.php   http://cashier.zol.com/paygate/pay?partnerId=101
        $way2 = '<form id="form_zolpaygate" action="http://cashier.zol.com/paygate/pay?partnerId=101" method="post" ' . $targetStr . '>
					<input type="hidden" name="_data" value="' . $xmlStr . '">
					<input type="hidden" name="sign" value="' . $sign . '">
					<script type="text/javascript">document.forms["form_zolpaygate"].submit();</script>
				</form>';
        $output->way2 = $way2;
        #echo $way2;return '';
        # 方案2 End
        # 二维码的HTML
        $output->qCodeHtml = $qCodeHtml = Reward_Plugin_PayQCode::getPayHtml($input, $output);
        $output->setTemplate('RewardQCode');
        return '';
    }
コード例 #17
0
ファイル: Member.php プロジェクト: dalinhuang/andyou
 /**
  * 登录显示的页面
  */
 public function doLoginShow(ZOL_Request $input, ZOL_Response $output)
 {
     $output->errMsg = $input->get("errMsg");
     $output->setTemplate('M/Login');
 }
コード例 #18
0
ファイル: Member.php プロジェクト: dalinhuang/andyou
 /**
  *  更新用户会员卡余额
  */
 public function doUpCard(ZOL_Request $input, ZOL_Response $output)
 {
     $mid = (int) $input->post("mid");
     $card = (int) $input->post("card");
     $direction = (int) $input->post("direction");
     $remark = $input->post("remark");
     $staffid = (int) $input->post('staffid');
     $urlStr = "?c={$output->ctlName}";
     if ($mid == 0) {
         echo "<script>alert('Error!');document.location='{$urlStr}';</script>";
         exit;
     }
     if ($card < 0) {
         $card = -$card;
     }
     //生成一个单号
     $output->bno = Helper_Bill::getCommonMaxBno();
     #获得会员信息
     $minfo = Helper_Member::getMemberInfo(array("id" => $mid));
     if (!$minfo) {
         echo "<script>alert('Member Error!');document.location='{$urlStr}';</script>";
         exit;
     }
     if ($direction == 1) {
         //减分的时候判断用户是否有这么多
         if ($minfo["balance"] < $card) {
             echo "<script>alert('Balance Error!');document.location='{$urlStr}';</script>";
             exit;
         }
     }
     $db = Db_Andyou::instance();
     $op = $direction == 1 ? "-" : "+";
     $sql = "update member set balance = balance {$op} {$card} where id = {$mid}";
     $db->query($sql);
     $logItem = array("memberId" => $mid, "direction" => $direction, "card" => $card, "dateTm" => SYSTEM_TIME, "adminer" => $output->admin, "remark" => $remark, "orgCard" => $minfo["balance"], "staffid" => $staffid, "bno" => $output->bno);
     $data = Helper_Dao::insertItem(array('addItem' => $logItem, 'dbName' => 'Db_Andyou', 'tblName' => 'log_cardchange'));
     if ($direction != 1) {
         //充值大小票
         $output->money = $card;
         #充值的钱
         $output->nowBalance = $card + $minfo["balance"];
         $output->memberInfo = $minfo;
         $staffArr = Helper_Staff::getStaffPairs();
         $output->staffName = $staffArr[$staffid];
         Helper_Bill::createOneCommonBno();
         //生成一个通用订单号
         $output->setTemplate("CardPrint");
     } else {
         echo "<script>document.location='{$urlStr}';</script>";
         exit;
     }
 }
コード例 #19
0
ファイル: Response.php プロジェクト: dalinhuang/andyou
 public function buildStaticPage(array $data, $template, $filePath)
 {
     if (empty($data)) {
         trigger_error('$data dose not empty!');
         return false;
     }
     if (empty($template)) {
         trigger_error('$template dose not empty!');
         return false;
     }
     if (empty($filePath)) {
         trigger_error('$filePath dose not empty!');
         return false;
     }
     $output = new ZOL_Response();
     $output->add($data);
     $output->template = $template;
     $view = new ZOL_View_Simple($output);
     ZOL_File::write($view->render(), $filePath);
     return false;
 }