1
This commit is contained in:
parent
de58d063ed
commit
20165d5e3b
@ -1387,7 +1387,7 @@ CREATE TABLE `t_mall` (
|
||||
`idx` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '自增id',
|
||||
`order_id` varchar(255) NOT NULL DEFAULT '' COMMENT '订单id',
|
||||
`goods_uuid` varchar(255) NOT NULL DEFAULT '' COMMENT '商品uuid',
|
||||
`account_id` varchar(60) NOT NULL DEFAULT '' COMMENT '账号id',
|
||||
`seller` varchar(60) NOT NULL DEFAULT '' COMMENT 'seller',
|
||||
`item_id` int(11) NOT NULL DEFAULT '0' COMMENT '物品id',
|
||||
`item_num` bigint NOT NULL DEFAULT '0' COMMENT '物品数量',
|
||||
`currency` varchar(60) NOT NULL COMMENT 'currency',
|
||||
@ -1396,7 +1396,7 @@ CREATE TABLE `t_mall` (
|
||||
`createtime` int(11) NOT NULL DEFAULT '0' COMMENT '创建时间',
|
||||
`modifytime` int(11) NOT NULL DEFAULT '0' COMMENT '修改时间',
|
||||
PRIMARY KEY (`idx`),
|
||||
KEY `account_id` (`account_id`),
|
||||
KEY `seller` (`seller`),
|
||||
UNIQUE KEY `order_id` (`order_id`),
|
||||
UNIQUE KEY `goods_uuid` (`goods_uuid`)
|
||||
) ENGINE=InnoDB AUTO_INCREMENT=10001 DEFAULT CHARSET=utf8 COLLATE=utf8_bin;
|
||||
|
@ -5,6 +5,7 @@ require_once('mt/Parameter.php');
|
||||
|
||||
require_once('models/BcOrder.php');
|
||||
require_once('models/Mall.php');
|
||||
require_once('models/OrderId.php');
|
||||
|
||||
require_once('services/BlockChainService.php');
|
||||
require_once('services/LogService.php');
|
||||
@ -13,6 +14,7 @@ use phpcommon\SqlHelper;
|
||||
|
||||
use models\BcOrder;
|
||||
use models\Mall;
|
||||
use models\OrderId;
|
||||
|
||||
use services\LogService;
|
||||
use services\BlockChainService;
|
||||
@ -21,7 +23,7 @@ class MallController extends BaseAuthedController {
|
||||
|
||||
public function productList()
|
||||
{
|
||||
$page = getReqVal('page', 1);
|
||||
$page = getReqVal('page', 0);
|
||||
$queryData = array();
|
||||
|
||||
$out = array(
|
||||
@ -43,7 +45,7 @@ class MallController extends BaseAuthedController {
|
||||
)
|
||||
),
|
||||
//'orderBy' => $orderBy,
|
||||
'handle' => function ($row) {
|
||||
'handle' => function ($row) use(&$out) {
|
||||
array_push($out['rows'],
|
||||
array(
|
||||
'goods_uuid' => $row['goods_uuid'],
|
||||
@ -62,10 +64,12 @@ class MallController extends BaseAuthedController {
|
||||
|
||||
public function sell()
|
||||
{
|
||||
$address = $this->_getAddress();
|
||||
if (!$address) {
|
||||
$this->_rspErr(1, 'address not found');
|
||||
return;
|
||||
if (SERVER_ENV == _ONLINE) {
|
||||
$address = myself()->_getAddress();
|
||||
if (!$address) {
|
||||
$this->_rspErr(1, 'address not found');
|
||||
return;
|
||||
}
|
||||
}
|
||||
$itemId = getReqVal('item_id', '');
|
||||
$amount = getReqVal('amount', '');
|
||||
@ -143,11 +147,11 @@ class MallController extends BaseAuthedController {
|
||||
$goodsUuid = getReqVal('goods_uuid', '');
|
||||
$goodsDb = Mall::findByGoodsUuid($goodsUuid);
|
||||
if (!$goodsDb) {
|
||||
myself()->_resErr(1, 'goods not found');
|
||||
myself()->_rspErr(1, 'goods not found');
|
||||
return;
|
||||
}
|
||||
if ($goodDb['seller'] != myself()->_getAccountId()) {
|
||||
myself()->_resErr(1, 'goods not found');
|
||||
if ($goodsDb['seller'] != myself()->_getAccountId()) {
|
||||
myself()->_rspErr(1, 'goods not found');
|
||||
return;
|
||||
}
|
||||
Mall::cancel($goodsDb['goods_uuid']);
|
||||
@ -160,11 +164,11 @@ class MallController extends BaseAuthedController {
|
||||
$price = getReqVal('price', '');
|
||||
$goodsDb = Mall::findByGoodsUuid($goodsUuid);
|
||||
if (!$goodsDb) {
|
||||
myself()->_resErr(1, 'goods not found');
|
||||
myself()->_rspErr(1, 'goods not found');
|
||||
return;
|
||||
}
|
||||
if ($goodDb['seller'] != myself()->_getAccountId()) {
|
||||
myself()->_resErr(1, 'goods not found');
|
||||
if ($goodsDb['seller'] != myself()->_getAccountId()) {
|
||||
myself()->_rspErr(1, 'goods not found');
|
||||
return;
|
||||
}
|
||||
Mall::modifyPrice($goodsDb['goods_uuid'], $price);
|
||||
|
@ -33,20 +33,21 @@ class Mall extends BaseModel {
|
||||
}
|
||||
|
||||
public static function add($orderId, $goodsUuid, $itemId, $itemNum,
|
||||
$currency, $pirce) {
|
||||
self::internalUpdate(
|
||||
$orderId,
|
||||
array(
|
||||
'order_id' => $orderId,
|
||||
'goods_uuid' => $goodsUuid,
|
||||
'seller' => myself()->_getAccountId(),
|
||||
'item_id' => $itemId,
|
||||
'item_num' => $amount,
|
||||
'currency' => $currency,
|
||||
'price' => $price,
|
||||
'createtime' => myself()->_getNowTime(),
|
||||
'modifytime' => myself()->_getNowTime(),
|
||||
));
|
||||
$currency, $price) {
|
||||
SqlHelper::insert
|
||||
(myself()->_getMysql(''),
|
||||
't_mall',
|
||||
array(
|
||||
'order_id' => $orderId,
|
||||
'goods_uuid' => $goodsUuid,
|
||||
'seller' => myself()->_getAccountId(),
|
||||
'item_id' => $itemId,
|
||||
'item_num' => $itemNum,
|
||||
'currency' => $currency,
|
||||
'price' => $price,
|
||||
'createtime' => myself()->_getNowTime(),
|
||||
'modifytime' => myself()->_getNowTime(),
|
||||
));
|
||||
}
|
||||
|
||||
public static function modifyPrice($goodsUuid, $price) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user