1
This commit is contained in:
parent
199d7af12d
commit
1958761e7a
@ -18,7 +18,7 @@ class InGameMall(object):
|
|||||||
['order_method', 0, '排序方式 0:默认排序(当前指向1) 1:上架时间 2:价格'],
|
['order_method', 0, '排序方式 0:默认排序(当前指向1) 1:上架时间 2:价格'],
|
||||||
['order_asc', 0, '排序方向, 0:从小到大 1:从大到小'],
|
['order_asc', 0, '排序方向, 0:从小到大 1:从大到小'],
|
||||||
['price_filter', '', '价格过滤(用|分割)'],
|
['price_filter', '', '价格过滤(用|分割)'],
|
||||||
['type_filter', '', '类型过滤 1:英雄皮肤 2:芯片 3:英雄碎片 11:其它(材料、宝箱)'],
|
['type_filter', '', '类型过滤 1:英雄皮肤 2:芯片 3:英雄碎片 5:金币 11:其它(材料、宝箱)'],
|
||||||
['item_filter', '', 'itemId过滤(用|分割)'],
|
['item_filter', '', 'itemId过滤(用|分割)'],
|
||||||
['quality_filter', '', '品质过滤'],
|
['quality_filter', '', '品质过滤'],
|
||||||
],
|
],
|
||||||
|
@ -1440,12 +1440,13 @@ DROP TABLE IF EXISTS `t_ingame_mall`;
|
|||||||
CREATE TABLE `t_ingame_mall` (
|
CREATE TABLE `t_ingame_mall` (
|
||||||
`idx` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '自增id',
|
`idx` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '自增id',
|
||||||
`order_id` varchar(255) NOT NULL DEFAULT '' COMMENT '订单id',
|
`order_id` varchar(255) NOT NULL DEFAULT '' COMMENT '订单id',
|
||||||
`order_type` int(11) NOT NULL DEFAULT '0' COMMENT '1:英雄 2:芯片 3:碎片 4:宝箱',
|
`order_type` int(11) NOT NULL DEFAULT '0' COMMENT '1:英雄皮肤 2:芯片 3:英雄碎片 4:皮肤碎片 5:金币 11:其它',
|
||||||
`seller` varchar(60) NOT NULL DEFAULT '' COMMENT 'seller',
|
`seller` varchar(60) NOT NULL DEFAULT '' COMMENT 'seller',
|
||||||
`seller_address` varchar(60) DEFAULT '' COMMENT 'seller_address',
|
`seller_address` varchar(60) DEFAULT '' COMMENT 'seller_address',
|
||||||
`goods_uniid` varchar(50) NOT NULL DEFAULT '0' COMMENT '物品id',
|
`goods_uniid` varchar(50) NOT NULL DEFAULT '0' COMMENT '物品id',
|
||||||
`item_id` int(11) NOT NULL DEFAULT '0' COMMENT '物品itemId',
|
`item_id` int(11) NOT NULL DEFAULT '0' COMMENT '物品itemId',
|
||||||
`item_num` bigint NOT NULL DEFAULT '0' COMMENT '物品数量',
|
`item_num` bigint NOT NULL DEFAULT '0' COMMENT '物品数量',
|
||||||
|
`pay_type` int(11) NOT NULL DEFAULT '0' COMMENT '0:金币 1:砖石',
|
||||||
`price` bigint NOT NULL DEFAULT '0' COMMENT '价格',
|
`price` bigint NOT NULL DEFAULT '0' COMMENT '价格',
|
||||||
`unit_price` decimal(10, 2) NOT NULL DEFAULT '0' COMMENT '单价',
|
`unit_price` decimal(10, 2) NOT NULL DEFAULT '0' COMMENT '单价',
|
||||||
`status` int(11) NOT NULL DEFAULT '0' COMMENT 'status',
|
`status` int(11) NOT NULL DEFAULT '0' COMMENT 'status',
|
||||||
|
@ -332,7 +332,7 @@ class BaseAuthedController extends BaseController {
|
|||||||
return in_array($itemId, array(V_ITEM_GOLD, V_ITEM_DIAMOND, V_ITEM_EXP, V_ITEM_ACTIVE,V_ITEM_BCEG,V_ITEM_STAR));
|
return in_array($itemId, array(V_ITEM_GOLD, V_ITEM_DIAMOND, V_ITEM_EXP, V_ITEM_ACTIVE,V_ITEM_BCEG,V_ITEM_STAR));
|
||||||
}
|
}
|
||||||
|
|
||||||
public function _addVirtualItem($itemId, $itemNum,$awardService,$propertyChgService)
|
public function _addVirtualItem($itemId, $itemNum)
|
||||||
{
|
{
|
||||||
if ($itemNum <= 0){
|
if ($itemNum <= 0){
|
||||||
return;
|
return;
|
||||||
|
@ -193,9 +193,11 @@ class InGameMallController extends BaseAuthedController {
|
|||||||
$this->_rspErr(1, 'param item_id error');
|
$this->_rspErr(1, 'param item_id error');
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (! $this->_isGoodsType($itemMeta['type'])){
|
if ($itemId != V_ITEM_GOLD){
|
||||||
$this->_rspErr(1, 'param item_id error');
|
if (! $this->_isGoodsType($itemMeta['type'])){
|
||||||
return;
|
$this->_rspErr(1, 'param item_id error');
|
||||||
|
return;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
switch ($itemMeta['type']){
|
switch ($itemMeta['type']){
|
||||||
case \mt\Item::HERO_SKIN_TYPE : {
|
case \mt\Item::HERO_SKIN_TYPE : {
|
||||||
@ -234,7 +236,7 @@ class InGameMallController extends BaseAuthedController {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
$propertyChgService = new PropertyChgService();
|
$propertyChgService = new PropertyChgService();
|
||||||
if (\mt\Item::isBagItem($itemMeta['type'],$itemMeta['sub_type'])){
|
if (\mt\Item::isBagItem($itemMeta['type'],$itemMeta['sub_type']) || $itemId == V_ITEM_GOLD){
|
||||||
$costItems = array(
|
$costItems = array(
|
||||||
array(
|
array(
|
||||||
'item_id' => $itemId,
|
'item_id' => $itemId,
|
||||||
@ -276,12 +278,18 @@ class InGameMallController extends BaseAuthedController {
|
|||||||
|
|
||||||
$orderId = OrderId::gen();
|
$orderId = OrderId::gen();
|
||||||
$orderType = $this->_getGoodsType($itemMeta);
|
$orderType = $this->_getGoodsType($itemMeta);
|
||||||
|
if ($orderType == InGameMall::GOLD_TYPE){
|
||||||
|
$payType = 1;
|
||||||
|
}else{
|
||||||
|
$payType = 0;
|
||||||
|
}
|
||||||
InGameMall::add(
|
InGameMall::add(
|
||||||
$orderId,
|
$orderId,
|
||||||
$orderType,
|
$orderType,
|
||||||
$goodsUniid,
|
$goodsUniid,
|
||||||
$itemId,
|
$itemId,
|
||||||
$amount,
|
$amount,
|
||||||
|
$payType,
|
||||||
$priceBn,
|
$priceBn,
|
||||||
$orderField
|
$orderField
|
||||||
);
|
);
|
||||||
@ -305,9 +313,14 @@ class InGameMallController extends BaseAuthedController {
|
|||||||
myself()->_rspErr(1, ' goods price error');
|
myself()->_rspErr(1, ' goods price error');
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
if ($goodsDb['pay_type'] == 1){
|
||||||
|
$costItemId = V_ITEM_DIAMOND;
|
||||||
|
}else{
|
||||||
|
$costItemId = V_ITEM_GOLD;
|
||||||
|
}
|
||||||
$costItems = array(
|
$costItems = array(
|
||||||
array(
|
array(
|
||||||
'item_id' => V_ITEM_GOLD,
|
'item_id' => $costItemId,
|
||||||
'item_num' => $goodsDb['price']
|
'item_num' => $goodsDb['price']
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
@ -327,11 +340,18 @@ class InGameMallController extends BaseAuthedController {
|
|||||||
if (!$goods){
|
if (!$goods){
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
if ($goods['pay_type'] == 1){
|
||||||
|
$payType = 'diamond';
|
||||||
|
$payItemId = V_ITEM_DIAMOND;
|
||||||
|
}else{
|
||||||
|
$payType = 'gold';
|
||||||
|
$payItemId = V_ITEM_GOLD;
|
||||||
|
}
|
||||||
$price = $goods['price'];
|
$price = $goods['price'];
|
||||||
InGameMall::buyOk($goods['order_id'],myself()->_getAccountId());
|
InGameMall::buyOk($goods['order_id'],myself()->_getAccountId());
|
||||||
$costItems = array(
|
$costItems = array(
|
||||||
array(
|
array(
|
||||||
'item_id' => V_ITEM_GOLD,
|
'item_id' => $payItemId,
|
||||||
'item_num' => $price
|
'item_num' => $price
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
@ -366,6 +386,11 @@ class InGameMallController extends BaseAuthedController {
|
|||||||
$propertyChgService->addChip();
|
$propertyChgService->addChip();
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
case InGameMall::GOLD_TYPE:{
|
||||||
|
myself()->_addVirtualItem($goods['item_id'],$goods['item_num']);
|
||||||
|
$propertyChgService->addUserChg();
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
default : {
|
default : {
|
||||||
Bag::addItem($goods['item_id'],$goods['item_num']);
|
Bag::addItem($goods['item_id'],$goods['item_num']);
|
||||||
@ -393,15 +418,17 @@ class InGameMallController extends BaseAuthedController {
|
|||||||
$taxGold = ceil($price*$taxRate);
|
$taxGold = ceil($price*$taxRate);
|
||||||
$falGold = $price - $taxGold;
|
$falGold = $price - $taxGold;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
$mailContent = <<<EOD
|
$mailContent = <<<EOD
|
||||||
{$itemName} has been successfully sold
|
{$itemName} has been successfully sold
|
||||||
Transaction price: + {$price} gold
|
Transaction price: + {$price} {$payType}
|
||||||
Service fee: - {$taxGold} gold
|
Service fee: - {$taxGold} {$payType}
|
||||||
After selling {$itemName}, you received {$falGold} gold
|
After selling {$itemName}, you received {$falGold} {$payType}
|
||||||
EOD;
|
EOD;
|
||||||
$attachments = array(
|
$attachments = array(
|
||||||
array(
|
array(
|
||||||
'itemid' => V_ITEM_GOLD,
|
'itemid' => $payItemId,
|
||||||
'itemnum' => $falGold
|
'itemnum' => $falGold
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
@ -420,7 +447,7 @@ EOD;
|
|||||||
'seller' =>$goods['seller'],
|
'seller' =>$goods['seller'],
|
||||||
'buyer' =>myself()->_getAccountId(),
|
'buyer' =>myself()->_getAccountId(),
|
||||||
'change' => array(
|
'change' => array(
|
||||||
'item_id' => V_ITEM_GOLD,
|
'item_id' => $payItemId,
|
||||||
'item_num' => $falGold
|
'item_num' => $falGold
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
@ -645,7 +672,8 @@ EOD;
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
$orderIdArr = explode("|",$orderIds);
|
$orderIdArr = explode("|",$orderIds);
|
||||||
$price = 0;
|
$goldPrice = 0;
|
||||||
|
$diamondPrice = 0;
|
||||||
foreach ($orderIdArr as $orderId) {
|
foreach ($orderIdArr as $orderId) {
|
||||||
$goodsDb = InGameMall::findByOrderId($orderId);
|
$goodsDb = InGameMall::findByOrderId($orderId);
|
||||||
if (!$goodsDb) {
|
if (!$goodsDb) {
|
||||||
@ -656,12 +684,21 @@ EOD;
|
|||||||
myself()->_rspErr(1, 'cannot cancel the goods');
|
myself()->_rspErr(1, 'cannot cancel the goods');
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
$price += $goodsDb['price'];
|
if ($goodsDb['pay_type'] == 1){
|
||||||
|
$diamondPrice += $goodsDb['price'];
|
||||||
|
}else{
|
||||||
|
$goldPrice += $goodsDb['price'];
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
$costItems = array(
|
$costItems = array(
|
||||||
array(
|
array(
|
||||||
'item_id' => V_ITEM_GOLD,
|
'item_id' => V_ITEM_GOLD,
|
||||||
'item_num' => $price
|
'item_num' => $goldPrice
|
||||||
|
),
|
||||||
|
array(
|
||||||
|
'item_id' => V_ITEM_DIAMOND,
|
||||||
|
'item_num' => $diamondPrice
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
$lackItem = null;
|
$lackItem = null;
|
||||||
@ -708,6 +745,9 @@ EOD;
|
|||||||
if (!$itemMeta){
|
if (!$itemMeta){
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
if ($itemMeta['id'] == V_ITEM_GOLD){
|
||||||
|
return InGameMall::GOLD_TYPE;
|
||||||
|
}
|
||||||
switch ($itemMeta['type']){
|
switch ($itemMeta['type']){
|
||||||
case \mt\Item::HERO_SKIN_TYPE : {
|
case \mt\Item::HERO_SKIN_TYPE : {
|
||||||
return InGameMall::HERO_SKIN_TYPE;
|
return InGameMall::HERO_SKIN_TYPE;
|
||||||
|
@ -14,8 +14,10 @@ class InGameMall extends BaseModel {
|
|||||||
const CHIP_TYPE = 2;
|
const CHIP_TYPE = 2;
|
||||||
const HERO_FRAGMENT_TYPE = 3;
|
const HERO_FRAGMENT_TYPE = 3;
|
||||||
const SKIN_FRAGMENT_TYPE = 4;
|
const SKIN_FRAGMENT_TYPE = 4;
|
||||||
|
const GOLD_TYPE = 5;
|
||||||
const OTHER_TYPE = 11;
|
const OTHER_TYPE = 11;
|
||||||
|
|
||||||
|
|
||||||
const SYSTEM_MALL_ACCOUNT = "kingsome";
|
const SYSTEM_MALL_ACCOUNT = "kingsome";
|
||||||
|
|
||||||
public static function findByOrderId($orderId)
|
public static function findByOrderId($orderId)
|
||||||
@ -30,7 +32,7 @@ class InGameMall extends BaseModel {
|
|||||||
return $row;
|
return $row;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function add($orderId, $orderType, $goodsUniid,$itemId, $itemNum, $price, $orderField)
|
public static function add($orderId, $orderType, $goodsUniid,$itemId, $itemNum, $payType,$price, $orderField)
|
||||||
{
|
{
|
||||||
SqlHelper::insert
|
SqlHelper::insert
|
||||||
(myself()->_getMysql(''),
|
(myself()->_getMysql(''),
|
||||||
@ -43,6 +45,7 @@ class InGameMall extends BaseModel {
|
|||||||
'goods_uniid' => $goodsUniid,
|
'goods_uniid' => $goodsUniid,
|
||||||
'item_id' => $itemId,
|
'item_id' => $itemId,
|
||||||
'item_num' => $itemNum,
|
'item_num' => $itemNum,
|
||||||
|
'pay_type' => $payType,
|
||||||
'price' => $price,
|
'price' => $price,
|
||||||
'order1' => $orderField,
|
'order1' => $orderField,
|
||||||
'unit_price' => $price/$itemNum,
|
'unit_price' => $price/$itemNum,
|
||||||
|
@ -40,7 +40,7 @@ class AddItemsService extends BaseService
|
|||||||
$awardService->addItem($item['item_id'], $item['item_num']);
|
$awardService->addItem($item['item_id'], $item['item_num']);
|
||||||
}
|
}
|
||||||
if (myself()->_isVirtualItem($item['item_id'])) {
|
if (myself()->_isVirtualItem($item['item_id'])) {
|
||||||
myself()->_addVirtualItem($item['item_id'], $item['item_num'],$awardService,$propertyService);
|
myself()->_addVirtualItem($item['item_id'], $item['item_num']);
|
||||||
$propertyService->addUserChg();
|
$propertyService->addUserChg();
|
||||||
} else {
|
} else {
|
||||||
$itemMeta = Item::get($item['item_id']);
|
$itemMeta = Item::get($item['item_id']);
|
||||||
|
@ -6,6 +6,7 @@ class ContributionService extends BaseService {
|
|||||||
|
|
||||||
private static $ignoreCa = array(
|
private static $ignoreCa = array(
|
||||||
'BlockChain@mintGoldBullion',
|
'BlockChain@mintGoldBullion',
|
||||||
|
'InGameMall@sellS',
|
||||||
'InGameMall@buyS',
|
'InGameMall@buyS',
|
||||||
'InGameMall@shoppingCartBuyS',
|
'InGameMall@shoppingCartBuyS',
|
||||||
);
|
);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user