1
This commit is contained in:
parent
eb5e3a3323
commit
0e247ac87d
@ -45,6 +45,7 @@ class Shop(object):
|
|||||||
'params': [
|
'params': [
|
||||||
_common.ReqHead(),
|
_common.ReqHead(),
|
||||||
['item_id', 0, '商品id'],
|
['item_id', 0, '商品id'],
|
||||||
|
['item_num', 0, '购买数量'],
|
||||||
['cost_item_id', 0, '支付方式'],
|
['cost_item_id', 0, '支付方式'],
|
||||||
],
|
],
|
||||||
'response': [
|
'response': [
|
||||||
|
@ -74,7 +74,9 @@ class ShopController extends BaseAuthedController {
|
|||||||
|
|
||||||
public function outsideBuy()
|
public function outsideBuy()
|
||||||
{
|
{
|
||||||
|
$itemId = getReqVal('item_id', 0);
|
||||||
|
$itemNum = getReqVal('item_num', 0);
|
||||||
|
$costItemId = getReqVal('cost_item_id', 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getOutsidePriceInfo()
|
public function getOutsidePriceInfo()
|
||||||
|
@ -1,36 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
namespace mt;
|
|
||||||
|
|
||||||
use phpcommon;
|
|
||||||
|
|
||||||
class NewItem {
|
|
||||||
|
|
||||||
|
|
||||||
public static function get($equipId)
|
|
||||||
{
|
|
||||||
return self::getMeta()[$equipId];
|
|
||||||
}
|
|
||||||
|
|
||||||
protected static function getMeta()
|
|
||||||
{
|
|
||||||
if (!self::$meta) {
|
|
||||||
self::$meta = getMetaTable('newitem@newitem.php');
|
|
||||||
}
|
|
||||||
return self::$meta;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static function getItemCfgByID($itemID)
|
|
||||||
{
|
|
||||||
$itemCfgArr = self::getMeta();
|
|
||||||
$itemData = null;
|
|
||||||
if($itemCfgArr[$itemID])
|
|
||||||
{
|
|
||||||
$itemData = $itemCfgArr[$itemID];
|
|
||||||
}
|
|
||||||
return $itemData;
|
|
||||||
}
|
|
||||||
protected static $itemArr;
|
|
||||||
protected static $meta;
|
|
||||||
|
|
||||||
}
|
|
@ -1,174 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
namespace mt;
|
|
||||||
|
|
||||||
use phpcommon;
|
|
||||||
|
|
||||||
class NewShop {
|
|
||||||
|
|
||||||
|
|
||||||
public static function get($equipId)
|
|
||||||
{
|
|
||||||
return self::getMeta()[$equipId];
|
|
||||||
}
|
|
||||||
|
|
||||||
protected static function getMeta()
|
|
||||||
{
|
|
||||||
if (!self::$meta) {
|
|
||||||
self::$meta = getMetaTable('newshop@newshop.php');
|
|
||||||
}
|
|
||||||
return self::$meta;
|
|
||||||
}
|
|
||||||
public static function getShopCfg()
|
|
||||||
{
|
|
||||||
$shopCfgArr = self::getMeta();
|
|
||||||
|
|
||||||
return $shopCfgArr;
|
|
||||||
}
|
|
||||||
public static function getShopItemByID($itemID)
|
|
||||||
{
|
|
||||||
$shopCfgArr = self::getMeta();
|
|
||||||
if(!self::$itemArr)
|
|
||||||
{ self::$itemArr = array();
|
|
||||||
foreach ($shopCfgArr as $item)
|
|
||||||
{
|
|
||||||
$goodsIDStr = $item["goods"];
|
|
||||||
$tmpPriceStr = $item["price"];
|
|
||||||
$goodsIDArrStr = explode("|",$goodsIDStr);
|
|
||||||
$goodsPriceArrStr = explode("|",$tmpPriceStr);
|
|
||||||
$discountStr = null;
|
|
||||||
$limitStr = null;
|
|
||||||
if($item["discount"] && $item["discount"] != "")
|
|
||||||
{
|
|
||||||
$discountStr = $item["discount"];
|
|
||||||
}
|
|
||||||
if($item["limit"] && $item["limit"] != "")
|
|
||||||
{
|
|
||||||
$limitStr = $item["limit"];
|
|
||||||
}
|
|
||||||
$discountStrArr = null;
|
|
||||||
$limitStrArr = null;
|
|
||||||
if($discountStr)
|
|
||||||
{
|
|
||||||
$discountStrArr = explode("|",$discountStr);
|
|
||||||
}
|
|
||||||
if($limitStr)
|
|
||||||
{
|
|
||||||
$limitStrArr = explode("|",$limitStr);
|
|
||||||
}
|
|
||||||
$len = count($goodsIDArrStr);
|
|
||||||
$len2 = count($goodsIDArrStr);
|
|
||||||
for($i = 0 ; $i < $len ;$i++)
|
|
||||||
{
|
|
||||||
$goodsIDArr = explode(":",$goodsIDArrStr[$i]);
|
|
||||||
$goodsPriceStr2 = $goodsPriceArrStr[$i];
|
|
||||||
if($goodsPriceStr2 == "")
|
|
||||||
{
|
|
||||||
$goodsPriceStr2 = "10001:99999";
|
|
||||||
}
|
|
||||||
$priceArr = explode(":",$goodsPriceStr2);
|
|
||||||
$goodsID = $goodsIDArr[0];
|
|
||||||
$goodsNum = 1;
|
|
||||||
$tmpLen = count($goodsIDArr);
|
|
||||||
if($tmpLen >= 2)
|
|
||||||
{
|
|
||||||
$goodsNum = $goodsIDArr[1];
|
|
||||||
}
|
|
||||||
$priceID = $priceArr[0];
|
|
||||||
$priceNum = $priceArr[1];
|
|
||||||
$specailPrice = 0;
|
|
||||||
$limitType = 0;
|
|
||||||
|
|
||||||
if($discountStrArr)
|
|
||||||
{
|
|
||||||
$len1 = count($discountStrArr);
|
|
||||||
if($len1 > 0)
|
|
||||||
{
|
|
||||||
$specailPrice = $discountStrArr[$i];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if($limitStrArr)
|
|
||||||
{
|
|
||||||
$len1 = count($limitStrArr);
|
|
||||||
if($len1 > 0)
|
|
||||||
{
|
|
||||||
if($len1 > $i)
|
|
||||||
{
|
|
||||||
$limitType = $limitStrArr[$i];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
$itemInfo = array("goodsID"=>$goodsID,"goodsNum"=>$goodsNum,
|
|
||||||
"priceID"=>$priceID,"priceNum"=>$priceNum,
|
|
||||||
"specailPrice"=>$specailPrice,"limitType"=>$limitType);
|
|
||||||
self::$itemArr[$itemInfo['goodsID']] = $itemInfo;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
$itemData = null;
|
|
||||||
if(self::$itemArr[$itemID])
|
|
||||||
{
|
|
||||||
$itemData = self::$itemArr[$itemID];
|
|
||||||
}
|
|
||||||
|
|
||||||
return $itemData;
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
public static function getGoodsInfo($meta, $goodsId)
|
|
||||||
{
|
|
||||||
$goodsStrArr = explode("|", $meta['goods']);
|
|
||||||
$priceStrArr = explode("|", $meta['price']);
|
|
||||||
if (count($goodsStrArr) != count($priceStrArr)) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
$idx = -1;
|
|
||||||
{
|
|
||||||
$i = 0;
|
|
||||||
array_filter($goodsStrArr, function($str) use(&$i, &$idx, $goodsId) {
|
|
||||||
if ($idx != -1) {
|
|
||||||
$strArr = explode(":", $str);
|
|
||||||
if (count($strArr) >= 2) {
|
|
||||||
if ($strArr[0] == $goodsId) {
|
|
||||||
$idx = $i;
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
++$i;
|
|
||||||
return false;
|
|
||||||
});
|
|
||||||
}
|
|
||||||
if ($idx <= 0) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
$info = array(
|
|
||||||
'goodsId' => 0,
|
|
||||||
'goodsNum' => 0,
|
|
||||||
'costItemId' => 0,
|
|
||||||
'costItemNum' => 0
|
|
||||||
);
|
|
||||||
{
|
|
||||||
$strArr = explode(":", $goodsStrArr[$idx]);
|
|
||||||
$info['goodsId'] = $strArr[0];
|
|
||||||
$info['goodsNum'] = $strArr[1];
|
|
||||||
}
|
|
||||||
{
|
|
||||||
$strArr = explode(":", $priceStrArr[$idx]);
|
|
||||||
if (count($strArr) < 2) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
$info['costItemId'] = $strArr[0];
|
|
||||||
$info['costItemNum'] = $strArr[1];
|
|
||||||
}
|
|
||||||
return $info;
|
|
||||||
}
|
|
||||||
|
|
||||||
protected static $itemArr;
|
|
||||||
protected static $meta;
|
|
||||||
|
|
||||||
}
|
|
@ -1,124 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
namespace mt;
|
|
||||||
|
|
||||||
use phpcommon;
|
|
||||||
|
|
||||||
class NewShop {
|
|
||||||
|
|
||||||
|
|
||||||
public static function get($equipId)
|
|
||||||
{
|
|
||||||
return self::getMeta()[$equipId];
|
|
||||||
}
|
|
||||||
|
|
||||||
protected static function getMeta()
|
|
||||||
{
|
|
||||||
if (!self::$meta) {
|
|
||||||
self::$meta = getMetaTable('newshop@newshop.php');
|
|
||||||
}
|
|
||||||
return self::$meta;
|
|
||||||
}
|
|
||||||
public static function getShopCfg()
|
|
||||||
{
|
|
||||||
$shopCfgArr = self::getMeta();
|
|
||||||
|
|
||||||
return $shopCfgArr;
|
|
||||||
}
|
|
||||||
public static function getShopItemByID($itemID)
|
|
||||||
{
|
|
||||||
$shopCfgArr = self::getMeta();
|
|
||||||
if(!self::$itemArr)
|
|
||||||
{ self::$itemArr = array();
|
|
||||||
foreach ($shopCfgArr as $item)
|
|
||||||
{
|
|
||||||
$goodsIDStr = $item["goods"];
|
|
||||||
$tmpPriceStr = $item["price"];
|
|
||||||
$goodsIDArrStr = explode("|",$goodsIDStr);
|
|
||||||
$goodsPriceArrStr = explode("|",$tmpPriceStr);
|
|
||||||
$discountStr = null;
|
|
||||||
$limitStr = null;
|
|
||||||
if($item["discount"] && $item["discount"] != "")
|
|
||||||
{
|
|
||||||
$discountStr = $item["discount"];
|
|
||||||
}
|
|
||||||
if($item["limit"] && $item["limit"] != "")
|
|
||||||
{
|
|
||||||
$limitStr = $item["limit"];
|
|
||||||
}
|
|
||||||
$discountStrArr = null;
|
|
||||||
$limitStrArr = null;
|
|
||||||
if($discountStr)
|
|
||||||
{
|
|
||||||
$discountStrArr = explode("|",$discountStr);
|
|
||||||
}
|
|
||||||
if($limitStr)
|
|
||||||
{
|
|
||||||
$limitStrArr = explode("|",$limitStr);
|
|
||||||
}
|
|
||||||
$len = count($goodsIDArrStr);
|
|
||||||
$len2 = count($goodsIDArrStr);
|
|
||||||
for($i = 0 ; $i < $len ;$i++)
|
|
||||||
{
|
|
||||||
$goodsIDArr = explode(":",$goodsIDArrStr[$i]);
|
|
||||||
$goodsPriceStr2 = $goodsPriceArrStr[$i];
|
|
||||||
if($goodsPriceStr2 == "")
|
|
||||||
{
|
|
||||||
$goodsPriceStr2 = "10001:99999";
|
|
||||||
}
|
|
||||||
$priceArr = explode(":",$goodsPriceStr2);
|
|
||||||
$goodsID = $goodsIDArr[0];
|
|
||||||
$goodsNum = 1;
|
|
||||||
$tmpLen = count($goodsIDArr);
|
|
||||||
if($tmpLen >= 2)
|
|
||||||
{
|
|
||||||
$goodsNum = $goodsIDArr[1];
|
|
||||||
}
|
|
||||||
$priceID = $priceArr[0];
|
|
||||||
$priceNum = $priceArr[1];
|
|
||||||
$specailPrice = 0;
|
|
||||||
$limitType = 0;
|
|
||||||
|
|
||||||
if($discountStrArr)
|
|
||||||
{
|
|
||||||
$len1 = count($discountStrArr);
|
|
||||||
if($len1 > 0)
|
|
||||||
{
|
|
||||||
$specailPrice = $discountStrArr[$i];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if($limitStrArr)
|
|
||||||
{
|
|
||||||
$len1 = count($limitStrArr);
|
|
||||||
if($len1 > 0)
|
|
||||||
{
|
|
||||||
if($len1 > $i)
|
|
||||||
{
|
|
||||||
$limitType = $limitStrArr[$i];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
$itemInfo = array("goodsID"=>$goodsID,"goodsNum"=>$goodsNum,
|
|
||||||
"priceID"=>$priceID,"priceNum"=>$priceNum,
|
|
||||||
"specailPrice"=>$specailPrice,"limitType"=>$limitType);
|
|
||||||
self::$itemArr[$itemInfo['goodsID']] = $itemInfo;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
$itemData = null;
|
|
||||||
if(self::$itemArr[$itemID])
|
|
||||||
{
|
|
||||||
$itemData = self::$itemArr[$itemID];
|
|
||||||
}
|
|
||||||
|
|
||||||
return $itemData;
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
protected static $itemArr;
|
|
||||||
protected static $meta;
|
|
||||||
|
|
||||||
}
|
|
Loading…
x
Reference in New Issue
Block a user